From: balajihands Date: Fri, 7 Feb 2020 10:45:55 +0000 (+0530) Subject: Initial commit for Bronze release X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=3235ecfc7414aa0b72d0ad50db63ae8b5626045b;p=o-du%2Fl2.git Initial commit for Bronze release Signed-off-by: balajihands Change-Id: I1bd8346a0e0a56a7bdf8e6f548e6eb91bced22e4 --- diff --git a/build/common/asn.mak b/build/common/asn.mak deleted file mode 100755 index 07b5b81b4..000000000 --- a/build/common/asn.mak +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for ASN - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/du_app/F1AP/asn -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - - -lib: $(LIB_DIR)/libasn.a -include $(COM_BUILD_DIR)/compile.mak - - - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libasn.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libasn.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning ASN$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libasn.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/build/common/asn_common.mak b/build/common/asn_common.mak new file mode 100755 index 000000000..13d9421b4 --- /dev/null +++ b/build/common/asn_common.mak @@ -0,0 +1,48 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ + +# This is makefile for ASN + +include ../common/rsys_fancy.mak +include ../common/env.mak +COLOR=$(COLOR_RED) + +SRC_DIR=$(ROOT_DIR)/src/codec_utils/common +C_SRCS=$(wildcard $(SRC_DIR)/*.c) +C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) +LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) +BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) +DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) + +lib: $(LIB_DIR)/libasn_common.a +include $(COM_BUILD_DIR)/compile.mak + +#-------------------------------------------------------------# +#Linker macros +#-------------------------------------------------------------# +$(LIB_DIR)/libasn_common.a:$(C_OBJS) $(C_WO_PED_OBJS) + @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" + $(Q)ar -cr $(LIB_DIR)/libasn_common.a $(C_OBJS) $(C_WO_PED_OBJS) + + +#-------------------------------------------------------------# +#Clean macros +#-------------------------------------------------------------# +clean: + @echo -e "$(COLOR_RED)Cleaning ASN$(REVERT_COLOR)" + @echo $(SRC_DIR) $(CM_DIR) + $(Q)\rm -f $(LIB_DIR)/libasn_common.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) + diff --git a/build/common/asn_f1ap.mak b/build/common/asn_f1ap.mak new file mode 100755 index 000000000..a7d082f6b --- /dev/null +++ b/build/common/asn_f1ap.mak @@ -0,0 +1,49 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ + +# This is makefile for ASN + +include ../common/rsys_fancy.mak +include ../common/env.mak +COLOR=$(COLOR_RED) + +SRC_DIR=$(ROOT_DIR)/src/codec_utils/F1AP +C_SRCS=$(wildcard $(SRC_DIR)/*.c) +C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) +LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) +BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) +DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) + +lib: $(LIB_DIR)/libasn_f1ap.a +include $(COM_BUILD_DIR)/compile.mak + +I_OPTS+=-I$(SRC_DIR)/../common +#-------------------------------------------------------------# +#Linker macros +#-------------------------------------------------------------# +$(LIB_DIR)/libasn_f1ap.a:$(C_OBJS) $(C_WO_PED_OBJS) + @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" + $(Q)ar -cr $(LIB_DIR)/libasn_f1ap.a $(C_OBJS) $(C_WO_PED_OBJS) + + +#-------------------------------------------------------------# +#Clean macros +#-------------------------------------------------------------# +clean: + @echo -e "$(COLOR_RED)Cleaning ASN$(REVERT_COLOR)" + @echo $(SRC_DIR) $(CM_DIR) + $(Q)\rm -f $(LIB_DIR)/libasn_f1ap.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) + diff --git a/build/common/asn_sysinfo.mak b/build/common/asn_sysinfo.mak new file mode 100755 index 000000000..b30992205 --- /dev/null +++ b/build/common/asn_sysinfo.mak @@ -0,0 +1,49 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ + +# This is makefile for ASN + +include ../common/rsys_fancy.mak +include ../common/env.mak +COLOR=$(COLOR_RED) + +SRC_DIR=$(ROOT_DIR)/src/codec_utils/SYSINFO +C_SRCS=$(wildcard $(SRC_DIR)/*.c) +C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) +LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) +BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) +DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) + +lib: $(LIB_DIR)/libasn_sysinfo.a +include $(COM_BUILD_DIR)/compile.mak + +I_OPTS+=-I$(SRC_DIR)/../common +#-------------------------------------------------------------# +#Linker macros +#-------------------------------------------------------------# +$(LIB_DIR)/libasn_sysinfo.a:$(C_OBJS) $(C_WO_PED_OBJS) + @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" + $(Q)ar -cr $(LIB_DIR)/libasn_sysinfo.a $(C_OBJS) $(C_WO_PED_OBJS) + + +#-------------------------------------------------------------# +#Clean macros +#-------------------------------------------------------------# +clean: + @echo -e "$(COLOR_RED)Cleaning ASN$(REVERT_COLOR)" + @echo $(SRC_DIR) $(CM_DIR) + $(Q)\rm -f $(LIB_DIR)/libasn_sysinfo.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) + diff --git a/build/common/cm.mak b/build/common/cm.mak index 18e66068f..f3370716b 100755 --- a/build/common/cm.mak +++ b/build/common/cm.mak @@ -29,6 +29,8 @@ CZ_DIR=$(ROOT_DIR)/src/x2ap # TODO - The dependency between layers and CM files should be removed # I_OPTS+=-I$(EG_DIR) -I$(SZ_DIR) -I$(CZ_DIR) +I_OPTS+=-I$(ROOT_DIR)/src/du_app +I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/common #-------------------------------------------------------------# #User macros (to be modified) diff --git a/build/common/compile.mak b/build/common/compile.mak index 219923183..e7464926b 100644 --- a/build/common/compile.mak +++ b/build/common/compile.mak @@ -64,9 +64,9 @@ endif TENB_FLAGS=-DLTERRC_REL9 -DEGTP_U_REL_9 -UMAC_SCH_STATS -USCH_STATS \ -DTENB_TTI_PERF -DAES -DLTE_RRC_DISSECTOR -DRSYS_WIRESHARK -ifneq ($(PLTFRM), PAL) -TENB_FLAGS += -DIPV6_SUPPORTED -endif +#ifneq ($(PLTFRM), PAL) +#TENB_FLAGS += -DIPV6_SUPPORTED +#endif ifeq ($(RADIO_CLUSTER), YES) TENB_FLAGS += -DRADIO_CLUSTER diff --git a/build/common/cu_stub.mak b/build/common/cu_stub.mak index 673b8753c..108ccc57c 100755 --- a/build/common/cu_stub.mak +++ b/build/common/cu_stub.mak @@ -38,10 +38,8 @@ lib: $(LIB_DIR)/libcu.a include $(COM_BUILD_DIR)/compile.mak I_OPTS+=-I$(ROOT_DIR)/src/mt -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn - -PLTFRM_FLAGS+=-DCU_STUB +I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/common +I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/F1AP #-------------------------------------------------------------# #Linker macros diff --git a/build/common/du_app.mak b/build/common/du_app.mak index 3b835ab29..3abb0640c 100755 --- a/build/common/du_app.mak +++ b/build/common/du_app.mak @@ -35,14 +35,12 @@ HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) HDR_FILES+=$(wildcard $(CM_DIR)/lkw*.[hx]) HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) - lib: $(LIB_DIR)/libduapp.a include $(COM_BUILD_DIR)/compile.mak I_OPTS+=-I$(ROOT_DIR)/src/mt -I_OPTS+=-I$(SRC_DIR)/F1AP -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn - +I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/common +I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/F1AP #-------------------------------------------------------------# #Linker macros diff --git a/build/common/f1ap.mak b/build/common/f1ap.mak index d45122114..f1946ef17 100755 --- a/build/common/f1ap.mak +++ b/build/common/f1ap.mak @@ -41,7 +41,7 @@ include $(COM_BUILD_DIR)/compile.mak I_OPTS+=-I$(ROOT_DIR)/src/mt I_OPTS+=-I$(ROOT_DIR)/src/du_app -I_OPTS+=-I$(ROOT_DIR)/src/cu_stub +I_OPTS+=-I$(ROOT_DIR)/src/cu_stub #TODO: Remove this dependency I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn diff --git a/build/common/mac.mak b/build/common/mac.mak new file mode 100644 index 000000000..76feb8a95 --- /dev/null +++ b/build/common/mac.mak @@ -0,0 +1,73 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ + +##-------------------------------------------------------------# +#Makefile for product RG - script generated. +#-------------------------------------------------------------# +include ../common/rsys_fancy.mak +include ../common/env.mak +COLOR=$(COLOR_GREEN) + +SRC_DIR=$(ROOT_DIR)/src/5gnrmac + +# prepare the list of common header files +HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/crg.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/rgr.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/rgm.[hx]) + +# Add the product specific header files +HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) + +#prepare the list of source files +C_SRCS=$(wildcard $(SRC_DIR)/*.c) +#C_SRCS:=$(filter-out $(SRC_DIR)/rg_sch%, $(C_SRCS)) + +#prepare the list of object files and RLOG related files +C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) + +#-------------------------------------------------------------# +#User macros (to be modified) +#-------------------------------------------------------------# +# Including RG_PHASE2_SCHED for supporting more than one schedulers +# supported by mac +# TODO: make it define for LTEMAC_MIMO and remove it from envopt.h +MOD_FLAGS=-DRGM_LC -DRGM_LWLC -USM -URG_DEBUG -DxRG_PHASE2_SCHED -DxRGR_V1 \ + -DRG_UL_DELTA=2 -ULTEMAC_DLUE_TMGOPTMZ -UTENB_SPLIT_ARCH -DRG -ULTEMAC_MIMO + +lib:$(LIB_DIR)/librg.a +include $(COM_BUILD_DIR)/compile.mak + +I_OPTS+=-I$(ROOT_DIR)/src/5gnrsch + +#-------------------------------------------------------------# +#Linker macros +#-------------------------------------------------------------# +$(LIB_DIR)/librg.a:$(C_OBJS) + @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" + $(Q)ar -cr $(LIB_DIR)/librg.a $(C_OBJS) + +#-------------------------------------------------------------# +#Clean macros +#-------------------------------------------------------------# +clean: + @echo -e "$(COLOR_RED)Cleaing MAC$(REVERT_COLOR)" + $(Q)\rm -f $(LIB_DIR)/librg.a $(C_OBJS) + diff --git a/build/common/phy_stub.mak b/build/common/phy_stub.mak index 0f56cc549..11ce3dce7 100755 --- a/build/common/phy_stub.mak +++ b/build/common/phy_stub.mak @@ -40,6 +40,7 @@ lib: $(LIB_DIR)/libphystub.a include $(COM_BUILD_DIR)/compile.mak I_OPTS+=-I$(ROOT_DIR)/src/mt +I_OPTS+=-I$(ROOT_DIR)/src/5gnrmac #-------------------------------------------------------------# diff --git a/build/common/rg.mak b/build/common/rg.mak deleted file mode 100644 index 4d0094cd7..000000000 --- a/build/common/rg.mak +++ /dev/null @@ -1,71 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -##-------------------------------------------------------------# -#Makefile for product RG - script generated. -#-------------------------------------------------------------# -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_GREEN) - -SRC_DIR=$(ROOT_DIR)/src/5gnrmac - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/crg.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/rgr.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/rgm.[hx]) - -# Add the product specific header files -HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) - -#prepare the list of source files -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_SRCS:=$(filter-out $(SRC_DIR)/rg_sch%, $(C_SRCS)) - -#prepare the list of object files and RLOG related files -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) - -#-------------------------------------------------------------# -#User macros (to be modified) -#-------------------------------------------------------------# -# Including RG_PHASE2_SCHED for supporting more than one schedulers -# supported by mac -# TODO: make it define for LTEMAC_MIMO and remove it from envopt.h -MOD_FLAGS=-DRGM_LC -DRGM_LWLC -USM -URG_DEBUG -DxRG_PHASE2_SCHED -DxRGR_V1 \ - -DRG_UL_DELTA=2 -ULTEMAC_DLUE_TMGOPTMZ -UTENB_SPLIT_ARCH -DRG -ULTEMAC_MIMO - -lib:$(LIB_DIR)/librg.a -include $(COM_BUILD_DIR)/compile.mak - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/librg.a:$(C_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/librg.a $(C_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaing MAC$(REVERT_COLOR)" - $(Q)\rm -f $(LIB_DIR)/librg.a $(C_OBJS) - diff --git a/build/common/sch.mak b/build/common/sch.mak new file mode 100644 index 000000000..a6c0797cd --- /dev/null +++ b/build/common/sch.mak @@ -0,0 +1,73 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ + +##-------------------------------------------------------------# +#Makefile for product RG - script generated. +#-------------------------------------------------------------# +include ../common/rsys_fancy.mak +include ../common/env.mak +COLOR=$(COLOR_GREEN) + +SRC_DIR=$(ROOT_DIR)/src/5gnrsch + +# prepare the list of common header files +HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/crg.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/rgr.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/rgm.[hx]) + +# Add the product specific header files +HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) + +#prepare the list of source files +C_SRCS=$(wildcard $(SRC_DIR)/*.c) +#C_SRCS:=$(filter-out $(SRC_DIR)/rg_sch%, $(C_SRCS)) + +#prepare the list of object files and RLOG related files +C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) + +#-------------------------------------------------------------# +#User macros (to be modified) +#-------------------------------------------------------------# +# Including RG_PHASE2_SCHED for supporting more than one schedulers +# supported by mac +# TODO: make it define for LTEMAC_MIMO and remove it from envopt.h +MOD_FLAGS=-DRGM_LC -DRGM_LWLC -USM -URG_DEBUG -DxRG_PHASE2_SCHED -DxRGR_V1 \ + -DRG_UL_DELTA=2 -ULTEMAC_DLUE_TMGOPTMZ -UTENB_SPLIT_ARCH -DRG -ULTEMAC_MIMO + +lib:$(LIB_DIR)/librg.a +include $(COM_BUILD_DIR)/compile.mak + +I_OPTS+=-I$(ROOT_DIR)/src/5gnrmac + +#-------------------------------------------------------------# +#Linker macros +#-------------------------------------------------------------# +$(LIB_DIR)/librg.a:$(C_OBJS) + @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" + $(Q)ar -cr $(LIB_DIR)/librg.a $(C_OBJS) + +#-------------------------------------------------------------# +#Clean macros +#-------------------------------------------------------------# +clean: + @echo -e "$(COLOR_RED)Cleaing MAC$(REVERT_COLOR)" + $(Q)\rm -f $(LIB_DIR)/librg.a $(C_OBJS) + diff --git a/build/odu/makefile b/build/odu/makefile index 410c3babc..255999e60 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -70,7 +70,7 @@ endif # macro for output file name and makefile name # -PLTFRM_FLAGS= -UMSPD -DODU +PLTFRM_FLAGS= -UMSPD -DODU #-DEGTP_TEST ifeq ($(MODE),TDD) PLTFRM_FLAGS += -DMODE=TDD @@ -79,6 +79,10 @@ ifeq ($(CA_ENABLE),YES) PLTFRM_FLAGS += -DCA_ENABLE=YES endif +ifeq ($(NODE),CU_STUB) + PLTFRM_FLAGS+=-DODU_TEST_STUB +endif + # The include options get merged with the options needed by # # the called makefiles and hence we export these to make them # # available to them. @@ -136,12 +140,15 @@ prepare_cu_dirs: $(Q)echo -e "Directories are successfully prepared" du: + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_sysinfo.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + #$(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rg.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' @@ -152,11 +159,13 @@ link_du: du clean_odu: $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_sysinfo.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rg.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' @@ -176,14 +185,17 @@ clean_all: clean_odu clean_cu cu: $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_sysinfo.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' clean_cu: $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' + $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_sysinfo.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' $(Q)rm -rf $(OBJ_ROOT)/cu_stub/* @@ -197,6 +209,7 @@ link_cu: $(L_OPTS) -L$(LIB_ROOT)/cu_stub -L$(ROOT_DIR)/libs/cu_stub $(Q)cp -f ./obj/cu_stub/cu_stub ./bin/cu_stub $(Q)cp -rf ./bin/cu_stub $(ROOT_DIR)/bin/ + $(Q)cp -f ../scripts/cu_script.sh $(ROOT_DIR)/bin/cu_stub $(Q)echo -e "***** CU STUB BUILD COMPLETE *****" copy_build: link_du @@ -204,6 +217,7 @@ copy_build: link_du $(Q)cp -f ../config/ssi_mem ./bin/config $(Q)cp -rf ./bin/odu $(ROOT_DIR)/bin/ $(Q)cp -rf ./bin/config $(ROOT_DIR)/bin/ + $(Q)cp -f ../scripts/odu_script.sh $(ROOT_DIR)/bin/odu $(Q)cp -f ./lib/odu/*.a $(ROOT_DIR)/libs/ $(Q)echo -e "***** BUILD COMPLETE *****" diff --git a/build/scripts/cu_script.sh b/build/scripts/cu_script.sh new file mode 100644 index 000000000..4737f588b --- /dev/null +++ b/build/scripts/cu_script.sh @@ -0,0 +1,45 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] +# # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 +# # +# # +# 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. +# # +################################################################################ + +#!/bin/sh + +ROOT_DIR=$PWD +d=`date +%Y_%m_%d_%I_%M_%S` + +touch $ROOT_DIR/"log_cu_stub_$d.txt" +chmod -c 777 $ROOT_DIR/"log_cu_stub_$d.txt" +touch /etc/rsyslog.d/rsyslog_loginauth.conf +cp /dev/null /etc/rsyslog.d/rsyslog_loginauth.conf +echo "if \$programname == \"CU_STUB\" then" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +echo "$ROOT_DIR/../cu_stub/log_cu_stub_$d.txt" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +systemctl restart rsyslog + + +#********************************************************************** +# End of file +#********************************************************************** diff --git a/build/scripts/odu_script.sh b/build/scripts/odu_script.sh new file mode 100644 index 000000000..fc8b28557 --- /dev/null +++ b/build/scripts/odu_script.sh @@ -0,0 +1,44 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] +# # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 +# # +# # +# 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. +# # +################################################################################ + +#!/bin/sh + +ROOT_DIR=$PWD +d=`date +%Y_%m_%d_%I_%M_%S` + +touch $ROOT_DIR/../odu/"log_odu_$d.txt" +chmod -c 777 $ROOT_DIR/../odu/"log_odu_$d.txt" +echo "if \$programname == \"ODU\" then" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +echo "$ROOT_DIR/../odu/log_odu_$d.txt" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +echo $ROOT_DIR +systemctl restart rsyslog + + +#********************************************************************** +# End of file +#********************************************************************** diff --git a/docs/README b/docs/README index fef88c391..708c2a6af 100644 --- a/docs/README +++ b/docs/README @@ -38,9 +38,9 @@ How to Clean and Build: a. Build folder cd l2/build/odu b. Building CU Stub binary - make cu_stub MACHINE=BIT64 MODE=FDD + make cu_stub NODE=CU_STUB MACHINE=BIT64 MODE=FDD c. Cleaning CU Stub binary - make clean_cu MACHINE=BIT64 MODE=FDD + make clean_cu NODE=CU_STUB MACHINE=BIT64 MODE=FDD 3. Cleaning ODU and CU Stub make clean_all MACHINE=BIT64 MODE=FDD diff --git a/src/5gnrmac/fapi.h b/src/5gnrmac/fapi.h new file mode 100644 index 000000000..6ab2abbb4 --- /dev/null +++ b/src/5gnrmac/fapi.h @@ -0,0 +1,796 @@ +/****************************************************************************** +* Copyright 2017 Cisco Systems, Inc. +* Copyright (c) 2019 Intel. +* +* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 +* +* 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. +* +*******************************************************************************/ +// This file has been modified by Intel in order to support 5G FAPI:PHY API Specification +// Document 222.10.01 dated June 2019 +// Changes made by luis.farias@intel.com +/** + * @file + * This file consist of FAPI configuration APIs macros, structure typedefs and + * prototypes. + * + **/ + +#ifndef _FAPI_H_ +#define _FAPI_H_ + +#include + +#include "fapi_interface.h" +//#include "fapi_vendor_common_defs.h" + +#define RELEASE_15 0x0001 + +// Datatypes typedefs - end + +typedef enum { + FAPI_SUCCESS = 0, + FAPI_FAILURE +} fapiStatus_t; +// Updated per 5G FAPI + + + +// Updated per 5G FAPI +typedef enum { + FAPI_UL_TTI_REQ_PRACH_PDU_TYPE = 0, + FAPI_UL_TTI_REQ_PUSCH_PDU_TYPE, + FAPI_UL_TTI_REQ_PUCCH_PDU_TYPE, + FAPI_UL_TTI_REQ_SRS_PDU_TYPE +}fapiULTtiReqPduType_e; +// Updated per 5G FAPI +typedef enum { + FAPI_UCI_IND_ON_PUSCH_PDU_TYPE = 0, + FAPI_UCI_IND_ON_PUCCH_FMT_0_1_PDU_TYPE, + FAPI_UCI_IND_ON_PUCCH_FMT_2_3_4_PDU_TYPE +}fapiUciIndPdu_Type_e; + +// CRC +enum { + FAPI_CRC_CORRECT = 0, + FAPI_CRC_ERROR = 1 +}; + +//------------------------------------------------------------------------------ +// Fapi Infra Declarations +//------------------------------------------------------------------------------ +// Release/Features support +typedef enum { + FAPI_NOT_SUPPORTED = 0, + FAPI_SUPPORTED, +} fapiSupport_t; + +// FAPI States +/** + * FAPI state is maintained per fapi instance. If FAPI messages are received in + * wrong state an ERROR.indication message will be sent by FAPI. + */ +typedef enum fapiStates +{ + FAPI_STATE_IDLE = 0, + FAPI_STATE_CONFIGURED, + FAPI_STATE_RUNNING +} fapiStates_t; + +// Information of optional and mandatory status for a TLV +typedef enum { + FAPI_IDLE_STATE_ONLY_OPTIONAL = 0, + FAPI_IDLE_STATE_ONLY_MANDATORY, + FAPI_IDLE_AND_CONFIGURED_STATES_OPTIONAL, + FAPI_IDLE_STATE_MANDATORY_CONFIGURED_STATE_OPTIONAL, + FAPI_IDLE_CONFIGURED_AND_RUNNING_STATES_OPTIONAL, + FAPI_IDLE_STATE_MANDATORY_CONFIGURED_AND_RUNNING_STATES_OPTIONAL +} fapiTlvStatus_t; + +// PARAMETERS INFORMATION + +#define FAPI_NORMAL_CYCLIC_PREFIX_MASK 0x01 +#define FAPI_EXTENDED_CYCLIC_PREFIX_MASK 0x02 + +// In 5G FAPI FrameDuplexType as part of Cell Configuration +typedef enum +{ + TDD_DUPLEX = 0, + FDD_DUPLEX +} modes; //Defined now + +// Subcarrier spacing information +#define FAPI_15KHZ_MASK 0x01 +#define FAPI_30KHZ_MASK 0x02 +#define FAPI_60KHZ_MASK 0x04 +#define FAPI_120KHZ_MASK 0x08 + +// Bandwitdth information +#define FAPI_5MHZ_BW_MASK 0x0001 +#define FAPI_10MHZ_BW_MASK 0x0002 +#define FAPI_15MHZ_BW_MASK 0x0004 +#define FAPI_20MHZ_BW_MASK 0x0010 +#define FAPI_40MHZ_BW_MASK 0x0020 +#define FAPI_50MHZ_BW_MASK 0x0040 +#define FAPI_60MHZ_BW_MASK 0x0080 +#define FAPI_70MHZ_BW_MASK 0x0100 +#define FAPI_80MHZ_BW_MASK 0x0200 +#define FAPI_90MHZ_BW_MASK 0x0400 +#define FAPI_100MHZ_BW_MASK 0x0800 +#define FAPI_200MHZ_BW_MASK 0x1000 +#define FAPI_400MHZ_BW_MASK 0x2000 + + +// PDCCH Information +#define FAPI_CCE_MAPPING_INTERLEAVED_MASK 0x01 +#define FAPI_CCE_MAPPING_NONINTERLVD_MASK 0x02 +// Upper Bound for PDCCH Channels per Slot +#define FAPI_MAX_PDCCHS_PER_SLOT_MASK 0xff + +// PUCCH Information +#define FAPI_FORMAT_0_MASK 0x01 +#define FAPI_FORMAT_1_MASK 0x02 +#define FAPI_FORMAT_2_MASK 0x04 +#define FAPI_FORMAT_3_MASK 0x08 +#define FAPI_FORMAT_4_MASK 0x10 +// Upper Bound for PUCCH Channels per Slot +#define FAPI_MAX_PUCCHS_PER_SLOT_MASK 0xff + +// PDSCH Information +#define FAPI_PDSCH_MAPPING_TYPE_A_MASK 0x01 +#define FAPI_PDSCH_MAPPING_TYPE_B_MASK 0x02 +#define FAPI_PDSCH_ALLOC_TYPE_0_MASK 0x01 +#define FAPI_PDSCH_ALLOC_TYPE_1_MASK 0x02 +#define FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK 0x01 +#define FAPI_PDSCH_VRB_TO_PRB_MAP_INTLVD_MASK 0x02 +#define FAPI_PDSCH_DMRS_CONFIG_TYPE_1_MASK 0x01 +#define FAPI_PDSCH_DMRS_CONFIG_TYPE_2_MASK 0x02 +#define FAPI_PDSCH_DMRS_MAX_LENGTH_1 0 +#define FAPI_PDSCH_DMRS_MAX_LENGTH_2 1 +#define FAPI_DMRS_ADDITIONAL_POS_0_MASK 0x01 +#define FAPI_DMRS_ADDITIONAL_POS_1_MASK 0x02 +#define FAPI_DMRS_ADDITIONAL_POS_2_MASK 0x04 +#define FAPI_DMRS_ADDITIONAL_POS_3_MASK 0x08 +//Upper Limit for PDSCHS TBs per Slot +#define FAPI_MAX_PDSCHS_TBS_PER_SLOT_MASK 0xff +#define FAPI_MAX_NUMBERMIMO_LAYERS_PDSCH 2 + +typedef enum modulationOrder { + FAPI_QPSK = 0, + FAPI_16QAM, + FAPI_64QAM, + FAPI_256QAM +} fapiModOrder_t; + +#define FAPI_MAX_MUMIMO_USERS_MASK 0xff + + +// PUSCH Parameters + +#define FAPI_PUSCH_MAPPING_TYPE_A_MASK 0x01 +#define FAPI_PUSCH_MAPPING_TYPE_B_MASK 0x02 +#define FAPI_PUSCH_ALLOC_TYPE_0_MASK 0x01 +#define FAPI_PUSCH_ALLOC_TYPE_1_MASK 0x02 +#define FAPI_PUSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK 0x01 +#define FAPI_PUSCH_VRB_TO_PRB_MAP_INTLVD_MASK 0x02 +#define FAPI_PUSCH_DMRS_CONFIG_TYPE_1_MASK 0x01 +#define FAPI_PUSCH_DMRS_CONFIG_TYPE_2_MASK 0x02 +#define FAPI_PUSCH_DMRS_MAX_LENGTH_1 0 +#define FAPI_PUSCH_DMRS_MAX_LENGTH_2 1 +// Upper limit for PUSCHMAXPTRSPORTS +#define FAPI_PUSCH_MAX_PTRS_PORTS_UB 2 +//Upper Limit for PDSCHS TBs per Slot +#define FAPI_MAX_PUSCHS_TBS_PER_SLOT_MASK 0xff + +typedef enum aggregationFactor +{ + FAPI_PUSCH_AGG_FACTOR_1 = 0, + FAPI_PUSCH_AGG_FACTOR_2, + FAPI_PUSCH_AGG_FACTOR_4, + FAPI_PUSCH_AGG_FACTOR_8 +} fapiPuschAggFactor_t; + +// PRACH Parameters +#define FAPI_PRACH_LF_FORMAT_0_MASK 0x01 +#define FAPI_PRACH_LF_FORMAT_1_MASK 0x02 +#define FAPI_PRACH_LF_FORMAT_2_MASK 0x04 +#define FAPI_PRACH_LF_FORMAT_3_MASK 0x08 + +#define FAPI_PRACH_SF_FORMAT_A1_MASK 0x01 +#define FAPI_PRACH_SF_FORMAT_A2_MASK 0x02 +#define FAPI_PRACH_SF_FORMAT_A3_MASK 0x04 +#define FAPI_PRACH_SF_FORMAT_B1_MASK 0x08 +#define FAPI_PRACH_SF_FORMAT_B2_MASK 0x10 +#define FAPI_PRACH_SF_FORMAT_B3_MASK 0x20 +#define FAPI_PRACH_SF_FORMAT_B4_MASK 0x40 +#define FAPI_PRACH_SF_FORMAT_C0_MASK 0x80 +#define FAPI_PRACH_SF_FORMAT_C2_MASK 0x100 + +typedef enum { + FAPI_MAX_PRACH_FD_OCC_IN_A_SLOT_1 = 0, + FAPI_MAX_PRACH_FD_OCC_IN_A_SLOT_2, + FAPI_MAX_PRACH_FD_OCC_IN_A_SLOT_4, + FAPI_MAX_PRACH_FD_OCC_IN_A_SLOT_8 +} fapi_prachMaxFdOccasionsPerSlot_t; + +// Measurement Parameters +#define FAPI_RSSI_REPORT_IN_DBM_MASK 0x01 +#define FAPI_RSSI_REPORT_IN_DBFS_MASK 0x02 + +// CONFIGURATION INFORMATION +// CARRIER CONFIGURATION +// BANDWIDTH +#define FAPI_BANDWIDTH_5_MHZ 5 +#define FAPI_BANDWIDTH_10_MHZ 10 +#define FAPI_BANDWIDTH_15_MHZ 15 +#define FAPI_BANDWIDTH_20_MHZ 20 +#define FAPI_BANDWIDTH_25_MHZ 25 +#define FAPI_BANDWIDTH_30_MHZ 30 +#define FAPI_BANDWIDTH_40_MHZ 40 +#define FAPI_BANDWIDTH_50_MHZ 50 +#define FAPI_BANDWIDTH_60_MHZ 60 +#define FAPI_BANDWIDTH_70_MHZ 70 +#define FAPI_BANDWIDTH_80_MHZ 80 +#define FAPI_BANDWIDTH_90_MHZ 90 +#define FAPI_BANDWIDTH_100_MHZ 100 +#define FAPI_BANDWIDTH_200_MHZ 200 +#define FAPI_BANDWIDTH_400_MHZ 400 + +// Frequency needs to track 38.104 Section 5.2 and 38.211 Section 5.3.1 +// Lower Bound KHz +#define FAPI_MIN_FREQUENCY_PT_A 450000 +// Upper Bound KHz +#define FAPI_MAX_FREQUENCY_PT_A 52600000 +// dlk0, ulk0 per 38.211 Section 5.3.1 +// Upper Bound +#define FAPI_K0_MAX 23699 +// dlGridSize, ulGridSize per 38.211 Section 4.4.2 +// Upper Bound +#define FAPI_GRIDSIZE_MAX 275 +// Number of Transmit Antennas +// Define upper mask based on variable type +#define FAPI_NUM_ANT_MASK 0xffff + +// CELL CONFIGURATION +// Physical Cell ID from 38.211 Section 7.4.2.1 +// Upper Bound +#define FAPI_MAX_CELL_ID 1007 + +// SSB CONFIGURATION +// SSB POWER RANGE in dBm +#define FAPI_SS_PBCH_LOWEST_POWER -60 +#define FAPI_SS_PBCH_MAX_POWER 50 +// BCH PAYLOAD for 5G the MAC always generates the BCH Payload +#define FAPI_BCH_PAYLOAD_GEN_BY_MAC 0 +#define FAPI_BCH_PAYLOAD_WITH_PHY_GEN_TIMING 1 +#define FAPI_BCH_PAYLOAD_ENTIRELY_GEN_BY_PHY 2 +// ScsCommon +#define FAPI_SCSCOMMON_MASK 0x03 + +// PRACH CONFIGURATION +#define FAPI_PRACH_LONG_SEQUENCE 0 +#define FAPI_PRACH_SHORT_SEQUENCE 1 +#define FAPI_PRACH_SUBC_SPACING_MAX 4 +// Restricted Set Configuration +#define FAPI_PRACH_RESTRICTED_SET_UNRESTRICTED 0 +#define FAPI_PRACH_RESTRICTED_SET_TYPE_A 1 +#define FAPI_PRACH_RESTRICTED_SET_TYPE_B 2 +// Root Sequence Index +// Upper Bound +#define FAPI_PRACH_ROOT_SEQ_INDEX_MAX 837 +// k1 +// Upper Bound +#define FAPI_K1_UPPER_BOUND 272 +// PRACH Zero Corr Configuration +// Upper Bound +#define FAPI_PRACHZEROCORRCONF_MASK 0x0f +// Number of Unused Root Sequences Mask +#define FAPI_UNUSEDROOTSEQUENCES_MASK 0x0f +// SSBPERRACH +typedef enum +{ + FAPI_SSB_PER_RACH_1_OVER_8 = 0, + FAPI_SSB_PER_RACH_1_OVER_4, + FAPI_SSB_PER_RACH_1_OVER_2, + FAPI_SSB_PER_RACH_1, + FAPI_SSB_PER_RACH_2, + FAPI_SSB_PER_RACH_4, + FAPI_SSB_PER_RACH_8, + FAPI_SSB_PER_RACH_16 +} fapiSsbPerRach_t; + +// SSB Table +// Ssb Offset Point A max +#define FAPI_SSB_OFFSET_POINTA_MAX 2199 +// betaPSS i.e. PSS EPRE to SSS EPRE in a SS/PBCH Block per 38.213 Section 4.1 +#define FAPI_BETAPSS_0_DB 0 +#define FAPI_BETAPSS_3_DB 1 +// SSB Period in ms +#define FAPI_SSB_PERIOD_5_MS 0 +#define FAPI_SSB_PERIOD_10_MS 1 +#define FAPI_SSB_PERIOD_20_MS 2 +#define FAPI_SSB_PERIOD_40_MS 3 +#define FAPI_SSB_PERIOD_80_MS 4 +#define FAPI_SSB_PERIOD_160_MS 5 + +// Ssb Subcarrier Offset per 38.211 Section 7.4.3.1 +// SsbSubcarrierOffset mask +#define FAPI_SSB_SUBCARRIER_OFFSET_MASK 0x1f +// MIB PAYLOAD MASK +#define MIB_PAYLOAD_MASK 0xfff0 +// BEAM ID MASK +#define FAPI_BEAM_ID_MASK 0x3f + +// TDD Table +// TDD Period +#define FAPI_TDD_PERIOD_0_P_5_MS 0 +#define FAPI_TDD_PERIOD_0_P_625_MS 1 +#define FAPI_TDD_PERIOD_1_MS 2 +#define FAPI_TDD_PERIOD_1_P_25_MS 3 +#define FAPI_TDD_PERIOD_2_MS 4 +#define FAPI_TDD_PERIOD_2_P_5_MS 5 +#define FAPI_TDD_PERIOD_5_MS 6 +#define FAPI_TDD_PERIOD_10_MS 7 + +// Slot Configuration +#define FAPI_DL_SLOT 0 +#define FAPI_UL_SLOT 1 +#define FAPI_GUARD_SLOT 2 + +// Measurement configuration +#define FAPI_NO_RSSI_REPORTING 0 +#define FAPI_RSSI_REPORTED_IN_DBM 1 +#define FAPI_RSSI_REPORTED_IN_DBFS 2 + +// Error Indication +#define FAPI_SFN_MASK 0x03ff + +// Status and Error Codes for either .response or ERROR.indication +// Updated per 5g FAPI Table 3-31 +/* +typedef enum { + MSG_OK = 0, + MSG_INVALID_STATE, + MSG_INVALID_CONFIG, + SFN_OUT_OF_SYNC, + MSG_SLOT_ERR, + MSG_BCH_MISSING, + MSG_INVALID_SFN, + MSG_UL_DCI_ERR, + MSG_TX_ERR + }fapiStatusAndErrorCodes_e; +*/ + // Digital Beam Table (DBT) PDU + // Number of Digital Beam Mask + // Number of TX RUS Mask + // Beam Index Mask + // Digital Beam Index weights Real and Imaginary Mask + + // Precoding Matrix (PM) PDU + // Precoding Matrix ID Mask + // Number of Layers Mask + // Number of Antenna Ports at the precoder output Mask + // Precoder Weights Real and Imaginary Mask + #define FAPI_U16_MASK 0xffff + + // Slot Indication + + #define FAPI_SLOT_MAX_VALUE 319 + + // DL_TTI.request + // nPDUS mask + // nGroup mask + #define FAPI_U8_MASK 0xff + + typedef enum { + FAPI_DL_TTI_REQ_PDCCH_PDU_TYPE = 0, + FAPI_DL_TTI_REQ_PDSCH_PDU_TYPE, + FAPI_DL_TTI_REQ_CSI_RS_PDU_TYPE, + FAPI_DL_TTI_REQ_SSB_PDU_TYPE +}fapiDlTtiReqPduType_e; + +// nUe +// Define Maximum number of Ues per Group +#define FAPI_MAX_NUMBER_OF_UES_PER_GROUP 12 + +// PDCCH PDU +#define FAPI_BWPSIZE_MAX 275 +#define FAPI_BWPSIZE_START_MAX 274 +#define FAPI_SUBCARRIER_SPACING_MAX 4 +#define FAPI_CYCLIC_PREFIX_NORMAL 0 +#define FAPI_CYCLIC_PREFIX_EXTENDED 1 +#define FAPI_MAX_SYMBOL_START_INDEX 13 + +#define FAPI_CORESET_DURATION_1_SYMBOL 1 +#define FAPI_CORESET_DURATION_2_SYMBOLS 2 +#define FAPI_CORESET_DURATION_3_SYMBOLS 3 + +#define FAPI_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0 +#define FAPI_CCE_REG_MAPPING_TYPE_INTERLEAVED 1 +#define FAPI_REG_BUNDLE_SIZE_2 2 +#define FAPI_REG_BUNDLE_SIZE_3 3 +#define FAPI_REG_BUNDLE_SIZE_6 6 + +#define FAPI_INTERLEAVER_SIZE_2 2 +#define FAPI_INTERLEAVER_SIZE_3 3 +#define FAPI_INTERLEAVER_SIZE_6 6 + +#define FAPI_CORESET_TYPE_0_CONF_BY_PBCH_OR_SIB1 0 +#define FAPI_CORESET_TYPE_1 1 + +#define FAPI_PREC_GRANULARITY_SAME_AS_REG_BUNDLE 0 +#define FAPI_PREC_GRANULARITY_ALL_CONTIG_RBS 1 + +#define FAPI_CCE_INDEX_MAX 135 +#define FAPI_PDCCH_AGG_LEVEL_1 1 +#define FAPI_PDCCH_AGG_LEVEL_2 2 +#define FAPI_PDCCH_AGG_LEVEL_4 4 +#define FAPI_PDCCH_AGG_LEVEL_8 8 +#define FAPI_PDCCH_AGG_LEVEL_16 16 + +#define FAPI_BETA_PDCCH_1_0_MAX 17 + +#define FAPI_POWER_CTRL_OFF_SS_MINUS_3_DB 0 +#define FAPI_POWER_CTRL_OFF_SS_0_DB 1 +#define FAPI_POWER_CTRL_OFF_SS_3_DB 2 +#define FAPI_POWER_CTRL_OFF_SS_6_DB 3 + +#define FAPI_MAX_NUMBER_OF_CODEWORDS 2 + +#define FAPI_MAX_MCS_INDEX 31 +#define FAPI_MCS_INDEX_MASK 0x1f + +#define FAPI_MCS_TABLE_NOT_QAM_256 0 +#define FAPI_MCS_TABLE_QAM_256 1 +#define FAPI_MCS_TABLE_QAM_64_LOW_SE 2 + +#define FAPI_REDUNDANCY_INDEX_MASK 0x03 +#define FAPI_MAX_DL_LAYERS 8 + +#define FAPI_TRANSMISSION_SCHEME_1 1 + +#define FAPI_REF_POINT_FOR_PDSCH_DMRS_AT_PT_A 0 +#define FAPI_REF_POINT_FOR_PDSCH_DMRS_AT_LOWEST_ALLOC 1 + +#define FAPI_DL_DMRS_SYMB_POS_MASK 0x3fff + +#define FAPI_MAX_DMRS_CDM_GRPS_WO_DATA 3 + +#define FAPI_DMRS_PORTS_MASK 0x0fff + +#define FAPI_RES_ALLOC_TYPE_0 0 +#define FAPI_RES_ALLOC_TYPE_1 1 + +#define FAPI_VRB_TO_PRB_MAP_NON_INTERLVD 0 +#define FAPI_VRB_TO_PRB_MAP_INTERLVD_RB_SIZE_2 1 +#define FAPI_VRB_TO_PRB_MAP_INTERLVD_RB_SIZE_4 2 + +#define FAPI_MAX_START_SYMBOL_INDEX 13 +#define FAPI_MAX_NR_OF_SYMBOLS 14 +#define FAPI_PTRS_PORT_INDEX_MASK 0x3f +#define FAPI_PTRS_TIME_DENSITY_1 0 +#define FAPI_PTRS_TIME_DENSITY_2 1 +#define FAPI_PTRS_TIME_DENSITY_4 2 +#define FAPI_PTRS_FREQ_DENSITY_2 0 +#define FAPI_PTRS_FREQ_DENSITY_4 1 +#define FAPI_PTRS_RE_OFFSET_MASK 0x03 +#define FAPI_EPRE_RATIO_PDSCH_PTRS_MASK 0x03 +// PDSCH Power Control Offset +#define FAPI_PWR_CTRL_OFFSET_MINUS_8_DB 0 +#define FAPI_PWR_CTRL_OFFSET_MINUS_7_DB 1 +#define FAPI_PWR_CTRL_OFFSET_MINUS_6_DB 2 +#define FAPI_PWR_CTRL_OFFSET_MINUS_5_DB 3 +#define FAPI_PWR_CTRL_OFFSET_MINUS_4_DB 4 +#define FAPI_PWR_CTRL_OFFSET_MINUS_3_DB 5 +#define FAPI_PWR_CTRL_OFFSET_MINUS_2_DB 6 +#define FAPI_PWR_CTRL_OFFSET_MINUS_1_DB 7 +#define FAPI_PWR_CTRL_OFFSET_0_DB 8 +#define FAPI_PWR_CTRL_OFFSET_1_DB 9 +#define FAPI_PWR_CTRL_OFFSET_2_DB 10 +#define FAPI_PWR_CTRL_OFFSET_3_DB 11 +#define FAPI_PWR_CTRL_OFFSET_4_DB 12 +#define FAPI_PWR_CTRL_OFFSET_5_DB 13 +#define FAPI_PWR_CTRL_OFFSET_6_DB 14 +#define FAPI_PWR_CTRL_OFFSET_7_DB 15 +#define FAPI_PWR_CTRL_OFFSET_8_DB 16 +#define FAPI_PWR_CTRL_OFFSET_9_DB 17 +#define FAPI_PWR_CTRL_OFFSET_10_DB 18 +#define FAPI_PWR_CTRL_OFFSET_11_DB 19 +#define FAPI_PWR_CTRL_OFFSET_12_DB 20 +#define FAPI_PWR_CTRL_OFFSET_13_DB 21 +#define FAPI_PWR_CTRL_OFFSET_14_DB 22 +#define FAPI_PWR_CTRL_OFFSET_15_DB 23 +// Power Control Offset SS +#define FAPI_PWR_CTRL_OFFSET_SS_MINUS_3_DB 0 +#define FAPI_PWR_CTRL_OFFSET_SS_0_DB 1 +#define FAPI_PWR_CTRL_OFFSET_SS_3_DB 2 +#define FAPI_PWR_CTRL_OFFSET_SS_6_DB 3 +// CSI Type +#define FAPI_CSI_TRS 0 +#define FAPI_CSI_NON_ZERO_POWER 1 +#define FAPI_CSI_ZERO_POWER 2 +// Row entry into CSI Resource Location Table +#define FAPI_CSIRLT_ROW_MAX_VALUE 18 +#define FAPI_CSI_FREQ_DOMAIN_MASK 0x0fff +#define FAPI_CSI_SYMB_L1_MIN 2 +#define FAPI_CSI_SYMB_L1_MAX 12 +// CDM Type +#define FAPI_CDM_TYPE_NO_CDM 0 +#define FAPI_CDM_TYPE_FD_CDM 1 +#define FAPI_CDM_TYPE_CDM4_FD2_TD2 2 +#define FAPI_CDM_TYPE_CDM8_FD2_TD4 3 +// Frequency Density +#define FAPI_FD_DOT5_EVEN_RB 0 +#define FAPI_FD_DOT5_ODD_RB 1 +#define FAPI_FD_ONE 2 +#define FAPI_FD_THREE 3 + +// SSB +#define FAPI_SSB_BLOCK_INDEX_MASK 0x3f +#define FAPI_SSB_SC_OFFSET_MASK 0x1f + +// UL TTI REQUEST +#define FAPI_MAX_NUM_UE_GROUPS_INCLUDED 8 +#define FAPI__MAX_NUM_UE_IN_GROUP 6 +// PRACH PDU +#define FAPI_MAX_NUM_PRACH_OCAS 7 +// PRACH FORMAT +#define FAPI_PRACH_FORMAT_A1 0 +#define FAPI_PRACH_FORMAT_A2 1 +#define FAPI_PRACH_FORMAT_A3 2 +#define FAPI_PRACH_FORMAT_B1 3 +#define FAPI_PRACH_FORMAT_B2 4 +#define FAPI_PRACH_FORMAT_B3 5 +#define FAPI_PRACH_FORMAT_B4 6 +#define FAPI_PRACH_FORMAT_C0 7 +#define FAPI_PRACH_FORMAT_C2 8 + +#define FAPI_MAX_PRACH_FD_OCCASION_INDEX 7 +#define FAPI_MAX_ZC_ZONE_CONFIG_NUMBER 419 + +// PUSCH PDU +#define FAPI_PUSCH_BIT_DATA_PRESENT_MASK 0x0001 +#define FAPI_PUSCH_UCI_DATA_PRESENT_MASK 0x0002 +#define FAPI_PUSCH_PTRS_INCLUDED_FR2_MASK 0x0004 +#define FAPI_PUSCH_DFTS_OFDM_TX_MASK 0x0008 + +#define FAPI_MAX_QAM_MOD_ORDER 8 +#define FAPI_MCS_INDEX_MASK 0x1f + +#define FAPI_MCS_TABLE_NOT_QAM256 0 +#define FAPI_MCS_TABLE_QAM256 1 +#define FAPI_MCS_TABLE_QAM64_LOWSE 2 +#define FAPI_MCS_TABLE_NOT_QAM256_W_XFRM_PRECOD 3 +#define FAPI_MCS_TABLE_QAM64_LOWSE_W_XFRM_PRECOD 4 +#define FAPI_PUSCH_MAX_NUM_LAYERS 4 +// DMRS +#define FAPI_UL_DMRS_SYMB_POS_MASK 0x3fff +#define FAPI_UL_DMRS_CONFIG_TYPE_1 0 +#define FAPI_UL_DMRS_CONFIG_TYPE_2 1 +#define FAPI_MAX_DMRS_CDM_GRPS_NO_DATA 3 +#define FAPI_UL_DMRS_PORTS_MASK 0x07ff +#define FAPI_UL_TX_DIRECT_CURR_LOCATION_MAX 3299 +#define FAPI_UL_TX_DIRECT_CURR_LOC_OUTSIDE_CARRIER 3300 +#define FAPI_UL_TX_DIRECT_CURR_LOC_UNDETERMINED 3301 +// PUSCH DATA +#define FAPI_RV_INDEX_MASK 0x03 +#define FAPI_HARQ_PROCESS_ID_MASK 0x0f +// PUSCH UCI INFO +#define FAPI_HARQ_ACK_CSI_PX_BIT_LEN_SMALL_BLOCK_MAX 11 +#define FAPI_HARQ_ACK_CSI_PX_BIT_LEN_POLAR_MAX 1706 +// ALPHA SCALING +#define FAPI_ALPHA_SCALE_0_5 0 +#define FAPI_ALPHA_SCALE_0_65 1 +#define FAPI_ALPHA_SCALE_0_8 2 +#define FAPI_ALPHA_SCALE_1_0 3 +// BETA OFFSET HARQ ACK +#define FAPI_BETA_OFFSET_HARQ_ACK_MAX 15 +#define FAPI_BETA_OFFSET_CSIX_MAX 18 + +// PUSCH PTRS INFORMATION 38.212 Section 7.3.1.1.2 +#define FAPI_MAX_NUMBER_PTRS_PORT_INDEX 11 // 0..11 +// UL PTRS POWER 5G FAPI Table 3-49 +#define FAPI_UL_PTRS_PWR_0_DB 0 +#define FAPI_UL_PTRS_PWR_3_DB 1 +#define FAPI_UL_PTRS_PWR_4_77_DB 2 +#define FAPI_UL_PTRS_PWR_6_DB 3 +// DFTSOFDM INFO 5g FAPI Table 3-50 +#define FAPI_MAX_LOW_PAPR_GROUP_NUMBER 29 // 0..29 +#define FAPI_MAX_LOW_PAPR_SEQ_NUMBER 87 // 3*LOW_PAPR_GRP_NUM +#define FAPI_MAX_UL PTRS_SAMP_DENSITY 8 +#define FAPI_MAX_UL_PTRS_TD_XFRM_PRECOD 4 + +// PUCCH PDU Table 3-51 +#define FAPI_MAX_PUCCH_FORMAT_TYPE 4 +#define FAPI_MULTI_SLOT_TX_IND_NO_MULTI_SLOT 0 +#define FAPI_MULTI_SLOT_TX_IND_TX_START 1 +#define FAPI_MULTI_SLOT_TX_IND_TX_CONT 2 +#define FAPI_MULTI_SLOT_TX_IND_TX_END 3 +#define FAPI_MAX_NUM_PRB_FOR_A_PUCCH 16 +#define FAPI_MAX_PUCCH_DUR_F0_AND_F2 2 +#define FAPI_MIN_PUCCH_DUR_F1_F3_F4 4 +#define FAPI_MAX_PUCCH_DUR_F1_F3_F4 14 +#define FAPI_MAX_INIT_CYCLIC_SHIFT_F0_F1_F3_F4 11 +#define FAPI_MAX_OCC_INDEX_F1 6 +#define FAPI_MAX_PRE_DFT_OCC_IDX_F4 3 +#define FAPI_MAX_PRE_DFT_OCC_LEN_F4 4 +#define FAPI_MAX_DMRS_CYC_SHIFT_F4 9 +#define FAPI_BIT_LEN_HARQ_PL_ZERO 0 +#define FAPI_BIT_LEN_HARQ_PL_F0_F1_2_BITS 1 +#define FAPI_BIT_LEN_HARQ_PL_F2_F3_F4_1706_BITS 2 +#define FAPI_BIT_LEN_CSI_PX_PL_NO_CSI 0 +#define FAPI_BIT_LEN_CSI_PX_PL_1706_BITS 1 + +// SRS PDU +#define FAPI_1_SRS_ANT_PORT 0 +#define FAPI_2_SRS_ANT_PORTS 1 +#define FAPI_4_SRS_ANT_PORTS 2 +#define FAPI_SRS_NO_REPETITIONS 0 +#define FAPI_SRS_2_REPETITIONS 2 +#define FAPI_SRS_4_REPETITIONS 4 +#define FAPI_SRS_CONFIG_INDEX_MASK 0x3f +#define FAPI_SRS_BW_INDEX_MASK 0x03 +#define FAPI_TX_COMB_SIZE_2 0 +#define FAPI_TX_COMB_SIZE_4 1 +#define FAPI_MAX_SRS_FREQ_POSITION 67 +#define FAPI_MAX_SRS_FD_SHIFT 268 +#define FAPI_SRS_FREQ_HOPPING_MASK 0x03 +#define FAPI_SRS_NO_HOPPING 0 +#define FAPI_SRS_GRP_OR_SEQ_HOPPING 1 +#define FAPI_SRS_SEQ_HOPPING 2 +#define FAPI_SRS_RES_ALLOC_APERIODIC 0 +#define FAPI_SRS_RES_ALLOC_SEMI_PERSISTENT 1 +#define FAPI_SRS_RES_ALLOC_PERIODIC 2 +#define FAPI_MAX_LSOT_OFFSET_VALUE 2559 + +// RX_DATA Indication +#define FAPI_UL_CQI_INVALID 255 +#define FAPI_TIMING_ADVANCE_INVALID 0xffff +#define FAPI_MAX_TIMING_ADVANCE 63 +#define FAPI_MAX_RSSI 1280 + + +// RACH Indication +#define FAPI_RACH_FREQ_INDEX_MAX 7 +#define FAPI_RACH_DETECTED_PREAMBLES_MASK 0x3f +#define FAPI_RACH_TIMING_ADVANCE_MAX 3846 +#define FAPI_RACH_PREAMBLE_POWER_INVALID 0xffffffff +#define FAPI_RACH_PREAMBLE_TIMING_ADVANCE_INVALID 0xffff +#define FAPI_RACH_PREAMBLE_POWER_MAX 170000 + +// SR, HARQ, and CSI Part 1/2 PDUs Table 3-66 +#define FAPI_SR_MASK 0x01 +#define FAPI_HARQ_MASK 0x02 +#define FAPI_CSI_PART1 0x04 +#define FAPI_CSI_PART2 0x08 +#define FAPI_PUCCH_FORMAT2 0 +#define FAPI_PUCCH_FORMAT3 1 +#define FAPI_PUCCH_FORMAT4 2 +#define FAPI_PUCCH_FORMAT_MASK 0x03 + +// SR PDU For Format 0 or 1 Table 3-67 +#define FAPI_SR_CONFIDENCE_LEVEL_GOOD 0 +#define FAPI_SR_CONFIDENCE_LEVEL_BAD 1 +#define FAPI_SR_CONFIDENCE_LEVEL_INVALID 0xff + +// HARQ PDU for Format 0 or 1 Table 3-68 +#define FAPI_HARQ_VALUE_PASS 0 +#define FAPI_HARQ_VALUE_FAIL 1 +#define FAPI_HARQ_VALUE_NOT_PRESENT 2 + +// SR PDU for Format 2,3 or 4 Table 3-69 +#define FAPI_SR_PAYLOAD_MAX 1 + +// HARQ PDU for Format 2,3 or 4 Table 3-70 +#define FAPI_HARQ_CRC_PASS 0 +#define FAPI_HARQ_CRC_FAIL 1 +#define FAPI_HARQ_CRC_NOT_PRESENT 2 +#define FAPI_HARQ_PAYLOAD_MAX 214 + + +// CSI Part 1 PDU Table 3-71 and 3-72 +#define FAPI_CSI_PARTX_CRC_PASS 0 +#define FAPI_CSI_PARTX_CRC_FAIL 1 +#define FAPI_CSI_PARTX_CRC_NOT_PRESENT 2 +#define FAPI_CSI_PARTX_PAYLOAD_MAX 214 + +#if 0 +//------------------------------------------------------------------------------ +// FAPI callback functions to be implemented by the user +//------------------------------------------------------------------------------ +/** + * fapi callback structure is passed as part of ``fapi_create``. FAPI will call + * these functions in response to any received request message. + * + * *Note: vendor specific callbacks are only valid in TIMER_MODE. Must be set + * to NULL in RADIO mode.* + */ +typedef struct { + void (*fapi_param_response) (fapiInstanceHdl_t fapiHdl, + pfapiParamResp_t resp); + void (*fapi_config_response) (fapiInstanceHdl_t fapiHdl, + pfapiConfigResp_t resp); + void (*fapi_stop_ind) (fapiInstanceHdl_t fapiHdl, + pfapiStopInd_t resp); + void (*fapi_error_ind) (fapiInstanceHdl_t fapiHdl, + pfapiErrorInd_t ind); + void (*fapi_subframe_ind) (fapiInstanceHdl_t fapiHdl, + pfapiSubframeInd_t ind); + void (*fapi_harq_ind) (fapiInstanceHdl_t fapiHdl, + pfapiHarqInd_t ind); + void (*fapi_crc_ind) (fapiInstanceHdl_t fapiHdl, + pfapiCrcInd_t ind); + void (*fapi_rx_ulsch_ind) (fapiInstanceHdl_t fapiHdl, + pfapiRxUlschInd_t ind); + void (*fapi_rx_cqi_ind) (fapiInstanceHdl_t fapiHdl, + pfapiRxCqiInd_t ind); + void (*fapi_rx_sr_ind) (fapiInstanceHdl_t fapiHdl, + pfapiRxSrInd_t ind); + void (*fapi_rach_ind) (fapiInstanceHdl_t fapiHdl, + pfapiRachInd_t ind); + void (*fapi_srs_ind) (fapiInstanceHdl_t fapiHdl, + pfapiSrsInd_t ind); +//------------------------------------------------------------------------------ +// Vendor Specific Callbacks +//------------------------------------------------------------------------------ + void (*fapi_rip_measurement) (fapiInstanceHdl_t fapiHdl, + pfapiMeasReport_t pMeasReport); + void (*fapi_start_phy_shutdown) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + void (*fapi_shutdown_resp) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + void (*fapi_start_cnf) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + void (*fapi_ul_iq_samples) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + void (*fapi_dl_iq_samples) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + void (*fapi_ul_copy_results_ind) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); + + void (*fapi_endof_phy2mac_processing) (fapiInstanceHdl_t fapiHdl, + void *pMsgInd); +} fapiCb_t, *pfapiCb_t; + +//------------------------------------------------------------------------------ + +fapiStatus_t fapi_init(pfapiInitConfig_t pinitConfig); +fapiStatus_t fapi_destroy(void); +fapiInstanceHdl_t fapi_create(pfapiCb_t callbacks, + pfapiCreateConfig_t pCreateConfig); +fapiStatus_t fapi_delete(fapiInstanceHdl_t fapiHdl); + +//------------------------------------------------------------------------------ +// Fapi P5 Messages +//------------------------------------------------------------------------------ +fapiStatus_t fapi_param_request(fapiInstanceHdl_t fapiHdl, + pfapiParamReq_t req); +fapiStatus_t fapi_config_request(fapiInstanceHdl_t fapiHdl, + pfapiConfigReq_t req); +fapiStatus_t fapi_start_request(fapiInstanceHdl_t fapiHdl, + pfapiStartReq_t req); +fapiStatus_t fapi_stop_request(fapiInstanceHdl_t fapiHdl, + pfapiStopReq_t req); +//------------------------------------------------------------------------------ +// Fapi P7 Messages +//------------------------------------------------------------------------------ +fapiStatus_t fapi_dl_config_request(fapiInstanceHdl_t fapiHdl, + pfapiDlConfigReq_t req); +fapiStatus_t fapi_ul_config_request(fapiInstanceHdl_t fapiHdl, + pfapiUlConfigReq_t req); +fapiStatus_t fapi_hi_dci0_request(fapiInstanceHdl_t fapiHdl, + pfapiHiDci0Req_t req); +fapiStatus_t fapi_tx_request(fapiInstanceHdl_t fapiHdl, pfapiTxReq_t + req); +#endif +#endif //_FAPI_H_ + diff --git a/src/5gnrmac/fapi_interface.h b/src/5gnrmac/fapi_interface.h new file mode 100644 index 000000000..d68816624 --- /dev/null +++ b/src/5gnrmac/fapi_interface.h @@ -0,0 +1,1196 @@ +/****************************************************************************** +* Copyright 2017 Cisco Systems, Inc. +* Copyright (c) 2019 Intel. +* +* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 +* +* 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. +* +*******************************************************************************/ +// This file has been modified by Intel in order to support 5G FAPI:PHY API Specification +// Document 222.10.01 dated June 2019 +// Changes made by luis.farias@intel.com + +#ifndef _FAPI_INTERFACE_H_ +#define _FAPI_INTERFACE_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef int16_t int16_t; +typedef uint16_t uint16_t; +typedef int32_t int32_t; +typedef uint32_t uint32_t; + +// Update for 5G FAPI +#define FAPI_PARAM_REQUEST 0x00 +#define FAPI_PARAM_RESPONSE 0x01 +#define FAPI_CONFIG_REQUEST 0x02 +#define FAPI_CONFIG_RESPONSE 0x03 +#define FAPI_START_REQUEST 0x04 +#define FAPI_STOP_REQUEST 0x05 +#define FAPI_STOP_INDICATION 0x06 +#define FAPI_ERROR_INDICATION 0x07 +// Reserved 0x08 - 0x7f +#define FAPI_DL_TTI_REQUEST 0x80 +#define FAPI_UL_TTI_REQUEST 0x81 +#define FAPI_SLOT_INDICATION 0x82 +#define FAPI_UL_DCI_REQUEST 0x83 +#define FAPI_TX_DATA_REQUEST 0x84 +#define FAPI_RX_DATA_INDICATION 0x85 +#define FAPI_CRC_INDICATION 0x86 +#define FAPI_UCI_INDICATION 0x87 +#define FAPI_SRS_INDICATION 0x88 +#define FAPI_RACH_INDICATION 0x89 +// Reserved 0x8a -0xff + + + +// Tags per 5G FAPI +// Cell Parameters +#define FAPI_RELEASE_CAPABILITY_TAG 0x0001 +#define FAPI_PHY_STATE_TAG 0x0002 +#define FAPI_SKIP_BLANK_DL_CONFIG_TAG 0x0003 +#define FAPI_SKIP_BLANK_UL_CONFIG_TAG 0x0004 +#define FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG 0x0005 +#define FAPI_CYCLIC_PREFIX_TAG 0x0006 +// PDCCH Parameters +#define FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG 0x0007 +#define FAPI_SUPPORTED_BANDWIDTH_DL_TAG 0x0008 +#define FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG 0x0009 +#define FAPI_SUPPORTED_BANDWIDTH_UL_TAG 0x000A +#define FAPI_CCE_MAPPING_TYPE_TAG 0x000B +#define FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG 0x000c +#define FAPI_PRECODER_GRANULARITY_CORESET_TAG 0x000d +#define FAPI_PDCCH_MU_MIMO_TAG 0x000e +#define FAPI_PDCCH_PRECODER_CYCLING_TAG 0x000f +#define FAPI_MAX_PDCCHS_PER_SLOT_TAG 0x0010 +// PUCCH Parameters +#define FAPI_PUCCH_FORMATS_TAG 0x0011 +#define FAPI_MAX_PUCCHS_PER_SLOT_TAG 0x0012 +// PDSCH Parameters +#define FAPI_PDSCH_MAPPING_TYPE_TAG 0x0013 +#define FAPI_PDSCH_ALLOCATION_TYPES_TAG 0x0014 +#define FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG 0x0015 +#define FAPI_PDSCH_CBG_TAG 0x0016 +#define FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG 0x0017 +#define FAPI_PDSCH_DMRS_MAX_LENGTH_TAG 0x0018 +#define FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG 0x0019 +#define FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG 0x001a +#define FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG 0x001b +#define FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG 0x001c +#define FAPI_MAX_MU_MIMO_USERS_DL_TAG 0x001d +#define FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG 0x001e +#define FAPI_PREMPTIONSUPPORT_TAG 0x001f +#define FAPI_PDSCH_NON_SLOT_SUPPORT_TAG 0x0020 +// PUSCH Parameters +#define FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG 0x0021 +#define FAPI_UCI_ONLY_PUSCH_TAG 0x0022 +#define FAPI_PUSCH_FREQUENCY_HOPPING_TAG 0x0023 +#define FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG 0x0024 +#define FAPI_PUSCH_DMRS_MAX_LEN_TAG 0x0025 +#define FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG 0x0026 +#define FAPI_PUSCH_CBG_TAG 0x0027 +#define FAPI_PUSCH_MAPPING_TYPE_TAG 0x0028 +#define FAPI_PUSCH_ALLOCATION_TYPES_TAG 0x0029 +#define FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG 0x002a +#define FAPI_PUSCH_MAX_PTRS_PORTS_TAG 0x002b +#define FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG 0x002c +#define FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG 0x002d +#define FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG 0x002e +#define FAPI_MAX_MU_MIMO_USERS_UL_TAG 0x002f +#define FAPI_DFTS_OFDM_SUPPORT_TAG 0x0030 +#define FAPI_PUSCH_AGGREGATION_FACTOR_TAG 0x0031 +// PRACH Parameters +#define FAPI_PRACH_LONG_FORMATS_TAG 0x0032 +#define FAPI_PRACH_SHORT_FORMATS_TAG 0x0033 +#define FAPI_PRACH_RESTRICTED_SETS_TAG 0x0034 +#define FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG 0x0035 +// Measurement Parameters +#define FAPI_RSSI_MEASUREMENT_SUPPORT_TAG 0x0036 + +// CONFIG TLV TAGS per 5G FAPI +// Carrier Configuration +#define FAPI_DL_BANDWIDTH_TAG 0x1001 +#define FAPI_DL_FREQUENCY_TAG 0x1002 +#define FAPI_DL_K0_TAG 0x1003 +#define FAPI_DL_GRIDSIZE_TAG 0x1004 +#define FAPI_NUM_TX_ANT_TAG 0x1005 +#define FAPI_UPLINK_BANDWIDTH_TAG 0x1006 +#define FAPI_UPLINK_FREQUENCY_TAG 0x1007 +#define FAPI_UL_K0_TAG 0x1008 +#define FAPI_UL_GRID_SIZE_TAG 0x1009 +#define FAPI_NUM_RX_ANT_TAG 0x100a +#define FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG 0x100b +// Cell Configuration +#define FAPI_PHY_CELL_ID_TAG 0x100c +#define FAPI_FRAME_DUPLEX_TYPE_TAG 0x100d +// SSB Configuration +#define FAPI_SS_PBCH_POWER_TAG 0x100e +#define FAPI_BCH_PAYLOAD_TAG 0x100f +#define FAPI_SCS_COMMON_TAG 0x1010 +// PRACH Configuration +#define FAPI_PRACH_SEQUENCE_LENGTH_TAG 0x1011 +#define FAPI_PRACH_SUBC_SPACING_TAG 0x1012 +#define FAPI_RESTRICTED_SET_CONFIG_TAG 0x1013 +#define FAPI_NUM_PRACH_FD_OCCASIONS_TAG 0x1014 +#define FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG 0x1015 +#define FAPI_NUM_ROOT_SEQUENCES_TAG 0x1016 +#define FAPI_K1_TAG 0x1017 +#define FAPI_PRACH_ZERO_CORR_CONF_TAG 0x1018 +#define FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG 0x1019 +#define FAPI_UNUSED_ROOT_SEQUENCES_TAG 0x101a +#define FAPI_SSB_PER_RACH_TAG 0x101b +#define FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG 0x101c +// SSB Table +#define FAPI_SSB_OFFSET_POINT_A_TAG 0x101d +#define FAPI_BETA_PSS_TAG 0x101e +#define FAPI_SSB_PERIOD_TAG 0x101f +#define FAPI_SSB_SUBCARRIER_OFFSET_TAG 0x1020 +#define FAPI_MIB_TAG 0x1021 +#define FAPI_SSB_MASK_TAG 0x1022 +#define FAPI_BEAM_ID_TAG 0x1023 +#define FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG 0x1024 +#define FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG 0x1025 +// TDD Table +#define FAPI_TDD_PERIOD_TAG 0x1026 +#define FAPI_SLOT_CONFIG_TAG 0x1027 +// Measurement Configuration +#define FAPI_RSSI_MESUREMENT_TAG 0x1028 + +// Error Codes updated per 5G FAPI Table 3-31 +#define FAPI_MSG_OK 0x0 +#define FAPI_MSG_INVALID_STATE 0x1 +#define FAPI_MSG_INVALID_CONFIG 0x2 +#define FAPI_MSG_SFN_OUT_OF_SYNC 0x3 +#define FAPI_MSG_SLOT_ERR 0x4 +#define FAPI_MSG_BCH_MISSING 0x5 +#define FAPI_MSG_INVALID_SFN 0x6 +#define FAPI_MSG_UL_DCI_ERR 0x7 +#define FAPI_MSG_TX_ERR 0x8 + + +// TODO : Work out what the correct maximums should be// Needs Review for 5G +#if 0 +// Number of UL/DL configurations, I, as defined by 36.212 section 5.3.3.1.4 +// todo : work out what the max is +#define FAPI_MAX_UL_DL_CONFIGURATIONS 4 +#define FAPI_MAX_NUM_PHYSICAL_ANTENNAS 4 +#define FAPI_MAX_NUM_SCHEDULED_UES 8 +#define FAPI_MAX_NUM_SUBBANDS 8 +#define FAPI_MAX_ANTENNA_PORT_COUNT 2 +#endif + +// 5G FAPI Definitions +#define NUMEROLOGIES 5 +#define MAX_NUM_UNUSED_ROOT_SEQUENCES 63 // 38.331 page 383 +#define MAX_NUM_PRACH_FD_OCCASIONS 64 // 38.331 page 383 +#define MAX_NUM_OF_SYMBOLS_PER_SLOT 14 +#define MAX_TDD_PERIODICITY 160// 38.212 11.1 for u=4 and P=10 ms +#define MAX_NUMBER_TX_RUS 4 // m=p*q with p number of panels and q number of TxRU/RxRU per panel, depends on + // the RF configuration, currently n=m=4, q=1, p=4 and k=21 (number of beams per pannel). n number of antenna ports +#define MAX_NUMBER_OF_BEAMS 64 // Intel API Page 27 +#define MAX_NUM_ANT_PORTS 8 // Based on current RF +#define MAX_NUM_LAYERS 8 // 38.211 Table 7.3.1.3-1 +#define MAX_NUM_TLVS_CELL_CONFIG 2 // 5G FAPI Table 3-9 (A) +#define MAX_NUM_TLVS_CARRIER_CONFIG 27 // 5G FAPI Table 3-10 (B) +#define MAX_NUM_TLVS_PDCCH_CONFIG 6 // 5G FAPI Table 3-11 (C) +#define MAX_NUM_TLVS_PUCCH_CONFIG 2 // 5G FAPI Table 3-12 (D) +#define MAX_NUM_TLVS_PDSCH_CONFIG 14 // 5G FAPI Table 3-13 (E) +#define MAX_NUM_TLVS_PUSCH_CONFIG 17 // 5G FAPI Table 3-14 (F) +#define MAX_NUM_TLVS_PRACH_CONFIG 4 // 5G FAPI Table 3-15 (G) +#define MAX_NUM_TLVS_MEAS_CONFIG 1 // 5G FAPI Table 3-16 (H) +#define MAX_NUM_TLVS_CONFIG 74 // A+B+C+D+E+F+G+H + Padding +#define MAX_NUMBER_UNSUPPORTED_TLVS 74 +#define MAX_NUMBER_OF_INVALID_IDLE_ONLY_TLVS 74 +#define MAX_NUMBER_OF_INVALID_RUNNING_ONLY_TLVS 74 +#define MAX_NUMBER_OF_MISSING_TLVS 74 +#define MAX_NUM_DIGBFINTERFACES 4 // Based on RF, 5G FAPI says {0,255} +#define MAX_NUM_PRGS_PER_TTI 4 // Based on 38.214 5.1.2.3 +#define DCI_PAYLOAD_BYTE_LEN 32 // Based on Intel API MAX_DCI_BIT_BYTE_LEN +#define MAX_NUMBER_DL_DCI 32 // Based on Intel API MAX_NUM_PDCCH +#define MAX_NUMBER_OF_CODEWORDS_PER_PDU 2 // Based on MAX_DL_CODEWORD +#define MAX_NUMBER_DL_PDUS_PER_TTI 129 // Based on (MAX_NUM_PDSCH*MAX_DL_CODEWORD + MAX_NUM_PDCCH + MAX_NUM_SRS + 1 PBCH/SLOT) +#define MAX_NUMBER_OF_UES_PER_TTI 16 // Per common_ran_parameters.h +#define MAX_NUM_CB_PER_TTI_IN_BYTES 192 // Based on Max Tb size of 1376264 bits + 24 crc over (8848-24) and O/H +#define MAX_NUM_PTRS_PORTS 12 // Per 3GPP 38.212 Table 7.3.1.1.2-21 +#define MAX_NUMBER_OF_GROUPS_PER_TTI 8 // FlexRAN API Table 33 +#define MAX_NUMBER_UL_PDUS_PER_TTI 328 // (MAX_NUM_PUSCH+MAX_NUM_PUCCH+MAX_NUM_SRS+MAX_NUM_PRACH_DET) +#define MAX_NUMBER_DCI_PDUS_PER_TTI 32 // Based on MAX_NUM_PDCCH +#define MAX_NUMBER_OF_TLVS_PER_PDU 32 // Based on FAPI/nFAPI implementation +#define MAX_NUMBER_TX_PDUS_PER_TTI 129 // Same as MAX_NUMBER_DL_PDUS_PER_TTI +#define MAX_PDU_LENGTH 172096 // Based on 38.214 5.1.3.4, the TBS is 1376264 bits and divided by 8 and aligned to 64 bytes +#define MAX_NUMBER_OF_PDUS_PER_TTI 129 // Same as MAX_NUMBER_DL_PDUS_PER_TTI +#define MAX_NUMBER_OF_ULSCH_PDUS_PER_TTI 64 // NUM_PUSCH_CHAN*MAX_NUMBER_OF_CODEWORDS_PER_PDU +#define MAX_NUMBER_OF_CRCS_PER_SLOT 32 // Based on MAX_NUM_UL_CHAN +#define MAX_HARQ_INFO_LEN_BYTES 214 // Based on 5G FAPI Table 3-70 +#define MAX_CSI_PART1_DATA_BYTES 214 // Based on 5G FAPI Table 3-71 +#define MAX_CSI_PART2_DATA_BYTES 214 // Based on 5G FAPI Table 3-72 +#define MAX_NUMBER_OF_HARQS_PER_IND 2 // Based on 5G FAPI Table 3-68 +#define MAX_SR_PAYLOAD_SIZE 1 // Based on 5G FAPI Table 3-69 +#define MAX_HARQ_PAYLOAD_SIZE 214 // Based on 5G FAPI Table 3-70 +#define MAX_NUMBER_UCI_PDUS_PER_SLOT 200 // Based on MAX_NUM_PUCCH +#define MAX_NUMBER_RBS 273 // Based on MAX_NUM_OF_PRB_IN_FULL_BAND +#define MAX_NUMBER_OF_REP_SYMBOLS 4 // Based on 5g FAPI Table 3-73 +#define MAX_NUMBER_SRS_PDUS_PER_SLOT 32 // Based on MAX_NUM_SRS +#define MAX_NUM_PREAMBLES_PER_SLOT 64 // Based on MAX_NUM_PRACH_DET +#define MAX_NUMBER_RACH_PDUS_PER_SLOT 64 // Based on MAX_NUM_PRACH_DET + +// Updated per 5G FAPI +typedef struct { + uint8_t numberOfMessagesIncluded; + uint8_t handle; // Can be used for Phy Id or Carrier Id +} fapi_msg_header_t; +// Updated per 5G FAPI +typedef struct { + uint8_t message_type_id; + uint32_t length; // Length of the message body in bytes +} fapi_msg_t; +// Updated per 5G FAPI +typedef struct { + uint16_t tag; + uint16_t length; +} fapi_tl_t; +// Updated per 5G FAPI +typedef struct { + fapi_tl_t tl; + uint8_t value; +} fapi_uint8_tlv_t; +// Updated per 5G FAPI +typedef struct { + fapi_tl_t tl; + uint16_t value; +} fapi_uint16_tlv_t; +// Updated per 5G FAPI +typedef struct { + fapi_tl_t tl; + int16_t value; +} fapi_int16_tlv_t; +// Updated per 5G FAPI +typedef struct { + fapi_tl_t tl; + uint32_t value; +} fapi_uint32_tlv_t; +// Updated per 5G FAPI +typedef struct { + uint16_t tag; // In 5G FAPI for Cell Params + uint8_t length; + uint8_t value; +} fapi_config_tlv_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; // For PARAM.req message length in fapi_msg_t is zero +} fapi_param_req_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint16_tlv_t releaseCapability; + fapi_uint16_tlv_t phyState; + fapi_uint8_tlv_t skipBlankDlConfig; + fapi_uint8_tlv_t skipBlankUlConfig; + fapi_uint16_tlv_t numTlvsToReport; + //fapi_param_tlv_t tlvStatus[MAX_NUMBER_OF_CONFIG_PARMS]; // Need to define this value based on 5G FAPI +} fapi_cell_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t cyclicPrefix; + fapi_uint8_tlv_t supportedSubcarrierSpacingDl; + fapi_uint16_tlv_t supportedBandwidthDl; + fapi_uint8_tlv_t supportedSubcarrierSpecingsUl; + fapi_uint16_tlv_t supportedBandwidthUl; +} fapi_carrier_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t cceMappingType; + fapi_uint8_tlv_t coresetOutsideFirst3OfdmSymsOfSlot; + fapi_uint8_tlv_t precoderGranularityCoreset; + fapi_uint8_tlv_t pdcchMuMimo; + fapi_uint8_tlv_t pdcchPrecoderCycling; + fapi_uint8_tlv_t maxPdcchsPerSlot; +} fapi_pdcch_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t pucchFormats; + fapi_uint8_tlv_t maxPucchsPerSlot; +} fapi_pucch_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t pdschMappingType; + fapi_uint8_tlv_t pdschAllocationTypes; + fapi_uint8_tlv_t pdschVrbToPrbMapping; + fapi_uint8_tlv_t pdschCbg; + fapi_uint8_tlv_t pdschDmrsConfigTypes; + fapi_uint8_tlv_t pdschDmrsMaxLength; + fapi_uint8_tlv_t pdschDmrsAdditionalPos; + fapi_uint8_tlv_t maxPdschsTBsPerSlot; + fapi_uint8_tlv_t maxNumberMimoLayersPdsch; + fapi_uint8_tlv_t supportedMaxModulationOrderDl; + fapi_uint8_tlv_t maxMuMimoUsersDl; + fapi_uint8_tlv_t pdschDataInDmrsSymbols; + fapi_uint8_tlv_t premptionSupport; + fapi_uint8_tlv_t pdschNonSlotSupport; +} fapi_pdsch_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t uciMuxUlschInPusch; + fapi_uint8_tlv_t uciOnlyPusch; + fapi_uint8_tlv_t puschFrequencyHopping; + fapi_uint8_tlv_t puschDmrsConfigTypes; + fapi_uint8_tlv_t puschDmrsMaxLen; + fapi_uint8_tlv_t puschDmrsAditionalPos; + fapi_uint8_tlv_t puschCbg; + fapi_uint8_tlv_t puschMappingType; + fapi_uint8_tlv_t puschAllocationTypes; + fapi_uint8_tlv_t puschVrbToPrbMapping; + fapi_uint8_tlv_t puschMaxPtrsPorts; + fapi_uint8_tlv_t maxPduschsTBsPerSlot; + fapi_uint8_tlv_t maxNumberMimoLayersnonCbPusch; + fapi_uint8_tlv_t supportedModulationOrderUl; + fapi_uint8_tlv_t maxMuMimoUsersUl; + fapi_uint8_tlv_t dftsOfdmSupport; + fapi_uint8_tlv_t puschAggregationFactor; +} fapi_pusch_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t prachLongFormats; + fapi_uint8_tlv_t prachShortFormats; + fapi_uint8_tlv_t prachRestrictedSets; + fapi_uint8_tlv_t maxPrachFdOccasionsInASlot; +} fapi_prach_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t rssiMeasurementSupport; +} fapi_meas_parms_t; + +// Updated per 5G FAPI +typedef struct { + fapi_cell_parms_t cell_parms; + fapi_carrier_parms_t carr_parms; + fapi_pdcch_parms_t pdcch_parms; + fapi_pucch_parms_t pucch_parms; + fapi_pdsch_parms_t pdsch_parms; + fapi_pusch_parms_t pusch_parms; + fapi_prach_parms_t prach_parms; + fapi_meas_parms_t meas_parms; +} fapi_params_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint8_t error_code; + uint8_t number_of_tlvs; + fapi_uint16_tlv_t tlvs[MAX_NUM_TLVS_CONFIG]; +} fapi_param_resp_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint16_tlv_t dlBandwidth; + fapi_uint32_tlv_t dlFrequency; + fapi_uint16_tlv_t dlk0[NUMEROLOGIES]; + fapi_uint16_tlv_t dlGridSize[NUMEROLOGIES]; + fapi_uint16_tlv_t numTxAnt; + fapi_uint16_tlv_t uplinkBandwidth; + fapi_uint32_tlv_t uplinkFrequency; + fapi_uint16_tlv_t ulk0[NUMEROLOGIES]; + fapi_uint16_tlv_t ulGridSize[NUMEROLOGIES]; + fapi_uint16_tlv_t numRxAnt; + fapi_uint8_tlv_t frequencyShift7p5KHz; +} fapi_carrier_config_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t phyCellId; + fapi_uint8_tlv_t frameDuplexType; +} fapi_cell_config_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint32_tlv_t ssPbchPower; + fapi_uint8_tlv_t bchPayload; + fapi_uint8_tlv_t scsCommon; +} fapi_ssb_config_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint16_tlv_t prachRootSequenceIndex; + fapi_uint8_tlv_t numRootSequences; + fapi_uint8_tlv_t unusedRootSequences[MAX_NUM_UNUSED_ROOT_SEQUENCES]; +} fapi_prachFdOccasion_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t prachSequenceLength; + fapi_uint8_tlv_t prachSubCSpacing; + fapi_uint8_tlv_t restrictedSetConfig; + fapi_prachFdOccasion_t prachFdOccasion[MAX_NUM_PRACH_FD_OCCASIONS]; + fapi_uint8_tlv_t ssbPerRach; + fapi_uint8_tlv_t prachMultipleCarriersInABand; +} fapi_prach_configuration_t; + +//Updated per 5G FAPI +typedef struct { + fapi_uint16_tlv_t ssbOffsetPointA; + fapi_uint8_tlv_t betaPss; + fapi_uint8_tlv_t ssbPeriod; + fapi_uint8_tlv_t ssbSubCarrierOffset; + fapi_uint32_tlv_t mib; + fapi_uint32_tlv_t ssbMask[2]; + fapi_uint8_tlv_t beamId[64]; + fapi_uint8_tlv_t ssPbchMultipleCarriersInABand; + fapi_uint8_tlv_t multipleCellsSsPbchInACarrier; +} fapi_ssb_table_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t slotConfig[MAX_NUM_OF_SYMBOLS_PER_SLOT]; +} fapi_slotconfig_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t tddPeriod; + fapi_slotconfig_t slotConfig[MAX_TDD_PERIODICITY]; +} fapi_tdd_table_t; + +// Updated per 5G FAPI +typedef struct { + fapi_uint8_tlv_t rssiMeasurement; +} fapi_meas_config_t; + +// Updated per 5G FAPI +typedef struct { + int16_t digBeamWeightRe; + int16_t digBeamWeightIm; +} fapi_dig_beam_weight_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t beamIdx; + fapi_dig_beam_weight_t digBeamWeight[MAX_NUMBER_TX_RUS]; +} fapi_dig_beam_config_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t numDigBeams; + uint16_t numTxRus; + fapi_dig_beam_config_t digBeam[MAX_NUMBER_OF_BEAMS]; +} fapi_beamforming_table_t; + +// Updated per 5G FAPI +typedef struct { + int16_t preCoderWeightRe; + int16_t preCoderWeightIm; +} fapi_precoderWeight_t; + +// Updated per 5G FAPI +typedef struct { + fapi_precoderWeight_t precoder_weight[MAX_NUM_ANT_PORTS]; +} fapi_precoder_weight_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pmIdx; + uint16_t numLayers; + uint16_t numAntPorts; + fapi_precoder_weight_t precoderWeight[MAX_NUM_LAYERS]; +} fapi_precoding_table_t; + +// Updated per 5G FAPI +typedef struct { + fapi_carrier_config_t carrierConfig; + fapi_cell_config_t cellConfig; + fapi_ssb_config_t ssbConfig; + //fapi_prach_config_t prachConfig; //To be defined + fapi_ssb_table_t ssbTable; + fapi_tdd_table_t tddTable; + fapi_meas_config_t measConfig; + fapi_beamforming_table_t beamformingTable; + fapi_precoding_table_t precodingTable; + } fapi_config_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint8_t number_of_tlvs; + fapi_uint16_tlv_t tlvs[MAX_NUM_TLVS_CONFIG]; +} fapi_config_req_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint8_t error_code; + uint8_t number_of_invalid_tlvs; + uint8_t number_of_inv_tlvs_idle_only; + uint8_t number_of_missing_tlvs; + fapi_uint16_tlv_t tlvs[4*MAX_NUM_TLVS_CONFIG]; + // fapi_uint16_tlv_t unsupported_or_invalid_tlvs[MAX_NUMBER_UNSUPPORTED_TLVS]; + // fapi_uint16_tlv_t invalid_idle_only_tlvs[MAX_NUMBER_OF_INVALID_IDLE_ONLY_TLVS]; + // fapi_uint16_tlv_t invalid_running_only_tlvs[MAX_NUMBER_OF_INVALID_RUNNING_ONLY_TLVS]; + // fapi_uint16_tlv_t missing_tlvs[MAX_NUMBER_OF_MISSING_TLVS]; +} fapi_config_resp_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; // Message Length is zero for START.request +} fapi_start_req_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; // Message Length is zero for STOP.request +} fapi_stop_req_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; // Message Length is zero for STOP.indication +} fapi_stop_ind_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t message_id; + uint8_t error_code; +} fapi_error_ind_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; +} fapi_slot_ind_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t beamidx; +} fapi_bmi_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pmIdx; + fapi_bmi_t beamIdx[MAX_NUM_DIGBFINTERFACES]; +} fapi_pmi_bfi_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t numPrgs; + uint16_t prgSize; + uint8_t digBfInterfaces; + fapi_pmi_bfi_t pmi_bfi[MAX_NUM_PRGS_PER_TTI]; +} fapi_precoding_bmform_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t rnti; + uint16_t scramblingId; + uint16_t scramblingRnti; + uint8_t cceIndex; + uint8_t aggregationLevel; + fapi_precoding_bmform_t pc_and_bform; + uint8_t beta_pdcch_1_0; + uint8_t powerControlOfssetSS; + uint16_t payloadSizeBits; + uint8_t payload[DCI_PAYLOAD_BYTE_LEN]; +} fapi_dl_dci_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t bwpSize; + uint16_t bwpPart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint8_t startSymbolIndex; + uint8_t durationSymbols; + uint8_t freqDomainResource[6]; + uint8_t cceRegMappingType; + uint8_t regBundleSize; + uint8_t interleaverSize; + uint8_t coreSetSize; + uint16_t shiftIndex; + uint8_t precoderGranularity; + uint16_t numDlDci; + fapi_dl_dci_t* dlDci; + } fapi_dl_pddch_pdu_t; + + // Updated per 5G FAPI + typedef struct { + uint16_t targetCodeRate; + uint8_t qamModOrder; + uint8_t mcsIndex; + uint8_t mcsTable; + uint8_t rvIndex; + uint32_t tbSize; + } fapi_codeword_pdu_t; + + // Updated per 5G FAPI + typedef struct { + uint16_t pduBitMap; + uint16_t rnti; + uint16_t pduIndex; + uint16_t bwpSize; + uint16_t bwpStart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint8_t nrOfCodeWords; + fapi_codeword_pdu_t cwInfo[MAX_NUMBER_OF_CODEWORDS_PER_PDU]; + uint16_t dataScramblingId; + uint8_t nrOfLayers; + uint8_t transmissionScheme; + uint8_t refPoint; + uint16_t dlDmrsSymbPos; + uint8_t dmrsConfigType; + uint16_t dlDmrsScramblingId; + uint8_t scid; + uint8_t numDmrsCdmGrpsNoData; + uint16_t dmrsPorts; + uint8_t resourceAlloc; + uint8_t rbBitmap; + uint16_t rbStart; + uint16_t rbSize; + uint8_t vrbToPrbMapping; + uint8_t startSymbIndex; + uint8_t nrOfSymbols; + uint8_t ptrsPortIndex; + uint8_t ptrsTimeDensity; + uint8_t ptrsFreqDensity; + uint8_t ptrsReOffset; + uint8_t nEpreRatioOfPdschToPtrs; + fapi_precoding_bmform_t preCodingAndBeamforming; + uint8_t powerControlOffset; + uint8_t powerControlOffsetSS; + uint8_t isLastCbPresent; + uint8_t isInlineTbCrc; + uint32_t dlTbCrc; + } fapi_dl_pdsch_pdu_t; + + // Updated per 5G FAPI + typedef struct { + uint16_t bwpSize; + uint16_t bwpStart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint16_t startRb; + uint16_t nrOfRbs; + uint8_t csiType; + uint8_t row; + uint16_t freqDomain; + uint8_t symbL0; + uint8_t symbL1; + uint8_t cdmType; + uint8_t freqDensity; + uint16_t scramId; + uint8_t powerControlOffset; + uint8_t powerControlOffsetSs; + fapi_precoding_bmform_t preCodingAndBeamforming; + } fapi_dl_csi_rs_pdu_t; + +// Updated per 5G FAPI + typedef struct { + uint8_t dmrsTypeAPosition; + uint8_t pdcchConfigSib1; + uint8_t cellBarred; + uint8_t intraFreqReselction; + } fapi_phy_mib_pdu_t; + +// Updated per 5G FAPI + typedef struct { + union + { + uint32_t bchPayload; + fapi_phy_mib_pdu_t phyMibPdu; + }; + } fapi_bch_payload_t; + + // Updated per 5G FAPI + typedef struct { + + uint16_t physCellId; + uint8_t betaPss; + uint8_t ssbBlockIndex; + uint16_t ssbSubCarrierOffset; + uint8_t ssbOffsetPointA; + uint8_t bchPayloadFlag; + fapi_bch_payload_t bchPayload; + fapi_precoding_bmform_t preCodingAndBeamforming; + } fapi_dl_ssb_pdu_t; + +// Updated per 5G FAPI + typedef struct { + uint16_t pduType; + uint16_t pduSize; + union + { + fapi_dl_pddch_pdu_t pdcch_pdu; + fapi_dl_pdsch_pdu_t pdsch_pdu; + fapi_dl_csi_rs_pdu_t csi_rs_pdu; + fapi_dl_ssb_pdu_t ssb_pdu; + }; +} fapi_dl_tti_req_pdu_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t nPdus; + uint8_t nGroup; + fapi_dl_tti_req_pdu_t* pdus; +} fapi_dl_tti_req_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t physCellId; + uint8_t numPrachOcas; + uint8_t prachFormat; + uint8_t numRa; + uint8_t prachStartSymbol; + uint8_t numCs; + fapi_precoding_bmform_t beamforming; +} fapi_ul_prach_pdu_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t nUe; + uint8_t pduIdx[MAX_NUMBER_OF_UES_PER_TTI]; +} fapi_ue_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t rvIndex; + uint8_t harqProcessId; + uint8_t newDataIndicator; + uint32_t tbSize; + uint16_t numCb; + uint8_t cbPresentAndPosition[MAX_NUM_CB_PER_TTI_IN_BYTES]; +}fapi_pusch_data_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t harqAckBitLength; + uint16_t csiPart1BitLength; + uint16_t csiPart2BitLength; + uint8_t alphaScaling; + uint8_t betaOffsetHarqAck; + uint8_t betaOffsetCsi1; + uint8_t betaOffsetCsi2; +} fapi_pusch_uci_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t ptrsPortIndex; + uint8_t ptrsDmrsPort; + uint8_t ptrsReOffset; +} fapi_ptrs_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t numPtrsPorts; + fapi_ptrs_info_t ptrsInfo[MAX_NUM_PTRS_PORTS]; + uint8_t ptrsTimeDensity; + uint8_t ptrsFreqDensity; + uint8_t ulPtrsPower; +} fapi_pusch_ptrs_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t lowPaprGroupNumber; + uint16_t lowPaprSequenceNumber; + uint8_t ulPtrsSampleDensity; + uint8_t ulPtrsTimeDensityTransformPrecoding; +} fapi_dfts_ofdm_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pduBitMap; + uint16_t rnti; + uint32_t handle; + uint16_t bwpSize; + uint16_t bwpStart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint16_t targetCodeRate; + uint8_t qamModOrder; + uint8_t mcsIndex; + uint8_t mcsTable; + uint8_t transformPrecoding; + uint16_t dataScramblingId; + uint8_t nrOfLayers; + uint16_t ulDmrsSymbPos; + uint8_t dmrsConfigType; + uint16_t ulDmrsScramblingId; + uint8_t scid; + uint8_t numDmrsCdmGrpsNoData; + uint16_t dmrsPorts; + uint8_t resourceAlloc; + uint8_t rbBitmap[36]; + uint16_t rbStart; + uint16_t rbSize; + uint8_t vrbToPrbMapping; + uint8_t frequencyHopping; + uint16_t txDirectCurrentLocation; + uint8_t uplinkFrequencyShift7p5khz; + uint8_t startSymbIndex; + uint8_t nrOfSymbols; + fapi_pusch_data_t puschData; + fapi_pusch_uci_t puschUci; + fapi_pusch_ptrs_t puschPtrs; + fapi_dfts_ofdm_t dftsOfdm; + fapi_precoding_bmform_t beamforming; +} fapi_ul_pusch_pdu_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t rnti; + uint32_t handle; + uint16_t bwpSize; + uint16_t bwpStart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint8_t formatType; + uint8_t multiSlotTxIndicator; + uint8_t pi2Bpsk; + uint16_t prbStart; + uint16_t prbSize; + uint8_t startSymbolIndex; + uint8_t nrOfSymbols; + uint8_t freqHopFlag; + uint16_t secondHopPrb; + uint8_t groupHopFlag; + uint8_t sequenceHopFlag; + uint16_t hoppingId; + uint16_t initialCyclicShift; + uint16_t dataScramblingId; + uint8_t timeDomainOccIdx; + uint8_t preDftOccIdx; + uint8_t preDftOccLen; + uint8_t addDmrsFlag; + uint16_t dmrsScramblingId; + uint8_t dmrsCyclicShift; + uint8_t srFlag; + uint8_t bitLenHarq; + uint16_t bitLenCsiPart1; + uint16_t bitLenCsiPart2; + fapi_precoding_bmform_t beamforming; +} fapi_ul_pucch_pdu_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t rnti; + uint32_t handle; + uint16_t bwpsize; + uint16_t bwpstart; + uint8_t subCarrierSpacing; + uint8_t cyclicPrefix; + uint8_t numAntPorts; + uint8_t numSymbols; + uint8_t numRepetitions; + uint8_t timeStartPosition; + uint8_t configIndex; + uint16_t sequenceId; + uint8_t bandwidthIndex; + uint8_t combSize; + uint8_t combOffset; + uint8_t cyclicShift; + uint8_t frequencyPosition; + uint8_t frequencyShift; + uint8_t frequencyHopping; + uint8_t groupOrSequenceHopping; + uint8_t resourceType; + uint16_t tSrs; + uint16_t tOffset; + fapi_precoding_bmform_t beamforming; +} fapi_ul_srs_pdu_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pduType; + uint16_t pduSize; + union + { + fapi_ul_prach_pdu_t prach_pdu; + fapi_ul_pusch_pdu_t pusch_pdu; + fapi_ul_pucch_pdu_t pucch_pdu; + fapi_ul_srs_pdu_t srs_pdu; + //fapi_ul_rx_bmform_pdu_t rx_beamforming_pdu; //To be defined + }; + fapi_ue_info_t ueGrpInfo[MAX_NUMBER_OF_GROUPS_PER_TTI]; +} fapi_ul_tti_req_pdu_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t nPdus; + uint8_t rachPresent; + uint8_t nUlsch; + uint8_t nUlcch; + uint8_t nGroup; + fapi_ul_tti_req_pdu_t* pdus; +} fapi_ul_tti_req_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pduType; + uint16_t pduSize; + //fapi_dl_pdcch_pdu_t pdcchPduConfig; //To be defined + } fapi_dci_pdu_t; + + // Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t numPdus; + fapi_dci_pdu_t* pdus; +} fapi_ul_dci_req_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pduLength; + uint16_t pduIndex; + uint32_t numTlvs; + fapi_uint32_tlv_t tlvs[MAX_NUMBER_OF_TLVS_PER_PDU]; +} fapi_tx_pdu_desc_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint16_t numPdus; + fapi_tx_pdu_desc_t* pduDesc; +} fapi_tx_data_req_t; + +// Updated per 5G FAPI +typedef struct { + uint32_t handle; + uint16_t rnti; + uint8_t harqId; + uint16_t pduLength; + uint8_t ul_cqi; + uint16_t timingAdvance; + uint16_t rssi; + void* pduData; +} fapi_pdu_ind_info_t; + + // Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint16_t numPdus; + fapi_pdu_ind_info_t pdus[MAX_NUMBER_OF_ULSCH_PDUS_PER_TTI]; +} fapi_rx_data_indication_t; + +// Updated per 5G FAPI +typedef struct { + uint32_t handle; + uint16_t rnti; + uint8_t harqId; + uint8_t tbCrcStatus; + uint16_t numCb; + uint8_t cbCrcStatus[MAX_NUM_CB_PER_TTI_IN_BYTES]; + uint8_t ul_cqi; + uint16_t timingAdvance; + uint16_t rssi; +} fapi_crc_ind_info_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint16_t numCrcs; + fapi_crc_ind_info_t crc[MAX_NUMBER_OF_CRCS_PER_SLOT]; +} fapi_crc_ind_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t harqCrc; + uint16_t harqBitLen; + uint8_t harqPayload[MAX_HARQ_INFO_LEN_BYTES]; +} fapi_harq_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t csiPart1Crc; + uint16_t csiPart1BitLen; + uint8_t csiPart1Payload[MAX_CSI_PART1_DATA_BYTES]; +} fapi_csi_p1_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t csiPart2Crc; + uint16_t csiPart2BitLen; + uint8_t csiPart2Payload[MAX_CSI_PART2_DATA_BYTES]; +} fapi_csi_p2_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t pduBitmap; + uint32_t handle; + uint16_t rnti; + uint8_t ul_cqi; + uint16_t timingAdvance; + uint16_t rssi; +// fapi_harq_info_t harqInfo; // This is included if indicated by the pduBitmap +// fapi_csi_p1_info_t csiPart1info; // This is included if indicated by the pduBitmap +// fapi_csi_p2_info_t csiPart2info; // This is included if indicated by the pduBitmap +} fapi_uci_o_pusch_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t srIndication; + uint8_t srConfidenceLevel; +} fapi_sr_f0f1_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t numHarq; + uint8_t harqConfidenceLevel; + uint8_t harqValue[MAX_NUMBER_OF_HARQS_PER_IND]; +} fapi_harq_f0f1_info_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t srBitlen; + uint8_t srPayload[MAX_SR_PAYLOAD_SIZE]; +} fapi_sr_f2f3f4_info_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t harqCrc; + uint16_t harqBitLen; + uint8_t harqPayload[MAX_HARQ_PAYLOAD_SIZE]; +} fapi_harq_f2f3f4_info_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t pduBitmap; + uint32_t handle; + uint16_t rnti; + uint8_t pucchFormat; + uint8_t ul_cqi; + uint16_t timingAdvance; + uint16_t rssi; + // fapi_sr_f2f3f4_info_t srInfo; // This is included if indicated by the pduBitmap + // fapi_harq_f2f3f4_info_t harqInfo; // This is included if indicated by the pduBitmap + // fapi_csi_p1_info_t csiPart1Info; // This is included if indicated by the pduBitmap + // fapi_csi_p2_info_t csiPart2Info; // This is included if indicated by the pduBitmap +} fapi_uci_o_pucch_f2f3f4_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t pduBitmap; + uint32_t handle; + uint16_t rnti; + uint8_t pucchFormat; + uint8_t ul_cqi; + uint16_t timingAdvance; + uint16_t rssi; + // fapi_sr_f0f1_info_t srInfo; // This is included if indicated by the pduBitmap + // fapi_harq_f0f1_info_t harqInfo; // This is included if indicated by the pduBitmap +} fapi_uci_o_pucch_f0f1_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t pduType; + uint16_t pduSize; + union + { + fapi_uci_o_pusch_t uciPusch; + fapi_uci_o_pucch_f0f1_t uciPucchF0F1; + fapi_uci_o_pucch_f2f3f4_t uciPucchF2F3F4; + }; +} fapi_uci_pdu_info_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint16_t numUcis; + fapi_uci_pdu_info_t uciPdu[MAX_NUMBER_UCI_PDUS_PER_SLOT]; +} fapi_uci_indication_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t numRbs; + uint8_t rbSNR[MAX_NUMBER_RBS]; +} fapi_symb_snr_t; + +// Updated per 5G FAPI +typedef struct { + uint32_t handle; + uint16_t rnti; + uint16_t timingAdvance; + uint8_t numSymbols; + uint8_t wideBandSnr; + uint8_t numReportedSymbols; + fapi_symb_snr_t symbSnr[MAX_NUMBER_OF_REP_SYMBOLS]; +} fapi_srs_pdu_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t numPdus; + fapi_srs_pdu_t srsPdus[MAX_NUMBER_SRS_PDUS_PER_SLOT]; +} fapi_srs_indication_t; + +// Updated per 5G FAPI +typedef struct { + uint8_t preambleIndex; + uint16_t timingAdvance; + uint32_t premblePwr; +} fapi_preamble_info_t; + +// Updated per 5G FAPI +typedef struct { + uint16_t physCellId; + uint8_t symbolIndex; + uint8_t slotIndex; + uint8_t freqIndex; + uint8_t avgRssi; + uint8_t avgSnr; + uint8_t numPreamble; + fapi_preamble_info_t preambleInfo[MAX_NUM_PREAMBLES_PER_SLOT]; +} fapi_rach_pdu_t; + +// Updated per 5G FAPI +typedef struct { + fapi_msg_t header; + uint16_t sfn; + uint16_t slot; + uint8_t numPdus; + fapi_rach_pdu_t rachPdu[MAX_NUMBER_RACH_PDUS_PER_SLOT]; +} fapi_rach_indication_t; + + +//------------------------------------------------------------------------------ + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/5gnrmac/lwr_mac.h b/src/5gnrmac/lwr_mac.h new file mode 100644 index 000000000..2ceb98775 --- /dev/null +++ b/src/5gnrmac/lwr_mac.h @@ -0,0 +1,275 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* Contains definitions for MAC CL modules */ +#ifndef __LWR_MAC_H__ +#define __LWR_MAC_H__ + +#define MAX_NUM_CELL_SUPP 1 + +#include "envdep.h" +#include "gen.h" +#include "ssi.h" +#include "cm_hash.h" + +#include "gen.x" +#include "ssi.x" +#include "cm_hash.x" +#include "cm_lib.x" +#include "lcl.h" + +typedef enum +{ + PHY_STATE_IDLE, + PHY_STATE_CONFIGURED, + PHY_STATE_RUNNING, + MAX_STATE +}PhyState; + +/* Events in Lower Mac */ +typedef enum{ + PARAM_REQ, + CONFIG_REQ = 2, + START_REQ = 4, + STOP_REQ, + MAX_EVENT +}EventState; + +typedef struct clCb +{ + Region region; + Pool pool; + Bool clCfgDone; /* CL configuration done */ + CmHashListCp cellCbLst; /* List of Cells configured */ + U8 numOfCells; /* Number of Cells configured */ + PhyState phyState; /* State of PHY */ + EventState event; /* State of Event */ +}ClCb; + +typedef struct cellCb +{ + U16 cellId; + ClCellCfg cellCfg; + PhyState phyState; +}ClCellCb; + +typedef enum +{ + RELEASE_15 +}ReleaseCapab; + +typedef enum +{ + NOT_SUPPORTED, + SUPPORTED +}ParamSupport; + +typedef enum +{ + NORMAL_CYCLIC_PREFIX_MASK, + EXTENDED_CYCLIC_PREFIX_MASK +}CyclicPrefix; + +typedef enum +{ + SPACING_15_KHZ, + SPACING_30_KHZ, + SPACING_60_KHZ, + SPACING_120_KHZ +}SubCarrierSpacing; + +typedef enum +{ + BW_5MHZ, + BW_10MHZ, + BW_15MHZ, + BW_20MHZ, + BW_40MHZ, + BW_50MHZ, + BW_60MHZ, + BW_70MHZ, + BW_80MHZ, + BW_90MHZ, + BW_100MHZ, + BW_200MHZ, + BW_400MHZ +}SupportedBandwidth; + +typedef enum +{ + CCE_MAPPING_INTERLEAVED_MASK, + CCE_MAPPING_NONINTERLVD_MASK +}CCEMappingType; + +typedef enum +{ + FORMAT_0, + FORMAT_1, + FORMAT_2, + FORMAT_3, + FORMAT_4 +}Formats; + +typedef enum +{ + MAPPING_TYPE_A, + MAPPING_TYPE_B, +}MappingType; + +typedef enum +{ + ALLOCATION_TYPE_0, + ALLOCATION_TYPE_1, +}AllocationType; + +typedef enum +{ + VRB_TO_PRB_MAP_NON_INTLV, + VRB_TO_PRB_MAP_INTLVD +}VrbToPrbMap; + +typedef enum +{ + DMRS_CONFIG_TYPE_1, + DMRS_CONFIG_TYPE_2 +}DmrsConfigType; + +typedef enum +{ + DMRS_MAX_LENGTH_1, + DMRS_MAX_LENGTH_2 +}DmrMaxLen; + +typedef enum +{ + DMRS_ADDITIONAL_POS_0, + DMRS_ADDITIONAL_POS_1, + DMRS_ADDITIONAL_POS_2, + DMRS_ADDITIONAL_POS_3 +}DmrsPos; + +typedef enum +{ + MOD_QPSK, + MOD_16QAM, + MOD_64QAM, + MOD_256QAM +}ModulationOrder; + +typedef enum +{ + AGG_FACTOR_1, + AGG_FACTOR_2, + AGG_FACTOR_4, + AGG_FACTOR_8 +}AggregationFactor; + +typedef enum +{ + SF_FORMAT_A1, + SF_FORMAT_A2, + SF_FORMAT_A3, + SF_FORMAT_B1, + SF_FORMAT_B2, + SF_FORMAT_B3, + SF_FORMAT_B4, + SF_FORMAT_C0, + SF_FORMAT_C2 +}ShortFormat; + +typedef enum +{ + PRACH_FD_OCC_IN_A_SLOT_1 = 1, + PRACH_FD_OCC_IN_A_SLOT_2 = 2, + PRACH_FD_OCC_IN_A_SLOT_4 = 4, + PRACH_FD_OCC_IN_A_SLOT_8 = 8 +}FdOccPerSlot; + +typedef enum +{ + RSSI_REPORT_DBM, + RSSI_REPORT_DBFS +}RssiMeasurement; + +typedef struct clCellParam +{ + ReleaseCapab releaseCapability; /* Release Capability */ + PhyState ParamPhystate; + ParamSupport skipBlankDlConfig; + ParamSupport skipBlankUlConfig; + ParamSupport numTlvsToReport; + CyclicPrefix cyclicPrefix; + SubCarrierSpacing supportedSubcarrierSpacingDl; + SupportedBandwidth supportedBandwidthDl; + SubCarrierSpacing supportedSubcarrierSpacingsUl; + SupportedBandwidth supportedBandwidthUl; + CCEMappingType cceMappingType; + ParamSupport coresetOutsideFirst3OfdmSymsOfSlot; + ParamSupport precoderGranularityCoreset; + ParamSupport pdcchMuMimo; + ParamSupport pdcchPrecoderCycling; + U8 maxPdcchsPerSlot; + Formats pucchFormats; + U8 maxPucchsPerSlot; + MappingType pdschMappingType; + AllocationType pdschAllocationTypes; + VrbToPrbMap pdschVrbToPrbMapping; + ParamSupport pdschCbg; + DmrsConfigType pdschDmrsConfigTypes; + DmrMaxLen pdschDmrsMaxLength; + DmrsPos pdschDmrsAdditionalPos; + U8 maxPdschsTBsPerSlot; + U8 maxNumberMimoLayersPdsch; + ModulationOrder supportedMaxModulationOrderDl; + U8 maxMuMimoUsersDl; + ParamSupport pdschDataInDmrsSymbols; + ParamSupport premptionSupport; + ParamSupport pdschNonSlotSupport; + ParamSupport uciMuxUlschInPusch; + ParamSupport uciOnlyPusch; + ParamSupport puschFrequencyHopping; + DmrsConfigType puschDmrsConfigTypes; + DmrMaxLen puschDmrsMaxLength; + DmrsPos puschDmrsAdditionalPos; + ParamSupport puschCbg; + MappingType puschMappingType; + AllocationType puschAllocationTypes; + VrbToPrbMap puschVrbToPrbMapping; + U8 puschMaxPtrsPorts; + U8 maxPduschsTBsPerSlot; + U8 maxNumberMimoLayersNonCbPusch; + ModulationOrder supportedModulationOrderUl; + U8 maxMuMimoUsersUl; + ParamSupport dftsOfdmSupport; + AggregationFactor puschAggregationFactor; + Formats prachLongFormats; + ShortFormat prachShortFormats; + ParamSupport prachRestrictedSets; + FdOccPerSlot maxPrachFdOccasionsInASlot; + RssiMeasurement rssiMeasurementSupport; +}ClCellParam; + + +EXTERN ClCb clGlobalCp; +EXTERN ClCellCb * rgClUtlGetCellCb ARGS((U16 cellId)); + +#endif + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c new file mode 100644 index 000000000..b1676f891 --- /dev/null +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -0,0 +1,1887 @@ + /******************************************************************************* + ################################################################################ + # Copyright (c) [2017-2019] [Radisys] # + # # + # Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # + # # + # 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. # + ################################################################################ + *******************************************************************************/ +#include +#include "lwr_mac_fsm.h" + +EXTERN void sendToPhy ARGS((U16 msgType, U32 msgLen, void *msg)); + + /******************************************************************* + * + * @brief Handles Invalid Request Event + * + * @details + * + * Function : lwr_mac_handleInvalidEvt + * + * Functionality: + * - Displays the PHY state when the invalid event occurs + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 lwr_mac_handleInvalidEvt(void *msg) +{ + printf("\n Error Indication Event[%d] received in state [%d]", clGlobalCp.event, clGlobalCp.phyState); + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Fills FAPI message header + * + * @details + * + * Function : fillMsgHeader + * + * Functionality: + * -Fills FAPI message header + * + * @params[in] Pointer to header + * Number of messages + * Messae Type + * Length of message + * @return void + * + * ****************************************************************/ +PUBLIC void fillMsgHeader(fapi_msg_t *hdr, U16 msgType, U16 msgLen) +{ + hdr->message_type_id = msgType; + hdr->length = msgLen; +} + +/******************************************************************* + * + * @brief Fills FAPI Config Request message header + * + * @details + * + * Function : fillTlvs + * + * Functionality: + * -Fills FAPI Config Request message header + * + * @params[in] Pointer to TLV + * Tag + * Length + * Value + * MsgLen + * @return void + * + * ****************************************************************/ +PUBLIC void fillTlvs(fapi_uint16_tlv_t *tlv, U16 tag, U16 length, U16 value, U16 *msgLen) +{ + tlv->tl.tag = tag; + tlv->tl.length = length; + tlv->value = value; + *msgLen = *msgLen + sizeof(tag) + sizeof(length) + length; +} + /******************************************************************* + * + * @brief fills the cyclic prefix by comparing the bitmask + * + * @details + * + * Function : fillCyclicPrefix + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's cyclic prefix. + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ********************************************************************/ +PUBLIC void fillCyclicPrefix(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_NORMAL_CYCLIC_PREFIX_MASK) == FAPI_NORMAL_CYCLIC_PREFIX_MASK) + { + (*cellPtr)->cyclicPrefix = NORMAL_CYCLIC_PREFIX_MASK; + } + else if((value & FAPI_EXTENDED_CYCLIC_PREFIX_MASK) == FAPI_EXTENDED_CYCLIC_PREFIX_MASK) + { + (*cellPtr)->cyclicPrefix = EXTENDED_CYCLIC_PREFIX_MASK; + } + else + { + (*cellPtr)->cyclicPrefix = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the subcarrier spacing of Downlink by comparing the bitmask + * + * @details + * + * Function : fillSubcarrierSpaceDl + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's subcarrier spacing in DL + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillSubcarrierSpaceDl(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_15KHZ_MASK) == FAPI_15KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingDl = SPACING_15_KHZ; + } + else if((value & FAPI_30KHZ_MASK) == FAPI_30KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingDl = SPACING_30_KHZ; + } + else if((value & FAPI_60KHZ_MASK) == FAPI_60KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingDl = SPACING_60_KHZ; + } + else if((value & FAPI_120KHZ_MASK) == FAPI_120KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingDl = SPACING_120_KHZ; + } + else + { + (*cellPtr)->supportedSubcarrierSpacingDl = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the downlink bandwidth by comparing the bitmask + * + * @details + * + * Function : fillBandwidthDl + * + * Functionality: + * -checks the value with the bitmask and + * -fills the cellPtr's DL Bandwidth + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillBandwidthDl(U16 value, ClCellParam **cellPtr) +{ + if((value & FAPI_5MHZ_BW_MASK) == FAPI_5MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_5MHZ; + } + else if((value & FAPI_10MHZ_BW_MASK) == FAPI_10MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_10MHZ; + } + else if((value & FAPI_15MHZ_BW_MASK) == FAPI_15MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_15MHZ; + } + else if((value & FAPI_20MHZ_BW_MASK) == FAPI_20MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_20MHZ; + } + else if((value & FAPI_40MHZ_BW_MASK) == FAPI_40MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_40MHZ; + } + else if((value & FAPI_50MHZ_BW_MASK) == FAPI_50MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_50MHZ; + } + else if((value & FAPI_60MHZ_BW_MASK) == FAPI_60MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_60MHZ; + } + else if((value & FAPI_70MHZ_BW_MASK) == FAPI_70MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_70MHZ; + } + else if((value & FAPI_80MHZ_BW_MASK) == FAPI_80MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_80MHZ; + } + else if((value & FAPI_90MHZ_BW_MASK) == FAPI_90MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_90MHZ; + } + else if((value & FAPI_100MHZ_BW_MASK) == FAPI_100MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_100MHZ; + } + else if((value & FAPI_200MHZ_BW_MASK) == FAPI_200MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_200MHZ; + } + else if((value & FAPI_400MHZ_BW_MASK) == FAPI_400MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthDl = BW_400MHZ; + } + else + { + (*cellPtr)->supportedBandwidthDl = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the subcarrier spacing of Uplink by comparing the bitmask + * + * @details + * + * Function : fillSubcarrierSpaceUl + * + * Functionality: + * -checks the value with the bitmask and + * -fills cellPtr's subcarrier spacing in UL + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillSubcarrierSpaceUl(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_15KHZ_MASK) == FAPI_15KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingsUl = SPACING_15_KHZ; + } + else if((value & FAPI_30KHZ_MASK) == FAPI_30KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingsUl = SPACING_30_KHZ; + } + else if((value & FAPI_60KHZ_MASK) == FAPI_60KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingsUl = SPACING_60_KHZ; + } + else if((value & FAPI_120KHZ_MASK) == FAPI_120KHZ_MASK) + { + (*cellPtr)->supportedSubcarrierSpacingsUl = SPACING_120_KHZ; + } + else + { + (*cellPtr)->supportedSubcarrierSpacingsUl = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the uplink bandwidth by comparing the bitmask + * + * @details + * + * Function : fillBandwidthUl + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's UL Bandwidth + * + * + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * + * ****************************************************************/ + +PUBLIC void fillBandwidthUl(U16 value, ClCellParam **cellPtr) +{ + if((value & FAPI_5MHZ_BW_MASK) == FAPI_5MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_5MHZ; + } + else if((value & FAPI_10MHZ_BW_MASK) == FAPI_10MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_10MHZ; + } + else if((value & FAPI_15MHZ_BW_MASK) == FAPI_15MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_15MHZ; + } + else if((value & FAPI_20MHZ_BW_MASK) == FAPI_20MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_20MHZ; + } + else if((value & FAPI_40MHZ_BW_MASK) == FAPI_40MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_40MHZ; + } + else if((value & FAPI_50MHZ_BW_MASK) == FAPI_50MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_50MHZ; + } + else if((value & FAPI_60MHZ_BW_MASK) == FAPI_60MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_60MHZ; + } + else if((value & FAPI_70MHZ_BW_MASK) == FAPI_70MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_70MHZ; + } + else if((value & FAPI_80MHZ_BW_MASK) == FAPI_80MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_80MHZ; + } + else if((value & FAPI_90MHZ_BW_MASK) == FAPI_90MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_90MHZ; + } + else if((value & FAPI_100MHZ_BW_MASK) == FAPI_100MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_100MHZ; + } + else if((value & FAPI_200MHZ_BW_MASK) == FAPI_200MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_200MHZ; + } + else if((value & FAPI_400MHZ_BW_MASK) == FAPI_400MHZ_BW_MASK) + { + (*cellPtr)->supportedBandwidthUl = BW_400MHZ; + } + else + { + (*cellPtr)->supportedBandwidthUl = INVALID_VALUE; + } +} + /******************************************************************* + * + * @brief fills the CCE maping by comparing the bitmask + * + * @details + * + * Function : fillCCEmaping + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's CCE Mapping Type + * + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillCCEmaping(U8 value, ClCellParam **cellPtr) +{ + if ((value & FAPI_CCE_MAPPING_INTERLEAVED_MASK) == FAPI_CCE_MAPPING_INTERLEAVED_MASK) + { + (*cellPtr)->cceMappingType = CCE_MAPPING_INTERLEAVED_MASK; + } + else if((value & FAPI_CCE_MAPPING_INTERLEAVED_MASK) == FAPI_CCE_MAPPING_NONINTERLVD_MASK) + { + (*cellPtr)->cceMappingType = CCE_MAPPING_NONINTERLVD_MASK; + } + else + { + (*cellPtr)->cceMappingType = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the PUCCH format by comparing the bitmask + * + * @details + * + * Function : fillPucchFormat + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's pucch format + * + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillPucchFormat(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_FORMAT_0_MASK) == FAPI_FORMAT_0_MASK) + { + (*cellPtr)->pucchFormats = FORMAT_0; + } + else if((value & FAPI_FORMAT_1_MASK) == FAPI_FORMAT_1_MASK) + { + (*cellPtr)->pucchFormats = FORMAT_1; + } + else if((value & FAPI_FORMAT_2_MASK) == FAPI_FORMAT_2_MASK) + { + (*cellPtr)->pucchFormats = FORMAT_2; + } + else if((value & FAPI_FORMAT_3_MASK) == FAPI_FORMAT_3_MASK) + { + (*cellPtr)->pucchFormats = FORMAT_3; + } + else if((value & FAPI_FORMAT_4_MASK) == FAPI_FORMAT_4_MASK) + { + (*cellPtr)->pucchFormats = FORMAT_4; + } + else + { + (*cellPtr)->pucchFormats = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief fills the PDSCH Mapping Type by comparing the bitmask + * + * @details + * + * Function : fillPdschMappingType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PDSCH MappingType + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillPdschMappingType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PDSCH_MAPPING_TYPE_A_MASK) == FAPI_PDSCH_MAPPING_TYPE_A_MASK) + { + (*cellPtr)->pdschMappingType = MAPPING_TYPE_A; + } + else if((value & FAPI_PDSCH_MAPPING_TYPE_B_MASK) == FAPI_PDSCH_MAPPING_TYPE_B_MASK) + { + (*cellPtr)->pdschMappingType = MAPPING_TYPE_B; + } + else + { + (*cellPtr)->pdschMappingType = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PDSCH Allocation Type by comparing the bitmask + * + * @details + * + * Function : fillPdschAllocationType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PDSCH AllocationType + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + * ****************************************************************/ + +PUBLIC void fillPdschAllocationType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PDSCH_ALLOC_TYPE_0_MASK) == FAPI_PDSCH_ALLOC_TYPE_0_MASK) + { + (*cellPtr)->pdschAllocationTypes = ALLOCATION_TYPE_0; + } + else if((value & FAPI_PDSCH_ALLOC_TYPE_1_MASK) == FAPI_PDSCH_ALLOC_TYPE_1_MASK) + { + (*cellPtr)->pdschAllocationTypes = ALLOCATION_TYPE_1; + } + else + { + (*cellPtr)->pdschAllocationTypes = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PDSCH PRB Mapping Type by comparing the bitmask + * + * @details + * + * Function : fillPrbMappingType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PRB Mapping Type + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ +PUBLIC void fillPrbMappingType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) == FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) + { + (*cellPtr)->pdschVrbToPrbMapping = VRB_TO_PRB_MAP_NON_INTLV; + } + else if((value & FAPI_PDSCH_VRB_TO_PRB_MAP_INTLVD_MASK) == FAPI_PDSCH_VRB_TO_PRB_MAP_INTLVD_MASK) + { + (*cellPtr)->pdschVrbToPrbMapping = VRB_TO_PRB_MAP_INTLVD; + } + else + { + (*cellPtr)->pdschVrbToPrbMapping = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PDSCH DmrsConfig Type by comparing the bitmask + * + * @details + * + * Function : fillPdschDmrsConfigType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's DmrsConfig Type + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPdschDmrsConfigType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PDSCH_DMRS_CONFIG_TYPE_1_MASK) == FAPI_PDSCH_DMRS_CONFIG_TYPE_1_MASK) + { + (*cellPtr)->pdschDmrsConfigTypes = DMRS_CONFIG_TYPE_1; + } + else if((value & FAPI_PDSCH_DMRS_CONFIG_TYPE_2_MASK) == FAPI_PDSCH_DMRS_CONFIG_TYPE_2_MASK) + { + (*cellPtr)->pdschDmrsConfigTypes = DMRS_CONFIG_TYPE_2; + } + else + { + (*cellPtr)->pdschDmrsConfigTypes = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PDSCH DmrsLength by comparing the bitmask + * + * @details + * + * Function : fillPdschDmrsLength + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PdschDmrsLength + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ +PUBLIC void fillPdschDmrsLength(U8 value, ClCellParam **cellPtr) +{ + if(value == FAPI_PDSCH_DMRS_MAX_LENGTH_1) + { + (*cellPtr)->pdschDmrsMaxLength = DMRS_MAX_LENGTH_1; + } + else if(value == FAPI_PDSCH_DMRS_MAX_LENGTH_2) + { + (*cellPtr)->pdschDmrsMaxLength = DMRS_MAX_LENGTH_2; + } + else + { + (*cellPtr)->pdschDmrsMaxLength = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PDSCH Dmrs Additional Pos by comparing the bitmask + * + * @details + * + * Function : fillPdschDmrsAddPos + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's Pdsch DmrsAddPos + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPdschDmrsAddPos(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_DMRS_ADDITIONAL_POS_0_MASK) == FAPI_DMRS_ADDITIONAL_POS_0_MASK) + { + (*cellPtr)->pdschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_0; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_1_MASK) == FAPI_DMRS_ADDITIONAL_POS_1_MASK) + { + (*cellPtr)->pdschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_1; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_2_MASK) == FAPI_DMRS_ADDITIONAL_POS_2_MASK) + { + (*cellPtr)->pdschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_2; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_3_MASK) == FAPI_DMRS_ADDITIONAL_POS_3_MASK) + { + (*cellPtr)->pdschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_3; + } + else + { + (*cellPtr)->pdschDmrsAdditionalPos = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the Modulation Order in DL by comparing the bitmask + * + * @details + * + * Function : fillModulationOrderDl + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's ModulationOrder in DL. + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ +PUBLIC void fillModulationOrderDl(U8 value, ClCellParam **cellPtr) +{ + if(value == 0 ) + { + (*cellPtr)->supportedMaxModulationOrderDl = MOD_QPSK; + } + else if(value == 1) + { + (*cellPtr)->supportedMaxModulationOrderDl = MOD_16QAM; + } + else if(value == 2) + { + (*cellPtr)->supportedMaxModulationOrderDl = MOD_64QAM; + } + else if(value == 3) + { + (*cellPtr)->supportedMaxModulationOrderDl = MOD_256QAM; + } + else + { + (*cellPtr)->supportedMaxModulationOrderDl = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH DmrsConfig Type by comparing the bitmask + * + * @details + * + * Function : fillPuschDmrsConfigType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH DmrsConfigType + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschDmrsConfig(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PUSCH_DMRS_CONFIG_TYPE_1_MASK) == FAPI_PUSCH_DMRS_CONFIG_TYPE_1_MASK) + { + (*cellPtr)->puschDmrsConfigTypes = DMRS_CONFIG_TYPE_1; + } + else if((value & FAPI_PUSCH_DMRS_CONFIG_TYPE_2_MASK) == FAPI_PUSCH_DMRS_CONFIG_TYPE_2_MASK) + { + (*cellPtr)->puschDmrsConfigTypes = DMRS_CONFIG_TYPE_2; + } + else + { + (*cellPtr)->puschDmrsConfigTypes = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH DmrsLength by comparing the bitmask + * + * @details + * + * Function : fillPuschDmrsLength + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH DmrsLength + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschDmrsLength(U8 value, ClCellParam **cellPtr) +{ + if(value == FAPI_PUSCH_DMRS_MAX_LENGTH_1) + { + (*cellPtr)->puschDmrsMaxLength = DMRS_MAX_LENGTH_1; + } + else if(value == FAPI_PUSCH_DMRS_MAX_LENGTH_2) + { + (*cellPtr)->puschDmrsMaxLength = DMRS_MAX_LENGTH_2; + } + else + { + (*cellPtr)->puschDmrsMaxLength = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH Dmrs Additional position by comparing the bitmask + * + * @details + * + * Function : fillPuschDmrsAddPos + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH DmrsAddPos + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschDmrsAddPos(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_DMRS_ADDITIONAL_POS_0_MASK) == FAPI_DMRS_ADDITIONAL_POS_0_MASK) + { + (*cellPtr)->puschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_0; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_1_MASK) == FAPI_DMRS_ADDITIONAL_POS_1_MASK) + { + (*cellPtr)->puschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_1; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_2_MASK) == FAPI_DMRS_ADDITIONAL_POS_2_MASK) + { + (*cellPtr)->puschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_2; + } + else if((value & FAPI_DMRS_ADDITIONAL_POS_3_MASK) == FAPI_DMRS_ADDITIONAL_POS_3_MASK) + { + (*cellPtr)->puschDmrsAdditionalPos = DMRS_ADDITIONAL_POS_3; + } + else + { + (*cellPtr)->puschDmrsAdditionalPos = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH Mapping Type by comparing the bitmask + * + * @details + * + * Function : fillPuschMappingType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH MappingType + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschMappingType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PUSCH_MAPPING_TYPE_A_MASK) == FAPI_PUSCH_MAPPING_TYPE_A_MASK) + { + (*cellPtr)->puschMappingType = MAPPING_TYPE_A; + } + else if((value & FAPI_PUSCH_MAPPING_TYPE_B_MASK) == FAPI_PUSCH_MAPPING_TYPE_B_MASK) + { + (*cellPtr)->puschMappingType = MAPPING_TYPE_B; + } + else + { + (*cellPtr)->puschMappingType = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH Allocation Type by comparing the bitmask + * + * @details + * + * Function : fillPuschAllocationType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH AllocationType + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschAllocationType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PUSCH_ALLOC_TYPE_0_MASK) == FAPI_PUSCH_ALLOC_TYPE_0_MASK) + { + (*cellPtr)->puschAllocationTypes = ALLOCATION_TYPE_0; + } + else if((value & FAPI_PUSCH_ALLOC_TYPE_0_MASK) == FAPI_PUSCH_ALLOC_TYPE_0_MASK) + { + (*cellPtr)->puschAllocationTypes = ALLOCATION_TYPE_1; + } + else + { + (*cellPtr)->puschAllocationTypes = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH PRB Mapping Type by comparing the bitmask + * + * @details + * + * Function : fillPuschPrbMappingType + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH PRB MApping Type + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschPrbMappingType(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PUSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) == FAPI_PUSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) + { + (*cellPtr)->puschVrbToPrbMapping = VRB_TO_PRB_MAP_NON_INTLV; + } + else if((value & FAPI_PUSCH_VRB_TO_PRB_MAP_INTLVD_MASK) == FAPI_PUSCH_VRB_TO_PRB_MAP_INTLVD_MASK) + { + (*cellPtr)->puschVrbToPrbMapping = VRB_TO_PRB_MAP_INTLVD; + } + else + { + (*cellPtr)->puschVrbToPrbMapping = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the Modulation Order in Ul by comparing the bitmask + * + * @details + * + * Function : fillModulationOrderUl + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's Modualtsion Order in UL. + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillModulationOrderUl(U8 value, ClCellParam **cellPtr) +{ + if(value == 0) + { + (*cellPtr)->supportedModulationOrderUl = MOD_QPSK; + } + else if(value == 1) + { + (*cellPtr)->supportedModulationOrderUl = MOD_16QAM; + } + else if(value == 2) + { + (*cellPtr)->supportedModulationOrderUl = MOD_64QAM; + } + else if(value == 3) + { + (*cellPtr)->supportedModulationOrderUl = MOD_256QAM; + } + else + { + (*cellPtr)->supportedModulationOrderUl = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PUSCH Aggregation Factor by comparing the bitmask + * + * @details + * + * Function : fillPuschAggregationFactor + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PUSCH Aggregation Factor + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPuschAggregationFactor(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_FORMAT_0_MASK) == FAPI_FORMAT_0_MASK) + { + (*cellPtr)->puschAggregationFactor = AGG_FACTOR_1; + } + else if((value & FAPI_FORMAT_1_MASK) == FAPI_FORMAT_1_MASK) + { + (*cellPtr)->puschAggregationFactor = AGG_FACTOR_2; + } + else if((value & FAPI_FORMAT_2_MASK) == FAPI_FORMAT_2_MASK) + { + (*cellPtr)->puschAggregationFactor = AGG_FACTOR_4; + } + else if((value & FAPI_FORMAT_3_MASK) == FAPI_FORMAT_3_MASK) + { + (*cellPtr)->puschAggregationFactor = AGG_FACTOR_8; + } + else + { + (*cellPtr)->puschAggregationFactor = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PRACH Long Format by comparing the bitmask + * + * @details + * + * Function : fillPrachLongFormat + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PRACH Long Format + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPrachLongFormat(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PRACH_LF_FORMAT_0_MASK) == FAPI_PRACH_LF_FORMAT_0_MASK) + { + (*cellPtr)->prachLongFormats = FORMAT_0; + } + else if((value & FAPI_PRACH_LF_FORMAT_1_MASK) == FAPI_PRACH_LF_FORMAT_1_MASK) + { + (*cellPtr)->prachLongFormats = FORMAT_1; + } + else if((value & FAPI_PRACH_LF_FORMAT_2_MASK) == FAPI_PRACH_LF_FORMAT_2_MASK) + { + (*cellPtr)->prachLongFormats = FORMAT_2; + } + else if((value & FAPI_PRACH_LF_FORMAT_3_MASK) == FAPI_PRACH_LF_FORMAT_3_MASK) + { + (*cellPtr)->prachLongFormats = FORMAT_3; + } + else + { + (*cellPtr)->prachLongFormats = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the PRACH Short Format by comparing the bitmask + * + * @details + * + * Function : fillPrachShortFormat + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's PRACH ShortFormat + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillPrachShortFormat(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_PRACH_SF_FORMAT_A1_MASK) == FAPI_PRACH_SF_FORMAT_A1_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_A1; + } + else if((value & FAPI_PRACH_SF_FORMAT_A2_MASK) == FAPI_PRACH_SF_FORMAT_A2_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_A2; + } + else if((value & FAPI_PRACH_SF_FORMAT_A3_MASK) == FAPI_PRACH_SF_FORMAT_A3_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_A3; + } + else if((value & FAPI_PRACH_SF_FORMAT_B1_MASK) == FAPI_PRACH_SF_FORMAT_B1_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_B1; + } + else if((value & FAPI_PRACH_SF_FORMAT_B2_MASK) == FAPI_PRACH_SF_FORMAT_B2_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_B2; + } + else if((value & FAPI_PRACH_SF_FORMAT_B3_MASK) == FAPI_PRACH_SF_FORMAT_B3_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_B3; + } + else if((value & FAPI_PRACH_SF_FORMAT_B4_MASK) == FAPI_PRACH_SF_FORMAT_B4_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_B4; + } + else if((value & FAPI_PRACH_SF_FORMAT_C0_MASK) == FAPI_PRACH_SF_FORMAT_C0_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_C0; + } + else if((value & FAPI_PRACH_SF_FORMAT_C2_MASK) == FAPI_PRACH_SF_FORMAT_C2_MASK) + { + (*cellPtr)->prachShortFormats = SF_FORMAT_C2; + } + else + { + (*cellPtr)->prachShortFormats = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the Fd Occasions Type by comparing the bitmask + * + * @details + * + * Function : fillFdOccasions + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's Fd Occasions + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillFdOccasions(U8 value, ClCellParam **cellPtr) +{ + if(value == 0) + { + (*cellPtr)->maxPrachFdOccasionsInASlot = PRACH_FD_OCC_IN_A_SLOT_1; + } + else if(value == 1) + { + (*cellPtr)->maxPrachFdOccasionsInASlot = PRACH_FD_OCC_IN_A_SLOT_2; + } + else if(value == 3) + { + (*cellPtr)->maxPrachFdOccasionsInASlot = PRACH_FD_OCC_IN_A_SLOT_4; + } + else if(value == 4) + { + (*cellPtr)->maxPrachFdOccasionsInASlot = PRACH_FD_OCC_IN_A_SLOT_8; + } + else + { + (*cellPtr)->maxPrachFdOccasionsInASlot = INVALID_VALUE; + } +} + +/******************************************************************* + * + * @brief fills the RSSI Measurement by comparing the bitmask + * + * @details + * + * Function : fillRssiMeas + * + * Functionality: + * -checks the value with the bitmask and + * fills the cellPtr's RSSI Measurement report + * + * @params[in] Pointer to ClCellParam + * Value to be compared + * @return void + * + ******************************************************************/ + +PUBLIC void fillRssiMeas(U8 value, ClCellParam **cellPtr) +{ + if((value & FAPI_RSSI_REPORT_IN_DBM_MASK) == FAPI_RSSI_REPORT_IN_DBM_MASK) + { + (*cellPtr)->rssiMeasurementSupport = RSSI_REPORT_DBM; + } + else if((value & FAPI_RSSI_REPORT_IN_DBFS_MASK) == FAPI_RSSI_REPORT_IN_DBFS_MASK) + { + (*cellPtr)->rssiMeasurementSupport = RSSI_REPORT_DBFS; + } + else + { + (*cellPtr)->rssiMeasurementSupport = INVALID_VALUE; + } +} + + /******************************************************************* + * + * @brief Returns the TLVs value + * + * @details + * + * Function : getParamValue + * + * Functionality: + * -return TLVs value + * + * @params[in] + * @return ROK - temp + * RFAILED - failure + * + * ****************************************************************/ + +S16 getParamValue(fapi_uint16_tlv_t *tlv, U16 type) +{ + U16 valueLen; + void *temp, *posPtr; + valueLen = tlv->tl.length; + posPtr = &tlv->tl.tag; + posPtr += sizeof(tlv->tl.tag); + posPtr += sizeof(tlv->tl.length); + /*TO DO: malloc to SSI memory */ + if(type == FAPI_UINT_8) + { + temp = (U8 *)malloc(valueLen * sizeof(U8)); + memcpy(temp, posPtr, valueLen); + return(*(U8 *)temp); + } + else if(type == FAPI_UINT_16) + { + temp = (U16 *)malloc(valueLen * sizeof(U16)); + memcpy(temp, posPtr, valueLen); + return(*(U16 *)temp); + } + else if(type == FAPI_UINT_32) + { + temp = (U32 *)malloc(valueLen * sizeof(U32)); + memcpy(temp, posPtr, valueLen); + return(*(U32 *)temp); + } + else + { + printf("\n Value Extraction failed" ); + RETVALUE(RFAILED); + } +} + /******************************************************************* + * + * @brief Sends FAPI Param req to PHY + * + * @details + * + * Function : lwr_mac_handleParamReqEvt + * + * Functionality: + * -Sends FAPI Param req to PHY + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 lwr_mac_handleParamReqEvt(void *msg) +{ + /* startGuardTimer(); */ + fapi_param_req_t *paramReq = (fapi_param_req_t *)msg; + if(SGetSBuf(0, 0, (Data **)¶mReq, sizeof(fapi_param_req_t)) != ROK) + { + printf("\nFailed to allocate memory for Param Request"); + RETVALUE(LCM_REASON_MEM_NOAVAIL); + } + else + { + fillMsgHeader(¶mReq->header, FAPI_PARAM_REQUEST, 0); + sendToPhy(paramReq->header.message_type_id, sizeof(fapi_param_req_t), (void *)paramReq); + RETVALUE(ROK); + } +} + + /******************************************************************* + * + * @brief Sends FAPI Param rsp to MAC via PHY + * + * @details + * + * Function : lwr_mac_handleParamRspEvt + * + * Functionality: + * -Sends FAPI Param rsp to MAC via PHY + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 lwr_mac_handleParamRspEvt(fapi_param_resp_t *paramRsp) +{ + /* stopGuardTimer(); */ + U16 index; + U32 encodedVal; + ClCellParam *cellParam = NULLP; + if(paramRsp == NULLP) + { + printf("\n Param Request for State [%d] is unsuccessfull", clGlobalCp.phyState); + RETVALUE(RFAILED); + } + printf("\n Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState); + SPutSBuf(0, 0, (Data *)paramRsp, paramRsp->header.length); + if(SGetSBuf(0, 0, (Data **)&cellParam, sizeof(ClCellParam)) != ROK) + { + printf("\nFailed to allocate memory for new cell"); + RETVALUE(LCM_REASON_MEM_NOAVAIL); + } + + printf("\n Filling TLVS into MAC API"); + if(paramRsp->error_code == MSG_OK) + { + for(index = 0; index < paramRsp->number_of_tlvs; index++) + { + switch(paramRsp->tlvs[index].tl.tag) + { + case FAPI_RELEASE_CAPABILITY_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_16); + if(encodedVal != RFAILED && (encodedVal & RELEASE_15) == RELEASE_15) + { + cellParam->releaseCapability = RELEASE_15; + } + break; + + case FAPI_PHY_STATE_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != clGlobalCp.phyState) + { + printf("\n PhyState mismatch [%d][%d]", clGlobalCp.phyState, clGlobalCp.event); + RETVALUE(RFAILED); + } + break; + + case FAPI_SKIP_BLANK_DL_CONFIG_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->skipBlankDlConfig = SUPPORTED; + } + else + { + cellParam->skipBlankDlConfig = NOT_SUPPORTED; + } + break; + + case FAPI_SKIP_BLANK_UL_CONFIG_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->skipBlankUlConfig = SUPPORTED; + } + else + { + cellParam->skipBlankUlConfig = NOT_SUPPORTED; + } + break; + + case FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG: + cellParam->numTlvsToReport = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_16); + break; + + case FAPI_CYCLIC_PREFIX_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillCyclicPrefix(encodedVal, &cellParam); + } + break; + + case FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillSubcarrierSpaceDl(encodedVal, &cellParam); + } + break; + + case FAPI_SUPPORTED_BANDWIDTH_DL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_16); + if(encodedVal != RFAILED) + { + fillBandwidthDl(encodedVal, &cellParam); + } + break; + + case FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillSubcarrierSpaceUl(encodedVal, &cellParam); + } + break; + + case FAPI_SUPPORTED_BANDWIDTH_UL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_16); + if(encodedVal != RFAILED) + { + fillBandwidthUl(encodedVal, &cellParam); + } + break; + + case FAPI_CCE_MAPPING_TYPE_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillCCEmaping(encodedVal, &cellParam); + } + break; + + case FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->coresetOutsideFirst3OfdmSymsOfSlot = SUPPORTED; + } + else + { + cellParam->coresetOutsideFirst3OfdmSymsOfSlot = NOT_SUPPORTED; + } + break; + + case FAPI_PRECODER_GRANULARITY_CORESET_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->precoderGranularityCoreset = SUPPORTED; + } + else + { + cellParam->precoderGranularityCoreset = NOT_SUPPORTED; + } + break; + + case FAPI_PDCCH_MU_MIMO_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->pdcchMuMimo = SUPPORTED; + } + else + { + cellParam->pdcchMuMimo = NOT_SUPPORTED; + } + break; + + case FAPI_PDCCH_PRECODER_CYCLING_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->pdcchPrecoderCycling = SUPPORTED; + } + else + { + cellParam->pdcchPrecoderCycling = NOT_SUPPORTED; + } + break; + + case FAPI_MAX_PDCCHS_PER_SLOT_TAG: + cellParam->maxPdcchsPerSlot = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_PUCCH_FORMATS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPucchFormat(encodedVal, &cellParam); + } + break; + + case FAPI_MAX_PUCCHS_PER_SLOT_TAG: + cellParam->maxPucchsPerSlot = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_PDSCH_MAPPING_TYPE_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPdschMappingType(encodedVal, &cellParam); + } + break; + + case FAPI_PDSCH_ALLOCATION_TYPES_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPdschAllocationType(encodedVal, &cellParam); + } + break; + + case FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPrbMappingType(encodedVal, &cellParam); + } + break; + + case FAPI_PDSCH_CBG_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->pdschCbg = SUPPORTED; + } + else + { + cellParam->pdschCbg = NOT_SUPPORTED; + } + break; + + case FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPdschDmrsConfigType(encodedVal, &cellParam); + } + break; + + case FAPI_PDSCH_DMRS_MAX_LENGTH_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPdschDmrsLength(encodedVal, &cellParam); + } + break; + + case FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPdschDmrsAddPos(encodedVal, &cellParam); + } + break; + + case FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG: + cellParam->maxPdschsTBsPerSlot = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal < FAPI_MAX_NUMBERMIMO_LAYERS_PDSCH) + { + cellParam->maxNumberMimoLayersPdsch = encodedVal; + } + break; + + case FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillModulationOrderDl(encodedVal, &cellParam); + } + break; + + case FAPI_MAX_MU_MIMO_USERS_DL_TAG: + cellParam->maxMuMimoUsersDl = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->pdschDataInDmrsSymbols = SUPPORTED; + } + else + { + cellParam->pdschDataInDmrsSymbols = NOT_SUPPORTED; + } + break; + + case FAPI_PREMPTIONSUPPORT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->premptionSupport = SUPPORTED; + } + else + { + cellParam->premptionSupport = NOT_SUPPORTED; + } + break; + + case FAPI_PDSCH_NON_SLOT_SUPPORT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->pdschNonSlotSupport = SUPPORTED; + } + else + { + cellParam->pdschNonSlotSupport = NOT_SUPPORTED; + } + break; + + case FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->uciMuxUlschInPusch = SUPPORTED; + } + else + { + cellParam->uciMuxUlschInPusch = NOT_SUPPORTED; + } + break; + + case FAPI_UCI_ONLY_PUSCH_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->uciOnlyPusch = SUPPORTED; + } + else + { + cellParam->uciOnlyPusch = NOT_SUPPORTED; + } + break; + + case FAPI_PUSCH_FREQUENCY_HOPPING_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->puschFrequencyHopping = SUPPORTED; + } + else + { + cellParam->puschFrequencyHopping = NOT_SUPPORTED; + } + break; + + case FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschDmrsConfig(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_DMRS_MAX_LEN_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschDmrsLength(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschDmrsAddPos(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_CBG_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->puschCbg = SUPPORTED; + } + else + { + cellParam->puschCbg = NOT_SUPPORTED; + } + break; + + case FAPI_PUSCH_MAPPING_TYPE_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschMappingType(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_ALLOCATION_TYPES_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschAllocationType(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschPrbMappingType(encodedVal, &cellParam); + } + break; + + case FAPI_PUSCH_MAX_PTRS_PORTS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal < FAPI_PUSCH_MAX_PTRS_PORTS_UB) + { + cellParam->puschMaxPtrsPorts = encodedVal; + } + break; + + case FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG: + cellParam->maxPduschsTBsPerSlot = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG: + cellParam->maxNumberMimoLayersNonCbPusch = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillModulationOrderUl(encodedVal, &cellParam); + } + break; + + case FAPI_MAX_MU_MIMO_USERS_UL_TAG: + cellParam->maxMuMimoUsersUl = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + break; + + case FAPI_DFTS_OFDM_SUPPORT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->dftsOfdmSupport = SUPPORTED; + } + else + { + cellParam->dftsOfdmSupport = NOT_SUPPORTED; + } + break; + + case FAPI_PUSCH_AGGREGATION_FACTOR_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPuschAggregationFactor(encodedVal, &cellParam); + } + break; + + case FAPI_PRACH_LONG_FORMATS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPrachLongFormat(encodedVal, &cellParam); + } + break; + + case FAPI_PRACH_SHORT_FORMATS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillPrachShortFormat(encodedVal, &cellParam); + } + break; + + case FAPI_PRACH_RESTRICTED_SETS_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED && encodedVal != 0) + { + cellParam->prachRestrictedSets = SUPPORTED; + } + else + { + cellParam->prachRestrictedSets = NOT_SUPPORTED; + } + break; + + case FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillFdOccasions(encodedVal, &cellParam); + } + break; + + case FAPI_RSSI_MEASUREMENT_SUPPORT_TAG: + encodedVal = getParamValue(¶mRsp->tlvs[index], FAPI_UINT_8); + if(encodedVal != RFAILED) + { + fillRssiMeas(encodedVal, &cellParam); + } + break; + + default: + printf("\n Invalid value for TLV[%d]", paramRsp->tlvs[index].tl.tag); + break; + } + } + } + else + { + printf("\n Error Indication Evnt received in state[%d] event[%d]", clGlobalCp.phyState, clGlobalCp.event); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} + + /******************************************************************* + * + * @brief Sends FAPI Config req to PHY + * + * @details + * + * Function : lwr_mac_handleConfigReqEvt + * + * Functionality: + * -Sends FAPI Config Req to PHY + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 lwr_mac_handleConfigReqEvt(void *msg) +{ + RETVALUE(ROK); +} + +S16 lwr_mac_handleConfigRspEvt(fapi_config_resp_t *configRsp) +{ + RETVALUE(ROK); +} + +S16 lwr_mac_handleStartReqEvt(void *msg) +{ + /*fapi_slot_ind_t *slotInd; + slotInd->header.message_type_id = FAPI_SLOT_INDICATION; + slotInd->sfn = 0; + slotInd->slot = 1; + phyToMac(slotInd->header.message_type_id, sizeof(fapi_slot_ind_t), (void *)slotInd); + */ + RETVALUE(ROK); +} + +S16 lwr_mac_handleStopReqEvt(void *msg) +{ + /* stop TX and RX operation return PHy to configured State + send stop.indication to l2/l3 */ + RETVALUE(ROK); +} + +lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] = +{ + { + /* PHY_STATE_IDLE */ + lwr_mac_handleParamReqEvt, + lwr_mac_handleParamRspEvt, + lwr_mac_handleConfigReqEvt, + lwr_mac_handleConfigRspEvt, + lwr_mac_handleInvalidEvt, + lwr_mac_handleInvalidEvt + }, + { + /* PHY_STATE_CONFIGURED */ + lwr_mac_handleParamReqEvt, + lwr_mac_handleParamRspEvt, + lwr_mac_handleConfigReqEvt, + lwr_mac_handleConfigRspEvt, + lwr_mac_handleStartReqEvt, + lwr_mac_handleInvalidEvt + }, + { + /* PHY_STATE_RUNNING */ + lwr_mac_handleInvalidEvt, + lwr_mac_handleInvalidEvt, + lwr_mac_handleConfigReqEvt, + lwr_mac_handleConfigRspEvt, + lwr_mac_handleInvalidEvt, + lwr_mac_handleStopReqEvt + } +}; + +/******************************************************************* + * + * @brief Sends message to Lower Mac Fsm Event Handler + * + * @details + * + * Function : sendToLowerMac + * + * Functionality: + * -Sends message to LowerMac + * + * @params[in] Message Type + * Message Length + * Messaga Pointer + * + * @return void + * +******************************************************************/ +S16 sendToLowerMac(U16 msgType, U32 msgLen, void *msg) +{ + clGlobalCp.event = msgType; + fapiEvtHdlr[clGlobalCp.phyState][msgType](msg); +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrmac/lwr_mac_fsm.h b/src/5gnrmac/lwr_mac_fsm.h new file mode 100644 index 000000000..e1a362833 --- /dev/null +++ b/src/5gnrmac/lwr_mac_fsm.h @@ -0,0 +1,43 @@ + /******************************************************************************* + ################################################################################ + # Copyright (c) [2017-2019] [Radisys] # + # # + # Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # + # # + # 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. # + ################################################################################ + *******************************************************************************/ +#ifndef _LWR_MAC_FSM_H_ +#define _LWR_MAC_FSM_H_ +#define FAPI_UINT_8 1 +#define FAPI_UINT_16 2 +#define FAPI_UINT_32 4 +#define INVALID_VALUE -1 + +#include "lwr_mac.h" +#include "rg_cl_phy.h" +#include "fapi.h" + +S16 lwr_mac_handleInvalidEvt(void *msg); +S16 lwr_mac_handleParamReqEvt(void *msg); +S16 lwr_mac_handleParamRspEvt(fapi_param_resp_t *); +S16 lwr_mac_handleConfigReqEvt(void *msg); +S16 lwr_mac_handleConfigRspEvt(fapi_config_resp_t *); +S16 lwr_mac_handleStartReqEvt(void *msg); +S16 lwr_mac_handleStopReqEvt(void *msg); + +typedef S16 (*lwrMacFsmHdlr)(void *); +#endif + +/********************************************************************** + End of file +**********************************************************************/ + diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index 6850884f4..36ead1f37 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -754,7 +754,7 @@ typedef enum { \ } #endif - +#define DEFAULT_CELLS 1 #endif /* __RGH__ */ /********************************************************************** diff --git a/src/5gnrmac/rg_cl.h b/src/5gnrmac/rg_cl.h index 9368b2acc..f1ec0cc04 100644 --- a/src/5gnrmac/rg_cl.h +++ b/src/5gnrmac/rg_cl.h @@ -22,14 +22,36 @@ #define MAX_NUM_CELL_SUPP 1 +#include "envdep.h" +#include "gen.h" +#include "ssi.h" +#include "cm_hash.h" + +#include "gen.x" +#include "ssi.x" +#include "cm_hash.x" +#include "cm_lib.x" +#include "lcl.h" + typedef enum { PHY_STATE_IDLE, PHY_STATE_CONFIGURED, PHY_STATE_RUNNING, - PHY_STATE_INVALID + MAX_STATE }PhyState; +/* Events in Lower Mac */ +typedef enum{ + PARAM_REQ, + PARAM_RSP, + CONFIG_REQ, + CONFIG_RSP, + START_REQ, + STOP_REQ, + MAX_EVENT +}EventState; + typedef struct clCb { Region region; @@ -38,6 +60,7 @@ typedef struct clCb CmHashListCp cellCbLst; /* List of Cells configured */ U8 numOfCells; /* Number of Cells configured */ PhyState phyState; /* State of PHY */ + EventState event; /* State of Event */ }ClCb; typedef struct cellCb @@ -47,6 +70,203 @@ typedef struct cellCb PhyState phyState; }ClCellCb; +typedef enum +{ + RELEASE_15 +}ReleaseCapab; + +typedef enum +{ + NOT_SUPPORTED, + SUPPORTED +}ParamSupport; + +typedef enum +{ + NORMAL_CYCLIC_PREFIX_MASK, + EXTENDED_CYCLIC_PREFIX_MASK +}CyclicPrefix; + +typedef enum +{ + SPACING_15_KHZ, + SPACING_30_KHZ, + SPACING_60_KHZ, + SPACING_120_KHZ +}SubCarrierSpacing; + +typedef enum +{ + BW_5MHZ, + BW_10MHZ, + BW_15MHZ, + BW_20MHZ, + BW_40MHZ, + BW_50MHZ, + BW_60MHZ, + BW_70MHZ, + BW_80MHZ, + BW_90MHZ, + BW_100MHZ, + BW_200MHZ, + BW_400MHZ +}SupportedBandwidth; + +typedef enum +{ + CCE_MAPPING_INTERLEAVED_MASK, + CCE_MAPPING_NONINTERLVD_MASK +}CCEMappingType; + +typedef enum +{ + FORMAT_0, + FORMAT_1, + FORMAT_2, + FORMAT_3, + FORMAT_4 +}Formats; + +typedef enum +{ + MAPPING_TYPE_A, + MAPPING_TYPE_B, +}MappingType; + +typedef enum +{ + ALLOCATION_TYPE_0, + ALLOCATION_TYPE_1, +}AllocationType; + +typedef enum +{ + VRB_TO_PRB_MAP_NON_INTLV, + VRB_TO_PRB_MAP_INTLVD +}VrbToPrbMap; + +typedef enum +{ + DMRS_CONFIG_TYPE_1, + DMRS_CONFIG_TYPE_2 +}DmrsConfigType; + +typedef enum +{ + DMRS_MAX_LENGTH_1, + DMRS_MAX_LENGTH_2 +}DmrMaxLen; + +typedef enum +{ + DMRS_ADDITIONAL_POS_0, + DMRS_ADDITIONAL_POS_1, + DMRS_ADDITIONAL_POS_2, + DMRS_ADDITIONAL_POS_3 +}DmrsPos; + +typedef enum +{ + MOD_QPSK, + MOD_16QAM, + MOD_64QAM, + MOD_256QAM +}ModulationOrder; + +typedef enum +{ + AGG_FACTOR_1, + AGG_FACTOR_2, + AGG_FACTOR_4, + AGG_FACTOR_8 +}AggregationFactor; + +typedef enum +{ + SF_FORMAT_A1, + SF_FORMAT_A2, + SF_FORMAT_A3, + SF_FORMAT_B1, + SF_FORMAT_B2, + SF_FORMAT_B3, + SF_FORMAT_B4, + SF_FORMAT_C0, + SF_FORMAT_C2 +}ShortFormat; + +typedef enum +{ + PRACH_FD_OCC_IN_A_SLOT_1 = 1, + PRACH_FD_OCC_IN_A_SLOT_2 = 2, + PRACH_FD_OCC_IN_A_SLOT_4 = 4, + PRACH_FD_OCC_IN_A_SLOT_8 = 8 +}FdOccPerSlot; + +typedef enum +{ + RSSI_REPORT_DBM, + RSSI_REPORT_DBFS +}RssiMeasurement; + +typedef struct clCellParam +{ + ReleaseCapab releaseCapability; /* Release Capability */ + PhyState ParamPhystate; + ParamSupport skipBlankDlConfig; + ParamSupport skipBlankUlConfig; + ParamSupport numTlvsToReport; + CyclicPrefix cyclicPrefix; + SubCarrierSpacing supportedSubcarrierSpacingDl; + SupportedBandwidth supportedBandwidthDl; + SubCarrierSpacing supportedSubcarrierSpacingsUl; + SupportedBandwidth supportedBandwidthUl; + CCEMappingType cceMappingType; + ParamSupport coresetOutsideFirst3OfdmSymsOfSlot; + ParamSupport precoderGranularityCoreset; + ParamSupport pdcchMuMimo; + ParamSupport pdcchPrecoderCycling; + U8 maxPdcchsPerSlot; + Formats pucchFormats; + U8 maxPucchsPerSlot; + MappingType pdschMappingType; + AllocationType pdschAllocationTypes; + VrbToPrbMap pdschVrbToPrbMapping; + ParamSupport pdschCbg; + DmrsConfigType pdschDmrsConfigTypes; + DmrMaxLen pdschDmrsMaxLength; + DmrsPos pdschDmrsAdditionalPos; + U8 maxPdschsTBsPerSlot; + U8 maxNumberMimoLayersPdsch; + ModulationOrder supportedMaxModulationOrderDl; + U8 maxMuMimoUsersDl; + ParamSupport pdschDataInDmrsSymbols; + ParamSupport premptionSupport; + ParamSupport pdschNonSlotSupport; + ParamSupport uciMuxUlschInPusch; + ParamSupport uciOnlyPusch; + ParamSupport puschFrequencyHopping; + DmrsConfigType puschDmrsConfigTypes; + DmrMaxLen puschDmrsMaxLength; + DmrsPos puschDmrsAdditionalPos; + ParamSupport puschCbg; + MappingType puschMappingType; + AllocationType puschAllocationTypes; + VrbToPrbMap puschVrbToPrbMapping; + U8 puschMaxPtrsPorts; + U8 maxPduschsTBsPerSlot; + U8 maxNumberMimoLayersNonCbPusch; + ModulationOrder supportedModulationOrderUl; + U8 maxMuMimoUsersUl; + ParamSupport dftsOfdmSupport; + AggregationFactor puschAggregationFactor; + Formats prachLongFormats; + ShortFormat prachShortFormats; + ParamSupport prachRestrictedSets; + FdOccPerSlot maxPrachFdOccasionsInASlot; + RssiMeasurement rssiMeasurementSupport; +}ClCellParam; + + EXTERN ClCb clGlobalCp; EXTERN ClCellCb * rgClUtlGetCellCb ARGS((U16 cellId)); diff --git a/src/5gnrmac/rg_cl_cfg.c b/src/5gnrmac/rg_cl_cfg.c index 3c699162a..8d8f32f16 100644 --- a/src/5gnrmac/rg_cl_cfg.c +++ b/src/5gnrmac/rg_cl_cfg.c @@ -29,7 +29,7 @@ #include "cm_lib.x" #include "lcl.h" -#include "rg_cl.h" +#include "lwr_mac.h" EXTERN S16 rgClBldAndSndFAPICfgReq ARGS((ClCellCb *cellCb)); diff --git a/src/5gnrmac/rg_cl_li.c b/src/5gnrmac/rg_cl_li.c index d41c17bb1..673fb0594 100644 --- a/src/5gnrmac/rg_cl_li.c +++ b/src/5gnrmac/rg_cl_li.c @@ -28,8 +28,9 @@ #include "cm_hash.x" #include "lcl.h" -#include "rg_cl.h" +#include "lwr_mac.h" #include "rg_cl_phy.h" +#include "fapi.h" /*#include "wls_lib.h"*/ EXTERN S16 sendToPhy ARGS((U16 msgType, U32 msgLen, void *msg)); @@ -275,6 +276,50 @@ S16 rgClHndlCfgReq(void *msg) RETVALUE(ROK); } +/******************************************************************* + * + * @brief Handles FAPI param response + * + * @details + * + * Function : lwrMacHndlParamReq + * + * Functionality: + * -Handles FAPI param request + * + * @params[in] Message pointer + * + * @return void + * + *****************************************************************/ +S16 lwrMacHndlParamReq(void *msg) +{ + ClCellCb *cellCb = NULLP; + fapi_param_resp_t *paramRsp; + + paramRsp = (fapi_param_resp_t *)msg; + + if(paramRsp->error_code != MSG_OK) + { + printf("\nPHY configuration failed"); + RETVALUE(RFAILED); + } + + if(paramRsp->tlvs[0].value == 0) + { + cellCb->phyState = PHY_STATE_IDLE; + clGlobalCp.phyState = PHY_STATE_IDLE; + } + + printf("\nReceived successful PHY configuration response"); + + SPutSBuf(0, 0, (Data *)msg, paramRsp->header.length); + + + RETVALUE(ROK); + +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/rg_cl_phy.c b/src/5gnrmac/rg_cl_phy.c new file mode 100644 index 000000000..3cb711d05 --- /dev/null +++ b/src/5gnrmac/rg_cl_phy.c @@ -0,0 +1,102 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains APIs to send/receive messages from PHY */ + +#include "stdio.h" +#include "envdep.h" +#include "ssi.h" + +#include "rg_cl_phy.h" +#include "fapi.h" + + +EXTERN S16 rgClHndlCfgReq ARGS((void *msg)); +EXTERN void macToPhy ARGS((U16 msgType, U32 msgLen, void *msg)); +EXTERN void processRequest ARGS((U16 msgType, U32 msgLen, void *msg)); +/****************************************************************** + * + * @brief Receives message to PHY + * + * @details + * + * Function : phyToMac + * + * Functionality: + * -Receives Msg from PHY + * + * @params[in] Message Pointer + * + * @return void + * + ******************************************************************/ + +void phyToMac(U16 msgType, U32 msgLen,void *msg) +{ + switch(msgType) + { + case MSG_TYPE_CONFIG_RSP: + rgClHndlCfgReq(msg); + break; + + default: + printf("\nInvalid message type[%x] from PHY", msgType); + } +} + +/******************************************************************* + * + * @brief Sends message to PHY + * + * @details + * + * Function : sendToPhy + * + * Functionality: + * -Sends message to PHY + * + * @params[in] Message Type + * Message Length + * Messaga Pointer + * + * @return void + * +******************************************************************/ + +PUBLIC S16 sendToPhy(U16 msgType, U32 msgLen, void *msg) +{ +#if 0 + S8 ret; + void *pMsg; + + pMsg = (void *)WLS_VA2PA(mtGetWlsHdl(), msg); + ret = WLS_put(mtGetWlsHdl(), (PTR)pMsg, msgLen, msgType, 0); + + if(ret != 0) + { + printf("\nFailure in sending message to PHY"); + RETVALUE(RFAILED); + } +#endif + + processRequest(msgType, msgLen, msg); +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_cl_phy_inf.c b/src/5gnrmac/rg_cl_phy_inf.c deleted file mode 100644 index 250bec821..000000000 --- a/src/5gnrmac/rg_cl_phy_inf.c +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/* This file contains APIs to send/receive messages from PHY */ - -#include "stdio.h" -#include "envdep.h" -#include "ssi.h" - -#include "rg_cl_phy.h" - - -EXTERN S16 rgClHndlCfgReq ARGS((void *msg)); -EXTERN void macToPhy ARGS((U16 msgType, U32 msgLen, void *msg)); - -/****************************************************************** - * - * @brief Receives message to PHY - * - * @details - * - * Function : phyToMac - * - * Functionality: - * -Receives Msg from PHY - * - * @params[in] Message Pointer - * - * @return void - * - ******************************************************************/ - -void phyToMac(U16 msgType, U32 msgLen,void *msg) -{ - switch(msgType) - { - case MSG_TYPE_CONFIG_RSP: - rgClHndlCfgReq(msg); - break; - - default: - printf("\nInvalid message type[%x] from PHY", msgType); - } -} - -/******************************************************************* - * - * @brief Sends message to PHY - * - * @details - * - * Function : sendToPhy - * - * Functionality: - * -Sends message to PHY - * - * @params[in] Message Type - * Message Length - * Messaga Pointer - * - * @return void - * -******************************************************************/ - -PUBLIC S16 sendToPhy(U16 msgType, U32 msgLen, void *msg) -{ -#if 0 - S8 ret; - void *pMsg; - - pMsg = (void *)WLS_VA2PA(mtGetWlsHdl(), msg); - ret = WLS_put(mtGetWlsHdl(), (PTR)pMsg, msgLen, msgType, 0); - - if(ret != 0) - { - printf("\nFailure in sending message to PHY"); - RETVALUE(RFAILED); - } -#endif - - macToPhy(msgType, msgLen, msg); - - RETVALUE(ROK); -} - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_cl_util.c b/src/5gnrmac/rg_cl_util.c index 1820bdf4b..edd749741 100644 --- a/src/5gnrmac/rg_cl_util.c +++ b/src/5gnrmac/rg_cl_util.c @@ -25,7 +25,7 @@ #include "cm_hash.h" #include "cm_hash.x" #include "lcl.h" -#include "rg_cl.h" +#include "lwr_mac.h" /******************************************************************* * diff --git a/src/5gnrmac/rg_env.h b/src/5gnrmac/rg_env.h index 24ca5f4a3..3afb0acaa 100755 --- a/src/5gnrmac/rg_env.h +++ b/src/5gnrmac/rg_env.h @@ -155,7 +155,7 @@ //EXTERN U32 wrSmDfltNumCells; #define RGSCH_MAX_UE_PER_DL_SF 32 #define RGSCH_MAX_RARNTI_PER_DL_SF 4 -#define RGSCH_INST_START 5 +#define SCH_INST_START 1 #define RGSCH_MAX_INST 2 /*MCELL changes*/ #define RG_MAX_INST 4 diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index b7fc99fc8..8d1e285b4 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -47,11 +47,13 @@ registered with SSI during the LTE MAC Task initialization. #include "rgu.h" /* RGU defines */ #include "tfu.h" /* RGU defines */ #include "lrg.h" /* layer management defines for LTE-MAC */ +#include "rgr.h" /* layer management defines for LTE-MAC */ #include "crg.h" /* CRG interface includes */ #include "rg_sch_inf.h" /* SCH interface includes */ #include "rg_prg.h" /* PRG interface includes */ #include "rg_env.h" /* customisable defines and macros for LTE-MAC */ #include "rg.h" /* defines and macros for MAC */ +#include "rgr.h" /* defines and macros for SCH */ /* header/extern include files (.x) */ @@ -67,6 +69,7 @@ registered with SSI during the LTE MAC Task initialization. #include "rgu.x" /* RGU types */ #include "tfu.x" /* RGU types */ #include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ #include "crg.x" /* CRG interface typedes */ #include "rg_sch_inf.x" /* SCH interface typedefs */ #include "rg_prg.x" /*PRG interface includes*/ @@ -108,6 +111,13 @@ Buffer *mBuf; /* message buffer */ /* Process a config. request */ cmUnpkLrgCfgReq(RgMiLrgCfgReq, pst, mBuf); break; + case EVTMACSCHGENCFGREQ: + /* Process a config. request */ + cmUnpkLrgSchCfgReq(MacSchGenCfgReq, pst, mBuf); + break; + case EVTMACSCHCFGREQ: + cmUnpkRgrCfgReq(MacSchCfgReq, pst, mBuf); + break; case EVTLRGCNTRLREQ: /* Process a control request */ cmUnpkLrgCntrlReq(RgMiLrgCntrlReq, pst, mBuf); diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 8e0c398f4..ced3b0679 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -52,8 +52,9 @@ static int RLOG_MODULE_ID=4096; #include "crg.h" /* CRG Interface defines */ #include "rgu.h" /* RGU Interface defines */ #include "tfu.h" /* RGU Interface defines */ -#include "rg_sch_inf.h" /* RGR Interface defines */ +#include "rg_sch_inf.h" /* RGR Interface defines */ #include "lrg.h" /* LRG Interface defines */ +#include "rgr.h" /* LRG Interface defines */ #include "rg.h" /* MAC defines */ #include "rg_err.h" /* MAC error defines */ @@ -73,6 +74,7 @@ static int RLOG_MODULE_ID=4096; #include "rg_sch_inf.x" /* SCH Interface includes */ #include "rg_prg.x" /* PRG Interface includes */ #include "lrg.x" /* LRG Interface includes */ +#include "rgr.x" /* LRG Interface includes */ #include "rg.x" /* MAC includes */ #ifdef SS_DIAG #include "ss_diag.h" /* Common log file */ @@ -222,6 +224,9 @@ Reason reason; /* reason */ RETVALUE(RFAILED); } + /* Initialize Scheduler as well */ + schActvInit(ENTRG, (DEFAULT_CELLS + SCH_INST_START), DFLT_REGION, PWR_UP); + RETVALUE(ROK); } /* rgActvInit */ @@ -1941,6 +1946,112 @@ Inst inst; } /* end of rgActvTmr */ +/** + * @brief Layer Manager Configuration request handler for Scheduler + * + * @details + * + * Function : MacSchGenCfgReq + * + * This function receives general configurations for Scheduler + * from DU APP and forwards to Scheduler. + * + * @param[in] Pst *pst, the post structure + * @param[in] RgMngmt *cfg, the configuration parameter's structure + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 MacSchGenCfgReq +( +Pst *pst, /* post structure */ +RgMngmt *cfg /* config structure */ +) +#else +PUBLIC S16 MacSchGenCfgReq(pst, cfg) +Pst *pst; /* post structure */ +RgMngmt *cfg; /* config structure */ +#endif +{ + printf("\nReceived Scheduler gen config at MAC"); + pst->dstInst = DEFAULT_CELLS + 1; + HandleSchGenCfgReq(pst, cfg); + + return ROK; +} + +/** + * @brief Layer Manager Configuration response from Scheduler + * + * @details + * + * Function : SchSendCfgCfm + * + * This function sends general configurations response from + * Scheduler to DU APP. + * + * @param[in] Pst *pst, the post structure + * @param[in] RgMngmt *cfm, the configuration confirm structure + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 SchSendCfgCfm +( +Pst *pst, /* post structure */ +RgMngmt *cfm /* config confirm structure */ +) +#else +PUBLIC S16 SchSendCfgCfm(pst, cfm) +Pst *pst; /* post structure */ +RgMngmt *cfm; /* config confirm structure */ +#endif +{ + printf("\nSending Scheduler config confirm to DU APP"); + RgMiLrgSchCfgCfm(pst, cfm); + + RETVALUE(ROK); +} + +/** + * @brief Layer Manager Configuration request handler. + * + * @details + * + * Function : MacSchCfgReq + * + * This function handles the gNB and cell configuration + * request received from DU APP. + * This API unapcks and forwards the config towards SCH + * + * @param[in] Pst *pst + * @param[in] RgrCfgTransId transId + * @param[in] RgrCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 MacSchCfgReq +( + Pst *pst, + RgrCfgTransId transId, + RgrCfgReqInfo *cfgReqInfo +) +#else +PUBLIC S16 MacSchCfgReq(pst, transId, cfgReqInfo) + Pst *pst; + RgrCfgTransId transId; + RgrCfgReqInfo *cfgReqInfo; +#endif +{ + printf("\nReceived Scheduler config at MAC"); + pst->dstInst = DEFAULT_CELLS + 1; + HandleSchCfgReq(pst, transId, cfgReqInfo); + + RETVALUE(ROK); + +} /* end of MacSchCfgReq*/ + /********************************************************************** diff --git a/src/5gnrmac/rg_ptui.c b/src/5gnrmac/rg_ptui.c index cfe0b7c13..2e5a8af68 100755 --- a/src/5gnrmac/rg_ptui.c +++ b/src/5gnrmac/rg_ptui.c @@ -678,14 +678,12 @@ RgrTtiIndInfo *ttiInd; PUBLIC S16 RgUiRgrCfgCfm ( Pst* pst, -SuId suId, RgrCfgTransId transId, U8 status ) #else -PUBLIC S16 RgUiRgrCfgCfm(pst, suId, transId, status) +PUBLIC S16 RgUiRgrCfgCfm(pst, transId, status) Pst* pst; -SuId suId; RgrCfgTransId transId; U8 status; #endif @@ -693,7 +691,7 @@ U8 status; TRC3(RgUiRgrCfgCfm); - RETVALUE((*RgUiRgrCfgCfmMt[pst->selector])(pst, suId, transId, status)); + RETVALUE((*RgUiRgrCfgCfmMt[pst->selector])(pst, transId, status)); } diff --git a/src/5gnrmac/rg_rom.c b/src/5gnrmac/rg_rom.c index 06886fff9..587d23ef7 100755 --- a/src/5gnrmac/rg_rom.c +++ b/src/5gnrmac/rg_rom.c @@ -136,6 +136,7 @@ Inst inst; RgRguDedDatReq *datReq; #endif { +#if 0 RgCellCb *cell; RgUeCb *ue; U8 idx1,idx2; @@ -304,7 +305,7 @@ RgRguDedDatReq *datReq; #ifdef CCPU_OPT boRpt.setMaxDlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduPrsnt; #endif - //TODO: commented for compilation without SCH RgMacSchDedBoUpdt(&schPst, &boRpt); + RgMacSchDedBoUpdt(&schPst, &boRpt); } } @@ -326,6 +327,7 @@ RgRguDedDatReq *datReq; #endif } /* for loop for num of Ue per TTI*/ +#endif /* Data send successfully to PHY. lets retuns ROK*/ RETVALUE(ROK); } /* rgROMDedDatReq */ diff --git a/src/5gnrmac/rg_sch.c b/src/5gnrmac/rg_sch.c deleted file mode 100755 index db5e0c826..000000000 --- a/src/5gnrmac/rg_sch.c +++ /dev/null @@ -1,3086 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch.c - -**********************************************************************/ - -/** @file rg_sch.c -@brief This file implements the schedulers main access to MAC layer code. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=185; -static int RLOG_MODULE_ID=4096; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system service interface */ -#include "cm_hash.h" /* common hash list */ -#include "cm_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ -#include "lrg.h" -#include "rgr.h" -#include "tfu.h" -#include "rgm.h" -#include "rg_env.h" -#include "rg_sch_inf.h" -#include "rg_sch.h" -#include "rg_sch_err.h" -#include "rg_sch_cmn.h" -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* TFU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for Scheduler */ -#include "rg_sch_cmn.x" - -#ifdef EMTC_ENABLE -EXTERN S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd)); -EXTERN S16 rgSCHGomEmtcHndlSiCfg ARGS(( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrSiCfgReqInfo *cfgReqInfo -)); -EXTERN S16 rgSCHGomEmtcHndlWarningSiCfg ARGS(( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo -)); -#endif -/* local defines */ -/************** LRG Interface ****************/ -/** - * @brief Layer Manager Configuration request handler. - * - * @details - * - * Function : RgMiLrgSchCfgReq - * - * This function handles the configuration - * request received at scheduler instance from the Layer Manager. - * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the - * functions rgHdlGenCfg() or rgHdlSapCfg(). - * -# Invokes RgMiLrgSchCfgCfm() to send back the confirmation to the LM. - * - * @param[in] Pst *pst, the post structure - * @param[in] RgMngmt *cfg, the configuration parameter's structure - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMiLrgSchCfgReq -( -Pst *pst, /* post structure */ -RgMngmt *cfg /* config structure */ -) -#else -PUBLIC S16 RgMiLrgSchCfgReq(pst, cfg) -Pst *pst; /* post structure */ -RgMngmt *cfg; /* config structure */ -#endif -{ - U16 ret = LCM_PRIM_OK; - U16 reason = LCM_REASON_NOT_APPL; - RgMngmt cfm; - Pst cfmPst; -#ifdef DEBUGP - Inst inst = (pst->dstInst - RGSCH_INST_START); -#endif - - TRC3(RgMiLrgSchCfgReq) - - - //if(pst->dstInst < RGSCH_INST_START) - //{ - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Invalid inst ID"); - RLOG_ARG2(L_DEBUG,DBG_INSTID,inst, "RgMiLrgSchCfgReq(): " - "pst->dstInst=%d RGSCH_INST_START=%d", pst->dstInst,RGSCH_INST_START); - //RETVALUE(ROK); - //} - - /* Fill the post structure for sending the confirmation */ - rgSCHLmmFillCfmPst(pst, &cfmPst, cfg); - - /* Initialize the cfg cfm structure - if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt)) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation"); - RETVALUE(ROK); - } */ - cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt)); - -#ifdef LMINT3 - cfm.hdr.transId = - cfg->hdr.transId; -#endif - - cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt; - switch(cfg->hdr.elmId.elmnt) - { - case STSCHINST: - reason = rgSCHLmmInstCfg(&cfg->t.cfg,pst->dstInst ); - break; - default: - ret = LCM_PRIM_NOK; - reason = LCM_REASON_INVALID_ELMNT; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid Elmnt=%d", cfg->hdr.elmId.elmnt); - break; - } - - if (reason != LCM_REASON_NOT_APPL) - { - ret = LCM_PRIM_NOK; - } - - cfm.cfm.status = ret; - cfm.cfm.reason = reason; - - RgMiLrgSchCfgCfm(&cfmPst, &cfm); - /* SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */ - - RETVALUE(ROK); -}/*-- RgMiLrgSchCfgReq --*/ - - -/** - * @brief Layer Manager Control request handler. - * - * @details - * - * Function : RgMiLrgSchCntrlReq - * - * This function handles the control - * request received from the Layer Manager. - * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action - * and cntrl->t.cntrl.subAction, it performs the appropriate control action - * of SAP (enable/disable) and layer shutdown. - * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM. - * - * @param[in] Pst *pst, the post structure - * @param[in] RgMngmt *cntrl, the control parameter's structure - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMiLrgSchCntrlReq -( -Pst *pst, /* post structure */ -RgMngmt *cntrl /* control structure */ -) -#else -PUBLIC S16 RgMiLrgSchCntrlReq(pst, cntrl) -Pst *pst; /* post structure */ -RgMngmt *cntrl; /* control structure */ -#endif -{ - S16 ret = ROK; /* return value */ - Pst cfmPst; - RgMngmt cfm; - - Inst inst = (pst->dstInst - RGSCH_INST_START); /* Scheduler instance Id */ - TRC3(RgMiLrgSchCntrlReq) - - - /* Fill the post structure for sending the confirmation */ - rgSCHLmmFillCfmPst(pst, &cfmPst, cntrl); - - /* Initialize the cfg cfm structure - if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt)) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation"); - SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); - RETVALUE(ROK); - } */ - cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt)); - -#ifdef LMINT3 - cfm.hdr.transId = - cntrl->hdr.transId; -#endif - - cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt; - cfm.t.cntrl.action = cntrl->t.cntrl.action; - cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction; - - /* Check if General Config Done*/ - if(rgSchCb[inst].rgSchInit.cfgDone != TRUE) - { - cfm.cfm.status = LCM_PRIM_NOK; - cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE; - cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt; - RgMiLrgSchCntrlCfm(&cfmPst, &cfm); - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done."); - /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */ - RETVALUE(ROK); - } - - /* General Config done, process the Control request */ - switch(cntrl->hdr.elmId.elmnt) - { - case STGEN: - rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst); - break; - case STTFUSAP: - case STRGRSAP: - rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst); - break; - default: - cfm.cfm.status = LCM_PRIM_NOK; - cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RgMiLrgSchCntrlCfm(&cfmPst, &cfm); - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d", - cntrl->hdr.elmId.elmnt); - break; - } - /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */ - RETVALUE(ret); -}/*-- RgMiLrgSchCntrlReq --*/ - -#ifdef LTE_L2_MEAS -/** - * @brief Layer Manager L2 Measurement request handler. - * - * @details - * - * Function : RgMiLrgSchL2MeasReq - * - * This function handles the control - * measurement request received from the Layer Manager. - * - * @param[in] Pst *pst, the post structure - * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMiLrgSchL2MeasReq -( -Pst *pst, /* post structure */ -LrgSchMeasReqInfo *measInfo /* Meas Req Info */ -) -#else -PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo) - Pst *pst; /* post structure */ - LrgSchMeasReqInfo *measInfo; /* Meas Req Info */ -#endif -{ - Pst cfmPst; - RgSchCellCb *cell; - RgSchErrInfo err; - S16 ret = ROK; - RgSchCb *instCb = &rgSchCb[(pst->dstInst - RGSCH_INST_START)]; -#if (ERRCLASS & ERRCLS_ADD_RES) - CmLList *lnk; -#endif - U32 idx; - RgSchL2MeasCb *measCb = NULLP; -#ifdef DEBUGP - Inst inst = (pst->dstInst - RGSCH_INST_START); /* Scheduler instance Id */ -#endif - - err.errType = 0; - err.errCause = 0; - - TRC3(RgMiLrgSchL2MeasReq) - - - /* Find the cellCb using cellId in measInfo. Iterate through all cells - * in rgrsapCb in RgschCb */ - cell = NULLP; - for (idx = 0; idx < instCb->numSaps; idx++) - { - if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) - { - /* got the cell break the loop */ - cell = instCb->rgrSap[idx].cell; - break; - } - } - /* If no cellCb return Err with Invalid Cell Id */ - if (cell == NULLP) - { - rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); - RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID); - rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE); - RLOG_ARG2(L_ERROR,DBG_INSTID,inst, - "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)", - err.errType, err.errCause); - RETVALUE(RFAILED); - } - /* Validate for Meas Types */ - if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK) - { - rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); - RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE); - rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE); - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "Meas req Failed.Invalid Measurement Type" - "errCasue(%d) errType(%d)", err.errType, err.errCause); - RETVALUE(RFAILED); - } - /* Iterate through all meas requests in l2mList in cellCb */ -#if (ERRCLASS & ERRCLS_ADD_RES) - lnk = cell->l2mList.first; - while(lnk != NULLP) - { - /* Get the MeasCb : RgSchL2MeasCb */ - measCb = (RgSchL2MeasCb *)lnk->node; - lnk = lnk->next; - if (measCb->measReq.hdr.transId == measInfo->hdr.transId) - { - rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); - RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID); - rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE); - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "Meas req Failed.Dublicate TransId" - "errType(%d) errCause(%d)", err.errType, err.errCause); - RETVALUE(RFAILED); - } - } -#endif - /* Call L2M Function to store Meas req */ - ret = rgSchL2mMeasReq(cell, measInfo, err); - if (ret != ROK) - { - rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); - RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED); - rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE); - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "Meas req Failed.errType(%d) errCause(%d)", - err.errType, err.errCause); - RETVALUE(RFAILED); - } - RETVALUE(ret); -} /* -- RRgMiLrgSchL2MeasReq-- */ - -/** - * @brief Layer Manager L2 Measurement Stop request handler. - * - * @details - * - * Function : RgMiLrgSchL2MeasStopReq - * - * This function handles the control - * measurement stop request received from the Layer Manager. - * - * @param[in] Pst *pst, the post structure - * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMiLrgSchL2MeasStopReq -( -Pst *pst, /* post structure */ -LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */ -) -#else -PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo) - Pst *pst; /* post structure */ - LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */ -#endif -{ - S16 ret = ROK; - RgSchCellCb *cell = NULLP; - RgSchCb *instCb = &rgSchCb[(pst->dstInst - RGSCH_INST_START)]; - CmLList *node = NULLP; - RgSchL2MeasCb *measCb = NULLP; - LrgSchMeasCfmInfo measCfm; - U8 idx; - - - TRC3(RgMiLrgSchL2MeasStopReq) - - - for (idx = 0; idx < instCb->numSaps; idx++) - { - if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) - { - /* got the cell break the loop */ - cell = instCb->rgrSap[idx].cell; - break; - } - } - if (cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, - "Stop req Failed.Invalid Cell Id "); - RETVALUE(RFAILED); - } - cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo)); - node = cell->l2mList.first; - while(node != NULLP) - { - measCb = (RgSchL2MeasCb *)(node)->node; - - node = (node)->next; - cmLListDelFrm(&cell->l2mList, &measCb->measLnk); - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, - sizeof(RgSchL2MeasCb)); - } - - if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) - { - RgInfL2MeasStopReq measStopReq; - Pst pstMac; - cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq)); - measStopReq.transId = measInfo->hdr.transId; - measStopReq.measType = measInfo->measType; - /* measReq.timePrd = measInfo->timePrd; */ - measStopReq.cellId = measInfo->cellId; - rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst); - RgSchMacL2MeasStop(&pstMac,&measStopReq); - } - else - { - RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst), - &measCfm); - } - RETVALUE(ret); -}/*RgMiLrgSchL2MeasStopReq*/ -/** - * @brief Layer Manager L2 Measurement request handler. - * for Send l2 measurement req - * @details - * - * Function : RgMiLrgSchL2MeasSendReq - * - * This function handles the control - * measurement send request received from the Layer Manager. - * - * @param[in] Pst *pst, the post structure - * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMiLrgSchL2MeasSendReq -( -Pst *pst, /* post structure */ -LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */ -) -#else -PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo) - Pst *pst; /* post structure */ - LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */ -#endif -{ - S16 ret = ROK; - RgSchCellCb *cell; - RgSchCb *instCb = &rgSchCb[(pst->dstInst - RGSCH_INST_START)]; - U8 idx; - - TRC3(RgMiLrgSchL2MeasSendReq) - - - - cell = NULLP; - for (idx = 0; idx < instCb->numSaps; idx++) - { - if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) - { - /* got the cell break the loop */ - cell = instCb->rgrSap[idx].cell; - break; - } - } - if (cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, - "Send req Failed.Invalid Cell Id"); - RETVALUE(RFAILED); - } - - if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) - { - RgInfL2MeasSndReq measSndReq; - Pst pstMac; - cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq)); - measSndReq.transId = measInfo->hdr.transId; - measSndReq.measType = measInfo->measType; - measSndReq.timePrd = measInfo->timePrd; - measSndReq.cellId = measInfo->cellId; - rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst); - RgSchMacL2MeasSend(&pstMac, &measSndReq); - } - else - { - cell->sndL2Meas = TRUE; - } - - RETVALUE(ret); -}/*RgMiLrgSchL2MeasSendReq*/ -#endif /* LTE_L2_MEAS */ - - - - -/************* RGR Interface ****************/ -/** - * @brief API for bind request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrBndReq - * - * This API is invoked by RRM towards MAC to bind RGR SAP. - * These API validates the Pst, spId, suId and sends the bind confirm to - * RRM. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] SpId spId - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrBndReq -( - Pst *pst, - SuId suId, - SpId spId - ) -#else -PUBLIC S16 RgUiRgrBndReq(pst, suId, spId) - Pst *pst; - SuId suId; - SpId spId; -#endif -{ - S16 ret = ROK; - Pst tmpPst; /* Temporary Post Structure */ - Inst instId = pst->dstInst-RGSCH_INST_START; - RgUstaDgn dgn; /* Alarm diagnostics structure */ - - TRC3(RgUiRgrBndReq) - - - tmpPst.prior = pst->prior; - tmpPst.route = pst->route; - tmpPst.selector = pst->selector; - tmpPst.region = rgSchCb[instId].rgSchInit.region; - tmpPst.pool = rgSchCb[instId].rgSchInit.pool; - tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId; - tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent; - tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + RGSCH_INST_START; - tmpPst.event = EVTNONE; - tmpPst.dstProcId = pst->srcProcId; - tmpPst.dstEnt = pst->srcEnt; - tmpPst.dstInst = pst->srcInst; - - if(spId < rgSchCb[instId].numSaps) - { - /* Check the state of the SAP */ - switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { - /* This case might not be needed if SAP not configured then it will go - * to else of above if condition */ - case LRG_UNBND: /* SAP is not bound */ - RLOG0(L_DEBUG,"SAP Not yet bound"); - rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND; - rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId; - /* Send Bind Confirm with status as SUCCESS */ - ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK); - /*Indicate to Layer manager */ - rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM); - ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE, - LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn); - break; - case LRG_BND: /* SAP is already bound*/ - RLOG0(L_DEBUG,"SAP is already bound"); - ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK); - break; - default: /* Should Never Enter here */ -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State:RgUiRrgBndReq failed\n"); -#endif - ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK); - break; - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state - to spId to avoid seg fault due to invalid sapID */ - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002, - (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n"); -#endif - ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK); - } - RETVALUE(ret); -} /* RgUiRgrBndReq */ - -/** - * @brief API for unbind request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrUbndReq - * - * This API is invoked by RRM towards MAC to unbind RGR SAP. - * These API validates the Pst, spId, suId and transfers the unbind request - * specific information to corresponding ownership module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] Reason reason - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrUbndReq -( - Pst *pst, - SpId spId, - Reason reason - ) -#else -PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason) - Pst *pst; - SpId spId; - Reason reason; -#endif -{ - Inst instId = pst->dstInst-RGSCH_INST_START; - TRC3(RgUiRgrUbndReq) - - - /* SAP Id validation */ - if (spId < rgSchCb[instId].numSaps) - { - switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { - case LRG_BND: /* SAP is already bound*/ - RLOG0(L_DEBUG,"SAP is already bound"); - /* setting SAP state to UN BOUND */ - rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND; - break; - default: -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgrUbndReq failed\n"); -#endif - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP Id:RgUiRgrUbndReq failed\n"); -#endif - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} /* RgUiRgrUbndReq */ - -/** - * @brief API for configuration request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrCfgReq - * - * This API is invoked by RRM towards MAC to configure MAC. - * These API validates the Pst, spId, suId and transfers the config request - * specific information to corresponding ownership module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrCfgReqInfo *cfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrCfgReq -( - Pst *pst, - SpId spId, - RgrCfgTransId transId, - RgrCfgReqInfo *cfgReqInfo - ) -#else -PUBLIC S16 RgUiRgrCfgReq(pst, spId, transId, cfgReqInfo) - Pst *pst; - SpId spId; - RgrCfgTransId transId; - RgrCfgReqInfo *cfgReqInfo; -#endif -{ - - S16 ret = ROK; - U8 cfmStatus = 0x00ff; - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - Inst instId = pst->dstInst-RGSCH_INST_START; - - TRC3(RgUiRgrCfgReq); - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if (cfgReqInfo == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer is NULL"); - rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - if (spId < rgSchCb[instId].numSaps) - { - switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { - case LRG_BND: /* SAP is already bound */ - RLOG0(L_DEBUG,"SAP is already bound"); - break; - default: /* Should never reach here */ -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG005, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgrCfgReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, - (Size)sizeof(*cfgReqInfo)); - rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG006, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, - "Invalid SAP Id:RgUiRgrCfgReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, - (Size)sizeof(*cfgReqInfo)); - rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - /* Handle configuration */ - ret = rgSCHGomHndlCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, - cfgReqInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Configuration Request Handling Failed"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* RgUiRgrCfgReq */ - -#ifdef RGR_SI_SCH -/** - * @brief API for SI configuration request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrSiCfgReq - * - * This API is invoked by RRM towards MAC to configure SI at MAC. - * These API validates the Pst, spId, suId and transfers the - * config request specific information to corresponding ownership - * module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrSiCfgReqInfo *cfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrSiCfgReq -( -Pst *pst, -SpId spId, -RgrCfgTransId transId, -RgrSiCfgReqInfo *cfgReqInfo -) -#else -PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo) -Pst *pst; -SpId spId; -RgrCfgTransId transId; -RgrSiCfgReqInfo *cfgReqInfo; -#endif -{ - S16 ret = ROK; - U8 cfmStatus = RGR_CFG_CFM_NOK; - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - Inst instId = pst->dstInst-RGSCH_INST_START; - - TRC2(RgUiRgrSiCfgReq); - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if (cfgReqInfo == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " - "is NULL"); - rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - if (spId < rgSchCb[instId].numSaps) - { - if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgrSiCfgReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, - (Size)sizeof(*cfgReqInfo)); - rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, - "Invalid SAP Id:RgUiRgrSiCfgReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, - (Size)sizeof(*cfgReqInfo)); - rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - /* Handle configuration */ -#ifdef EMTC_ENABLE -if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable) -{ - ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, - cfgReqInfo); -} -else -{ - ret = rgSCHGomHndlSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, - cfgReqInfo); -} - #else - ret = rgSCHGomHndlSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, - cfgReqInfo); - #endif - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:" - "Configuration Request Handling Failed"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* RgUiRgrSiCfgReq */ - - -/** - * @brief API for Warning SI configuration request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrWarningSiCfgReq - * - * This API is invoked by RRM towards MAC to configure SI at MAC. - * These API validates the Pst, spId, suId and transfers the - * config request specific information to corresponding ownership - * module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrWarningSiCfgReq -( -Pst *pst, -SpId spId, -RgrCfgTransId transId, -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo -) -#else -PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo) -Pst *pst; -SpId spId; -RgrCfgTransId transId; -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo; -#endif -{ - Inst instId = pst->dstInst-RGSCH_INST_START; - S16 ret = ROK; - U8 cfmStatus = RGR_CFG_CFM_NOK; - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - - TRC2(RgUiRgrWarningSiCfgReq); - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - - if (warningSiCfgReqInfo == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " - "is NULL"); - rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus); - RETVALUE(RFAILED); - } - - if (spId < rgSchCb[instId].numSaps) - { - if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: warningSiCfgReqInfo failed\n"); -#endif - rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, - &warningSiCfgReqInfo->siPduLst); - SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, - transId, cfmStatus); - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, - "Invalid SAP Id:warningSiCfgReqInfo failed\n"); -#endif - rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, - &warningSiCfgReqInfo->siPduLst); - SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, - transId, cfmStatus); - RETVALUE(RFAILED); - } - - /* Handle configuration */ -#ifdef EMTC_ENABLE -if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable) -{ - ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); -} -else -{ - ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); -} -#else - ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool, - &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); -#endif - if(ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId, - "Configuration Request Handling Failed"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} - - -/** - * @brief API for Warning SI Stop request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrWarningSiStopReq - * - * This API is invoked by RRM towards MAC to Stop warning SI at MAC. - * These API validates the Pst, spId, suId and transfers the - * stop request specific information to corresponding ownership - * module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SpId spId - * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrWarningSiStopReq -( -Pst *pst, -SpId spId, -RgrCfgTransId transId, -U8 siId -) -#else -PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId) -Pst *pst; -SpId spId; -RgrCfgTransId transId; -U8 siId; -#endif -{ - Inst instId = pst->dstInst-RGSCH_INST_START; - - TRC3(RgUiRgrWarningSiStopReq) - - - - if (spId < rgSchCb[instId].numSaps) - { - if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n"); -#endif - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, - "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n"); -#endif - RETVALUE(RFAILED); - } - - rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool, - &rgSchCb[instId], siId, transId, spId); - - RETVALUE(ROK); -} -#endif /*RGR_SI_SCH */ - -/* LTE_ADV_FLAG_REMOVED_START */ - -/** - * @brief API for LOAD INF request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgrLoadInfReq - * - * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC. - * These API validates the Pst, spId, suId and transfers the - * LOAD INF request to corresponding ownership - * module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrLoadInfReqInfo *loadInfReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgrLoadInfReq -( - Pst *pst, - SpId spId, - RgrCfgTransId transId, - RgrLoadInfReqInfo *loadInfReq - ) -#else -PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq) - Pst *pst; - SpId spId; - RgrCfgTransId transId; - RgrLoadInfReqInfo *loadInfReq; -#endif -{ - S16 ret = ROK; - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - Inst instId = pst->dstInst-RGSCH_INST_START; - - TRC2(RgUiRgrLoadInfReq); - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if (loadInfReq == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " - "is NULL"); - RETVALUE(RFAILED); - } - - if (spId < rgSchCb[instId].numSaps) - { - if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgrLoadInfReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq, - (Size)sizeof(*loadInfReq)); - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008, - (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, - "Invalid SAP Id:RgUiRgrLoadInfReq failed\n"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq, - (Size)sizeof(*loadInfReq)); - RETVALUE(RFAILED); - } - - /* Handle configuration */ - ret = rgSCHGomHndlLoadInf(pst->region, pst->pool, - &rgSchCb[(pst->dstInst - RGSCH_INST_START)], spId, transId, - loadInfReq); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId, - "Configuration Request Handling Failed"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* RgUiRgrLoadInfReq */ -/* LTE_ADV_FLAG_REMOVED_END */ - -/************** MAC SCH Interface **************/ -/** - * @brief Function for updating dedicated channel BO at scheduler from MAC. - * - * @details - * - * Function : rgMacSchDedBoUpdtReq - * - * This function shall be invoked whenever MAC gets staRsp from RLC - * Scheduler shall update BO in its dedicated logical channel control block. - * - * @param[in] Pst* pst - * @param[in] S16 cellSapId - * @param[in] RgInfDedBoRpt *boRpt - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchDedBoUpdtReq -( -Pst* pst, -RgInfDedBoRpt *boRpt -) -#else -PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt) -Pst* pst; -RgInfDedBoRpt *boRpt; -#endif -{ - RgSchCellCb *cell; - RgSchUeCb *ue; -#ifdef SCH_STATS - RgSchCmnDlUe *dlUe; -#endif - - - Inst inst = (pst->dstInst - RGSCH_INST_START); - S16 cellSapId = boRpt->cellSapId; - - TRC3(RgMacSchDedBoUpdtReq) -/* - RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():" - " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId); -*/ - /* No need to chk for cell being NULL as MAC wouldn't have found instance if - * it doesnt exist */ - cell = rgSchCb[inst].rgrSap[cellSapId].cell; - -#ifndef NO_ERRCLS - if (cell->cellId != boRpt->cellId) - { - /* Handle Cell fetch failure */ - RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId, - "rgMacSchDedBoUpdtReq(): Invalid cell Id"); - RETVALUE(RFAILED); - } -#endif - - /* Update Bo in the given logical channel of the UE */ - if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP) - { - RgSchDlLcCb *dlLc; - /* Honor BO Reports only from PCELL */ -#ifdef LTE_ADV - if (cell != ue->cell) - { - RETVALUE(RFAILED); - } -#endif - if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP) - { -#ifdef LTE_L2_MEAS - if(dlLc->lcType == CM_LTE_LCH_DTCH) - { - if((dlLc->bo == 0) &&(boRpt->bo != 0)) - { - /* UE is active */ - if(!(ue->qciActiveLCs[dlLc->qciCb->qci])) - { - dlLc->qciCb->dlUeCount++; - } - ue->qciActiveLCs[dlLc->qciCb->qci]++; - } - else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount)) - { - /* UE is inactive */ - if (ue->qciActiveLCs[dlLc->qciCb->qci]) - { - ue->qciActiveLCs[dlLc->qciCb->qci]--; - if (!(ue->qciActiveLCs[dlLc->qciCb->qci])) - { - dlLc->qciCb->dlUeCount--; - } - } - } - } -#endif -#ifdef SCH_STATS - dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); - if (boRpt->bo > dlLc->bo) - { - dlUe->boReported += (boRpt->bo - dlLc->bo); - } -#endif -#ifdef TENB_STATS - if (boRpt->bo > dlLc->bo) - { - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3); - } -#endif - /* RLC provides cumulative BO for each LC. - * Reduce the left out unscheduled bo from total bo and - * update the new BO to the total bo */ - if(ue->totalBo >= dlLc->bo) - { - ue->totalBo -= dlLc->bo; - } - else - { - ue->totalBo = 0; /* this case should not arise - * Resetting for safety */ - } - - ue->totalBo += boRpt->bo; - dlLc->bo = boRpt->bo; - dlLc->oldestSduArrTime = boRpt->oldestSduArrTime; - dlLc->staPduBo = boRpt->staPduBo; - - dlLc->setMaxUlPrio = boRpt->setMaxUlPrio; - dlLc->setMaxDlPrio = boRpt->setMaxDlPrio; - /* Update the scheduler */ - rgSCHUtlDlDedBoUpd(cell, ue, dlLc); - RETVALUE(ROK); - } - } - RETVALUE(RFAILED); - -} /* end of rgMacSchDedBoUpdtReq */ - - -/** - * @brief Function for updating common channel BO at scheduler from MAC. - * - * @details - * - * Function : RgMacSchCmnBoUpdtReq - * - * This function shall be invoked whenever MAC gets staRsp from RLC - * Scheduler shall update BO in its common logical channel control block. - * - * @param[in] Pst* pst - * @param[in] S16 cellSapId - * @param[in] RgInfCmnBoRpt *boRpt - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchCmnBoUpdtReq -( -Pst* pst, -RgInfCmnBoRpt *boRpt -) -#else -PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt) -Pst* pst; -RgInfCmnBoRpt *boRpt; -#endif -{ - RgSchCellCb *cell; - Inst inst = (pst->dstInst - RGSCH_INST_START); - S16 cellSapId = boRpt->cellSapId; - - TRC3(RgMacSchCmnBoUpdtReq) - - /* No need to chk for cell being NULL as MAC would not have found instance if - * it doesnt exist */ - cell = rgSchCb[inst].rgrSap[cellSapId].cell; - if (cell->cellId != boRpt->cellId) - { - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():" - "Invalid boRpt cell Id:%d",boRpt->cellId); - RETVALUE(RFAILED); - } - - /* handle status response on CCCH */ - if(boRpt->lcId == cell->dlCcchId) - { - RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():" - " BO update for CCCH"); - rgSCHUtlHndlCcchBoUpdt(cell, boRpt); - } - else - { - rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt); - } - - RETVALUE(ROK); -} /* end of RgMacSchCmnBoUpdtReq */ -/*Fix: start: Inform UE delete to scheduler*/ -/** - * @brief This API is used to send data indication to Scheduler instance from MAC. - * - * @details - * - * Function : rgMacSchUeDelInd - * - * This function shall be invoked whenever MAC gets Ue delete request. - * - * - * @param[in] Pst* pst - * @param[in] RgInfUeDelInd *ueDelInd - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchUeDelInd -( -Pst* pst, -RgInfUeDelInd *ueDelInd -) -#else -PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd) -Pst* pst; -RgInfUeDelInd *ueDelInd; -#endif -{ - RgSchCellCb *cell; - Inst inst = (pst->dstInst - RGSCH_INST_START); - S16 cellSapId = ueDelInd->cellSapId; - CmLList *tmp; - RgSchRntiLnk *rntiLnk=NULL; - - TRC3(RgMacSchUeDelInd) - - if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured"); - RETVALUE(ROK); - } - cell = rgSchCb[inst].rgrSap[cellSapId].cell; -#ifndef NO_ERRCLS - if (cell->cellId != ueDelInd->cellId) - { - /* Handle Cell fetch failure */ - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d", - ueDelInd->cellId); - RETVALUE(ROK); - } -#endif - - CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp); - - while(tmp) - { - rntiLnk = (RgSchRntiLnk *)(tmp->node); - if(rntiLnk->rnti == ueDelInd->rnti) - { - cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp); - tmp->node = NULLP; - rgSCHDbmRlsRnti(cell, rntiLnk); - RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, - "RNTI:%d Released from the Guard pool(%ld)", - ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count); - - break; - } - CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp); - } - -#ifdef EMTC_ENABLE - rgEmtcMacSchUeDelInd(cell,ueDelInd); -#endif - - if(tmp == NULLP) - { - /* Fix : syed HO UE does not have a valid ue->rntiLnk */ - RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the" - "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count); - } - - RETVALUE(ROK); -} /* rgMacSchUeDelInd */ -/*Fix: end: Inform UE delete to scheduler*/ -/** - * @brief This API is used to send data indication to Scheduler instance from MAC. - * - * @details - * - * Function : rgMacSchSfRecpInd - * - * This function shall be invoked whenever MAC gets datInd on TFU - * Scheduler shall act on the CEs and data that are received as part of - * datInd. - * - * @param[in] Pst* pst - * @param[in] S16 cellSapId - * @param[in] CmLteRnti rnti - * @param[in] DatIndInfo *datInd - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchSfRecpInd -( -Pst* pst, -RgInfSfDatInd *subfrmInfo -) -#else -PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo) -Pst* pst; -RgInfSfDatInd *subfrmInfo; -#endif -{ - S16 ret = RFAILED; - RgSchErrInfo err; - RgSchUeCb *ue; - RgInfUeDatInd *datInd; - RgSchCellCb *cell; - Inst inst = (pst->dstInst - RGSCH_INST_START); - CmLteRnti rnti; - CmLListCp *lnkLst; - CmLList *tmp; - S16 cellSapId = subfrmInfo->cellSapId; - RgrUeStaIndInfo *ueStaInd; -#ifdef RG_UNUSED -//#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe ; -#endif - /* RRM_RBC_X */ - U32 idx; - /* RRM_RBC_Y */ - -#ifdef LTE_L2_MEAS - U8 qci; - U16 datIndActQci = 0; - U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */ - U16 tempUeActQci = 0; /* UE specific Active QCIs */ - U16 diffBits = 0; - U8 lcCount; -#endif - TRC3(RgMacSchSfRecpInd) - - /* No need to chk for cell being NULL as MAC wouldn't have found instance if - * it doesnt exist */ - cell = rgSchCb[inst].rgrSap[cellSapId].cell; - - /* lnkLst assignment */ - lnkLst = &(subfrmInfo->ueLst); - - CM_LLIST_FIRST_NODE(lnkLst, tmp); - - while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP)) - { - ue = NULLP; -#ifdef LTE_L2_MEAS - qci = 0; -#endif - datInd = (RgInfUeDatInd *)tmp->node; - rnti = datInd->rnti; - - /* We shall try and find - * out the RaCb based on the following - - * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3. - * 2. If the incoming PDU contained a CRNTI control element, i.e. we should - * have a ueCb also for this - */ - - /* It could be that a non-msg3 pdu contains a CRNTI Control element. We - * should check for CRNTI CE and if it exists the UECb must exist, also an - * if the CRNTI in the CE and the one with which the message came in are - * different we shall look for an raCb as well. - */ - if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT) - { - /* SR_RACH_STATS : CRNTI CE*/ - rgNumMsg3CrntiCE++; - - if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT) - { - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Received MSG3 with CRNTI:%d and also CCCH ", - datInd->ceInfo.ces.cRnti); - RETVALUE(RFAILED); - } - ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti); - if (ue == NULLP) - { - /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/ - rgNumCrntiCeCrntiNotFound++; - /* ccpu00141318 - Removed condition for SPS rnti checking*/ - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 " - "with CRNTI:%d unable to find ueCb", - datInd->ceInfo.ces.cRnti); - RETVALUE(RFAILED); - } - - if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, - rnti, datInd, &err)) != ROK) - { - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d", - datInd->rnti); - RETVALUE(RFAILED); - } - -#ifdef LTEMAC_SPS - rgSCHUtlHdlCrntiCE (cell, ue); -#endif - ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd, - sizeof(RgrUeStaIndInfo)); - if(ret == ROK) - { - ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD; -#ifdef RG_UNUSED -//#ifdef LTEMAC_SPS - ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue); - if(ulSpsUe->isUlSpsActv) - { - ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE; - ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE; - } -#endif - ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd); - if(ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Could not Send Ue Sta Ind UEID:%d",ue->ueId); - } - } - CM_LLIST_NEXT_NODE(lnkLst, tmp); - continue; - } /* end of CRNTI based message */ - else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT) - { - /* SR_RACH_STATS : CCCH SDU */ - rgNumMsg3CCCHSdu++; - /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/ - if (NULLP == rgSCHDbmGetRaCb (cell, rnti)) - { - rgNumCCCHSduCrntiNotFound++; - } - - if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, - rnti, datInd, &err)) != ROK) - { - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d", - datInd->rnti); - RETVALUE(RFAILED); - } - /* fix */ - CM_LLIST_NEXT_NODE(lnkLst, tmp); - continue; - } /* end of Msg3 processing */ - - if (ue == NULLP) - { - ue = rgSCHDbmGetUeCb (cell, datInd->rnti); - if (ue == NULLP) - { -#ifdef LTEMAC_SPS - if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP) -#endif - { - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d", - datInd->rnti); - RETVALUE(RFAILED); - } - } - } -/* L2_COUNTERS */ -#ifdef LTE_L2_MEAS - /* The LCs for which data is received at MAC is provided to SCH. - This information is used to estimate the Active LCs at UE - since estimates based on only BSR is not accurate */ - if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT) - { - - /* Compose a Bitmask with for the QCI's for which Data - is received */ - for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++) - { - if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid)) - { - datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1)); - } - } - if (ue->ulActiveLCs && ue->lastDatIndLCs) - { - /* Combine previous Dat Ind and current Dat Ind to - estimate active LCs at UE */ - combDatIndActQci = ue->lastDatIndLCs | datIndActQci; - tempUeActQci = ue->ulActiveLCs; - ue->ulActiveLCs = combDatIndActQci; - diffBits = combDatIndActQci ^ tempUeActQci; - while (diffBits) - { - qci++; - if (0x1 & diffBits) - { - if (0x1 & tempUeActQci) - { - /* An active QCI has become inactive */ - cell->qciArray[qci].ulUeCount--; - } - else - { - /* An Inactive QCI has become active */ - cell->qciArray[qci].ulUeCount++; - } - } - diffBits >>= 1; - tempUeActQci >>= 1; - } - } - ue->lastDatIndLCs = datIndActQci; - - } - -#endif /* LTE_L2_MEAS */ - /* Just copy the timing information from the dat indication into the one - * stored in the UE CB, will be later utilized to handle Timing advance - */ - - if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK) - { - RGSCH_FREE_MEM(subfrmInfo); - err.errType = RGSCHERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data" - " Indication for UEID:%d",ue->ueId); - RETVALUE(RFAILED); - } - - CM_LLIST_NEXT_NODE(lnkLst, tmp); - } - /* RRM_RBC_X */ - /* update the UL PRB usage for all GBR QCIs*/ - for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++) - { - cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx]; - } - /* RRM_RBC_Y */ - - /* chk if Sch needs to dealloc datInd after unpk */ - RGSCH_FREE_MEM(subfrmInfo); - RETVALUE(ret); -} /* rgMacSchSfRecpInd */ - -#ifdef LTEMAC_SPS -/** - * @brief Function to handle relInd from MAC for a UE - * - * @details - * - * Function: RgMacSchSpsRelInd - * - * Handler for processing relInd for UL SPS of a UE - * - * Invoked by: - * MAC - * - * Processing Steps: - * - * @param[in] Pst *pst - * @param[in] RgInfSpsRelInfo *relInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchSpsRelInd -( -Pst *pst, -RgInfSpsRelInfo *relInfo -) -#else -PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo) -Pst *pst; -RgInfSpsRelInfo *relInfo; -#endif -{ - RgSchUeCb *ue; - RgSchCellCb *cell; - Inst inst = (pst->dstInst - RGSCH_INST_START); - - TRC2(RgMacSchSpsRelInd); - - /* No need to chk for cell being NULL as MAC wouldn't have found instance if - * it doesnt exist */ - cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell; - - if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "No Ue exists with CRNTI:%d",relInfo->cRnti); - RETVALUE(RFAILED); - } - - if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "RelInd processing for CRNTI:%d failed",relInfo->cRnti); - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} /* end of RgMacSchSpsRelInd */ -#endif /* LTEMAC_SPS */ - -#ifdef LTE_L2_MEAS - -/** - * @brief Function to handle L2MeasCfm from MAC - * - * @details - * - * Function: RgMacSchL2MeasCfm - * - * Handler for processing L2 measurement confirm - * - * Invoked by: - * MAC - * - * Processing Steps: - * - * @param[in] Pst *pst - * @param[in] RgInfL2MeasCfm *measCfm - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchL2MeasCfm -( -Pst *pst, -RgInfL2MeasCfm *measCfm -) -#else -PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm) -Pst *pst; -RgInfL2MeasCfm *measCfm; -#endif -{ - RgSchCellCb *cell = NULLP; - Inst inst = (pst->dstInst - RGSCH_INST_START); - CmLList *lnk; - RgSchL2MeasCb *measCb = NULLP; - RgSchCb *instCb = &rgSchCb[inst]; - U32 idx; - LrgSchMeasCfmInfo schMeasCfm; - U8 qciVal; - U8 idx1; /*LTE_L2_MEAS_PHASE2*/ - U8 qciVal1; - TRC2(RgMacSchL2MeasCfm); - - /* Find the cellCb using cellId in measInfo. Iterate through all cells - * in rgrsapCb in RgschCb */ - for (idx = 0; idx < instCb->numSaps; idx++) - { - if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId) - { - /* got the cell break the loop */ - cell = instCb->rgrSap[idx].cell; - break; - } - } - /* If no cellCb return Err with Invalid Cell Id */ - if (cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId, - "Meas Cfm Failed.Invalid Cell Id"); - RETVALUE(RFAILED); - } - - - /* Iterate through all meas requests in l2mList in cellCb */ - lnk = cell->l2mList.first; - while(lnk != NULLP) - { - /* Get the MeasCb : RgSchL2MeasCb */ - measCb = (RgSchL2MeasCb *)lnk->node; - lnk = lnk->next; - if (measCb->measReq.hdr.transId == measCfm->transId) - { - break; - } - } - if ( measCb == NULLP ) - { - RETVALUE( RFAILED ); - } - - - if(measCfm->cfm.status != LCM_PRIM_OK) - { - for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++) - { - qciVal = measCb->measReq.avgPrbQciUl.qci[idx]; - cell->qciArray[qciVal].qci = 0; - } - /* Delete this measCb, send the negative confirmation to - * stack manager */ - cmLListDelFrm(&cell->l2mList, &measCb->measLnk); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb)); - cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo)); - schMeasCfm.measType = measCfm->measType; - schMeasCfm.cfm = measCfm->cfm; - schMeasCfm.hdr.transId = measCfm->transId; - schMeasCfm.cellId = measCfm->cellId; - RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm); - RETVALUE(ROK); - } - for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++) - { - measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage; - measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue; - /*LTE_L2_MEAS_PHASE2*/ - qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue; - for(idx1=0;idx1measReq.avgPrbQciUl.numQci;idx1++) - { - if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1) - { - break; - } - } - if(idx1 == measCb->measReq.avgPrbQciUl.numQci) - { - measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1; - } - } - measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci; - measCb->cfmRcvd = TRUE; - cell->sndL2Meas = TRUE; - RETVALUE(ROK); -} /* end of RgMacSchL2MeasCfm */ - -/** - * @brief Function to handle L2MeasStopCfm from MAC - * - * @details - * - * Function: RgMacSchL2MeasStopCfm - * - * Handler for processing L2 measurement confirm - * - * Invoked by: - * MAC - * - * Processing Steps: - * - * @param[in] Pst *pst - * @param[in] RgInfL2MeasCfm *measCfm - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgMacSchL2MeasStopCfm -( -Pst *pst, -RgInfL2MeasCfm *measCfm -) -#else -PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm) -Pst *pst; -RgInfL2MeasCfm *measCfm; -#endif -{ - LrgSchMeasCfmInfo schMeasCfm; - Inst inst = (pst->dstInst - RGSCH_INST_START); - RgSchCb *instCb = &rgSchCb[inst]; - - TRC2(RgMacSchL2MeasStopCfm); - - cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo)); - schMeasCfm.measType = measCfm->measType; - schMeasCfm.cfm = measCfm->cfm; - schMeasCfm.hdr.transId = measCfm->transId; - schMeasCfm.cellId = measCfm->cellId; - RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm); - RETVALUE(ROK); -} -#endif - -/************** TFU Interface *************/ - -/** - * @brief Bind confirm API for TFU SAP on scheduler instance. - * - * @details - * - * Function : RgLiTfuSchBndCfm - * - * This API is invoked by PHY to confirm TFU SAP bind. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuSchBndCfm -( -Pst *pst, -SuId suId, -U8 status -) -#else -PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status) -Pst *pst; -SuId suId; -U8 status; -#endif -{ - S16 ret; - RgSchLowSapCb *tfuSap; - Inst instId = pst->dstInst - RGSCH_INST_START; - - TRC3(RgLiTfuSchBndCfm); - - - if(suId >= rgSchCb[instId].numSaps) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId"); - RETVALUE(RFAILED); - } - /* Lets validate suId first */ - tfuSap = &(rgSchCb[instId].tfuSap[suId]); - - if (suId != tfuSap->sapCfg.suId) - { - RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)" - "Recieved (%d)", tfuSap->sapCfg.suId, suId); - RETVALUE(RFAILED); - } - ret = rgSCHLmmBndCfm (pst, suId, status); - RETVALUE(ret); -} /* RgLiTfuSchBndCfm */ - -/** - * @brief Random Access Request indication from PHY. - * - * @details - * - * Function : RgLiTfuRaReqInd - * - * This API is invoked by PHY to send Random Access Request to Scheduler. - * This API contains information for Random Access Request including - * raRnti, list of associated RAPIDs and related information. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuRaReqIndInfo *raReqInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuRaReqInd -( -Pst *pst, -SuId suId, -TfuRaReqIndInfo *raReqInd -) -#else -PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd) -Pst *pst; -SuId suId; -TfuRaReqIndInfo *raReqInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuRaReqInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(raReqInd); - RETVALUE(ret); - } - - if(raReqInd == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed"); - RETVALUE(RFAILED); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists"); - RETVALUE(RFAILED); - } - - ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(raReqInd); - /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd, - sizeof(TfuRaReqIndInfo)); */ - RETVALUE(ret); -} /* RgLiTfuRaReqInd */ - -/** - * @brief Uplink CQI indication from PHY. - * - * @details - * - * Function : RgLiTfuUlCqiInd - * - * This API is invoked by PHY to send Uplink CQI to Scheduler. - * This API contains Uplink CQI information reported per UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuUlCqiIndInfo *ulCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuUlCqiInd -( -Pst *pst, -SuId suId, -TfuUlCqiIndInfo *ulCqiInd -) -#else -PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd) -Pst *pst; -SuId suId; -TfuUlCqiIndInfo *ulCqiInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuUlCqiInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(ulCqiInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(ulCqiInd); - RETVALUE(RFAILED); - } - ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(ulCqiInd); - RETVALUE(ret); -} /* RgLiTfuUlCqiInd */ - -/** - * @brief PUCCH power adjustment indication. - * - * @details - * - * Function : RgLiTfuPucchDeltaPwrInd - * - * This API is invoked by PHY to send PUCCH power adjustment - * indication. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuPucchDeltaPwrInd -( -Pst *pst, -SuId suId, -TfuPucchDeltaPwrIndInfo *pucchDeltaPwr -) -#else -PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr) -Pst *pst; -SuId suId; -TfuPucchDeltaPwrIndInfo *pucchDeltaPwr; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuPucchDeltaPwrInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(pucchDeltaPwr); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } - ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(pucchDeltaPwr); - RETVALUE(ret); -} /* RgLiTfuPucchDeltaPwrInd */ - - -/** - * @brief HARQ ACK indication from PHY for Downlink transmissions. - * - * @details - * - * Function : RgLiTfuHqInd - * - * This API is invoked by PHY to send HARQ ACK information to Scheduler - * on recieving HARQ ACK/NACK from UEs. - * This API contains HARQ ACK information recieved by PHY for downlink - * transmissions. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuHqIndInfo *harqAckInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuHqInd -( -Pst *pst, -SuId suId, -TfuHqIndInfo *harqAckInd -) -#else -PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd) -Pst *pst; -SuId suId; -TfuHqIndInfo *harqAckInd; -#endif -{ - S16 ret; - Inst inst = (pst->dstInst - RGSCH_INST_START); - - TRC3(RgLiTfuHqInd); - -#ifndef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - RGSCH_FREE_MEM(harqAckInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } -#endif - - /* Now call the TOM (Tfu ownership module) primitive to process further */ - ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(harqAckInd); - RETVALUE(ret); -} /* RgLiTfuHqInd */ - - -/** - * @brief Scheduling request(SR) indication from PHY for an UE. - * - * @details - * - * Function : RgLiTfuSrInd - * - * This API is invoked by PHY to send Scheduling request information to - * Scheduler on recieving SR from a list of UEs. - * This API contains scheduling request information recieved by PHY for UEs. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuSrIndInfo *srInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuSrInd -( -Pst *pst, -SuId suId, -TfuSrIndInfo *srInd -) -#else -PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd) -Pst *pst; -SuId suId; -TfuSrIndInfo *srInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuSrInd); - -#ifndef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed"); - RGSCH_FREE_MEM(srInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists"); - RETVALUE(RFAILED); - } -#endif - /* Now call the TOM (Tfu ownership module) primitive to process further */ - ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(srInd); - RETVALUE(ret); -} /* RgLiTfuSrInd */ - - -/** - * @brief Downlink CQI indication from PHY for an UE. - * - * @details - * - * Function : RgLiTfuDlCqiInd - * - * This API is invoked by PHY to send Downlink CQI indication to Scheduler - * on recieving downlink CQI from UE. - * This API contains downlink CQI information recieved by PHY for an UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuDlCqiIndInfo *dlCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuDlCqiInd -( -Pst *pst, -SuId suId, -TfuDlCqiIndInfo *dlCqiInd -) -#else -PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd) -Pst *pst; -SuId suId; -TfuDlCqiIndInfo *dlCqiInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuDlCqiInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(dlCqiInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } - ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(dlCqiInd); - RETVALUE(ret); -} /* RgLiTfuDlCqiInd */ -#ifdef TFU_UPGRADE - -/** - * @brief Raw CQI indication from PHY for an UE. - * - * @details - * - * Function : RgLiTfuRawCqiInd - * - * This API is invoked by PHY to send Raw CQI indication to Scheduler - * on receiving Raw CQI from UE. - * This API contains Raw CQI information recieved by PHY for an UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuRawCqiIndInfo *rawCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuRawCqiInd -( -Pst *pst, -SuId suId, -TfuRawCqiIndInfo *rawCqiInd -) -#else -PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd) -Pst *pst; -SuId suId; -TfuRawCqiIndInfo *rawCqiInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuRawCqiInd); - -#ifdef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(rawCqiInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists"); - RETVALUE(RFAILED); - } -#endif - ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(rawCqiInd); - RETVALUE(ret); -} /* RgLiTfuRawCqiInd */ - -/** - * @brief SRS indication from PHY for an UE. - * - * @details - * - * Function : RgLiTfuSrsInd - * - * This API is invoked by PHY to send UL SRS indication to Scheduler - * on receiving a SRS from UE. - * This API contains SRS information recieved by PHY for an UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuSrsIndInfo *srsInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuSrsInd -( -Pst *pst, -SuId suId, -TfuSrsIndInfo *srsInd -) -#else -PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd) -Pst *pst; -SuId suId; -TfuSrsIndInfo *srsInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuSrsInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(srsInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } - ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(srsInd); - RETVALUE(ret); -} /* RgLiTfuSrsInd */ - -#endif - -/** - * @brief DOA indication from PHY for an UE. - * - * @details - * - * Function : RgLiTfuDoaInd - * - * This API is invoked by PHY to send Direction Of Arrival to Scheduler - * on calculating DOA at PHYSICAL LAYER for an UE. - * This API contains DOA information calculated by PHY for an UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuDoaIndInfo *doaInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuDoaInd -( -Pst *pst, -SuId suId, -TfuDoaIndInfo *doaInd -) -#else -PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd) -Pst *pst; -SuId suId; -TfuDoaIndInfo *doaInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC2(RgLiTfuDoaInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(doaInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } - ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(doaInd); - RETVALUE(ret); -} /* RgLiTfuDlCqiInd */ - -/** - * @brief CRC indication from PHY. - * - * @details - * - * Function : RgLiTfuCrcInd - * - * This API is invoked by PHY to give CRC indication to scheduler. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuCrcIndInfo *crcInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuCrcInd -( -Pst *pst, -SuId suId, -TfuCrcIndInfo *crcInd -) -#else -PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd) -Pst *pst; -SuId suId; -TfuCrcIndInfo *crcInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuCrcInd); -#ifdef XEON_SPECIFIC_CHANGES -struct timeval start6, end6; -gettimeofday(&start6, NULL); -#endif -#ifndef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - RGSCH_FREE_MEM(crcInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } -#endif - - /* Now call the TOM (Tfu ownership module) primitive to process further */ - ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(crcInd); -#ifdef XEON_SPECIFIC_CHANGES -gettimeofday(&end6, NULL); -#endif - RETVALUE(ret); -} /* RgLiTfuCrcInd */ - -/** - * @brief Timing Advance indication from PHY. - * - * @details - * - * Function : RgLiTfuTimingAdvInd - * - * This API is invoked by PHY to indicate timing advance to Scheduler for - * an UE. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuTimingAdvIndInfo *timingAdvInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuTimingAdvInd -( -Pst *pst, -SuId suId, -TfuTimingAdvIndInfo *timingAdvInd -) -#else -PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd) -Pst *pst; -SuId suId; -TfuTimingAdvIndInfo *timingAdvInd; -#endif -{ - S16 ret; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuTimingAdvInd); - - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(timingAdvInd); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } - /* Now call the TOM (Tfu ownership module) primitive to process further */ - ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd); - /* Free up the memory for the request structure */ - RGSCH_FREE_MEM(timingAdvInd); - RETVALUE(ret); -} /* RgLiTfuTimingAdvInd */ - - -/** - * @brief Transmission time interval indication from PHY. - * - * @details - * - * Function : RgLiTfuSchTtiInd - * - * This API is invoked by PHY to indicate TTI indication to Scheduler for - * a cell. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuTtiIndInfo *ttiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuSchTtiInd -( -Pst *pst, -SuId suId, -TfuTtiIndInfo *ttiInd -) -#else -PUBLIC S16 RgLiTfuSchTtiInd(pst, suId, ttiInd) -Pst *pst; -SuId suId; -TfuTtiIndInfo *ttiInd; -#endif -{ - S16 ret = ROK; - Inst inst = pst->dstInst-RGSCH_INST_START; - - TRC3(RgLiTfuSchTtiInd); - - - /* Removing the validation with every TTI - for optimization */ -#ifndef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - RETVALUE(ret); - } -#endif - /* Moved check for cell outside ERRCLS*/ - - /* Now call the TOM (Tfu ownership module) primitive to process further */ - rgSCHTomTtiInd(ttiInd, inst); - - RETVALUE(ret); -} /* RgLiTfuSchTtiInd */ - -/************* RGM Interface ****************/ -/** - * @brief API for bind request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgmBndReq - * - * This API is invoked by RRM towards MAC to bind RGM SAP. - * These API validates the Pst, spId, suId and sends the bind confirm to - * RRM. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] SpId spId - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgmBndReq -( -Pst *pst, -SuId suId, -SpId spId -) -#else -PUBLIC S16 RgUiRgmBndReq(pst, suId, spId) -Pst *pst; -SuId suId; -SpId spId; -#endif -{ - S16 ret = ROK; - Pst tmpPst; /* Temporary Post Structure */ - Inst instId = pst->dstInst-RGSCH_INST_START; - - TRC3(RgUiRgmBndReq) - - - tmpPst.prior = pst->prior; - tmpPst.route = pst->route; - tmpPst.selector = pst->selector; - tmpPst.region = rgSchCb[instId].rgSchInit.region; - tmpPst.pool = rgSchCb[instId].rgSchInit.pool; - - tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId; - tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent; - tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + RGSCH_INST_START; - - tmpPst.event = EVTNONE; - - tmpPst.dstProcId = pst->srcProcId; - tmpPst.dstEnt = pst->srcEnt; - tmpPst.dstInst = pst->srcInst; - - /*TODO remove follo statement*/ - rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND; - - if(spId < rgSchCb[instId].numSaps) - { - /* Check the state of the SAP */ - switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState) - { - /* This case might not be needed if SAP not configured then it will go - * to else of above if condition */ - case LRG_UNBND: /* SAP is not bound */ - RLOG0(L_DEBUG,"SAP is not yet bound"); - rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND; - rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId; - /* Send Bind Confirm with status as SUCCESS */ - ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK); - /*Indicate to Layer manager */ - break; - case LRG_BND: /* SAP is already bound*/ - RLOG0(L_DEBUG,"SAP is already bound"); - ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK); - break; - default: /* Should Never Enter here */ -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, - (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, - "Invalid SAP State:RgUiRgmBndReq failed\n"); -#endif - ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK); - break; - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) -/* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state - to spId to avoid seg fault due to invalid sapID */ - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002, - (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n"); -#endif - ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK); - } - RETVALUE(ret); -} /* RgUiRgmBndReq */ - -/** - * @brief API for unbind request from RRM towards MAC. - * - * @details - * - * Function: RgUiRgmUbndReq - * - * This API is invoked by RRM towards MAC to unbind RGM SAP. - * These API validates the Pst, spId, suId and transfers the unbind request - * specific information to corresponding ownership module (GOM) API. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] Reason reason - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgmUbndReq -( -Pst *pst, -SpId spId, -Reason reason -) -#else -PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason) -Pst *pst; -SpId spId; -Reason reason; -#endif -{ - Inst instId = pst->dstInst-RGSCH_INST_START; - TRC3(RgUiRgmUbndReq) - - - /* SAP Id validation */ - if (spId < rgSchCb[instId].numSaps) - { - switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState) - { - case LRG_BND: /* SAP is already bound*/ - /* setting SAP state to UN BOUND */ - RLOG0(L_DEBUG,"SAP is already bound"); - rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND; - break; - default: -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003, - (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, - "Invalid SAP State: RgUiRgmUbndReq failed\n"); -#endif - RETVALUE(RFAILED); - } - } - else - { -#if (ERRCLASS & ERRCLS_ADD_RES) - RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, - (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, - "Invalid SAP Id:RgUiRgmUbndReq failed\n"); -#endif - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} /* RgUiRgmUbndReq */ - - -/** - * @brief API for start or stop PRB reporting from RRM towards MAC. - * - * @details - * - * Function: RgUiRgmCfgPrbRprt - * - * This API is invoked by RRM towards MAC to start or stop calculating - * Average PRB usage in downlink and uplink. The average PRB usage will - * be reported to RRM based on confiured periodicity. - * - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] SpId spId - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgUiRgmCfgPrbRprt -( -Pst *pst, -SpId spId, -RgmPrbRprtCfg *prbRprtCfg -) -#else -PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg) -Pst *pst; -SpId spId; -RgmPrbRprtCfg *prbRprtCfg; -#endif -{ -/* Initalize*/ - RgSchCellCb *cell; - RgSchPrbUsage *prbUsage; - Inst inst = (pst->dstInst - RGSCH_INST_START); - - TRC2(RgUiRgmCfgPrbRprt); - cell = rgSchCb[inst].rgmSap[spId].cell; - prbUsage = &cell->prbUsage; - prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType; - prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty; - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1); - - /* clear the qciPrbRpts for all GBR QCIs */ - cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0, - (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage))); - - RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, - "RgUiRgmCfgPrbRprt config type %d with the report period %d", - prbUsage->prbRprtEnabld,prbUsage->rprtPeriod); - - /* ccpu00134393 : mem leak fix */ - SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg)); - - RETVALUE(ROK); -} -/** - * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission. - * - * @details - * - * Function : RgLiTfuErrInd - * - * This API is invoked by PHY to send ERROR INDICATION to scheduler - * Currently invoked in the cases when the Unlicensed SCell transmission - * fails. - * This API contains the Cell and subframe information for which the - * transmission failed. - * - * @param[in] Pst *pst - * @param[in] SuId suId - * @param[in] TfuErrIndInfo *errIndInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 RgLiTfuErrInd -( -Pst *pst, -SuId suId, -TfuErrIndInfo *errInd -) -#else -PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd) -Pst *pst; -SuId suId; -TfuErrIndInfo *errInd; -#endif -{ - S16 ret = ROK; -#ifdef LTE_ADV - Inst inst = (pst->dstInst - RGSCH_INST_START); -#endif - - TRC3(RgLiTfuErrInd); - -#ifndef NO_ERRCLS - if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) - { - - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); - RETVALUE(ret); - } - - if (rgSchCb[inst].tfuSap[suId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); - RETVALUE(RFAILED); - } -#endif - -#ifdef LTE_ADV - /* Now call the TOM (Tfu ownership module) primitive to process further */ - ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd); -#endif - RETVALUE(ret); -} /* RgLiTfuErrInd */ - - - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch.x b/src/5gnrmac/rg_sch.x deleted file mode 100755 index ae310fb32..000000000 --- a/src/5gnrmac/rg_sch.x +++ /dev/null @@ -1,5564 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/********************************************************************** - - Name: LTE MAC layer - - Type: C include file - - Desc: Defines required by LTE MAC - - File: rg_sch.x - -**********************************************************************/ -/** @file rg_sch.x -@brief This file contains basic data structures for the scheuler. -*/ - -#ifdef TENB_STATS -#include "pj_tenb_stats.x" -#endif - -#ifndef __SCH__ -#define __SCH__ - -#ifdef TENB_STATS -#include "l2_tenb_stats.x" -#endif - -#ifdef EMTC_ENABLE -#include "rg_sch_emtc.x" -#endif - -typedef struct rgSchHistNode -{ - U32 line; - S8* file; - const S8* func; - Void * dbgVal; /* This is specific to the data struct being debug - for example if the debugging is done fo list - then this should contain the node address */ - U32 action; -}RgSchHistNode; - -#define MAX_HIST_NODES 50 - -#define RGSCH_ACTION_ADD 11 -#define RGSCH_ACTION_DEL 12 - -typedef struct rgSchHistInfo -{ - U32 histCount; - RgSchHistNode hist[MAX_HIST_NODES]; -}RgSchHistInfo; - -#define RG_SCH_RECORD(_histInfo,_action,_dbgVal)\ -{\ - (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].file = __FILE__;\ - (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].func = __FUNCTION__;\ - (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].line = __LINE__;\ - (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].action = _action;\ - (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].dbgVal = _dbgVal;\ - (_histInfo)->histCount++;\ -} - - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef TfuDciFormat1aInfo RgDciFmt1AInfo; -typedef TfuRaReqInfo RgTfuRaReqInfo; -typedef TfuSubbandCqiInfo RgSchSubbandCqiInfo; -typedef TfuHqIndInfo RgTfuHqIndInfo; -typedef TfuHqInfo RgTfuHqInfo; -typedef TfuCntrlReqInfo RgTfuCntrlReqInfo; - -/* Forward declarations for some structures */ -#ifdef LTE_L2_MEAS -typedef struct rgSchL2MeasCb RgSchL2MeasCb; -#endif /* LTE_L2_MEAS */ -typedef struct rgSchQciCb RgSchQciCb; -typedef struct rgSchUeCb RgSchUeCb; -typedef struct rgSchCellCb RgSchCellCb; -typedef struct rgSchErrInfo RgSchErrInfo; -typedef struct rgSchUlAlloc RgSchUlAlloc; -typedef struct rgSchUlRetxAlloc RgSchUlRetxAlloc; -typedef struct rgSchUlHqProcCb RgSchUlHqProcCb; -typedef struct rgSchDlHqProcCb RgSchDlHqProcCb; -/* Changes for MIMO feature addition */ -/* Removed dependency on MIMO compile-time flag */ -typedef struct rgSchDlHqTbCb RgSchDlHqTbCb; -typedef struct rgSchLcgCb RgSchLcgCb; -typedef struct rgSchDlHqEnt RgSchDlHqEnt; -typedef struct rgSchRaCb RgSchRaCb; -typedef struct _rgSchCb RgSchCb; -typedef struct rgSchUlLcCb RgSchUlLcCb; -typedef struct rgSchDlLcCb RgSchDlLcCb; -typedef struct _rgSchdApis RgSchdApis; -#ifdef LTE_TDD -typedef struct rgSchTddPhichOffInfo RgSchTddPhichOffInfo; -typedef U8 RgSchTddNpValTbl[RGSCH_TDD_MAX_P_PLUS_ONE_VAL]; -#endif -/* Added support for SPS*/ -#ifdef LTEMAC_SPS -typedef struct rgSchDlSfAllocInfo RgSchDlSfAllocInfo; -#endif - -typedef struct rgSchUeCellInfo RgSchUeCellInfo; -/** - * @brief - * Scheduler APIs - */ -struct _rgSchdApis -{ - S16 (*rgSCHRgrUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg, - RgSchErrInfo *err)); - S16 (*rgSCHRgrUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg, - RgSchErrInfo *err)); - Void (*rgSCHFreeUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); - S16 (*rgSCHRgrCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg, - RgSchErrInfo *err)); - S16 (*rgSCHRgrCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg, - RgSchErrInfo *err)); - Void (*rgSCHFreeCell) ARGS((RgSchCellCb *cell)); - S16 (*rgSCHRgrLchCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *dl, RgrLchCfg *cfg, RgSchErrInfo *errInfo)); - S16 (*rgSCHRgrLcgCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchLcgCb *lcg, RgrLcgCfg *cfg, RgSchErrInfo *errInfo)); - S16 (*rgSCHRgrLchRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *dl, RgrLchRecfg *recfg, - RgSchErrInfo *errInfo)); - S16 (*rgSCHRgrLcgRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchLcgCb *lcg, RgrLcgRecfg *recfg, RgSchErrInfo *errInfo)); - Void (*rgSCHFreeDlLc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *dlLc)); - Void (*rgSCHFreeLcg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *lcg)); - S16 (*rgSCHRgrLchDel) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,CmLteLcId lcId, \ - U8 lcgId)); - Void (*rgSCHActvtUlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); - Void (*rgSCHActvtDlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); - Void (*rgSCHHdlUlTransInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - CmLteTimingInfo timingInfo)); - Void (*rgSCHUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); - S16 (*rgSCHUpdBsrShort) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, U8 bsr, RgSchErrInfo *err)); - S16 (*rgSCHUpdBsrTrunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, U8 bsr, RgSchErrInfo *err)); - S16 (*rgSCHUpdBsrLong) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 bsArr[], RgSchErrInfo *err)); - S16 (*rgSCHUpdPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 phr, RgSchErrInfo *err)); - S16 (*rgSCHUpdExtPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err)); -#ifdef RG_UNUSED - S16 (*rgSCHUpdUlHqProc) ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc, - RgSchUlHqProcCb *oldProc)); -#endif - S16 (*rgSCHContResUlGrant) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchErrInfo *err)); - S16 (*rgSCHSrRcvd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo, RgSchErrInfo *err)); - S16 (*rgSCHTti) ARGS((RgSchCellCb *cell, RgSchErrInfo *err)); - Void (*rgSCHUlCqiInd) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, TfuUlCqiRpt *ulCqiInfo)); - Void (*rgSCHPucchDeltaPwrInd) ARGS(( RgSchCellCb *cell, - RgSchUeCb *ue, S8 delta)); - S16 (*rgSCHlUeReset) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue)); - Void (*rgSCHDlDedBoUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc)); - /* ccpu00105914: PHR handling for MSG3 */ - Void (*rgSCHUlRecMsg3Alloc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchRaCb *raCb)); - Void (*rgSCHUlHqProcForUe) ARGS((RgSchCellCb *cell, CmLteTimingInfo frm, - RgSchUeCb *ue, RgSchUlHqProcCb **procRef)); - RgSchUlAlloc *(*rgSCHFirstRcptnReq) ARGS((RgSchCellCb *cell)); - RgSchUlAlloc *(*rgSCHNextRcptnReq) ARGS((RgSchCellCb *cell, - RgSchUlAlloc *alloc)); - RgSchUlAlloc *(*rgSCHFirstHqFdbkAlloc) ARGS((RgSchCellCb *cell, U8 idx)); - RgSchUlAlloc *(*rgSCHNextHqFdbkAlloc) ARGS((RgSchCellCb *cell, - RgSchUlAlloc *alloc,U8 idx)); - Void (*rgSCHDlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchDlHqProcCb *hqP)); - Void (*rgSCHDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - Bool isPucchInfo, Void *dlCqi, CmLteTimingInfo timingInfo)); -/* Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE -Void (*rgSCHSrsInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - TfuSrsRpt* srsInd, CmLteTimingInfo timingInfo)); -#endif - - Void (*rgSCHDlTARpt) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); - /* Changes for MIMO feature addition */ - /* Removed dependency on MIMO compile-time flag */ - Void (*rgSCHDlRlsSubFrm) ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm)); - /* Added support for SPS*/ -#ifdef LTEMAC_SPS - Void (*rgSCHHdlCrntiCE) ARGS((RgSchCellCb *cell, RgSchUeCb * ue)); - Void (*rgSCHDlProcAck) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); - Void (*rgSCHDlProcDtx) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); - Void (*rgSCHDlRelPdcchFbk) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, - U8 isAck)); - Void (*rgSCHUlSpsRelInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, - Bool isExplRel)); - - Void (*rgSCHUlSpsActInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, - U16 sduSuze)); - - Void (*rgSCHUlCrcFailInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, - CmLteTimingInfo crcTime)); - Void (*rgSCHUlCrcInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, - CmLteTimingInfo crcTime)); -#endif /* LTEMAC_SPS */ - Void (*rgSCHDrxStrtInActvTmrInUl) ARGS((RgSchCellCb *cell)); - Void (*rgSCHUpdUeDataIndLcg) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, RgInfUeDatInd *datInd)); -#ifdef LTE_ADV - S16 (*rgSCHRgrSCellUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue ,RgrUeSecCellCfg *sCellInfoCfg, - RgSchErrInfo *err)); - S16 (*rgSCHRgrSCellUeDel) ARGS((RgSchUeCellInfo *sCellInfo, RgSchUeCb *ue)); -#endif -#ifdef EMTC_ENABLE - Void (*rgSCHUlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchUlHqProcCb *hqP)); -#endif -}; - -/* Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE - -/** -* @brief Periodic CQI/PMI/RI configuration parameters information -*/ -typedef RgrUePrdDlCqiCfg RgSchUeDlPCqiCfg; - -/** -* @brief Periodic CQI Setup configuration parameters information -*/ -/* Reference: 36.313: CQI-ReportPeriodic */ -typedef RgrUeDlPCqiSetup RgSchUeDlPCqiSetup; - -/** -* @brief SRS configuration parameters information -*/ -/* Reference 36.313 SoundingRS-UL-Config */ - -typedef RgrUeUlSrsCfg RgSchUeUlSrsCfg; - - -/** -* @brief SRS configuration setup parameters information -*/ -/* Reference 36.313 SoundingRS-UL-Config */ - -typedef RgrUeUlSrsSetupCfg RgSchUeSrsUlSetupCfg; - -/** -* @brief SR configuration parameters information -*/ - -typedef RgrUeSrCfg RgSchUeSrCfg; - -/** -* @brief SR Setup configuration parameters information -*/ - -typedef RgrUeSrSetupCfg RgSchUeSrSetupCfg; - -#define IOT_INVALID_FREQSTART 0xffffffff -#define IOT_INFINITE_SIZE 0xffffffff -#define RGSCH_IOT_PDCCH_POOLSZ 100 -#define RGSCH_IOT_PDSCH_POOLSZ 100 -#define RGSCH_IOT_PUSCH_POOLSZ 100 -#define RGSCH_IOT_PUCCH_POOLSZ 100 -#define RGSCH_IOT_SCHED_POOLSZ 100 -/* TODO: Minimum Delta between CRNT Time and TX time */ -#define RGSCH_IOT_PDCCH_DELTA RG_SCH_CMN_DL_DELTA -#define RGSCH_IOT_PDSCH_DELTA RG_SCH_CMN_DL_DELTA - 1 /* UL_CNTRL_DELTA value is 2*/ -#define RGSCH_IOT_PUCCH_DELTA 6 -#define RGSCH_IOT_PUSCH_DELTA 6 -#define RGSCH_IOT_PDCCH_MAXFREQSZ 24 /* MAX num of eCCEs per SF */ -#define RGSCH_IOT_PDSCH_MAXFREQSZ 100 /* MAX num of PDSCH RB per SF */ -#define RGSCH_IOT_PUCCH_MAXFREQSZ 2048 /* MAx num of PUCCH resource per SF */ -#define RGSCH_IOT_PUSCH_MAXFREQSZ 100 /* MAx num of PUSCh RB per SF */ -#define RGSCH_IOT_SCHED_MAXFREQSZ 1 /*Resource only in Time domain */ -#define RGSCH_IOT_PUCCH_INVALID_FREQ 2049 -/** - * @brief - * IoT PDCCH/PDSCH/PUSCH/PUCCH resource definition. - * For Iot Devices resource can span multiple subframes - * Hence resource is defined as a set of freq resources - * over a set of consecutive valid subframes - */ -typedef struct rgSchIotRes -{ - U32 resType; - PTR allctdBy; - CmLteTimingInfo timeStart; - CmLteTimingInfo timeEnd; - U32 tSize; - U8 freqStart; - U8 freqEnd; - U32 fSize; - CmLList lnk; /*!< Link to other Fragments or Allocs in resMngmt */ - CmLList cbLnk; /*!< Link to other allocs in a given control block (ueCb) */ - CmLList resLnk;/*! 1*/ - U32 aCqiTrigWt; /* Metric to track Aperiodic CQI Trigger occassion */ - RgSchCqiReqField cqiReqField; /* Cqi Request field. This Value can be 00 01 10 11, based upon - the cell present in which trigger list form App */ -}RgSchUeACqiCb; - -typedef enum -{ - RG_SCH_FDD_PCQI_TBL = 0, - RG_SCH_TDD_PCQI_TBL, - RG_SCH_RI_TBL, - RG_SCH_FDD_SRS_TBL, - RG_SCH_TDD_SRS_TBL, - RG_SCH_SR_TBL -} RgSchPerTbl; - -/*ccpu00116923 - ADD - SRS present support*/ -#ifdef LTE_TDD -typedef U8 RgSchTddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES]; -#else -typedef U8 RgSchFddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES]; -#endif - - -#endif - - - -#ifdef LTE_TDD -/** - * @brief - * Enum to define the type of Downlink subframe. - */ -typedef enum -{ - RG_SCH_SPL_SF_NO_DATA = 0, - RG_SCH_SPL_SF_DATA, - RG_SCH_DL_SF_0, - RG_SCH_DL_SF -}RgSchTddSfType; -/** - * @brief - * TDD UE specific PUCCH recpetion information. - */ -typedef struct rgSchUePucchRecpInfo -{ - CmHashListEnt hashLstEnt; /*!< List of PUCCH for receiving - ACK/NACK feedback information */ - TfuUeRecpReqInfo *pucchRecpInfo; /*!< UE PUCCH Reception information */ -} RgSchUePucchRecpInfo; - -/** - * @brief - * TDD switch point information. - */ -typedef struct rgSchTddSubfrmInfo -{ - U8 switchPoints; /*!< Number of DL-UL switch points */ - U8 numFrmHf1; /*!< Number of subframes for half frame 1 - Present for both 5ms and 10ms periodicity */ - U8 numFrmHf2; /*!< Number of subframes for half frame 2 - Present only for 5ms periodicity */ -} RgSchTddSubfrmInfo; - -/** - * @brief - * TDD DL Association Set information. - */ -typedef struct rgSchTddDlAscSetIdxK -{ - U8 numFdbkSubfrms; /*!< Number of Feedbacks for DL Subframes */ - U8 subfrmNum[RGSCH_NUM_SUB_FRAMES-1]; /*!< List of Subframe Number */ -} RgSchTddDlAscSetIdxK; - -/** @brief PRACH Information for a frequency resource. */ -typedef struct rgrSchTddPrachInfo -{ - U8 freqIdx; /*!< Frequency Index */ - U8 sfn; /*!< Even/Odd/All Radio Frames */ - U8 halfFrm; /*!< First/Second Half Frame */ - U8 ulStartSfIdx; /*!< Uplink Start Subframe Index*/ -} RgSchTddPrachInfo; - -/** @brief PRACH resource Information for each of the - * frequency resources. */ -typedef struct rgrSchTddPrachRscInfo -{ - U8 numRsc; /*!< Number of frequency resources*/ - RgSchTddPrachInfo prachInfo[RGSCH_TDD_MAX_FREQ_RSRC]; /*!< PRACH Information */ -} RgSchTddPrachRscInfo; - -/** - * @brief - * TDD Special subframe configuration information. - */ -struct rgSchTddSplSubfrmInfo -{ - U8 norDlDwPts; /*!< DL Normal CP: DwPTS in Ts */ - U8 norDlNorUpPts; /*!< DL Normal CP: UL Normal CP:UpPTS in Ts */ - U8 norDlExtUpPts; /*!< DL Normal CP: UL Extended CP: UpPTS in Ts */ - U8 extDlDwPts; /*!< DL Extended CP: DwPTS in Ts */ - U8 extDlNorUpPts; /*!< DL Extended CP: UL Normal CP:UpPTS in Ts */ - U8 extDlExtUpPts; /*!< DL Extended CP: UL Extended CP: UpPTS in Ts */ -}; - -/** - * @brief - * RACH response awaiting scheduling from the current time is - * identified with sfn offset and subframe. - */ -typedef struct rgSchTddRachRspInfo -{ - U8 sfnOffset; /*!< SFN offset with respect to - expected RACH available for - scheduling */ - U8 numSubfrms; /* Number of subframes present */ - U8 subframe[RGSCH_NUM_SUB_FRAMES]; /*!< List of Subframe numbers */ -} RgSchTddRachRspInfo; - -typedef RgSchTddRachRspInfo RgSchTddRachDelInfo; - -/** - * @brief - * List of awaiting RACH responses for scheduling across radio frames. - * - */ -typedef struct rgSchTddRachRspLst -{ - U8 numRadiofrms; /*!< Number of radio frames */ - RgSchTddRachRspInfo rachRsp[2]; /*!< RACH Occasions for which response - can be sent */ - RgSchTddRachDelInfo delInfo; /*!< Previous RACH responses for - which the scheduling deadline - has expired. So those responses - can be deleted */ -} RgSchTddRachRspLst; - -/** - * @brief - * Uplink association index information indicates the SFN offset and - * subframe in which DL HARQ ACK/NACK is expected. - */ -typedef struct rgSchTddUlAscInfo -{ - U8 subframe; /*!< Subframe number */ - U8 sfnOffset; /*!< SFN offset with respect to expected - UL data reception time */ -} RgSchTddUlAscInfo; - -/** - * @brief - * PUSCH information indicates the SFN offset and - * subframe in which UL data is scheduled. - */ -typedef struct rgSchTddPuschOffInfo -{ - U8 subframe; /*!< Subframe number */ - U8 sfnOffset; /*!< SFN offset with respect to expected - UL data reception time */ -} RgSchTddPuschOffInfo; - -/** - * @brief - * PHICH information indicates the SFN offset and - * subframe for which PHICH should be sent. - */ -struct rgSchTddPhichOffInfo -{ - U8 numSubfrms; /*!< Number of subframes */ -/* ACC-TDD */ - U8 subframe; /*!< The Uplink Subframe number corresponding - to the phich */ - U8 sfnOffset; /*!< SFN offset with respect to expected - UL data reception time */ -}; - -/** - * @brief - * DL feedback reception information indicates the SFN offset - * and subframe at which feedback is expected. - */ -typedef struct rgSchTddDlFdbkInfo -{ - U8 subframe; /*!< Subframe number */ - U8 sfnOffset; /*!< SFN offset with respect to current - scheduled time */ - U8 m; /*!< m factor used in Downlink Association - Set Index */ -#ifdef LTE_ADV /*Naw:: This is not correct */ - CmLListCp n1PucchResLst; /*!< List for storing the used N1 resource */ -#endif -} RgSchTddDlFdbkInfo; - - -/** - * @brief - * Special subframe configuration index. - */ -typedef struct rgSchTddSplSubfrmCfg -{ - U16 dwPts; /*!< DwPTS in OFDM Symbol Duration */ - U16 upPts; /*!< UpPTS in OFDM Symbol Duration */ - Bool isDlDataAllowed; /*!< To allow scheduling of DL data on - special subframe */ -} RgSchTddSplSubfrmCfg; - -/** - * @brief - * ACK/NACK information to be used for ACK/NACK bundling mode. - */ -typedef struct rgSchTddANInfo -{ - U16 sfn; /*!< ACK/NACK is sent for PDU in this SFN */ - U8 subframe; /*!< ACK/NACK is sent for PDU in this subframe */ - U8 dlDai; /*!< Downlink Assignment Index for - UL-DL Configuration 1-6 */ - U8 ulDai; /*!< DAI for uplink */ - U8 latestMIdx; /*!< Last transmitted DL subframe 'm' index */ - U8 n1ResTpcIdx; /*!< N1 Res idx for scell assigned in TPC command */ - Bool isSpsOccasion; /*!< To indicate the presence of SPS occasion */ -#ifdef LTE_ADV - U8 wUlDai; /*!< Max Ul dai in all the cells */ -#endif -} RgSchTddANInfo; -#endif - -/** - * @brief - * Information about one MCS entry. - */ -typedef struct rgSchUlIMcsInfo -{ - U8 qm; - U8 iTbs; -} RgSchUlIMcsTbl[29]; -EXTERN RgSchUlIMcsTbl rgUlIMcsTbl; - -typedef struct rgSchUeCatTbl -{ - U32 maxUlBits;/*Maximum number of - bits of an UL-SCH - transport block - transmitted within a - TTI*/ - U32 maxDlBits[4];/*Maximum number of - bits of a DLSCH - transport block - received within a TTI*/ -/* correcting DL harq softbuffer limitation logic */ - U32 maxSftChBits;/*Total number of soft channel bits*/ - Bool ul64qamSup;/*Support for 64QAM in UL*/ -/* Changes for MIMO feature addition */ -/* Removed dependency on MIMO compile-time flag */ - U32 maxDlTbBits;/*Maximum number of DL-SCH - transport block bits - received within a TTI*/ - U8 maxTxLyrs;/*Maximum number of supported - layers for spatial multiplexing - in DL*/ -} RgSchUeCatTbl[CM_MAX_UE_CAT_SUPP + 1]; -EXTERN RgSchUeCatTbl rgUeCatTbl; - -/* Changes for MIMO feature addition */ -/* Removed dependency on MIMO compile-time flag */ -typedef U32 RgSchTbSzTbl[RGSCH_MAX_NUM_LYR_PERCW][RGSCH_NUM_ITBS][RGSCH_MAX_NUM_RB]; - -#ifdef LTE_TDD -typedef U8 RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_TDD_RA_PREAMBLE_FMT+1]; -#else -/* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA - sub-frames from preamble format */ -typedef U8 RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_RA_PREAMBLE_FMT+1]; -#endif -EXTERN RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl; - -EXTERN U8 rgRvTable[4]; - -typedef struct rgDciFmt -{ - U8 dciType; - union - { - RgDciFmt1AInfo dci1a; - } dci; -} RgDciFmt; - -typedef enum rgSchPdcchSearchSpace -{ - RG_SCH_UE_SPECIFIC_SEARCH_SPACE, - RG_SCH_CMN_SEARCH_SPACE, -}RgSchPdcchSearchSpace; - -/** - * @brief - * Information about one PDCCH. - */ -typedef struct rgSchPdcch { - U8 nCce; /*!< CCE index */ - CmLteAggrLvl aggrLvl; /*!< Aggregation level */ - TfuDciInfo dci; /*!< PDCCH format */ - U16 rnti; /*!< RNTI to who the PDCCH is allocated */ -#if (defined (LTE_TDD)) - U8 dlDai; /*!< DAI associated with this PDCCH. - THis is used for F1BCS resource calulcation */ -#endif - /* Added support for SPS*/ -#ifdef LTEMAC_SPS - CmLteTimingInfo relFbkTiming; /*!< Feebback timing information for release - PDCCH */ - Bool isSpsRnti; /*!< TRUE if rnti is SPS RNTI */ - U16 crnti; /*!< CRNTI to who the PDCCH is allocated */ -#endif - CmLList lnk; /*!< To link PDCCHs in a subframe */ -#ifdef EMTC_ENABLE - Void *emtcPdcch; -#endif - RgSchUeCb *ue; /*!< Pointer to the UE Control Block */ - RgSchPdcchSearchSpace pdcchSearchSpace; /*!< Search Space from this PDCCH allocated */ - U8 dciNumOfBits; /*!< Size of DCI in bits */ -} RgSchPdcch; - -/** - * @brief - * PDCCH information for cell. - */ -typedef struct rgSchPdcchInfo { - U8 *map; /*!< Bit map of PDCCHs */ - U8 currCfi; /*!< Number of CCEs */ - U16 nCce; /*!< Total CCEs */ - CmLListCp pdcchs; /*!< List of RgSchPdcch */ -} RgSchPdcchInfo; - -typedef struct rgSchPhich -{ - CmLList lnk; /*!< To link PHICHs in a subframe */ - U8 hqFeedBack; /*!< Harq Feed Back */ - U8 rbStart; /*!< Starting RB */ - U8 nDmrs; /*!< 3 bits for DMRS cyclic shift */ - /* changes for passing iphich at TFU;*/ - Bool isForMsg3; /*! < Phich Ack/Nack conveyed for MSG 3 */ -#ifdef LTE_TDD - U8 iPhich; /*!< For determining phich group */ -#endif -} RgSchPhich; - -typedef struct rgSchPhichInfo -{ - CmLListCp phichs; /*!< List of RgSchPhich */ -} RgSchPhichInfo; - -typedef struct rgSchBcchTb -{ - RgSchPdcch *pdcch; - Buffer *tb; - U16 tbSize; -} RgSchBcchTb; - -typedef struct rgSchPcchTb -{ - RgSchPdcch *pdcch; - Buffer *tb; - U16 tbSize; -} RgSchPcchTb; - -typedef struct rgSchRaRspAlloc -{ - U16 raRnti; - U32 tbSz; - TknU8 backOffInd; /*!< Backoff index value */ - CmLListCp raRspLst; /*!< List of RaCbs */ - CmLListCp contFreeUeLst; /*! List of HandOver or PdcchOrder UEs */ - RgSchPdcch *pdcch; /*!< NULLP if no Rsp allocation done for raRnti*/ -}RgSchRaRspAlloc; - -typedef struct rgSchBchTb -{ - Buffer *tb; /*!< BCH data for this frame */ - U16 tbSize; /*!< Non-Zero if bch data is scheduled for this SF */ -}RgSchBchTb; - -/* Added support for SPS*/ -#ifdef LTEMAC_SPS -/** - * TODO: check compilation - @brief Downlink Resource allocation type information. */ -struct rgSchDlSfAllocInfo -{ - U32 raType0Mask; /*!< RBG allocation mask for type 0*/ - U32 raType1Mask[RG_SCH_NUM_RATYPE1_32BIT_MASK]; /*!< RA Type 1 - allocation mask */ - U32 raType1UsedRbs[RG_SCH_NUM_RATYPE1_32BIT_MASK];/*!< RA Type 1 Used RBs - per subset */ - U32 nxtRbgSubset; /*!< Next RBG subset to be used for allocation */ - U32 raType2Mask[RG_SCH_NUM_RATYPE2_32BIT_MASK]; - /*!< Mask for resource allocation type 2 */ -}; -#endif /* LTEMAC_SPS */ - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - @brief RGR RB range for SFR */ -typedef struct rgrPwrHiCCRange -{ - U8 startRb; /*ueLst */ - Void * laaCb; - CmLListCp hqPLst; /*!< This is a list of hq proc per DL - SF which are scheduled in that SF. - The number of harq procs awaiting - feedback for the same subframe depends on - mode TDD or FDD and max number of Carriers - that can be aggregated */ -#ifdef LTE_ADV - RgSchN3PucchRes n3ScellPucch; -#endif -}RgSchDlHqInfo; - -/*CA Dev End*/ -/** @brief This structure contains the Measurement gap configuration for an UE. - */ -typedef struct rgUeMeasGapCfg -{ - Bool isMesGapEnabled; /*!< Is Measuremnet gap enabled or disabled */ - U8 gapPrd; /*!< Gap period 40ms/80ms */ - U8 gapOffst; /*!< Gap offset - Vaue is 0 to 1*/ -} RgUeMeasGapCfg; - -/** - @brief Measurement Gap related information per UE. */ -typedef struct rgSchUeMeasGapCb -{ - Bool isMesGapEnabled;/*!< TRUE if Measurement gap is enabled for this UE */ - U8 isMeasuring; /*!< Set to TRUE during measurement gap */ - U8 gapPrd; /*!< Measurement gap period configuration for the UE */ - U8 gapOffst; /*!< Measurement gap offset for the UE */ - CmLList measQLnk; /*!< To Link to the measurement gap list */ - CmLList ackNakQLnk; /*!< To Link to the ACK NACK Rep list */ - CmTimer measGapTmr; /*!< Timer for Measurement Gap */ - CmTimer measGapUlInactvTmr; /*!< UL Inactive timer for measurement gap */ - CmTimer measGapDlInactvTmr; /*!< DL Inactive timer for measurement gap */ -} RgSchUeMeasGapCb; - -/** - @brief ACK-NACK repetition related information per UE. */ -typedef struct rgSchUeAckNakRepCb -{ - Bool isAckNackEnabled; /*!< Is ACK/NACK Enabled*/ - U8 isAckNakRep; /*!< Set to TRUE during ACK-NACK repetition prd */ - U8 cfgRepCnt; /*!< Configured value for the repetition counter */ - U8 repCntr; /*!< Actual repetition counter */ - U16 pucchRes; /*!< PUCCH resource for repetition */ - CmTimer ackNakRepUlInactvTmr; /*!< UL Inactive timer for ack-nack repetition */ - CmTimer ackNakRepDlInactvTmr; /*!< DL Inactive timer for ack-nack repetition */ - CmTimer ackNakRepTmr; /*!< Timer for ack-nack repetition */ - CmLList ackNakRepLnk; /*!< ACK NACK repetition queue link */ - CmLListCp *prsntQ; /*!< Pointer to the Queue that this UE is current - present in. */ -} RgSchUeAckNakRepCb; - -/** - * @brief - * UE's MIMO specific information. - */ -typedef struct rgSchUeMimoInfo -{ - RgrTxMode oldTMode; /*!< UE's Previous Transmission Mode */ - RgrTxMode txMode; /*!< UE's Transmission Mode */ - TknU32 doa; /*!< DOA indicator for this UE */ - Bool puschFdbkVld; /*!< True if Precoding Info in PDCCH has to be - in-accordance with the latest PUSCH report */ - TfuDlCqiPuschInfo puschPmiInfo; /*!< PUSCH report details for explicit PMI - * information to PHY during a PDSCH */ - RgrCodeBookRstCfg cdbkSbstRstrctn; /*!< Codebook subset restriction defined as per - * 36.331 section 6.3.2. As of now, this info - * is not processed by MAC. SCH shall use the - * PMI reported by UE unconditionally.*/ -#ifdef DL_LA - S32 txModUpChgFactor; /*!< tx mode chnage factor for step up*/ - S32 txModDownChgFactor; /*!< tx mode chnage factor for step - Down*/ -#endif -}RgSchUeMimoInfo; - -/* Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH for Aperiodic Mode 3-1. -*/ -typedef struct rgSchCqiRawPuschMode31 -{ - U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ - U8 totLenSbDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */ - U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/ - U8 r1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank = 1*/ - U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/ - U8 rg1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank > 1*/ - U8 r1PmiBitLen; /*!< Length of PMI Bits for Rank = 1*/ - U8 rg1PmiBitLen; /*!< Length of PMI Bits for Rank > 1*/ -} RgSchCqiRawPuschMode31; - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH for Aperiodic Mode 3-0. -*/ -typedef struct rgSchCqiRawPuschMode30 -{ - U8 wideBCqiCw; /*!< Length of Wideband CQI */ - U8 totLenSbDiffCqi; /*!< Length of SubBand Differential CQI */ -} RgSchCqiRawPuschMode30; - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH for Aperiodic Mode 2-2. -*/ -typedef struct rgSchCqiRawPuschMode22 -{ - U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ - U8 sBDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */ - U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1 */ - U8 r1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank =1*/ - U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/ - U8 rg1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank >1*/ - U8 posOfM; /*!< Position of M selected SubBands */ - U8 r1PmiBitLen; /*!< Length of PMI Bits for Rank =1*/ - U8 rg1PmiBitLen; /*!< Length of PMI Bits for Rank >1*/ -} RgSchCqiRawPuschMode22; - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH for Aperiodic Mode 2-0. -*/ -typedef struct rgSchCqiRawPuschMode20 -{ - U8 wideBCqiCw; /*!< Length of Wideband CQI */ - U8 subBandDiffCqi; /*!< Length of SubBand Differential CQI */ - U8 posOfM; /*!< Position of M selected SubBands */ -} RgSchCqiRawPuschMode20; - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH for Aperiodic Mode 1-2. -*/ -typedef struct rgSchCqiRawPuschMode12 -{ - U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ - U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/ - U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword for Rank > 1 */ - U8 r1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank =1 */ - U8 rg1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank > 1 */ -} RgSchCqiRawPuschMode12; - - -/** @brief This structure that stores the length of Bits that -* will be received over PUSCH. -*/ -typedef struct rgSchDlCqiRawPusch -{ - TfuDlCqiPuschMode mode; /*!< PUSCH CQI mode */ - TknU8 ri; /*!< Rank Indicator for TM 3,4 */ - union - { - RgSchCqiRawPuschMode12 mode12Info; /*!< Mode 1-2 information */ - RgSchCqiRawPuschMode20 mode20Info; /*!< Mode 2-0 information */ - RgSchCqiRawPuschMode22 mode22Info; /*!< Mode 2-2 information */ - RgSchCqiRawPuschMode30 mode30Info; /*!< Mode 3-0 information */ - RgSchCqiRawPuschMode31 mode31Info; /*!< Mode 3-1 information */ - }u; -} RgSchDlCqiRawPusch; - -typedef struct rgSchPuschRawCqiInfoPerCell -{ - U8 sCellIdx; /*!< Serving cell idx of the cell for - this cqi info*/ - RgSchDlCqiRawPusch puschRawCqiInfo; /*!< Raw CQI Bit Width for PUSCH */ -} RgSchPuschRawCqiInfoPerCell; - -typedef struct rgSchPuschRawCqiInfoForSCells -{ - U8 numOfCells; /* Num of cells for which Apcqi is comming*/ - RgSchPuschRawCqiInfoPerCell cqiBitWidth[CM_LTE_MAX_CELLS]; -} RgSchPuschRawCqiInfoForSCells; - -typedef struct rgSchPucchRawCqiInfoPerCell -{ - U8 sCellIdx; /*!< Serving cell idx of the cell for - this cqi info*/ - TfuDlCqiPucch pucchRawCqiInfo; /*!< Raw CQI Bit Width for PUCCH */ -} RgSchPucchRawCqiInfoPerCell; - -typedef struct rgSchUeRawCqiBitWidthInfo -{ - TfuRecpReqType type; /*!< Type indicating PUCCH or PUSCH */ - CmLteTimingInfo recvTime; - union - { - RgSchPucchRawCqiInfoPerCell pucch; - RgSchPuschRawCqiInfoForSCells pusch; - }u; -} RgSchUeRawCqiBitWidthInfo; -#endif - - -/* CaDev start */ -#ifdef LTE_ADV - -/** - * @brief - * Enum for storing the different states of a Scell - * RG_SCH_SCELL_INACTIVE : SCell is added but not activate - * RG_SCH_SCELL_TOBE_ACTIVATED : SCell Activation trigger condition is met - Need to be scheduled. - * RG_SCH_SCELL_ACTVTN_IN_PROG : Waiting for Harq feedback for the scell activation - * RG_SCH_SCELL_ACTIVE : SCell is activated succesfully - */ -typedef enum -{ - RG_SCH_SCELL_INACTIVE = 0, /*!sfInfo[(_sfi)].sfType = _state;\ -} - -/* Mark sfi as UL Subframe */ -#define RG_SCH_DYN_TDD_MARKTYPE_UL(_dynTdd, _sfi)\ -{\ - RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_ULD);\ -} - -/* Mark sfi as DL Subframe */ -#define RG_SCH_DYN_TDD_MARKTYPE_DL(_dynTdd, _sfi)\ -{\ - RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_DLD);\ -} - -/* Get SFI and SFN from given time and subframe offset */ -#define RG_SCH_DYN_TDD_GET_SFIDX(_sfi, _crntSfIdx, _offset)\ - (_sfi) = (_crntSfIdx + _offset)% RG_SCH_DYNTDD_MAX_SFINFO - -/** - @brief Dynamic TDD subframe type. */ - -typedef struct rgSchDynTddSfType -{ - U8 sfType; /*!< 0= NOT Defined - 1= DL Cntrl + DL Data - 2= DL Cntrl + DL Data + UL Cntrl - 3= DL Cntrl + UL Data - 4= DL Cntrl + UL Data + UL Cntrl - */ - -}RgSchDynTddSfType; -/** - @brief Dynamic TDD control Block */ - -typedef struct rgSchDynTddCb -{ - Bool isDynTddEnbld; /*!< Is dynamic TDD enabled */ - U8 crntDTddSfIdx; /*!< Pivot Index corresponding - cell's current subframe */ - RgSchDynTddSfType sfInfo[RG_SCH_DYNTDD_MAX_SFINFO]; -}RgSchDynTddCb; - -#endif - -/** - * @brief - * Global Control block for LTE-MAC. - */ -struct _rgSchCb -{ - TskInit rgSchInit; /*!< Task Init info */ - RgSchGenCb genCfg; /*!< General Config info */ - U8 numSaps; /*!< Num RGR Saps = Num TFU Saps */ - RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ - RgSchLowSapCb *tfuSap; /*!< TFU SAP Control Block */ - RgSchUpSapCb *rgmSap; /*!< TFU SAP Control Block */ - CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ - CmTqType tmrTq[RGSCH_TQ_SIZE]; /*!< Timer Task Queue */ - U8 rgSchDlDelta; /* 4UE_TTI_DELTA */ - U8 rgSchCmnDlDelta; - U8 rgSchUlDelta; - RgSchCellCb *cells[CM_LTE_MAX_CELLS]; /* Array to store cellCb ptr */ - RgrSchedEnbCfg rgrSchedEnbCfg; /*!< eNB level RR/PFS Config */ - Void *rgSchEnbPfsDl; /*!< eNB level PFS DL Block */ - - Void * laaCb; -#ifdef RG_5GTF - RgSchDynTddCb rgSchDynTdd; /*!< Dynamic TDD Control Block */ -#endif -}; - -/* Declaration for scheduler control blocks */ -EXTERN RgSchCb rgSchCb[RGSCH_MAX_INST]; - -/* - * Data structures for RAM - */ - -/** - * @brief - * Random Access Req Info to be stored in cellCb. - */ -typedef struct rgSchRaReqInfo -{ - CmLList raReqLstEnt; /*!< Linked list entity for RaReq List */ - CmLteTimingInfo timingInfo; /*!< RACHO: Time of RaReq Reception */ - RgTfuRaReqInfo raReq; /*!< Random Access Request Information */ - RgSchUeCb *ue; /*!< UECB if RAP ID is a dedicated one */ -} RgSchRaReqInfo; - -/** - * @enum rgSchRaState - * Enumeration of random access states. - */ -typedef enum rgSchRaState -{ - RGSCH_RA_MSG3_PENDING, /*!< Msg3 reception pending */ - RGSCH_RA_MSG4_PENDING, /*!< Msg4 transmission pending */ - RGSCH_RA_MSG4_DONE /*!< Msg4 transmission successful */ -} RgSchRaState; - -/** - * @brief - * Control block for Random Access. - */ -struct rgSchRaCb -{ - CmLList raCbLnk; /*!< To link to the raCb list */ - CmLList schdLnk; /*!< To link raCb to the "to be scheduled" - list */ - CmLteRnti tmpCrnti; /*!< Temporary C-RNTI */ - CmLteTimingInfo timingInfo; /*!< Timing information */ - RgSchRntiLnk *rntiLnk; /*!< Link to RNTI for raCb */ - RgSchRaState raState; /*!< Random access state */ - struct - { - U32 bo; /*!< Buffer occupancy for CCCH */ - } dlCcchInfo; /*!< Params for DL CCCH */ - U8 msg3HqProcId; /*!< Msg3 Harq Process ID */ - /*ccpu00128820 - DEL - msg3HqProcRef is delete for Msg3 alloc double delete issue*/ - RgSchUlHqProcCb msg3HqProc; /*!< msg3HqProcRef points to this initially */ - RgSchUeCb *ue; /*!< NULL initially */ - Bool toDel; /*!< To delete this RaCb after msg4 reject */ - TknU8 phr; /*!< To store the PHR, if received along with - Msg3 */ - CmLList rspLnk; /*!< Used to link RACB to a frame for resp */ - U8 rapId; /*!< RAP ID */ - TknU16 ta; /*!< Timing Adjustment */ - RgSchUlGrnt msg3Grnt; /*!< Msg3 grant as given by the UL Sched */ - U32 y[RGSCH_NUM_SUB_FRAMES]; /*!< y values using tmpCrnti by DLSCHED */ - RgSchDlHqEnt *dlHqE; /*!< DL HARQ module */ - U8 ccchCqi; /*!< DL Cqi obtained from RaReq and Used for CCCH */ - RgSchDlRbAlloc rbAllocInfo; /*!< RB Allocation Info for MSG4 Trans/Retrans */ - /* PHR handling for MSG3 */ - CmLteTimingInfo msg3AllocTime; /*!< Allocation time for msg3 grant */ -#ifdef RGR_V1 - /* CR timer changes*/ - CmLList contResTmrLnk; /*!< To link raCb to the - Guard Timer/Contention Resolution timer list*/ - CmLteTimingInfo expiryTime; /*!< Expiry time for Guard/Contention - Resolution timers */ - - U32 ccchSduBo; /*!rntiLnk */ -EXTERN Void rgSCHUtlIndRntiRls2Mac ARGS(( RgSchCellCb *cell, CmLteRnti rnti, - Bool ueIdChng, CmLteRnti newRnti)); - -/*rg008.201 - Added support for SPS*/ -#ifdef LTEMAC_SPS -EXTERN S16 rgSCHDbmDeInitSpsUeCbLst ARGS((RgSchCellCb *cellCb)); -EXTERN S16 rgSCHDbmInsSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb)); -EXTERN RgSchUeCb* rgSCHDbmGetSpsUeCb ARGS((RgSchCellCb *cellCb, CmLteRnti ueId)); -EXTERN RgSchUeCb* rgSCHDbmGetNextSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb)); -EXTERN S16 rgSCHDbmDelSpsUeCb ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb)); -#endif /* LTEMAC_SPS */ - -#ifdef LTE_L2_MEAS -/* - * L2M APIs - */ -EXTERN S16 rgSchL2mMeasReq ARGS (( - RgSchCellCb *cell, - LrgSchMeasReqInfo *measInfo, - RgSchErrInfo err)); -EXTERN S16 RgSchMacL2MeasSend ARGS -(( -Pst* pst, -RgInfL2MeasSndReq *measInfo -)); - -EXTERN S16 RgSchMacL2MeasStop ARGS -(( -Pst* pst, -RgInfL2MeasStopReq *measInfo -)); -#endif /* LTE_L2_MEAS */ -/* - * DHM APIs - */ -/* LTE_ADV_FLAG_REMOVED_START */ -EXTERN S16 rgSchSFRTotalPoolInit ARGS((RgSchCellCb *cell, RgSchDlSf *sf)); -/* LTE_ADV_FLAG_REMOVED_END */ -EXTERN Void rgSCHDhmHqPAdd2FreeLst ARGS (( RgSchDlHqProcCb *hqP)); -EXTERN Void rgSCHDhmHqPAdd2InUseLst ARGS (( RgSchDlHqProcCb *hqP)); -EXTERN Void rgSCHDhmHqPDelFrmFreeLst ARGS (( RgSchDlHqProcCb *hqP)); -EXTERN Void rgSCHDhmHqPDelFrmInUseLst ARGS (( RgSchDlHqProcCb *hqP)); - -EXTERN RgSchDlHqEnt *rgSCHDhmHqEntInit ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHDhmGetAvlHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo timingInfo, - RgSchDlHqProcCb **hqP)); -EXTERN Void rgSCHDhmHqRetx ARGS((RgSchDlHqEnt *hqE, CmLteTimingInfo timeInfo, - RgSchDlHqProcCb *hqP)); -EXTERN RgSchDlHqProcCb * rgSCHDhmLastSchedHqProc ARGS((RgSchDlHqEnt *hqE)); -/* CR timer changes*/ -EXTERN S16 rgSCHDhmGetCcchSduHqProc ARGS((RgSchUeCb *ueCb, CmLteTimingInfo timeInfo, - RgSchDlHqProcCb **hqP)); -EXTERN S16 rgSCHDhmGetMsg4HqProc ARGS((RgSchRaCb *raCb, CmLteTimingInfo timeInfo)); -EXTERN Void rgSCHDhmRlsHqProc ARGS((RgSchDlHqProcCb *hqP)); -/* ccpu00118350 : Correcting NDI manipulation of Harq */ -EXTERN Void rgSCHDhmRlsHqpTb ARGS((RgSchDlHqProcCb *hqP, U8 tbIdx, Bool togNdi)); -EXTERN Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm, -RgSchDlHqProcCb *hqP, U8 tbIdx )); -EXTERN Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE, -CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, U8 tbIdx)); -EXTERN Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm, -RgSchDlHqProcCb *hqP, U8 tbIdx )); -EXTERN Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE, -CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, U8 tbIdx)); -#ifdef RG_UNUSED -EXTERN S16 rgSCHDhmGetHqProcFrmId ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 idx, - RgSchDlHqProcCb **hqP)); -#endif -/* Changes for MIMO feature addition */ -EXTERN Void rgSCHDhmSchdTa ARGS((RgSchUeCb *ueCb, RgSchDlHqTbCb *tbInfo)); -EXTERN S16 rgSCHDhmHqFdbkInd ARGS((Void *cb, U8 cbType, RgSchCellCb *cellCb, - CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo - *rlsHqBufs,RgSchErrInfo *err)); -#ifdef EMTC_ENABLE -EXTERN S16 rgSCHDhmEmtcHqFdbkInd ARGS((Void *cb, U8 cbType, RgSchCellCb *cellCb, - CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo - *rlsHqBufs,RgSchErrInfo *err)); -EXTERN PUBLIC S16 rgSCHUtlAddToResLst -( - CmLListCp *cp, - RgSchIotRes *iotRes - ); -#endif -/*CA Dev Start */ -EXTERN S16 rgSCHDhmPrcFdbkForTb(RgSchCellCb *cell,RgSchUeCb *ue, - RgSchDlHqProcCb *hqP,RgSchDlSf *sf,Bool isMsg4, - U16 rnti,U8 tbCnt,CmLteTimingInfo timingInfo, U8 isAck, - RgInfRlsHqInfo *rlsHqBufs,RgSchErrInfo *err - ); -/*CA Dev End */ -EXTERN Void rgSCHDhmRgrUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUeCfg *ueCfg, RgSchErrInfo *err)); -EXTERN Void rgSCHDhmRgrUeRecfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUeRecfg *ueCfg, RgSchErrInfo *err)); -EXTERN Void rgSCHDhmRgrCellCfg ARGS((RgSchCellCb *cellCb, RgrCellCfg *cellCfg, - RgSchErrInfo *err)); -EXTERN Void rgSCHDhmRgrCellRecfg ARGS((RgSchCellCb *cellCb, RgrCellRecfg - *cellRecfg, RgSchErrInfo *err)); -EXTERN Void rgSCHDhmFreeUe ARGS((RgSchUeCb *ueCb)); -EXTERN Void rgSCHDhmUpdTa ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, U8 ta)); -EXTERN Void rgSCHDhmProcTAExp ARGS((RgSchUeCb *ue)); -/* Changes for MIMO feature addition */ -EXTERN S16 rgSCHDhmAddLcData ARGS((Inst inst, RgSchLchAllocInfo *lchData, - RgSchDlHqTbCb *tbInfo)); -EXTERN S16 rgSCHDhmRlsDlsfHqProc ARGS((RgSchCellCb *cellCb, CmLteTimingInfo -timingInfo)); - -#ifdef LTE_TDD -EXTERN S16 rgSCHDhmTddRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo uciTimingInfo)); -EXTERN S16 rgSCHCfgVldtTddDrxCycCfg ARGS((RgSchCellCb *cell, U16 drxCycle, - U8 onDurTmr, U16 offSet)); -#endif -/* Added support for SPS*/ -#ifdef LTEMAC_SPS -EXTERN S16 rgSCHDhmGetHqProcFrmId ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 idx, -RgSchDlHqProcCb **hqP -)); -#endif /* LTEMAC_SPS */ -/* Freeing up the HARQ proc blocked for - * indefinite time in case of Retx */ -EXTERN S16 rgSCHDhmDlRetxAllocFail ARGS(( -RgSchUeCb *ue, -RgSchDlHqProcCb *proc -)); -/* MS_WORKAROUND for ccpu00122893 temp fix Incorrect HqProc release was done instead of - * a Harq Entity reset. Fixing the same */ -EXTERN Void rgSCHDhmHqEntReset ARGS(( - RgSchDlHqEnt *hqE -)); -/* Measurement GAP and ACK NACK */ - -EXTERN S16 rgSCHMeasGapANRepUeCfg ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeCfg *ueCfg -)); -EXTERN S16 rgSCHMeasGapANRepUeRecfg ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -)); -/* ccpu00133470- Added extra argument to identify UE DEL*/ -EXTERN Void rgSCHMeasGapANRepUeDel ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isUeDel -)); -EXTERN S16 rgSCHMeasGapANRepTtiHndl ARGS(( -RgSchCellCb *cell -)); -EXTERN S16 rgSCHMeasGapANRepGetDlInactvUe ARGS(( -RgSchCellCb *cell, -CmLListCp *dlInactvUeLst -)); -EXTERN S16 rgSCHMeasGapANRepGetUlInactvUe ARGS(( -RgSchCellCb *cell, -CmLListCp *ulInactvUeLst -)); -EXTERN Void rgSCHMeasGapANRepDlInactvTmrExpry ARGS(( -RgSchUeCb *ue, -U8 tmrEvnt -)); -EXTERN Void rgSCHMeasGapANRepUlInactvTmrExpry ARGS(( -RgSchUeCb *ue, -U8 tmrEvnt -)); -EXTERN Void rgSCHMeasGapANRepTmrExpry ARGS(( -RgSchUeCb *ue -)); -EXTERN Void rgSCHAckNakRepTmrExpry ARGS(( -RgSchUeCb *ue -)); -EXTERN Void rgSCHAckNakRepSndHqFbkRcpReq ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -CmLteTimingInfo timingInfo)); - -EXTERN Void rgSCHAckNakRepAddToQ ARGS(( -RgSchCellCb *cell, -RgSchDlSf *crntDlSf)); - -/* - * SCH Util APIs - */ -#ifdef LTEMAC_SPS -EXTERN Void rgSCHUtlHdlCrcInd ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -)); -#endif - -#ifdef LTE_L2_MEAS -EXTERN S16 rgSCHUtlValidateMeasReq ARGS ((RgSchCellCb *cellCb, - LrgSchMeasReqInfo *schL2MeasInfo, - RgSchErrInfo *err - )); -EXTERN S16 rgSchL2mSndCfm ARGS((Pst *pst, - RgSchL2MeasCb *measCb, - LrgSchMeasReqInfo *measInfo, - Bool isErr -)); -EXTERN S16 rgSchFillL2MeasCfm ARGS(( - RgSchCellCb *cell, - RgSchL2MeasCb *measCb, - LrgSchMeasCfmInfo *cfm, - U32 measTime -)); -EXTERN Void rgSchL2mFillCfmPst ARGS(( - Pst *pst, - Pst *cfmPst, - LrgSchMeasReqInfo *measInfo -)); -EXTERN S16 rgSCHL2Meas ARGS(( - RgSchCellCb *cell, - U8 isCalrCrcInd -)); -#endif /* LTE_L2_MEAS */ -/* Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE -EXTERN F64 rgSCHUtlPower ARGS -(( -F64 x, -F64 n -)); - - EXTERN U32 rgSCHUtlParse ARGS - (( - U8 *buff, - U8 startPos, - U8 endPos, - U8 buffSize - )); - - EXTERN U8 rgSCHUtlFindDist ARGS -(( -U16 crntTime, -U16 tempIdx -)); -#endif -EXTERN Bool rgSCHUtlPdcchAvail ARGS((RgSchCellCb *cell, RgSchPdcchInfo - *pdcchInfo, CmLteAggrLvl aggrLvl, RgSchPdcch **pdcch)); -EXTERN Void rgSCHUtlPdcchPut ARGS((RgSchCellCb *cell, RgSchPdcchInfo *pdcchInfo, - RgSchPdcch *pdcch)); -#ifdef LTE_TDD -/* Changes for passing iPhich at TFU interface*/ -EXTERN S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm, - U8 hqFeedBack, U8 nDmrs, U8 rbStart, U8 iPhich)); -#else -EXTERN S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm, - U8 hqFeedBack, U8 nDmrs, U8 rbStart,Bool isForMsg3)); -#endif -EXTERN RgSchDlSf* rgSCHUtlSubFrmGet ARGS((RgSchCellCb *cell, - CmLteTimingInfo frm)); -EXTERN Void rgSCHUtlSubFrmPut ARGS((RgSchCellCb *cell, RgSchDlSf *sf)); -EXTERN U8 rgSCHUtlLog32bitNbase2 ARGS((U32 n)); -/* Added support for SPS*/ - - -#ifdef LTEMAC_SPS -EXTERN RgSchDlHqProcCb * rgSCHDhmSpsDlGetHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, -CmLteTimingInfo timingInfo)); -#endif -#ifdef LTE_TDD -EXTERN U8 rgSCHUtlCalcNCce ARGS((U8 bw, RgrPhichNg ng, U8 cfi, U8 mPhich, - U8 numAntna, Bool isEcp)); -#else -EXTERN U8 rgSCHUtlCalcNCce ARGS((U8 bw, RgrPhichNg ng, U8 cfi, U8 numAntna, Bool -isEcp)); -#endif -#ifdef LTE_TDD -/* Changes for passing iPhich at TFU interface*/ -EXTERN S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, U8 *rbStartRef, - U8 *nDmrsRef, U8 *iPhich)); -#else -EXTERN S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, U8 *rbStartRef, - U8 *nDmrsRef)); -#endif -/* Added changes of TFU_UPGRADE */ -#ifndef TFU_UPGRADE -/* To include the length and ModOrder in DataRecp Req. */ -/* Updating NDI and HARQ proc Id */ -EXTERN S16 rgSCHUtlAllocRcptInfo ARGS((RgSchUlAlloc *alloc, CmLteRnti *rnti, - U8 *iMcsRef, U8 *rbStartRef, U8 *numRbRef, U8 *rvRef, U16 *size, - TfuModScheme *modType,Bool *isRtx, -U8 *nDmrs, -Bool *ndi, -U8 *hqPId)); -#else -EXTERN S16 rgSCHUtlAllocRcptInfo ARGS(( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - CmLteTimingInfo *timeInfo, - TfuUeUlSchRecpInfo *recpReq - )); -#endif /* TFU_UPGRADE */ - -EXTERN S16 rgSCHUtlRgrCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg, - RgSchErrInfo *errInfo)); -EXTERN S16 rgSCHUtlRgrCellRecfg ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg, - RgSchErrInfo *errInfo)); -EXTERN S16 rgSCHUtlFreeCell ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlRgrUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgrUeCfg *cfg, RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlRgrLcCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *dl, RgrLchCfg *cfg,RgSchErrInfo *errInfo)); -EXTERN S16 rgSCHUtlRgrLcDel ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - CmLteLcId lcId, U8 lcgId)); -EXTERN S16 rgSCHUtlRgrLcRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, - RgSchDlLcCb *dlLc,RgrLchRecfg *recfg,RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlRgrLcgCfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, - RgrLcgCfg *cfg,RgSchErrInfo *errInfo)); -EXTERN S16 rgSCHUtlRgrLcgRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, - RgrLcgRecfg *recfg,RgSchErrInfo *err)); -EXTERN Void rgSCHUtlRgrLcgDel ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, - U8 lcgId)); -EXTERN Void rgSCHUtlDlCqiInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - TfuDlCqiRpt *dlCqiInd, CmLteTimingInfo timingInfo)); - -/* Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE -EXTERN Void rgSCHUtlRawCqiInd ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuRawCqiRpt* rawCqiRpt, -CmLteTimingInfo timingInfo -)); - -EXTERN Void rgSCHUtlSrsInd ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuSrsRpt* srsRpt, -CmLteTimingInfo timingInfo -)); -EXTERN S16 rgSCHUtlGetCfgPerOff ARGS -(( -RgSchPerTbl tbl, -U16 cfgIdx, -U16 *peri, -U16 *offset -)); -#endif - -EXTERN Void rgSCHUtlDoaInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - TfuDoaRpt *doaInd)); -EXTERN Void rgSCHUtlDlTARpt ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -/* Changes for MIMO feature addition */ -EXTERN Void rgSCHUtlDlRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm)); -EXTERN Void rgSCHUtlDlProcAddToRetx ARGS((RgSchCellCb *cell, - RgSchDlHqProcCb *hqP)); -EXTERN S16 rgSCHUtlRegSch ARGS((U8 schIdx, RgSchdApis *apis)); -EXTERN Void rgSCHUtlDlHqProcAddToTx ARGS((RgSchDlSf *subFrm, RgSchDlHqProcCb *hqP)); -/* Changes for MIMO feature addition */ -EXTERN Void rgSCHUtlDlHqPTbRmvFrmTx ARGS((RgSchDlSf *subFrm, - RgSchDlHqProcCb *hqP, U8 tbIdx, Bool isRepeating)); -EXTERN S16 rgSCHUtlRgrUeRecfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgrUeRecfg *recfg, RgSchErrInfo *err)); -EXTERN Void rgSCHUtlFreeDlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *dlLc)); -EXTERN Void rgSCHUtlFreeUlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchUlLcCb *ulLc)); -EXTERN Void rgSCHUtlFreeUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -EXTERN Void rgSCHUtlDlDedBoUpd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *svc)); -#ifdef RG_UNUSED -EXTERN S16 rgSCHUtlUpdUlHqProc ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc, - RgSchUlHqProcCb *oldProc)); -#endif -/* PHR handling for MSG3 */ -EXTERN Void rgSCHUtlRecMsg3Alloc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchRaCb *raCb)); -EXTERN S16 rgSCHUtlContResUlGrant ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlSrRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - CmLteTimingInfo, RgSchErrInfo *err)); -EXTERN Void rgSCHUtlUpdBsrShort ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 lcgId, - U8 bsr, RgSchErrInfo *err)); -EXTERN Void rgSCHUtlUpdBsrTrunc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 lcgId, - U8 bsr, RgSchErrInfo *err)); -EXTERN Void rgSCHUtlUpdBsrLong ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - U8 bsr1,U8 bsr2,U8 bsr3,U8 bsr4, RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlUpdPhr ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - U8 phr, RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlUpdExtPhr ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, -RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlDataRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 numLc, - RgSchUlLcCb *lcArr[], U16 bytesArr[], RgSchErrInfo *err)); -EXTERN Void rgSCHUtlUlCqiInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, - TfuUlCqiRpt *ulCqiInfo)); -EXTERN Void rgSCHUtlPucchDeltaPwrInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, - S8 delta)); -EXTERN Void rgSCHUtlUeReset ARGS(( RgSchCellCb *cell, RgSchUeCb *ue)); -EXTERN Void rgSCHUtlUlHqProcForUe ARGS((RgSchCellCb *cell, CmLteTimingInfo frm, - RgSchUeCb *ue, RgSchUlHqProcCb **procRef)); -EXTERN RgSchUlAlloc *rgSCHUtlFirstRcptnReq ARGS((RgSchCellCb *cell)); -EXTERN RgSchUlAlloc *rgSCHUtlNextRcptnReq ARGS((RgSchCellCb *cell, - RgSchUlAlloc *alloc)); -EXTERN RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc ARGS((RgSchCellCb *cell, U8 idx)); -EXTERN RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc ARGS((RgSchCellCb *cell, - RgSchUlAlloc *alloc, U8 idx)); -EXTERN S16 rgSCHUtlTfuBndReq ARGS((Inst inst, SuId suId, SpId spId)); -EXTERN S16 rgSCHUtlTfuUBndReq ARGS((Inst inst, RgSchLowSapCfgInfo sapCfg, Reason reason)); -#ifdef EMTC_ENABLE -EXTERN S16 rgSCHEmtcUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc, - Bool resetCmnLcInfo, Bool restAlloc)); -#endif -EXTERN S16 rgSCHUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc, - Bool resetCmnLcInfo, Bool restAlloc)); -EXTERN S16 rgSCHUtlGetSfAlloc ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlPutSfAlloc ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlAllocSBuf ARGS((Inst inst, Data **pData, Size size)); -/* ccpu00117052 - MOD - Passing double pointer -for proper NULLP assignment*/ -EXTERN Void rgSCHUtlFreeSBuf ARGS((Inst inst, Data **data, Size size)); -EXTERN Void rgSCHUtlFillDgnParams ARGS((Inst inst, RgUstaDgn *dgn,U8 dgnType)); -EXTERN Void rgSCHUtlGetPstToLyr ARGS((Pst *pst,RgSchCb *schCb,Inst macInst)); -EXTERN S16 rgSCHUtlFillRgInfCmnLcInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc, - CmLteLcId lcId, Bool sendInd)); -EXTERN S16 rgSCHUtlFillRgInfRarInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlFillPdschDciInfo ARGS((TfuPdschDciInfo *pdschDci,TfuDciInfo - *pdcchDci)); - /* CA dev Start */ -EXTERN Void rgSCHUtlFillRgInfUeInfo ARGS((RgSchDlSf*, RgSchCellCb *cell, CmLListCp *dlDrxInactvTmrLst, - CmLListCp *dlInActvLst, CmLListCp *ulInActvLst)); - /* CA dev End */ -EXTERN S16 rgSCHUtlUpdSch ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb, - RgSchUeCb *ueCb, RgInfUeDatInd *pdu,RgSchErrInfo *err)); -EXTERN S16 rgSCHUtlHndlCcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt *boRpt)); -EXTERN S16 rgSCHUtlHndlBcchPcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt - *boUpdt)); -EXTERN S16 rgSCHUtlRgrBndCfm ARGS ((Inst inst, SuId suId,U8 status)); -/* Added for sending TTI tick to RRM */ -#ifdef RGR_RRM_TICK -EXTERN S16 rgSCHUtlRgrTtiInd ARGS ((RgSchCellCb *cell, RgrTtiIndInfo *ttiInd)); -#endif -EXTERN S16 rgSCHUtlRgrCfgCfm ARGS ((Inst inst, SpId spId, - RgrCfgTransId transId,U8 status)); -EXTERN S16 rgSCHUtlProcMsg3 ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb, - RgSchUeCb *ueCb, CmLteRnti rnti,RgInfUeDatInd *pdu, - RgSchErrInfo *err )); -#ifdef RG_PHASE_2 -EXTERN S16 rgSCHUtlTfuGrpPwrCntrlReq ARGS((Inst inst,S16 sapId, - TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq)); -#endif -EXTERN S16 rgSCHUtlTfuCntrlReq ARGS((Inst inst, S16 sapId, - TfuCntrlReqInfo *cntrlReq)); -EXTERN S16 rgSCHUtlTfuRecpReq ARGS((Inst inst, S16 sapId, - TfuRecpReqInfo *recpReq)); -EXTERN S16 rgSCHUtlValidateTfuSap ARGS((Inst inst,SuId suId)); -EXTERN S16 rgSCHUtlAllocEventMem ARGS((Inst inst,Ptr *memPtr,Size memSize)); -EXTERN S16 rgSCHUtlGetEventMem ARGS((Ptr *ptr,Size len,Ptr memCpa)); -EXTERN S16 rgSCHUtlGetRlsHqAlloc ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlPutRlsHqAlloc ARGS((RgSchCellCb *cell)); - -EXTERN S16 rgSCHUtlDlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -EXTERN S16 rgSCHUtlUlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -EXTERN Void rgSCHUtlHdlUlTransInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - CmLteTimingInfo timingInfo)); -#ifdef TFU_UPGRADE -EXTERN Void rgSCHUtlUpdACqiTrigWt ARGS((RgSchUeCb *ue,RgSchUeCellInfo *sCellInfo, U8 isAck)); -#endif -/* Nprb indication at PHY for common Ch */ -/* Corrected allocation for common channels */ -EXTERN PUBLIC S32 rgSCHUtlGetAllwdCchTbSz ARGS((U32 bo, U8 *nPrb, U8 *mcs -)); -/* CR timer changes*/ -EXTERN PUBLIC S16 rgSCHUtlUpdtBo ARGS((RgSchCellCb *cell, - RgInfCmnBoRpt *staRsp)); -EXTERN PUBLIC S16 rgSCHUtlAddUeToCcchSduLst ARGS( - (RgSchCellCb *cell, - RgSchUeCb *ueCb)); -#ifdef EMTC_ENABLE -EXTERN PUBLIC S16 rgSCHUtlAddUeToEmtcCcchSduLst ARGS( - (RgSchCellCb *cell, - RgSchUeCb *ueCb)); - -EXTERN S16 rgSCHRamRmvFrmEmtcRaInfoSchdLst ARGS((RgSchCellCb *cell, RgSchRaCb *raCb)); -EXTERN Void rgSCHRamEmtcDelRaCb ARGS((RgSchCellCb *cell, RgSchRaCb *raCb)); -EXTERN S16 rgSCHRamEmtcUpdtBo ARGS((RgSchCellCb *cell, RgSchRaCb *raCb, - RgInfCmnBoRpt *staRsp)); -#endif -/* Added for SI Enhancement*/ -#ifdef RGR_SI_SCH -EXTERN Void rgSCHUtlPutSiInfo ARGS((RgSchCellCb *cell)); -EXTERN Void rgSCHUtlFreeWarningSiSeg ARGS((Region reg,Pool pool, - CmLListCp *siPduLst)); -EXTERN Void rgSCHUtlFreeWarningSiPdu ARGS((RgSchCellCb *cell)); -EXTERN Buffer *rgSCHUtlGetWarningSiPdu ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHUtlGetMcsAndNPrb ARGS((RgSchCellCb *cell, U8 *nPrb, U8 *mcs, MsgLen *msgLen)); -EXTERN S16 rgSCHUtlCalMcsAndNPrb ARGS((RgSchCellCb *cell, U8 cfgType, MsgLen msgLen, U8 siId)); -#endif/*RGR_SI_SCH*/ - -#ifdef LTE_TDD -EXTERN S16 rgSCHUtlAllocUeANFdbkInfo ARGS((RgSchUeCb *ue,U8 servCellIdx)); -EXTERN Void rgSCHUtlDelUeANFdbkInfo ARGS((RgSchUeCb *ue,U8 servCellIdx)); -EXTERN S16 rgSCHUtlInitUeANFdbkInfo ARGS((RgSchTddANInfo *anInfo)); -EXTERN RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo ARGS((RgSchUeCb *ueCb, CmLteTimingInfo *timeInfo,U8 servCellIdx)); -EXTERN U8 rgSCHUtlGetDlSfIdx ARGS((RgSchCellCb *cell, CmLteTimingInfo *timeInfo)); -EXTERN Void rgSCHUtlPrachCfgInit ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg )); -EXTERN Void rgSCHUtlGetNxtDlSfInfo ARGS((CmLteTimingInfo curDlTime, RgSchCellCb *cell, RgSchDlSf *dlSf, RgSchDlSf **nxtDlsf, CmLteTimingInfo *nxtDlTime)); -EXTERN Void rgSCHUtlGetPrevDlSfInfo ARGS((RgSchCellCb * cell, CmLteTimingInfo curDlTime, CmLteTimingInfo *prevDlTime, U8 *numSubfrm)); -#endif -EXTERN Void rgSCHCmnDlSch ARGS -(( -RgSchCellCb *cell -)); -EXTERN Void rgSCHCmnSndCnsldtInfo ARGS -(( -RgSchCellCb *cell -)); -EXTERN Void rgSCHCmnCnsldtSfAlloc ARGS -(( -RgSchCellCb *cell -)); - -/* Added support for SPS*/ -EXTERN Void rgSCHCmnDlAllocFnlz ARGS -(( -RgSchCellCb *cell -)); - -#ifdef LTEMAC_SPS -EXTERN Void rgSCHUtlDlRelPdcchFbk ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isAck -)); - -EXTERN Void rgSCHUtlDlProcAck ARGS(( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -)); -EXTERN S16 rgSCHUtlSpsRelInd ARGS(( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -Bool isExplRel -)); - -EXTERN Void rgSCHCmnDlSch ARGS -(( -RgSchCellCb *cell -)); - -EXTERN S16 rgSCHUtlSpsActInd ARGS(( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -U16 spsSduSize -)); - -EXTERN Void rgSCHUtlHdlCrcFailInd ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -)); - -EXTERN Void rgSCHUtlHdlCrntiCE ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); - -#endif /* LTEMAC_SPS*/ - -/******* : START *****/ -EXTERN S16 rgSCHUtlUlSfInit ARGS(( - RgSchCellCb *cell, - RgSchUlSf *sf, - U8 idx, - U8 maxUePerSf - )); -EXTERN Void rgSCHUtlUlSfDeinit ARGS(( - RgSchCellCb *cell, - RgSchUlSf *sf - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetHole ARGS(( - RgSchUlSf *sf, - U8 numRb, - RgSchUlHole *hole - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole ARGS(( - RgSchUlSf *sf, - RgSchUlHole *hole - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole ARGS(( - RgSchUlSf *sf, - U8 numRb, - RgSchUlHole *hole - )); -EXTERN Void rgSCHUtlUlAllocRls ARGS(( - RgSchUlSf *sf, - RgSchUlAlloc *alloc - )); - -/* UL_ALLOC_ENHANCEMENT */ -EXTERN Void rgSCHUtlUlAllocRelease ARGS(( - RgSchUlAlloc *alloc - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocFirst ARGS(( - RgSchUlSf *sf - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocNxt ARGS(( - RgSchUlSf *sf, - RgSchUlAlloc *alloc - )); -EXTERN RgSchUlHole *rgSCHUtlUlHoleFirst ARGS(( - RgSchUlSf *sf - )); -EXTERN RgSchUlHole *rgSCHUtlUlHoleNxt ARGS(( - RgSchUlSf *sf, - RgSchUlHole *hole - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt ARGS(( - RgSchUlAllocDb *db, - RgSchUlAlloc *prv - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetFirst ARGS(( - RgSchUlAllocDb *db - )); -EXTERN Void rgSCHUtlUlHoleAddAlloc ARGS(( - RgSchUlSf *sf, - RgSchUlAlloc *alloc - )); -/* UL_ALLOC_ENHANCEMENT */ -EXTERN Void rgSCHUtlUlHoleAddAllocation ARGS(( - RgSchUlAlloc *alloc - )); - -EXTERN Void rgSCHUtlUlHoleJoin ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *prv, - RgSchUlHole *nxt, - RgSchUlAlloc *alloc - )); -EXTERN Void rgSCHUtlUlHoleExtndRight ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *prv, - RgSchUlAlloc *alloc - )); -EXTERN Void rgSCHUtlUlHoleExtndLeft ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *nxt, - RgSchUlAlloc *alloc - )); -EXTERN Void rgSCHUtlUlHoleNew ARGS(( - RgSchUlHoleDb *db, - RgSchUlAlloc *alloc - )); -EXTERN Void rgSCHUtlUlHoleUpdAllocLnks ARGS(( - RgSchUlHole *hole, - RgSchUlAlloc *prvAlloc, - RgSchUlAlloc *nxtAlloc - )); -EXTERN Void rgSCHUtlUlHoleIns ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *hole - )); -EXTERN Void rgSCHUtlUlHoleIncr ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *hole - )); -EXTERN Void rgSCHUtlUlHoleDecr ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *hole - )); -EXTERN Void rgSCHUtlUlHoleRls ARGS(( - RgSchUlHoleDb *db, - RgSchUlHole *hole - )); -EXTERN S16 rgSCHUtlUlAllocMemInit ARGS(( - RgSchCellCb *cell, - RgSchUlAllocMem *mem, - U8 maxAllocs - )); -EXTERN Void rgSCHUtlUlAllocMemDeinit ARGS(( - RgSchCellCb *cell, - RgSchUlAllocMem *mem - )); -EXTERN S16 rgSCHUtlUlHoleMemInit ARGS(( - RgSchCellCb *cell, - RgSchUlHoleMem *mem, - U8 maxHoles, - RgSchUlHole **holeRef - )); -EXTERN Void rgSCHUtlUlHoleMemDeinit ARGS(( - RgSchCellCb *cell, - RgSchUlHoleMem *mem - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlAllocMemGet ARGS(( - RgSchUlAllocMem *mem - )); -EXTERN Void rgSCHUtlUlAllocMemRls ARGS(( - RgSchUlAllocMem *mem, - RgSchUlAlloc *alloc - )); -EXTERN RgSchUlHole *rgSCHUtlUlHoleMemGet ARGS(( - RgSchUlHoleMem *mem - )); -EXTERN Void rgSCHUtlUlHoleMemRls ARGS(( - RgSchUlHoleMem *mem, - RgSchUlHole *hole - )); -EXTERN RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc ARGS(( - RgSchUlSf *sf, - U8 startSb, - U8 numSb -)); -/******* : END *****/ - -/* DRX function declarations */ -EXTERN S16 rgSCHDrxCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg)); -EXTERN Void rgSCHDrxCellDel ARGS((RgSchCellCb *cell)); -EXTERN S16 rgSCHDrxUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgrUeCfg *ueCfg)); -#ifdef RGR_V2 -EXTERN S16 rgSCHDrxUeReCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgrUeRecfg *ueCfg)); -#endif -EXTERN S16 rgSCHDrxUeDel ARGS((RgSchCellCb *cell,RgSchUeCb *ue)); -EXTERN Void rgSCHDrxTtiInd ARGS ((RgSchCellCb *cell)); - -EXTERN S16 rgSCHDrxSfAlloc ARGS ((RgSchCellCb *cellCb, RgSchDlSf - *dlSf)); -EXTERN S16 rgSCHDrxDlTrnsFail ARGS((RgSchCellCb *cell, RgSchDlHqProcCb - *dlHq)); -EXTERN Void rgSCHDrxDedRa ARGS((RgSchCellCb *cellCb, RgSchUeCb* ueCb)); -EXTERN S16 rgSCHDrxSrInd ARGS((RgSchCellCb *cell,RgSchUeCb *ue)); - -EXTERN Void rgSCHDrxStrtInActvTmr ARGS((RgSchCellCb *cell, - CmLListCp *ueLst, - U8 direction)); -EXTERN S16 rgSCHUtlGetDrxSchdUesInDl ARGS((RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgSchDlHqProcCb *dlHq, - RgInfUeAlloc *allocInfo, - CmLListCp *dlDrxInactvTmrLst, - CmLListCp *dlInActvLst, - CmLListCp *ulInActvLst)); -EXTERN Void rgSCHDrxStartHarqRTTTmr ARGS((RgSchCellCb *cell, - RgSchDlHqProcCb *hqP, - U8 tbCnt)); -EXTERN Void rgSCHDrxUeHqReset ARGS((RgSchCellCb *cell, - RgSchUeCb *ue, - RgSchDlHqEnt *hqE, - U8 cellIdx)); - -#ifdef TFU_UPGRADE -#ifdef LTE_TDD -EXTERN CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl; -#else -EXTERN CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl; -#endif -#endif - -#ifdef LTEMAC_HDFDD -EXTERN S16 rgSCHHdFddUeCfg ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - Bool hdFdd)); -EXTERN S16 rgSCHHdFddUeDel ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb)); -EXTERN Void rgSCHCmnHdFddPtUlMrk ARGS(( - RgSchCellCb *cellCb)); -EXTERN Void rgSCHCmnHdFddChkUlAllow ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - U8 *flag)); -EXTERN Void rgSCHCmnHdFddChkDlAllow ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - Bool *flag)); -EXTERN Void rgSCHCmnHdFddChkNackAllow ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - CmLteTimingInfo timInfo, - Bool *flag)); -EXTERN Void rgSCHCmnHdFddUpdULMark ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb)); -EXTERN Void rgSCHCmnHdFddUpdDLMark ARGS(( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb)); -EXTERN Void rgSCHHdFddGetSfn ARGS(( - U16 *sfn, - CmLteTimingInfo timeInfo, - S16 offset)); -#endif /* ifdef LTEMAC_HDFDD */ - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT -PUBLIC S16 rgSCHUtlRgrStaInd ARGS(( -RgSchCellCb *cell, -RgrStaIndInfo *rgrSta -)); - -PUBLIC S16 rgSCHUtlFillSndStaInd ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrStaIndInfo *staInfo, -U8 numCqiRept -)); -#endif /* End of RGR_CQI_REPT */ -PUBLIC S16 rgSCHUtlRgrUeStaInd ARGS(( -RgSchCellCb *cell, -RgrUeStaIndInfo *rgrUeSta -)); - -PUBLIC S16 rgSCHUtlFillSndUeStaInd ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeStaIndInfo *ueStaInfo -)); - - -/* LTE_ADV_FLAG_REMOVED_START */ -PUBLIC S16 rgSCHUtlRgrLoadInfInd ARGS(( -RgSchCellCb *cell, -RgrLoadInfIndInfo *rgrLoadInf -)); -/* LTE_ADV_FLAG_REMOVED_END */ -#ifdef LTE_ADV -#ifdef TFU_UPGRADE -PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode ARGS(( -RgrSchFrmt1b3TypEnum fdbkType -)); - -EXTERN TfuAckNackMode rgSchUtlGetFdbkMode ARGS(( -RgrSchFrmt1b3TypEnum fdbkType -)); - -#endif /*TFU_UPGRADE */ -#endif /* LTE_ADV */ -/* FIX */ -PUBLIC Void rgSCHUtlRlsRnti ARGS(( -RgSchCellCb *cellCb, -RgSchRntiLnk *rntiLnk, -Bool ueIdChngd, -CmLteRnti newRnti -)); -PUBLIC S16 rgSCHUtlRgmBndCfm ARGS(( -Inst instId, -SuId suId, -U8 status -)); -PUBLIC Void rgSCHDhmDelHqEnt ARGS(( -RgSchCellCb *cell, -RgSchDlHqEnt **hqE -)); -PUBLIC Void rgSCHDhmAssgnUeHqEntFrmRaCb ARGS(( -RgSchUeCb *ue, -RgSchRaCb *raCb -)); -PUBLIC Void rgSCHUtlReTxTa ARGS(( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb)); -/* LTE_ADV_FLAG_REMOVED_START */ -PUBLIC Void rgSchSFRTotalPoolFree ARGS(( -RgSchSFRTotalPoolInfo *sfrTotalPoolInfo, -RgSchCellCb *cell)); -PUBLIC Void rgSchDSFRPwrCheck ARGS(( -RgSchDlSf *sf, -Bool *isAllUePwrHigh)); -/* LTE_ADV_FLAG_REMOVED_END */ - -PUBLIC S16 rgSCHUtlUpdAvgPrbUsage ARGS(( -RgSchCellCb *cell -)); - -PUBLIC U8 rgSchUtlCfg0ReTxIdx ARGS(( -RgSchCellCb *cell, -CmLteTimingInfo phichTime, -U8 hqFdbkIdx -)); - -EXTERN S16 rgSCHUtlBuildNSendLcgReg ARGS(( -RgSchCellCb *cell, -CmLteRnti crnti, -U8 lcgId, -Bool isGbr -)); - -EXTERN Void rgSCHUtlPdcchInit ARGS(( - RgSchCellCb *cell, - RgSchDlSf *subFrm, - U16 nCce)); -EXTERN Void rgSCHDynCfiReCfg ARGS(( - RgSchCellCb *cell, - Bool isDynCfiEnb -)); -PUBLIC Void rgSchUtlCalcTotalPrbReq ARGS((RgSchCellCb *cell, - RgSchUeCb *ue, - U32 bo, - U32 *prbReqrd)); -EXTERN U8 rgSchUtlGetNumSbs ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 *numSbs -)); - -EXTERN U8 rgSchUtlSortInsUeLst ARGS(( -RgSchCellCb *cell, -CmLListCp *ueLst, -CmLList *node, -U8 subbandRequired -)); -EXTERN S16 rgSCHUtlResetCpuOvrLdState ARGS(( - RgSchCellCb *cell, - U8 cnrtCpuOvrLdIns -)); -EXTERN Void rgSCHUtlCpuOvrLdAdjItbsCap ARGS(( - RgSchCellCb *cell -)); -#ifdef TFU_UPGRADE -EXTERN S16 rgSCHTomUtlPcqiSbCalcBpIdx ARGS(( -CmLteTimingInfo crntTimInfo, -RgSchUeCb *ueCb, -RgSchUePCqiCb *cqiCb -)); - -#ifdef LTE_ADV -EXTERN S16 rgSCHUtlSCellHndlCqiCollsn ARGS(( -RgSchUePCqiCb *cqiCb -)); - -EXTERN S16 rgSCHUtlSCellHndlRiCollsn ARGS(( -RgSchUePCqiCb *cqiCb -)); - -#endif/*LTE_ADV*/ -#endif/*TFU_UPGRADE*/ - -EXTERN Void rgSCHTomUtlGetTrigSet ARGS(( - RgSchCellCb *cell, - RgSchUeCb *ueCb, - U8 cqiReq, - U8 *triggerSet -)); - -EXTERN Void rgSCHUtlUpdUeDciSize ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -Bool isCsi2Bit -)); -EXTERN Void rgSCHUtlCalcDciSizes ARGS(( -RgSchCellCb *cell -)); - -EXTERN Void rgSchCmnPreDlSch ARGS (( - RgSchCellCb **cell, - U8 nCell, - RgSchCellCb **cellLst - )); - -EXTERN Void rgSchCmnPstDlSch ARGS (( - RgSchCellCb *cell - )); - -EXTERN PUBLIC U8 rgSCHCmnGetBiIndex ARGS (( -RgSchCellCb *cell, -U32 ueCount -)); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* __SCH__ */ - - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_cfg.c b/src/5gnrmac/rg_sch_cfg.c deleted file mode 100755 index 559d30f95..000000000 --- a/src/5gnrmac/rg_sch_cfg.c +++ /dev/null @@ -1,10459 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point functions. - - File: rg_sch_cfg.c - -**********************************************************************/ - -/** @file rg_sch_cfg.c -@brief This module handles the configuration of SCH by RRC and RRM. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=186; -static int RLOG_MODULE_ID=4096; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system service interface */ -#include "cm_hash.h" /* common hash list */ -#include "cm_mblk.h" /* common memory link list library */ -#include "cm_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ -#include "lrg.h" -#include "rgr.h" -#include "rgm.h" -#include "tfu.h" -#include "rg_env.h" -#include "rg_sch_inf.h" -#include "rg_sch.h" -#include "rg_sch_err.h" -#include "rg_sch_cmn.h" -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* TFU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for MAC */ -#include "rg_sch.x" /* typedefs for MAC */ -/* [ccpu00124018]-MOD- Retrieving CQI value from cell config*/ -#include "rg_sch_cmn.x" -#include "rg_sch_clist.x" - - -/* LTE-MAC Scheduler instance control block structures */ -PUBLIC RgSchCb rgSchCb[RGSCH_MAX_INST]; - -#ifdef PHY_ERROR_LOGING -PUBLIC RgSchUlAllocCntr rgSchUlAllocCntr; -#endif - -#ifdef EMTC_ENABLE -EXTERN Void rgSCHEmtcPOTrigger ARGS (( -RgSchCellCb *cell, -RgSchUeCb *ue -)); - -EXTERN S16 rgSchEmtcUpdSiCfg ARGS (( -RgSchCellCb *cell, -RgrCellRecfg *cellRecfg -)); - -EXTERN S16 rgSCHEmtcCfgVldtDrxReTxCfg ARGS(( -U16 reTxTmr -)); - -EXTERN S16 rgSCHEmtcCfgVldtDrxUlReTxCfg ARGS(( -U16 reTxTmr -)); -#endif - -PUBLIC S16 rgSCHEnbPfsDlCfg ARGS(( - Inst instIdx, - RgSchErrInfo *err - )); -/* local defines */ -PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg ARGS (( RgSchCellCb *cell, - RgSchUeCb *ue, RgrUeRecfg *ueRecfg, RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHCfgVldtUePwrCfg ARGS((RgSchCellCb *cell, - RgrUeUlPwrCfg *pwrCfg)); -PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg ARGS((RgSchCellCb *cell, - RgrUeGrpPwrCfg *grpPwrCfg)); -#ifdef LTEMAC_SPS -PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg ARGS((RgSchCellCb *cell, - RgrUeSpsDlCfg *dlSpsCfg)); -PRIVATE S16 rgSCHCfgVldtSpsReCfg ARGS ((RgSchCellCb *cell, - RgSchUeCb *ue, RgrUeRecfg *ueRecfg)); -#endif /*LTEMAC_SPS*/ -PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg ARGS((RgSchCellCb *cell,RgrUeDlCqiCfg *ueDlCqiCfg)); -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg ARGS ((RgSchCellCb *cell, - RgrUeCfg *ueCfg)); -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg ARGS ((RgSchCellCb *cell, - RgrUeRecfg *ueRecfg)); -PRIVATE Void rgSCHCfgFreeDlDedLcCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - RgSchDlLcCb *dlLc)); -PRIVATE Void rgSCHCfgFreeDlCmnLcCb ARGS((RgSchClcDlLcCb *cmnDlLc)); -PRIVATE Void rgSCHCfgFreeUeCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -PRIVATE Void rgSCHCfgFreeRgrCfgLst ARGS((RgSchCellCb *cell)); -PRIVATE Void rgSCHCfgFreeCmnLcLst ARGS((RgSchCellCb *cell)); -PRIVATE Void rgSCHCfgFreeUeLst ARGS((RgSchCellCb *cell)); -#ifdef LTEMAC_SPS -PRIVATE Void rgSCHCfgFreeSpsUeLst ARGS((RgSchCellCb *cell)); -#endif -PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg ARGS((Inst inst, RgrCellCfg *cellCfg, - RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg ARGS((Inst inst, RgrCellCfg *cellCfg, - RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHCfgVldtRgrCellSchCfg ARGS((Inst inst, RgrCellCfg *cellCfg)); -PRIVATE S16 rgSCHCfgVldtRgrSchCfg ARGS((Inst inst, RgrSchedEnbCfg *schedEnbCfg)); -PRIVATE S16 rgSCHCfgVldtRgrCellRACfg ARGS((Inst inst, RgrCellCfg *cellCfg)); -PRIVATE Void rgSCHCfgRgrUePhrMsg3 ARGS(( RgSchCellCb *cell, - RgSchRaCb *raCb,RgSchUeCb *ue, RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHCfgRgrCmnLcCfg ARGS((RgSchCellCb *cell, RgrCmnLchCfg *lcCfg, - RgSchErrInfo *errInfo)); -PUBLIC Void rgSCHSCellFreeBuf ARGS((Inst inst,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,U8 idx)); -#ifdef RGR_SI_SCH -PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg ARGS(( Inst inst, RgrSiCfg *siCfg)); -#endif/*RGR_SI_SCH */ - -/* LTE_ADV_FLAG_REMOVED_START */ -PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg ARGS(( Inst inst, - RgrLteAdvancedCellConfig *lteAdvCfg, U8 dlTotalBw)); -/* LTE_ADV_FLAG_REMOVED_END */ - -PRIVATE S16 rgSCHCfgVldtDrxUeCfg ARGS ((RgSchCellCb *cell, - RgrUeDrxCfg *ueDrxCfg)); -PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg ARGS((U8 onDurTmr)); -PRIVATE S16 rgSCHCfgVldtDrxInActvCfg ARGS((U16 inActvTmr)); -PRIVATE S16 rgSCHCfgVldtDrxReTxCfg ARGS((U8 reTxTmr)); -PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg ARGS((RgrDrxLongCycleOffst lngCycleOffst)); -PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs ARGS((U16 val)); -PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg ARGS((RgrDrxShortDrx shrtCycCfg)); -PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg ARGS((Inst inst, - RgrCellCsgParamCfg *csgParam)); -#ifdef TFU_UPGRADE - -PUBLIC S16 rgSCHCfgACqiUeCfg ARGS(( RgSchCellCb *cellCb,RgSchUeCb *ue, RgSchUeACqiCb *aCqiCb, - RgrTxMode ueTxMode,RgrUeAprdDlCqiCfg *aCqiCfg, CmLteUeCategory ueCat )); - -PUBLIC S16 rgSCHCfgAcqiUeReCfg ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUeAprdDlCqiCfg *acqiCfg, CmLteUeCategory ueCat )); - -PUBLIC S16 rgSCHUtlGetCfgPerOff ARGS(( RgSchPerTbl tbl, U16 cfgIdx, - U16 *peri, U16 *offset )); - -PUBLIC S16 rgSCHCfgRiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg, CmLteUeCategory ueCat )); - -PUBLIC S16 rgSCHCfgPCqiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat )); - -PUBLIC S16 rgSCHCfgSrsUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb, - RgrUeUlSrsCfg *srsCfg )); - -PUBLIC S16 rgSCHCfgSrUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb, - RgrUeSrCfg *srCfg)); - -PUBLIC S16 rgSCHCfgPCqiUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat)); - -PUBLIC S16 rgSCHCfgSrsUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUeUlSrsCfg *srsCfg)); - -PUBLIC S16 rgSCHCfgSrUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, - RgrUeSrCfg *srCfg)); - -PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode ARGS((RgSchCellCb *cellCb, - RgrTxMode txMde, RgrAprdCqiMode puschMode,RgSchErrInfo *errInfo)); - -PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg ARGS(( RgSchCellCb *cellCb, - CmLteRnti crnti, RgrUeAprdDlCqiCfg *acqiCfg, RgrUeTxModeCfg txMode, - RgSchErrInfo *errInfo )); - -PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode ARGS((RgSchCellCb *cellCb, - RgrTxMode txMde, RgrPrdCqiMode pucchMode,RgSchErrInfo *errInfo)); - -#ifdef LTEMAC_HDFDD -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb, - CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, Bool hdFdd, - RgrUeTxModeCfg txMode, RgSchErrInfo *errInfo)); -#else -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb, - CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, RgrUeTxModeCfg txMode, - RgSchErrInfo *errInfo)); -#endif -#ifdef LTEMAC_HDFDD -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb, - CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg, Bool hdFdd, - RgSchErrInfo *errInfo)); -#else -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb, - CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg, - RgSchErrInfo *errInfo)); -#endif - -#ifdef LTEMAC_HDFDD -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti, - RgrUeSrCfg *srCfg, Bool hdFdd, RgSchErrInfo *errInfo)); -#else -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti, - RgrUeSrCfg *srCfg, RgSchErrInfo *errInfo)); -#endif -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg ARGS (( RgSchCellCb *cellCb, - RgrUeCfg *ueCfg, - RgSchErrInfo *errInfo)); - -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg ARGS (( RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeRecfg *ueReCfg, - RgSchErrInfo *errInfo )); - -PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel ARGS ((RgSchCellCb *cellCb, - RgSchUeCb *ueCb)); - -PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz ARGS (( RgSchUeACqiCb *acqiCb,U8 numTxAnt, - U8* cqiPmiSzR1,U8* cqiPmiSzRn1 )); - -/* Added the function to be used instead of the - * MACRO RG_SCH_GET_PERIODICITY_TBL */ -PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl* rgSCHCfgUtlGetPcqiSrsSrRiTbl ARGS (( - RgSchPerTbl tblType, - U8 * min, - U8 * max)); - -#endif /* TFU_UPGRADE */ -PRIVATE Void rgSCHCfgUeTaRecfg ARGS (( RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeRecfg *ueReCfg, - RgSchErrInfo *errInfo )); -#ifdef LTE_ADV -PUBLIC S16 rgSCHSCellCfgUeCfg ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -)); - -PUBLIC S16 rgSCHSCellCfgUePucchReCfg ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -)); -PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg ARGS(( -RgrUeRecfg *ueRecfg, -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchErrInfo *errInfo -)); -PRIVATE S16 rgSCHSCellCfgUeCfgRollBack ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -)); -#endif - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) -PRIVATE S16 rgSCHCfgUeCqiReptReCfg ARGS (( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -)); - -PRIVATE S16 rgSCHCfgVldtCqiReptReCfg ARGS (( -RgSchCellCb *cell, -RgrUeRecfg *ueRecfg -)); -#endif -/*LTE_L2_MEAS_PHASE2*/ -#ifdef LTE_L2_MEAS -PRIVATE S16 rgSchAddToL2Meas ARGS ((RgSchCellCb *cellCb,RgSchDlLcCb *dlLc)); -#endif -#ifdef EMTC_ENABLE -PUBLIC S16 rgSCHEmtcCfgVldtDrxOnDurCfg -( -U16 onDurTmr -); -PUBLIC Void rgSCHUtlUpdEmtcY -( -RgSchUeCb *ue -); -EXTERN Void rgSCHEmtcHqPAlloc -( -RgSchCellCb *cell, -RgSchDlHqEnt *hqEnt -); -#endif - -/* local typedefs */ -CONSTANT RgSchSrsTxOffst rgSrsTxOffstTbl[RGSCH_MAX_SRS_SFCFG_IDX+1]= - {{1,{0,0,0,0,0,0,0,0}}, - {1,{0,0,0,0,0,0,0,0}}, - {1,{1,0,0,0,0,0,0,0}}, - {1,{0,0,0,0,0,0,0,0}}, - {1,{1,0,0,0,0,0,0,0}}, - {1,{2,0,0,0,0,0,0,0}}, - {1,{3,0,0,0,0,0,0,0}}, - {2,{0,1,0,0,0,0,0,0}}, - {2,{2,3,0,0,0,0,0,0}}, - {1,{0,0,0,0,0,0,0,0}}, - {1,{1,0,0,0,0,0,0,0}}, - {1,{2,0,0,0,0,0,0,0}}, - {1,{3,0,0,0,0,0,0,0}}, - {7,{0,1,2,3,4,6,8,0}}, - {8,{0,1,2,3,4,5,6,8}}, - {0,{0,0,0,0,0,0,0,0}}}; - -/* local externs */ - -#ifdef TFU_UPGRADE -/* SRSCfg Table: Ref 36.213, Table: 8.2.1 */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl -rgSchUeSrsCfgIdxFddTbl[RG_SCH_SRS_ISRS_INDX_MAX_FDD]= -{ - { 0,1, 2, 0 }, - { 2,6, 5, 2 }, - { 7,16, 10, 7 }, - { 17,36, 20, 17}, - { 37,76, 40, 37}, - { 77,156, 80, 77}, - { 157,316,160,157}, - { 317,636,320,317 } -}; - -/* Reference : 36.213 Table 8.2-2 */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl -rgSchUeSrsCfgIdxTddTbl[RG_SCH_SRS_ISRS_INDX_MAX_TDD]= -{ - { 10,14, 5, 10 }, - { 15,24, 10, 15 }, - { 25,44, 20, 25 }, - { 45,84, 40, 45 }, - { 85,164, 80, 85 }, - { 165,324,160, 165 }, - { 325,644,320, 325 } - /* RESERVED: Configuration Module should not allow Res values */ -}; - -/*Reference: 36.213 Table:7.2.2-1A */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl -rgSchUePCqiCfgIdxFddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_FDD]= -{ - { 0,1, 2, 0 }, - { 2,6, 5, 2 }, - { 7,16, 10,7 }, - {17,36, 20,17}, - {37,76, 40, 37}, - {77,156, 80, 77}, - {157,316,160,157}, - {318,349,32,318}, - {350,413,64, 350}, - {414,541,128,414 } - /* RESERVED: Configuration should not allow Res values */ -}; - -/* Reference: 36.213 Table:7.2.2-1C */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl -rgSchUeCqiPmiCfgIdxTddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_TDD]= -{ - { 0,0, 1, 0 }, - { 1,5, 5, 1 }, - { 6,15, 10,6 }, - {16,35, 20,16}, - {36,75, 40,36}, - {76,155, 80,76}, - {156,315,160,156} - /* RESERVED: Configuration should not allow Res values */ -}; - -/* Note: RI table is same for FDD and TDD */ -/*Reference: 36.213 Table:7.2.2-1B */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl -rgSchUeRiCfgIdxTbl[RG_SCH_RI_CFGIDX_MAX]= -{ - { 0,160, 1, 0 }, - { 161,321, 2, 161 }, - { 322,482, 4, 322 }, - { 483,643, 8, 483}, - { 644,804, 16,644}, - { 805,965, 32,805 } - /* RESERVED: Configuration should not allow Res values */ -}; - -/*Reference: 36.213 Table:7.2.2-2 */ -CONSTANT RgSchUeBwSubSzBwParts -rgSchUeBwSubSzBwPartsTbl[RG_SCH_BW_SUBSZ_BWPARTS_MAX]= -{ - {6,7, 0, 0}, /*TODO: 6,7, NA, NA */ - {8, 10, 4,1}, - {11, 26, 4,2}, - {27, 63, 6,3}, - {64, 110, 8,4} -}; - - -/* Reference : 36.213 Table 10.1-5 */ -/* Note: SR is same table for TDD and FDD */ -CONSTANT RgSchUePCqiSrsSrCfgIdxTbl rgSchUeSrCfgIdxTbl[RG_SCH_ISR_INDX_MAX]= -{ - { 0,4, 5, 0 }, - { 5,14, 10, 5 }, - { 15,34, 20,15 }, - { 35,74, 40,35}, - { 75,154, 80, 75} - /* RESERVED: Configuration should not allow Res values */ -}; - -/*Reference:36.213: Derived from Table: 7.2.1-5 for Label L. - The Label L is CEIL(log2(BinCoe(N and M)))*/ -CONSTANT U8 RgSCHUeAcqi2022LBitWidth[6][28] ={ -{0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5}, -{0,0,2,3,4,4,5,5,6,6,6,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,9}, -{0,0,0,2,4,5,6,6,7,7,8,8,9,9,9,10,10,10,10,11,11,11,11,11,12,12,12,12}, -{0,0,0,0,3,4,6,7,7,8,9,9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,15,15}, -{0,0,0,0,0,3,5,6,7,8,9,10,11,11,12,13,13,14,14,14,15,15,16,16,16,17,17,17}, -{0,0,0,0,0,0,3,5,7,8,9,10,11,12,13,13,14,15,15,16,16,17,17,18,18,18,19,19} -}; - -#endif - -EXTERN U8 rgSchCmnHarqRtt[]; -#ifdef EMTC_ENABLE -EXTERN S16 rgSCHEmtcCellAlloc ARGS((RgSchCellCb *cel)); -EXTERN Void rgSCHEmtcCellFree ARGS((RgSchCellCb *cel)); -EXTERN Void rgSCHEmtcUeInfoFree ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); -EXTERN U8 rgSchfillPucchSrRepNumCountemtc ARGS((RgSchUeCb *ueCb)); -EXTERN U8 rgSchfillPucchCqiRepNumCountemtc ARGS((RgSchUePCqiCb *cqiCb, RgSchUeCb *ueCb)); -EXTERN S16 rgEmtcvalidateSiCfg ARGS((RgrSiCfgReqInfo *siCfg,RgSchCellCb *cell)); -#endif -/* forward references */ - - -/** - * @brief Validates the SCH EndoeB configuration request from RRM to SCH. - * - * @details - * - * Function : rgSCHCfgVldtRgrSchedEnbCfg - * - ** Processing Steps: - * - Retrieve the cell control block. - * - If successful, - * - Validate the range of configured values recieved in - * configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * @param[in] Inst inst - * @param[in] RgrSchedEnbCfg *schedEnbCfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrSchedEnbCfg -( -Inst inst, -RgrSchedEnbCfg *schedEnbCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrSchedEnbCfg(inst, schedEnbCfg, errInfo) -Inst inst; -RgrSchedEnbCfg *schedEnbCfg; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrSchedEnbCfg); - RGSCHDBGPRM(inst, (rgSchPBuf(inst), "VALIDATE RGR SCH ENB CONFIG: \n")); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG; - - // TODO - if ((rgSCHCfgVldtRgrSchCfg(inst, schedEnbCfg)) != ROK) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst), "Validation for scheduler related " - "config failed\n")); - RETVALUE(RFAILED); - } - - RLOG1(L_INFO, "MIMO_DBG:: SCH:: numAntPorts=%d\n",schedEnbCfg->numTxAntPorts); - - /* Validation for the ENB parameters */ - if ((schedEnbCfg->numTxAntPorts == 0) || (schedEnbCfg->numTxAntPorts > 4)) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst),"Invalid number of transmit antenna" - " ports %d\n", schedEnbCfg->numTxAntPorts)); - RETVALUE(RFAILED); - } - - /* Validate csg access mode */ - if((schedEnbCfg->accsMode < RGR_CELL_ACCS_OPEN) || - (schedEnbCfg->accsMode > RGR_CELL_ACCS_HYBRID)) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst), "Invalid CSG Access mode\n")); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR SCHED ENB config validation done:"\n)); - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrSchedEnbCfg */ - -/** - * @brief Validates the cell configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrCellCfg - * - * Processing Steps: - * - Retrieve the cell control block. - * - If successful, - * - Validate the range of configured values recieved in - * configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * @param[in] Inst inst - * @param[in] RgrCellCfg *cellCfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrCellCfg -( -Inst inst, -RgrCellCfg *cellCfg, -RgSchCellCb *cell, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrCellCfg(inst, cellCfg, cell, errInfo) -Inst inst; -RgrCellCfg *cellCfg; -RgSchCellCb *cell; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrCellCfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_CFG; - - /* check if cell exists already */ - if ((U8 *)cell != NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Cell Id already exists"); - RETVALUE(RFAILED); - } - - if(cellCfg->macInst >= RGSCH_INST_START) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid MAC Instance %d ", - cellCfg->macInst); - RETVALUE(RFAILED); - } - - if (cellCfg->macRnti.startRnti < RGSCH_MIN_MAC_RNTI ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid start RNTI %d for cell ", - cellCfg->macRnti.startRnti); - RETVALUE(RFAILED); - } - - if ((rgSCHCfgVldtRgrCellSchCfg(inst, cellCfg)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for scheduler related " - "config failed"); - RETVALUE(RFAILED); - } - - if ((cellCfg->dlHqCfg.maxDlHqTx < RGSCH_MIN_HQ_TX) || - (cellCfg->dlHqCfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid Downlink HARQ configuration:" - " maxDlHqTx %d maxMsg4HqTx %d", cellCfg->dlHqCfg.maxDlHqTx, - cellCfg->dlHqCfg.maxMsg4HqTx); - RETVALUE(RFAILED); - } - if ((cellCfg->cfiCfg.cfi < RGSCH_MIN_CFI_VAL) || - (cellCfg->cfiCfg.cfi > RGSCH_MAX_CFI_VAL)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid CFI configuration %d", - cellCfg->cfiCfg.cfi); - RETVALUE(RFAILED); - } - if (((cellCfg->puschSubBand.subbandStart) + - ((cellCfg->puschSubBand.numSubbands -1) * cellCfg->puschSubBand.size)) - > (cellCfg->bwCfg.ulTotalBw - 1)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PUSCH subband configuration:" - " subBandStart %d numSubBands %d subBandSize %d ulTotBw %d", - cellCfg->puschSubBand.subbandStart, - cellCfg->puschSubBand.numSubbands, cellCfg->puschSubBand.size, - cellCfg->bwCfg.ulTotalBw); - RETVALUE(RFAILED); - } - - if (((cellCfg->bwCfg.dlTotalBw < RGSCH_MIN_DL_BW) || - (cellCfg->bwCfg.dlTotalBw > RGSCH_MAX_DL_BW)) || - ((cellCfg->bwCfg.ulTotalBw < RGSCH_MIN_UL_BW) || - (cellCfg->bwCfg.ulTotalBw > RGSCH_MAX_UL_BW))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid Bandwidth configuration:" - " ul %d dl %d",cellCfg->bwCfg.ulTotalBw, - cellCfg->bwCfg.dlTotalBw); - RETVALUE(RFAILED); - } - if (cellCfg->phichCfg.ngEnum > RGR_NG_TWO) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PHICH Ng configuration %d", - (U8)cellCfg->phichCfg.ngEnum); - RETVALUE(RFAILED); - } - /* Validation for extended PHICH Duration */ - if ((cellCfg->phichCfg.isDurExtend == TRUE) && - (cellCfg->bwCfg.dlTotalBw <= 10) && (cellCfg->cfiCfg.cfi < 2)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid cfi value for" - "Extended PHICH duration cfi:%d dlBw:%d", - (U8)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw); - RETVALUE(RFAILED); - } - if ((cellCfg->phichCfg.isDurExtend == TRUE) && - (cellCfg->bwCfg.dlTotalBw > 10) && (cellCfg->cfiCfg.cfi < 3)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid cfi value for" - "Extended PHICH duration cfi:%d dlBw:%d", - (U8)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw); - RETVALUE(RFAILED); - } - RLOG4(L_INFO,"CA_DBG:: PUCCH configuration:" - " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", - cellCfg->pucchCfg.resourceSize, - cellCfg->pucchCfg.n1PucchAn, - cellCfg->pucchCfg.deltaShift, - cellCfg->pucchCfg.cyclicShift); - - /* ccpu00138567- Removing validation check for resourceSize as 0. - * From the spec, n2RB value 0 is a valid config. */ - if ((cellCfg->pucchCfg.resourceSize >= cellCfg->bwCfg.ulTotalBw/2) || - (cellCfg->pucchCfg.n1PucchAn == 0) || - (cellCfg->pucchCfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) || - (cellCfg->pucchCfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS) || - (cellCfg->pucchCfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PUCCH configuration:" - " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", - cellCfg->pucchCfg.resourceSize, - cellCfg->pucchCfg.n1PucchAn, - cellCfg->pucchCfg.deltaShift, - cellCfg->pucchCfg.cyclicShift); - RETVALUE(RFAILED); - } - if (cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsBwEnum > RGR_SRS_BWCFG_7) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid SRS configuration: " - " srsBw %d", (U8)cellCfg->srsCfg.srsBwEnum); - RETVALUE(RFAILED); - } - - if ((rgSCHCfgVldtRgrCellRACfg(inst, cellCfg)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for Random access related" - "config failed"); - RETVALUE(RFAILED); - } - - if ((rgSCHCfgVldtRgrCellPwrCfg(inst, cellCfg, errInfo)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for cell power " - "config failed"); - RETVALUE(RFAILED); - } - - /* Validate the common logical channel configuration */ - if( (cellCfg->numCmnLcs < RGR_MIN_CMN_LC_PER_CELL)|| - (cellCfg->numCmnLcs > RGR_MAX_CMN_LC_PER_CELL)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid number(%d) of common logical" - "channels in cell config", cellCfg->numCmnLcs); - RETVALUE(RFAILED); - } - if ((rgSCHCfgVldtRgrCmnLcCfg(inst, cellCfg, errInfo)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for common logical" - "channels failed"); - RETVALUE(RFAILED); - } - - /* Added 0 as a valid value for number of TICKs RRM - * 0 implies no ticks i.e. shutting off the feature.*/ - -#ifdef RGR_SI_SCH - if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellCfg->siCfg))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for SI" - "configuration failed"); - RETVALUE(RFAILED); - } -#endif /*RGR_SI_SCH */ - - /*ccpu00116923 - ADD - Srs Present support - Start*/ -#ifdef TFU_UPGRADE -#ifdef LTE_TDD - if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 13) -#else - if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 14) -#endif - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid" - "Subframe configuration"); - RETVALUE(RFAILED); - } -#endif - /*ccpu00116923 - ADD - Srs Present support - End*/ - - if ((cellCfg->bcchTxPwrOffset > 10000) || - (cellCfg->pcchTxPwrOffset > 10000) || - (cellCfg->rarTxPwrOffset > 10000) || - (cellCfg->phichTxPwrOffset > 10000) - ) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, - "Invalid txPower offset "); - RETVALUE(RFAILED); - } - -/* LTE_ADV_FLAG_REMOVED_START */ - /* Checking Whether DSFR is enabled without enabling SFR */ - if(((cellCfg->rgrLteAdvCfg.pres & RGR_DSFR) && - (RGR_ENABLE == cellCfg->rgrLteAdvCfg.dsfrCfg.status)) && - (!((cellCfg->rgrLteAdvCfg.pres & RGR_SFR) && - (RGR_ENABLE == cellCfg->rgrLteAdvCfg.sfrCfg.status)))) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "DSFR is enbaled" - "Without enabling SFR"); - RETVALUE(RFAILED); - } - - if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellCfg->rgrLteAdvCfg), - cellCfg->bwCfg.dlTotalBw)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for LTE Adv" - "configuration failed"); - RETVALUE(RFAILED); - } -#ifdef LTE_ADV - if ((rgSCHCfgVldtRgrCellLteLAACfg(inst, cellCfg)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for LTE LAA" - "configuration failed"); - RETVALUE(RFAILED); - } -#endif -/* LTE_ADV_FLAG_REMOVED_END */ - if (cellCfg->msg4pAVal > RGRUE_DLPWRCNTRL_PA_DB3) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid" - "msg4pAVal %u", cellCfg->msg4pAVal); - RETVALUE(RFAILED); - } - - /* Validate RgrCellCsgParamCfg */ - if(rgSchCb[inst].rgrSchedEnbCfg.accsMode == RGR_CELL_ACCS_HYBRID) - { - if((rgSCHCfgVldtRgrCellCsgParamCfg(inst, - &(cellCfg->csgParamCfg)) != ROK)) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst), "Validation failed for \n" - "Access CSG parameter failed\n")); - RETVALUE(RFAILED); - } - } -#ifdef EMTC_ENABLE - if (cellCfg->emtcEnable) - { - if(ROK != rgSCHCfgVldtRgrEmtcCellCfg(cellCfg)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid EMTC cell Configuration %d for cell" ,cellCfg->cellId); - RETVALUE(RFAILED); - } - } -#endif - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrCellCfg */ - -/** - * @brief Validates the scheduler related configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrSchCfg - * - * Processing Steps: - * - Validate the scheduler related configuration request from RRC to MAC at CFG: - * validate the value range for the configured values. - * - If validated successfully, - * - Return ROK . - * - Else - * - Return RFAILED. - * - * @param[in] Inst inst - * @param[out] RgSchedCfg *rgSchedCfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrSchCfg -( -Inst inst, -RgrSchedEnbCfg *rgSchedCfg -) -#else -PUBLIC S16 rgSCHCfgVldtRgrSchCfg(inst, rgSchedCfg) -Inst inst; -RgrSchedCfg *rgSchedCfg; -#endif -{ - TRC2(rgSCHCfgVldtRgrSchCfg); - - RGSCHDBGPRM(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Validating \ - scheduler related Configuration")); - if (rgSchedCfg->ulSchdType > (RGSCH_NUM_SCHEDULERS - 1)) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Invalid \ - UL scheduler type %d \n", rgSchedCfg->ulSchdType)); - RETVALUE(RFAILED); - } - if (rgSchedCfg->dlSchdType > (RGSCH_NUM_SCHEDULERS - 1)) - { - RGSCHDBGERR(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Invalid \ - DL scheduler type %d \n", rgSchedCfg->dlSchdType)); - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} -/** - * @brief Validates the scheduler related configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrCellSchCfg - * - * Processing Steps: - * - Validate the scheduler related configuration request from RRC to MAC at CFG: - * validate the value range for the configured values. - * - If validated successfully, - * - Return ROK and pointer to the cell of UE. - * - Else - * - Return RFAILED. - * - * @param[in] Inst inst - * @param[out] RgSchCellCfg *cellCfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrCellSchCfg -( -Inst inst, -RgrCellCfg *cellCfg -) -#else -PUBLIC S16 rgSCHCfgVldtRgrCellSchCfg(inst, cellCfg) -Inst inst; -RgrCellCfg *cellCfg; -#endif -{ - TRC2(rgSCHCfgVldtRgrCellSchCfg); - -#if RGSCH_NUM_DLFS_SCHEDULERS - if (cellCfg->dlfsSchdType > RGSCH_NUM_DLFS_SCHEDULERS - 1) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid dlfs scheduler type %d for cell", - cellCfg->dlfsSchdType); - RETVALUE(RFAILED); - } -#endif - RETVALUE(ROK); -} -/** - * @brief Validates the RACH related configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrCellRACfg - * - * Processing Steps: - * - Validate the RA configuration request from RRC to MAC at CFG: - * validate the value range for the configured values. - * - If validated successfully, - * - Return ROK and pointer to the cell of UE. - * - Else - * - Return RFAILED. - * - * @param[in] Inst inst - * @param[out] RgSchCellCfg *cellCfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrCellRACfg -( -Inst inst, -RgrCellCfg *cellCfg -) -#else -PUBLIC S16 rgSCHCfgVldtRgrCellRACfg(inst, cellCfg) -Inst inst; -RgrCellCfg *cellCfg; -#endif -{ - TRC2(rgSCHCfgVldtRgrCellRACfg); - - -#ifdef LTE_TDD - if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_TDD_RA_PREAMBLE_FMT) || -#else - if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) || -#endif - (cellCfg->rachCfg.raWinSize < RGSCH_MIN_RA_WINSIZE) || - (cellCfg->rachCfg.raWinSize > RGSCH_MAX_RA_WINSIZE) || - (cellCfg->rachCfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) || - (cellCfg->rachCfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE) || - (cellCfg->rachCfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE) || - (cellCfg->rachCfg.sizeRaPreambleGrpA > - cellCfg->rachCfg.numRaPreamble) || - (cellCfg->rachCfg.prachResource > - (cellCfg->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB))) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid RACH configuration:" - "preamble Fmt %d raWinSize %d maxMsg3Tx %d", - cellCfg->rachCfg.preambleFormat, cellCfg->rachCfg.raWinSize, - cellCfg->rachCfg.maxMsg3Tx); - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid numRaPreamble %d sizeRaPreambleGrpA %d", - cellCfg->rachCfg.numRaPreamble, - cellCfg->rachCfg.sizeRaPreambleGrpA); - RETVALUE(RFAILED); - } - /* RACHO */ - /* verify that the ded Preambles cfgd for Pdcch Order - * do not collide with that of non-dedicated and validates against - * the configuration index and number of RACH - * ded-preambles. For non-zero ded preamble cfg, - * the config index is expected to be != NA.*/ - if ((cellCfg->macPreambleSet.pres) && - ((cellCfg->macPreambleSet.start < cellCfg->rachCfg.numRaPreamble) || - (cellCfg->macPreambleSet.start >= RGSCH_MAX_NUM_RA_PREAMBLE) || - (cellCfg->macPreambleSet.size < 1) || - (cellCfg->macPreambleSet.size > RGSCH_MAX_NUM_RA_PREAMBLE- - cellCfg->rachCfg.numRaPreamble) || - (cellCfg->rachCfg.raOccasion.sfnEnum == RGR_SFN_NA))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid RACH Preambleset conf:" - "preambleSet Start %d preambleSet Size %d", - cellCfg->macPreambleSet.start, cellCfg->macPreambleSet.size); - RETVALUE(RFAILED); - } -#ifdef RGR_V1 - if(cellCfg->rachCfg.contResTmr) - { - U8 idx; -#ifdef LTE_TDD - idx = cellCfg->ulDlCfgIdx; -#else - idx = 7; /* FDD */ -#endif - /* maxMsg4TxDelay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + - 3 TTI (MAX L1+L2 processing delay at the UE) */ - U8 maxMsg4TxDelay = (cellCfg->dlHqCfg.maxMsg4HqTx-1) * - rgSchCmnHarqRtt[idx] + 3; - - - if(maxMsg4TxDelay >= cellCfg->rachCfg.contResTmr) - { - RLOG_ARG2(L_WARNING,DBG_CELLID,cellCfg->cellId , - "Warining !: Contention Resolution timer not greater than the " - "guard timer. Conte Res timer %d Guard timer %d", - cellCfg->rachCfg.contResTmr, - maxMsg4TxDelay ); - /* [ccpu00138532]-DEL- removed return fail here as it is ok if the - max Msg4 Tx delay is more than the contension Resolution timer. - In such case, the CRI CE will be scheduled immediately once - msg3 is received */ - } - } - else - { - /* ccpu00128575 ADD - If contention resolution timer is configured as 0, - Then return fail*/ - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, - "Contention Resolution timer is configured as '0'"); - RETVALUE(RFAILED); - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief Validates the UE configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeCfg - * - * Processing Steps: - * - Validate the UE configuration request from RRC to MAC at CFG: - * validate the value range for the configured values. - * - If validated successfully, - * - Return ROK and pointer to the cell of UE. - * - Else - * - Return RFAILED. - * - * @param[in] Inst inst - * @param[in] RgrUeCfg *ueCfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeCfg -( -Inst inst, -RgrUeCfg *ueCfg, -RgSchCellCb **cell, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeCfg(inst, ueCfg, cell, errInfo) -Inst inst; -RgrUeCfg *ueCfg; -RgSchCellCb **cell; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrUeCfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_CFG; - - if (((*cell) == NULLP) || - ((*cell)->cellId != ueCfg->cellId)) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"Cell does not exist %d", - ueCfg->cellId); - RETVALUE(RFAILED); - } - /* RACHO: - * Check configured preamble id not colliding with non dedicated or PDCCH - * order preamble sets. When valid preamble id given check that C-RNTI given - * in configuration is not amongst the C-RNTI'smanaged by scheduler */ - if ((rgSCHRamVldtUeCfg(*cell, ueCfg)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Preamble Id configuration" - "failed ",ueCfg->cellId); - RETVALUE(RFAILED); - } - /* Check if Ue already configured */ - if (rgSCHDbmGetUeCb(*cell, ueCfg->crnti) != NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d UEID already exists", - ueCfg->cellId); - RETVALUE(RFAILED); - } - /* Validate Transmission UE modes */ - if ((ueCfg->txMode.pres == TRUE) && ((ueCfg->txMode.txModeEnum < RGR_UE_TM_1) - || (ueCfg->txMode.txModeEnum > RGR_UE_TM_7))) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid transmission mode for" - " UE is %d", ueCfg->cellId,(U8)ueCfg->txMode.txModeEnum); - RETVALUE(RFAILED); - } - - /* Validate UE Category */ - if (ueCfg->ueCatEnum > CM_LTE_UE_CAT_8) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid category for UE %d", - ueCfg->cellId,(U8)ueCfg->ueCatEnum); - RETVALUE(RFAILED); - } - - /* Validate UE Access Stratum Release */ - if (ueCfg->accessStratumRls > RGR_REL_10) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid Access Stratum Release %u for UE\n", - ueCfg->accessStratumRls)); - RETVALUE(RFAILED); - } - RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "Configured Access Stratum Release %u\n", \ - ueCfg->accessStratumRls)); - - if ((*cell)->numTxAntPorts == 1) - { - if ((ueCfg->txMode.pres == TRUE) && - (ueCfg->txMode.txModeEnum > RGR_UE_TM_1)) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid transmission mode for" - " UE (%d) for the configured Cell Antenna Ports",ueCfg->cellId, - (U8)ueCfg->txMode.txModeEnum); - RETVALUE(RFAILED); - } - } - - if ((rgSCHCfgVldtUeCqiModeCfg(*cell, &ueCfg->ueDlCqiCfg)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti, "CELLID:%d Invalid CQI Mode configuration", - ueCfg->cellId); - RETVALUE(RFAILED); - } - - /* Validate Max Uplink HARQ transmission value */ - if (ueCfg->ueUlHqCfg.maxUlHqTx < RGSCH_MIN_HQ_TX) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid Uplink HARQ config for " - "UE %d",ueCfg->cellId,ueCfg->ueUlHqCfg.maxUlHqTx); - RETVALUE(RFAILED); - } - - if (rgSCHCfgVldtUePwrCfg(*cell, &ueCfg->ueUlPwrCfg) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid PUSCH Group power" - " configuration",ueCfg->cellId); - RETVALUE(RFAILED); - } - - if (rgSCHCfgVldtUeMeasGapAckNakRepCfg(*cell, ueCfg) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid MeasGap/AckNackRep" - " configuration",ueCfg->cellId); - RETVALUE(RFAILED); - } - -#ifdef LTEMAC_SPS - /* Validating SPS RNTI */ - if (((ueCfg->ueSpsCfg.spsRnti >= (*cell)->rntiDb.rntiStart) && - (ueCfg->ueSpsCfg.spsRnti<=((*cell)->rntiDb.rntiStart+(*cell)->rntiDb.maxRntis))) - ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_SI_RNTI) - ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_P_RNTI)) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid SPS RNTI " - " in DL SPS Config",ueCfg->cellId); - RETVALUE(RFAILED); - } - - if (ueCfg->ueSpsCfg.dlSpsCfg.isDlSpsEnabled) - { - if (rgSCHCfgVldtUeDlSpsCfg(*cell, &ueCfg->ueSpsCfg.dlSpsCfg) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid DL SPS configuration" - " for the UE",ueCfg->cellId); - RETVALUE(RFAILED); - } - } -#endif -#ifdef TFU_UPGRADE - /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */ - if ( ROK != rgSCHCfgVldtCqiSrSrsUeCfg(*cell, ueCfg, errInfo)) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid Periodic CQI/SR/SRS" - "configuration",ueCfg->cellId); - RETVALUE(RFAILED); - } -#endif - - /* Validate DRX specific parameters */ - if ( ROK != rgSCHCfgVldtDrxUeCfg(*cell, &(ueCfg->ueDrxCfg))) - { - RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid DRX configuration", - ueCfg->cellId); - RETVALUE(RFAILED); - } - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - if (ueCfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid numColltdCqiRept," - "MAX supported %d",RGR_CQIRPTS_MAXN,ueCfg->cellId); - RETVALUE(RFAILED); - } -#endif /* End of RGR_CQI_REPT */ - -#ifdef EMTC_ENABLE -/*This is to validate the EMTC related configuration if a UE is an EMTC UE*/ - if(TRUE == ueCfg->emtcUeCfg.pres) - { - if ( ROK != rgSCHCfgVldtEmtcUeCfg(*cell, &(ueCfg->emtcUeCfg))) - { - RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid EMTC UE configurationfor crnti:%d", - ueCfg->cellId, ueCfg->crnti); - RETVALUE(RFAILED); - } - } -#endif - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrUeCfg */ - - -/** - * @brief Validates the cell reconfiguration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrCellRecfg - * - * Processing Steps: - * - Retrieve the cell control block. - * - If successful, - * - Validate the range of reconfigured values recieved in - * re-configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * - * @param[in] Inst inst - * @param[in] RgrCellRecfg *cellRecfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrCellRecfg -( -Inst inst, -RgrCellRecfg *cellRecfg, -RgSchCellCb **cell, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrCellRecfg(inst, cellRecfg, cell, errInfo) -Inst inst; -RgrCellRecfg *cellRecfg; -RgSchCellCb **cell; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrCellRecfg); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_RECFG; - - /* Fetch cell and validate cell Id with the cell control block*/ - if (((*cell) == NULLP) || - ((*cell)->cellId != cellRecfg->cellId)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Cell control block does not exist"); - RETVALUE(RFAILED); - } - - /* Validate recieved values */ - if ((cellRecfg->recfgTypes & RGR_CELL_DL_HARQ_RECFG) && - ((cellRecfg->dlHqRecfg.maxDlHqTx < RGSCH_MIN_HQ_TX) || - (cellRecfg->dlHqRecfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Downlink HARQ configuration:" - " maxDlHqTx %d maxMsg4HqTx %d", cellRecfg->dlHqRecfg.maxDlHqTx, - cellRecfg->dlHqRecfg.maxMsg4HqTx); - RETVALUE(RFAILED); - } - if ((cellRecfg->recfgTypes & RGR_CELL_CFI_RECFG) && - ((cellRecfg->cfiRecfg.cfi < RGSCH_MIN_CFI_VAL) || - (cellRecfg->cfiRecfg.cfi > RGSCH_MAX_CFI_VAL))) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid CFI configuration %d", - cellRecfg->cfiRecfg.cfi); - RETVALUE(RFAILED); - } - if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG) - { - /* ccpu00138567- Removing validation check for resourceSize as 0. - * From the spec, n2RB value 0 is a valid config. */ - if ((cellRecfg->pucchRecfg.n1PucchAn == 0) || - (cellRecfg->pucchRecfg.resourceSize >= (*cell)->bwCfg.ulTotalBw/2)|| - ((cellRecfg->pucchRecfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) || - (cellRecfg->pucchRecfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS)) || - (cellRecfg->pucchRecfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid PUCCH configuration: " - "N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", - cellRecfg->pucchRecfg.resourceSize, - cellRecfg->pucchRecfg.n1PucchAn, - cellRecfg->pucchRecfg.deltaShift, - cellRecfg->pucchRecfg.cyclicShift); - RETVALUE(RFAILED); - } - } - if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG) - { - if (cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsBwEnum > RGR_SRS_BWCFG_7) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid SRS configuration: " - "srsBw %d", (U8)cellRecfg->srsRecfg.srsBwEnum); - RETVALUE(RFAILED); - } - - /*ccpu00116923 - ADD - Srs Present support - Start*/ -#ifdef TFU_UPGRADE -#ifdef LTE_TDD - if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 13) -#else - if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 14) -#endif - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Subframe configuration "); - RETVALUE(RFAILED); - } -#endif - /*ccpu00116923 - ADD - Srs Present support - End*/ - } - if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG) - { - if ((cellRecfg->rachRecfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) || - ((cellRecfg->rachRecfg.raWinSize < RGSCH_MIN_RA_WINSIZE) || - (cellRecfg->rachRecfg.raWinSize > RGSCH_MAX_RA_WINSIZE)) || - (cellRecfg->rachRecfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) || - ((cellRecfg->rachRecfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE) - || (cellRecfg->rachRecfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE)) - || (cellRecfg->rachRecfg.sizeRaPreambleGrpA > - cellRecfg->rachRecfg.numRaPreamble) || - (cellRecfg->rachRecfg.prachResource > - (*cell)->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB)) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid RACH configuration:" - " preamble Fmt %d raWinSize %d maxMsg3Tx %d", - cellRecfg->rachRecfg.preambleFormat, - cellRecfg->rachRecfg.raWinSize, - cellRecfg->rachRecfg.maxMsg3Tx); - RLOG_ARG2(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid RACH configuration:" - "numRaPreamble %d sizeRaPreambleGrpA %d", - cellRecfg->rachRecfg.numRaPreamble, - cellRecfg->rachRecfg.sizeRaPreambleGrpA); - RETVALUE(RFAILED); - } - } - -#ifdef RGR_SI_SCH - if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG) - { - if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellRecfg->siReCfg))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Validation for SI" - "Re-configuration failed"); - RETVALUE(RFAILED); - } - } -#endif /*RGR_SI_SCH */ - -/* LTE_ADV_FLAG_REMOVED_START */ - if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG) - { - /* Checkin whether DSFR is enbaled without enabling SFR. - * So we need to check if SFR is enabled along with DSFR - * in the same reconfiguration or it is already enabled earlier*/ - if((cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR) && - (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.dsfrCfg.status)) - { - if(!(((cellRecfg->rgrLteAdvCfg.pres & RGR_SFR) && - (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.sfrCfg.status)) || - ((*cell)->lteAdvCb.sfrCfg.status == RGR_ENABLE))) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"DSFR is enbaled" - "Without enabling SFR"); - RETVALUE(RFAILED); - } - } - if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellRecfg->rgrLteAdvCfg), - (*cell)->bwCfg.dlTotalBw)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Validation for Lte Adv" - "Re-configuration failed"); - RETVALUE(RFAILED); - } - } -/* LTE_ADV_FLAG_REMOVED_END */ - - /* Validating minimum resource for non-CSG users */ - if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG) - { - if (cellRecfg->csgParamCfg.minDlResNonCsg > 100) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Configuration " - "of minimum DL resources for NON-CSG"); - RETVALUE(RFAILED); - } - if (cellRecfg->csgParamCfg.minUlResNonCsg > 100) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Configuration " - "of minimum UL resources for NON-CSG"); - RETVALUE(RFAILED); - } - } - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrCellRecfg */ - -#ifdef LTE_ADV -/** - * @brief Ue SCell configuration for scheduler. It is invoked during first time - * Scell configuration. It is not for reconfiguration - * - * @details - * - * Function : rgSCHSCellCfgUeCfg - * - * This functions updates UE specific scheduler - * information upon UE SCell first time Scell configuration - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHSCellCfgUeCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHSCellCfgUeCfg(cell, ue, ueRecfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *err; -#endif -{ - U8 idx; - Inst inst = cell->instIdx; - RgSchCellCb *secCellCb = NULLP; - U8 sCellidx = 0; - RgSchUeCellInfo *sCellInfo = NULLP; - RgrUeSecCellCfg *sCellInfoCfg = NULLP; -#ifdef TFU_UPGRADE - RgrUeAprdDlCqiCfg *aCqiCfg; - RgrUePrdDlCqiCfg *pCqiCfg; -#endif - - TRC2(rgSCHSCellCfgUeCfg); - - RLOG0(L_INFO, "SCELL recfg received from APP \n"); - - RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), - "--------------------------------------------------------------------\n" - "UE SCell ReConfiguration at SCH: rnti (%u) cell(%u)\n" - "--------------------------------------------------------------------\n", - ue->ueId, cell->cellId)); - - - for(idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) - { - /* Allocate the Ue control block */ - if (((rgSCHUtlAllocSBuf(inst, (Data **)&sCellInfo, - sizeof(RgSchUeCellInfo))) != ROK)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx :Memomy allocation " - "Failed while Adding SCell Information\n", idx)); - RETVALUE(RFAILED); - } - - - sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; - - - sCellInfo->sCellIdx = sCellInfoCfg->sCellIdx; - sCellInfo->sCellId = sCellInfoCfg->sCellId; - - if(PRSNT_NODEF == sCellInfoCfg->sCellDeActTmr.pres) - { - /* Configure implicit release */ - ue->sCellDeactTmrVal.val = sCellInfoCfg->sCellDeActTmr.val; - ue->isScellExplicitDeAct = FALSE; - ue->sCellDeactTmrVal.pres = PRSNT_NODEF; - } - else if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE) - { - /* Configure explicit release */ - ue->sCellDeactTmrVal.val = RGSCH_SCELL_DEACT_TMR_INFINITY_VAL; - ue->isScellExplicitDeAct = TRUE; - ue->sCellDeactTmrVal.pres = PRSNT_NODEF; - } - else - { - ue->sCellDeactTmrVal.val = 0; - ue->isScellExplicitDeAct = FALSE; - ue->sCellDeactTmrVal.pres = NOTPRSNT; - } - - sCellInfo->sCellState = RG_SCH_SCELL_INACTIVE; - - sCellInfo->ue = ue; - ue->cellInfo[(sCellInfoCfg->sCellIdx)] = sCellInfo; - sCellidx = ((sCellInfo->sCellId - - rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); - ue->cellIdToCellIdxMap[sCellidx] = sCellInfo->sCellIdx; - - /* For for time one Scell got added, setting allocCmnUlPdcch flag to TRUE, So that - we will allocate PDCCH from common search space and the csiRequest field in DCI0 will - be one bit (spec 36.213 sec 7.2.1)*/ -#ifdef LTE_ADV - if ( ue->numSCells == 0) - { - ue->allocCmnUlPdcch = TRUE; - } -#endif - ue->numSCells++; -#ifdef CA_DBG - printf("\n SCell added for ue %d numScells %d\n",ue->ueId,ue->numSCells); -#endif - /* retrieve teh sec cell Cb */ - if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, sCellInfo->sCellId)) == NULLP) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCell doesnt exists")); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } - - if(TRUE == sCellInfoCfg->txMode.pres) - { - sCellInfo->txMode = sCellInfoCfg->txMode; - } - else - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx Tx mode not present ",idx)); - sCellInfoCfg->txMode.pres = TRUE; - sCellInfoCfg->txMode.txModeEnum = RGR_UE_TM_1; - - sCellInfo->txMode = sCellInfoCfg->txMode; - } - cmInitTimers (&sCellInfo->actDelayTmr, 1); - cmInitTimers (&sCellInfo->deactTmr, 1); - - ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum); - -#ifdef TFU_UPGRADE - if(TRUE == sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.pres) - { - sCellInfo->acqiCb.aCqiCfg.aprdModeEnum = - sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.aprdModeEnum; - } - - if(TRUE == sCellInfoCfg->uePdschDedCfg.uepACfg.pAPrsnt) - { - sCellInfo->pA.pres = TRUE; - sCellInfo->pA.val = sCellInfoCfg->uePdschDedCfg.uepACfg.pA; - } - else - { - sCellInfo->pA.pres = FALSE; - } - - aCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg; - RGSCHDBGPRM(cell->instIdx, (rgSchPBuf(cell->instIdx), - "rgSCHCfgACqiUeCfg cellId =%d,Config Presence =%d for \ - Sec Cell Id = %d\n", - cellCb->cellId, aCqiCfg->pres,sCellInfo->sCellId)); - - /* if aperiodic cqi is present then only call the below function as it is - * not mandatory*/ - if(aCqiCfg->pres) - { - if( ROK != rgSCHCfgACqiUeCfg(secCellCb,ue, &sCellInfo->acqiCb, - sCellInfo->txMode.txModeEnum, aCqiCfg, ue->ueCatEnum)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx ACQI Cfg" - "failed..n\n", idx)); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } - } - /* Configuring PCQI */ - /* Scell needs to be added to the - * pcqi list only after activation */ - pCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.prdCqiCfg; - - if(ROK != rgSCHSCellPCqiCfg(cell,secCellCb,ue,pCqiCfg, - ue->ueCatEnum,sCellInfoCfg->sCellIdx)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx PCQI Cfg failed..n\n", idx)); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } -#endif - - /* Configuring ACQI */ - - /* Stroing the secCell for easy access */ - sCellInfo->cell = secCellCb; - - -#ifdef LTE_ADV - if (ROK != rgSCHLaaInitDlRbAllocCb(secCellCb, - &sCellInfo->dlAllocCb)) - { - RETVALUE(RFAILED); - } -#endif - /* Initialize Harq entity */ - - sCellInfo->hqEnt = rgSCHDhmHqEntInit(secCellCb); - if (sCellInfo->hqEnt == NULLP) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UEID:Hq Entity Initialization " - "failed in config\n", ue->ueId)); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } -#ifdef EMTC_ENABLE - rgSCHEmtcHqPAlloc(secCellCb, sCellInfo->hqEnt); -#endif - rgSCHCmnDlInitHqEnt(secCellCb, sCellInfo->hqEnt); - - sCellInfo->hqEnt->ue = ue; - /* Init SCell Specific Sched Spfc UE DL CB */ - if ((secCellCb->sc.apis->rgSCHRgrSCellUeCfg(secCellCb, ue, sCellInfoCfg, err)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Spec Sched DL UE CFG FAILED\n")); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } - -#ifdef LTE_TDD - if((rgSCHUtlAllocUeANFdbkInfo(ue,sCellInfoCfg->sCellIdx)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UEID:Memomy allocation " - "Failed while UE related Ack Nack Information\n", - ue->ueId)); - rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); - RETVALUE(RFAILED); - } -#endif /* LTE_TDD */ - -#ifdef LTE_ADV - sCellInfo->sCellLnk.node = (PTR)sCellInfo; - cmLListAdd2Tail(&secCellCb->sCellUeLst, &sCellInfo->sCellLnk); -#endif - - /* Inserting UECB into SCELL DBM */ - rgSCHDbmInsUeCb(secCellCb, ue); - } - -#ifndef MAC_5GTF_UPDATE - ue->ul.useExtBSRSizes = ueRecfg->ueSCellCfgInfo.useExtBSRSizes; -#else - ue->ul.useExtBSRSizes = TRUE; -#endif - - for (idx = 0; idx < RGSCH_ULCTRL_RECP_DIST; idx++) - { - ue->ul.ctrlOnServCellIdx[idx] = 0xFF; - } - /* Trigger SCell addition to primary MAC */ - RETVALUE(ROK); - -} /* rgSCHSCellCfgUeCfg */ -/*f1b_Sprint */ -/** - * @brief UE SCell PUCCH reconfiguration for scheduler - * - * @details - * - * Function : rgSCHSCellCfgUePucchReCfg - * - * This functions updates UE specific scheduler - * information upon UE SCell PUCCH reconfiguration - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHSCellCfgUePucchReCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHSCellCfgUePucchReCfg(cell, ue, ueRecfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *err; -#endif -{ - Inst inst = cell->instIdx; - RgrUeSCellAckPucchCfg *sCellPucchRecfg = NULLP; - U8 idx; - - TRC2(rgSCHSCellCfgUePucchReCfg); - RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), - "--------------------------------------------------------------------\n" - "UE SCell PUCCH ReConfiguration at SCH: rnti (%u) cell(%u)\n" - "--------------------------------------------------------------------\n", - ue->ueId, cell->cellId)); - - - sCellPucchRecfg = &ueRecfg->sCellAckN1ResCfg; - /* Copy the UCI format type suported/configured for UE */ - ue->uciFrmtTyp = sCellPucchRecfg->pucchFormatType; - - if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS) - { - ue->n1PucchF1bResCb.cw1N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count; - ue->n1PucchF1bResCb.cw2N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count; - - for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count; idx++) - { - ue->n1PucchF1bResCb.cw1N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1[idx]; - } - - for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count; idx++) - { - ue->n1PucchF1bResCb.cw2N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2[idx]; - } - } -#ifdef LTE_ADV - else if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT3) - { - ue->n3PucchResCb.antP0N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0Count; - ue->n3PucchResCb.antP1N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1Count; - for (idx = 0;idx < ue->n3PucchResCb.antP0N3ResCount; idx++ ) - { - ue->n3PucchResCb.antP0N3Res[idx].n3PucchIdx - = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0[idx]; - ue->n3PucchResCb.antP0N3Res[idx].n3Lnk.node = NULLP; - ue->n3PucchResCb.antP0N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX; - } - for (idx = 0;idx < ue->n3PucchResCb.antP1N3ResCount; idx++ ) - { - ue->n3PucchResCb.antP1N3Res[idx].n3PucchIdx - = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1[idx]; - ue->n3PucchResCb.antP1N3Res[idx].n3Lnk.node = NULLP; - ue->n3PucchResCb.antP1N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX; - } - ue->simulAckNackCQIFormat3 = ueRecfg->simulAckNackCQIFormat3; - } -#endif - else - { - RLOG1(L_ERROR,"Wrong PUCCH Format:%d configured for CA",ue->uciFrmtTyp); - } - - RETVALUE(ROK); - -} /* rgSCHSCellCfgUePucchReCfg */ -/** - * @brief Validates the UE SCell Reconfiguration request from APP to SCH. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeSCellRecfg - * - * Processing Steps: - * - Validate Number of SCells - * - If validated successfully, - * - Process Number of SCells - * - Else - * - Return RFAILED. - * - Validate SCellIdx value, - * - If validated successfully, - * - Process Number of RgrUeSecCellCfg - * - Else - * - Return RFAILED. - * - * @param[in] RgrUeRecfg *ueRecfg - * @param[out] RgSchCellCb *cell - * @param[out] RgSchUeCb *ue - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg -( -RgrUeRecfg *ueRecfg, -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg(inst, ueRecfg, cell, ue, errInfo) -RgrUeRecfg *ueRecfg; -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchErrInfo *errInfo; -#endif -{ - RgrUeSecCellCfg *ueSCellDedCfg = NULLP; - RgSchCellCb *sCell = NULLP; - Inst inst = cell->instIdx; - - TRC2(rgSCHCfgVldtRgrUeSCellRecfg); - - RGSCHDBGPRM(inst, (rgSchPBuf(inst), "VALIDATE RGR UE SCELL RECONFIG: cellId %d " - "oldUeId %d cell %p \n", ueRecfg->cellId, ueRecfg->oldCrnti)); - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG; - - if((ueRecfg->ueSCellCfgInfo.numSCells > RGR_MAX_SCELL_PER_UE) || - (ueRecfg->ueSCellCfgInfo.numSCells < 1)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid number of SCELL " - " in SCELL Recfg\n")); - RETVALUE(RFAILED); - } - - for(U8 idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) - { - ueSCellDedCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; - if(ROK != rgSchUtlVldtCellId(inst, ueSCellDedCfg->sCellId)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCellId is out of range")); - RETVALUE(RFAILED); - } - /* Validate existence of sec cell */ - sCell = rgSchUtlGetCellCb(inst, ueSCellDedCfg->sCellId); - if(NULLP == sCell ) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCell doesnt exists")); - RETVALUE(RFAILED); - } - - /* validate the range of serv cell index */ - if((ueSCellDedCfg->sCellIdx < 1) || - (ueSCellDedCfg->sCellIdx > RGR_MAX_SCELL_PER_UE)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid Serv Cell Idx %d\n", - ueSCellDedCfg->sCellIdx)); - RETVALUE(RFAILED); - } - - /* Is this sec cell alredy confiured */ - if(NULLP != ue->cellInfo[ueSCellDedCfg->sCellIdx]) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Secll with id %d already added\n", - ueSCellDedCfg->sCellIdx)); - RETVALUE(RFAILED); - } - - /* Validate CQI config params */ - if((rgSCHCfgVldtUeCqiModeCfg(sCell, &ueSCellDedCfg->ueSCellDlCqiCfg)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid CQI Mode " - " configuration for Ue %d\n",ue->ueId)); - RETVALUE(RFAILED); - } -#ifdef TFU_UPGRADE - /* 1. Validate UE Aperiodic CQI related parameters */ - if( ROK != rgSCHCfgVldtRgrUeACqiCfg (sCell, ue->ueId, - &ueSCellDedCfg->ueSCellDlCqiCfg.aprdCqiCfg, ueSCellDedCfg->txMode, - errInfo )) - { - RGSCHDBGERR(sCell->instIdx, (rgSchPBuf(sCell->instIdx), - "rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Aperiodic CQI configuration\n")); - RETVALUE(RFAILED); - } - -#ifdef LTEMAC_HDFDD - if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId, - &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg, ueRecfg->isHdFddEnbld, - ueSCellDedCfg->txMode, errInfo )) -#else - if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId, - &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg, - ueSCellDedCfg->txMode, - errInfo )) -#endif - { - RGSCHDBGERR(sCell->instIdx, (rgSchPBuf(sCell->instIdx), - "rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Periodic CQI configuration\n")); - RETVALUE(RFAILED); - } - - if((ueSCellDedCfg->txMode.txModeEnum < RGR_UE_TM_1) || - (ueSCellDedCfg->txMode.txModeEnum > RGR_UE_TM_9)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCELL Invalid transmission mode for" - " UE %d\n", (U8)ueSCellDedCfg->txMode.txModeEnum)); - RETVALUE(RFAILED); - } -#endif - } - - errInfo->errCause = RGSCHERR_NONE; - RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR Ue SCell Reconfig validation done: " - "cellId %d oldUeId %d\n", ueRecfg->cellId, ue->ueId)); - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrUeSCellRecfg */ - -/** - * @brief Ue SCell configuration roll back due to failure during configuration - * of any scell - * - * @details - * - * Function : rgSCHSCellCfgUeCfgRollBack - * - * This functions roll backs the configuration of successfully added Scell - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHSCellCfgUeCfgRollBack -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE S16 rgSCHSCellCfgUeCfgRollBack(cell, ue, ueRecfg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -#endif -{ - Inst inst = cell->instIdx; - RgrUeSecCellCfg *sCellInfoCfg = NULLP; - RgSchUeCellInfo *sCellInfo = NULLP; - RgSchCmnCell *cellSch = NULLP; - - TRC2(rgSCHSCellCfgUeCfgRollBack); - - RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), - "--------------------------------------------------------------------\n" - "UE SCell config roll back at SCH: rnti (%u) cell(%u)\n" - "--------------------------------------------------------------------\n", - ue->ueId, cell->cellId)); - - /* Free all Added scell in this transaction */ - for(U8 idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) - { - sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; - sCellInfo = ue->cellInfo[(sCellInfoCfg->sCellIdx)]; - - /* if sCellInfo is not NULLP that means this Scell is added hence - * delte it*/ - if (NULLP != sCellInfo) - { - /* Clear Scheduler specific list for this UE from the - * corresponding CELL */ - cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell); - cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue); - - /* Delete harq Entity of Scell*/ - rgSCHDhmDelHqEnt(cell, &(sCellInfo->hqEnt)); - - rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo), - sizeof(RgSchUeCellInfo)); - - ue->cellInfo[(sCellInfoCfg->sCellIdx)] = NULLP; - ue->numSCells--; -#ifdef LTE_ADV - if (ue->numSCells == 0) - { - ue->allocCmnUlPdcch = TRUE; - /* As there is no SCell left so DCI 0 size at UE specific search space - * will be recalculated as the CSI is reduced to 1 bit */ - rgSCHUtlUpdUeDciSize(cell, ue, FALSE); - } -#endif - } - } - RETVALUE(ROK); -} -#endif /* LTE_ADV */ -/** - * @brief Validates the UE reconfiguration request from RRC to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeRecfg - * - * Processing Steps: - * - Retrieve the UE control block. - * - If successful, - * - Validate the range of reconfigured values recieved in - * re-configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell and ue. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * - * @param[in] Inst inst - * @param[in] RgrUeRecfg *ueRecfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchUeCb **ue - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeRecfg -( -Inst inst, -RgrUeRecfg *ueRecfg, -RgSchCellCb **cell, -RgSchUeCb **ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeRecfg(inst, ueRecfg, cell, ue, errInfo) -Inst inst; -RgrUeRecfg *ueRecfg; -RgSchCellCb **cell; -RgSchUeCb **ue; -RgSchErrInfo *errInfo; -#endif -{ - - TRC2(rgSCHCfgVldtRgrUeRecfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RECFG; - - if (((*cell) == NULLP) || - ((*cell)->cellId != ueRecfg->cellId)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId, - "Cell does not exist for OLD CRNTI:%d",ueRecfg->oldCrnti); - RETVALUE(RFAILED); - } - - /* Fetch the Old Ue */ - if ((*ue = rgSCHDbmGetUeCb(*cell, ueRecfg->oldCrnti)) == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"OLD CRNTI:%d does not exist", - ueRecfg->oldCrnti); - RETVALUE(RFAILED); - } - -#ifdef LTE_ADV - if(RGR_UE_SCELL_ADD_RECFG & ueRecfg->ueRecfgTypes) - { - S16 ret = rgSCHCfgVldtRgrUeSCellRecfg(ueRecfg,*cell, *ue, errInfo); - if ( ret != ROK) - { - RGSCHDBGERR(inst,(rgSchPBuf(inst), "Ue SCell Recfg Validation FAILED\n")); - RETVALUE(RFAILED); - } - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); - } -#endif - - if (ueRecfg->oldCrnti != ueRecfg->newCrnti) - { - if (rgSCHDbmGetUeCb(*cell, ueRecfg->newCrnti) != NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"NEW CRNTI:%d already exists", - ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - - if ((ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG) &&\ - ((*ue)->csgMmbrSta == ueRecfg->csgMmbrSta)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE ID [%d] invalid CSG Membership reconfig :%d ", - ueRecfg->newCrnti, (U8)ueRecfg->csgMmbrSta); - RETVALUE(RFAILED); - } - /* Validate values */ - if ((ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) && - (ueRecfg->txMode.pres == TRUE) && - ((ueRecfg->txMode.txModeEnum < RGR_UE_TM_1) || - (ueRecfg->txMode.txModeEnum > RGR_UE_TM_7))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid transmission mode %d" - "for NEW CRNTI:%d", (U8)ueRecfg->txMode.txModeEnum,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#ifndef TFU_UPGRADE - if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) && - (((ueRecfg->prdDlCqiRecfg.k < 1) || (ueRecfg->prdDlCqiRecfg.k > 4)) || - ((ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx < 1) || - (ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx > 1024)))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid Periodic CQI INFO" - "OLD CRNTI:%d NEW CRNTI:%d",(U8)ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#endif - if ((ueRecfg->ueRecfgTypes & RGR_UE_ULHARQ_RECFG) && - (ueRecfg->ueUlHqRecfg.maxUlHqTx < RGSCH_MIN_HQ_TX)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid Uplink HARQ config %d" - "for NEW CRNTI:%d", ueRecfg->ueUlHqRecfg.maxUlHqTx,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#ifndef TFU_UPGRADE - if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) && - (ueRecfg->prdDlCqiRecfg.prdModeEnum > RGR_PRD_CQI_MOD21)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid periodic mode config for" - " DL CQI %d NEW CRNTI:%d", (U8)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#else - if ((ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG) && - (ueRecfg->cqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid periodic mode config for " - "DL CQI %d for NEW CRNTI:%d",(U8)ueRecfg->cqiCfg.cqiSetup.prdModeEnum,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#endif /* TFU_UPGRADE */ - /* Validate UE Category */ - if (ueRecfg->ueCatEnum > CM_LTE_UE_CAT_8) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid category %d for NEW CRNTI:%d", - (U8)ueRecfg->ueCatEnum,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - - /* Validate UE Access Stratum Release */ - if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ - (ueRecfg->accessStratumRls > RGR_REL_11)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid Access Stratum Release %u for UE\n", - ueRecfg->accessStratumRls)); - RETVALUE(RFAILED); - } - RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "Configured Access Stratum Release %u\n", \ - ueRecfg->accessStratumRls)); - - if ((ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG) && - ((ueRecfg->aprdDlCqiRecfg.pres == TRUE) && - ((ueRecfg->aprdDlCqiRecfg.aprdModeEnum > RGR_APRD_CQI_MOD31) || - (*cell)->bwCfg.dlTotalBw <= 7))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid aperiodic mode config for" - " DL CQI %d for NEW CRNTI:%d", (U8)ueRecfg->aprdDlCqiRecfg.aprdModeEnum,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - if ((ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG) && - (rgSCHCfgVldtUePwrCfg(*cell, &ueRecfg->ueUlPwrRecfg) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid PUSCH Group power" - " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - - - if ((ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG) && - (rgSCHCfgVldtUeMeasGapAckNakRepRecfg(*cell, ueRecfg) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid MeasGap/AckNackRep" - " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#ifdef LTEMAC_SPS - if(rgSCHCfgVldtSpsReCfg(*cell, *ue, ueRecfg)!= ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid SPS" - " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#endif -#ifdef TFU_UPGRADE - /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */ - if ( ROK != rgSCHCfgVldtCqiSrSrsUeReCfg(*cell, *ue, ueRecfg, errInfo)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid ACQI, PCQI/SR/SRS " - "Re-configuration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#endif - if ((ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) && - (rgSCHCfgVldtDrxUeCfg(*cell, &(ueRecfg->ueDrxRecfg)) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid drxParams" - " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* Validate DL Power Control Config parameters */ - if(rgSCHCfgVldtCqiReptReCfg(*cell, ueRecfg)!= ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid DL Power Control" - " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); - RETVALUE(RFAILED); - } -#endif /* End of RGR_CQI_REPT */ - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrUeRecfg */ - - -/** - * @brief Validates the logical channel reconfiguration request from - * RRC to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrLchRecfg - * - * Processing Steps: - * - Retrieve the uplink and downlink logical channel control block. - * - If successful, - * - Validate the range of reconfigured values recieved in - * re-configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell, UE and logical channel. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * - * @param[in] RgrLchRecfg *lcRecfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchUeCb **ue - * @param[out] RgSchUlLcCb **ulLc - * @param[out] RgSchDlLcCb **dlLc - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrLchRecfg -( -Inst inst, -RgrLchRecfg *lcRecfg, -RgSchCellCb **cell, -RgSchUeCb **ue, -RgSchDlLcCb **dlLc, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrLchRecfg(inst, lcRecfg, cell, ue, dlLc, errInfo) -Inst inst; -RgrLchRecfg *lcRecfg; -RgSchCellCb **cell; -RgSchUeCb **ue; -RgSchDlLcCb **dlLc; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrLchRecfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LC_RECFG; - - if (((*cell) == NULLP) || - ((*cell)->cellId != lcRecfg->cellId)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Cell does not exist " - "for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue for dedicated channels */ - if ((*ue = rgSCHDbmGetUeCb(*cell, lcRecfg->crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"UEID does not exist" - "dedicated logical channel for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); - RETVALUE(RFAILED); - } - - if ((*dlLc = rgSCHDbmGetDlDedLcCb((*ue), lcRecfg->lcId)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Dedicated DL LC does not " - "exist for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrLchRecfg */ - -/** - * @brief Validates the UE Reset request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeReset - * - * Processing Steps: - * - Retrieve the CELL control block - * - If cell does not exist return RFAILED - * - Retrieve UE Control block - * - If UE does not exist return RFAILED - * - Return ROK - * - * @param[in] Inst inst - * @param[in] RgrRst *reset - * @param[out] RgSchCellCb **cell - * @param[out] RgSchUeCb **ue - * @param[out] RgErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeReset -( -Inst inst, -RgrRst *reset, -RgSchCellCb *cell, -RgSchUeCb **ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeReset(inst, reset, cell, ue, errInfo) -Inst inst; -RgrRst *reset; -RgSchCellCb *cell; -RgSchUeCb **ue; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrUeReset); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RESET; - - if ((cell == NULLP) || (cell->cellId != reset->cellId)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"CELL does not exist for CRNTI:%d", - reset->crnti); - RETVALUE(RFAILED); - } - /* Fetch the Ue */ - if ((*ue = rgSCHDbmGetUeCb(&(*cell), reset->crnti)) == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"UE does not exist for CRNTI:%d", - reset->crnti); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrUeReset */ - - -/** - * @brief Validates the logical channel reconfiguration request from - * RRC to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrLcgRecfg - * - * Processing Steps: - * - Retrieve the uplink and downlink logical channel control block. - * - If successful, - * - Validate the range of reconfigured values recieved in - * re-configuration request. - * - If validated successfully, - * - Return ROK and pointer to the cell, UE and logical channel. - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * - * @param[in] RgrLchRecfg *lcRecfg - * @param[out] RgSchCellCb **cell - * @param[out] RgSchUeCb **ue - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrLcgRecfg -( -Inst inst, -RgrLcgRecfg *lcgRecfg, -RgSchCellCb *cell, -RgSchUeCb **ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrLcgRecfg(inst, lcgRecfg, cell, ue, errInfo) -Inst inst; -RgrLcgRecfg *lcgRecfg; -RgSchCellCb *cell; -RgSchUeCb **ue; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrLcgRecfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LCG_RECFG; - - if (((cell) == NULLP) || - ((cell)->cellId != lcgRecfg->cellId)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Cell does not exist for" - "CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue for dedicated channels */ - if ((*ue = rgSCHDbmGetUeCb(&(*cell), lcgRecfg->crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"UE does not exist for " - "dedicated logical channel group CRNTI:%d LCGID:%d", - lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); - RETVALUE(RFAILED); - } - if (lcgRecfg->ulRecfg.lcgId > (RGSCH_MAX_LCG_PER_UE - 1)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Invalid lcgId for uplink logical" - "channel CRNTI:%d LCGID:%d", - lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); - RETVALUE(RFAILED); - } - - if ((lcgRecfg->ulRecfg.gbr != 0) && (lcgRecfg->ulRecfg.mbr < lcgRecfg->ulRecfg.gbr)) - { - RGSCHDBGINFO(inst, (rgSchPBuf(inst), "Dedicated Logical Group %d validation failed" - " for ue %d for cell %d\n", lcgCfg->ulInfo.lcgId, lcgCfg->crnti, lcgCfg->cellId)); - RETVALUE(RFAILED); - } - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrLcgRecfg */ - -/** - * - * @details - * - * Function : rgSCHDynCfiCfg - * - * @param[in] RgSchCellCb *cell - * RgrCellCfg *cellCfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHDynCfiCfg -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg -) -#else -PRIVATE S16 rgSCHDynCfiCfg(cell, cellCfg) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -#endif -{ - U8 cfi; -#ifdef LTE_TDD - U8 ulDlCfgIdx = cellCfg->ulDlCfgIdx; - U8 mphIdx; - U8 maxMPhich; - U16 numDlSf; -#endif - - TRC2(rgSCHDynCfiCfg); - - cell->dynCfiCb.isDynCfiEnb = cellCfg->isDynCfiEnb; - - /* Initializing Failure Sample Period */ - cell->dynCfiCb.failSamplePrd = (RGSCH_CFI_TTI_MON_INTRVL * - RGSCH_CFI_STEP_UP_TTI_PRCNTG)/100; - /* Initializing Number of Failure Samples */ - cell->dynCfiCb.numFailSamples = (RGSCH_CFI_TTI_MON_INTRVL/ - cell->dynCfiCb.failSamplePrd); - cell->dynCfiCb.maxCfi = RGSCH_MAX_CFI_VAL; - /* Allocating memory for CCE failure average array based on - * monitoring interval and CCE failure sample period */ - if((rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&(cell->dynCfiCb.cceFailSamples), - (cell->dynCfiCb.numFailSamples * sizeof(U16)))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); - RETVALUE(RFAILED); - } - - /* Setting the Invalid value 0xFF to pdcchSfIdx, it will be assigned - * a valid value during CFI swithing is done */ - cell->dynCfiCb.pdcchSfIdx = 0xFF; - -#ifdef LTE_TDD - /* In case of config index 0, the mphich index can be upto 2 - * in other config index cases, it will always be set as 1*/ - if(ulDlCfgIdx == 0) - { - maxMPhich = RG_SCH_MAX_MPHICH; - } - else - { - maxMPhich = RG_SCH_MAX_MPHICH -1; - } - /* Calculate the number of CCEs in the cell */ - for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) - { - for(mphIdx = 0; mphIdx < maxMPhich; mphIdx++) - { - cell->dynCfiCb.cfi2NCceTbl[mphIdx][cfi] = - rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw, - cell->phichCfg.ngEnum, cfi, mphIdx, - cell->numTxAntPorts, - cell->isCpDlExtend); - } - } -#else - /* Calculate the number of CCEs in the cell */ - for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) - { - /* CFI Index starts from 1 so that there can be a direct mapping from - actual CFI value to cfi Index. mPhich index will always be set - as 0 for FDD */ - cell->dynCfiCb.cfi2NCceTbl[0][cfi] = - rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw, cell->phichCfg.ngEnum, - cfi, cell->numTxAntPorts, cell->isCpDlExtend); - } - - /* Calculate the number of CCEs in the cell */ - if(cell->dynCfiCb.isDynCfiEnb == TRUE) - { - /* In case if Dynamic CFI feature is enabled, default CFI - * value 1 is used */ - cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][1]; - } - else - { - cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCfg->cfiCfg.cfi]; - } -#endif - -#ifdef LTE_TDD - numDlSf = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][9] * - (RGSCH_CFI_TTI_MON_INTRVL/10); - cell->dynCfiCb.cfiStepUpTtiCnt = - (RGSCH_CFI_STEP_UP_TTI_PRCNTG * numDlSf)/100; - cell->dynCfiCb.cfiStepDownTtiCnt = - (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG * numDlSf)/100; -#else - cell->dynCfiCb.cfiStepUpTtiCnt = (RGSCH_CFI_STEP_UP_TTI_PRCNTG * - RGSCH_CFI_TTI_MON_INTRVL)/100; - cell->dynCfiCb.cfiStepDownTtiCnt = (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG * - RGSCH_CFI_TTI_MON_INTRVL)/100; -#endif - - RETVALUE(ROK); -} - -/** - * @brief Handler for the SCHED Enb configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrSchedEnbCfg - * - * Processing Steps: - * - Invoke SCH with SCHEDULER control block to update - * scheduler specific information. - * - Update rgSch control block with the values recieved in the - * configuration. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgSchSchedEnbCfg *schedEnbCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrSchedEnbCfg -( -Inst inst, -SpId spId, -RgrSchedEnbCfg *schedEnbCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrSchedEnbCfg(inst, spId, schedEnbCfg, errInfo) -Inst inst, -SpId spId; -RgrSchedEnbCfg *schedEnbCfg; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgRgrSchedEnbCfg); - - RGSCHDBGPRM(inst, (rgSchPBuf(inst), "APPLYING RGR SCH ENB CONFIG: \n")); - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG; - - rgSchCb[inst].rgrSchedEnbCfg = *schedEnbCfg; - RGSCHDBGPRM(inst, (rgSchPBuf(inst),"\ndlSchdType %d ulSchdType %d dlTptCoeffi %d" - "dlFairCoeffi %d ulTptCoeffi %d ulFairCoeffi %d\n", - schedEnbCfg->dlSchdType, schedEnbCfg->ulSchdType, schedEnbCfg->dlSchInfo.dlPfs.tptCoeffi, - schedEnbCfg->dlSchInfo.dlPfs.fairCoeffi, schedEnbCfg->ulSchInfo.ulPfs.tptCoeffi, - schedEnbCfg->ulSchInfo.ulPfs.fairCoeffi)); - -#ifdef RG_5GTF - rgSchCb[inst].rgSchDynTdd.isDynTddEnbld = schedEnbCfg->isDynTddEnbld; -#endif - if(RGR_SCH_TYPE_PFS == schedEnbCfg->dlSchdType) - { - rgSCHEnbPfsDlCfg(inst, errInfo); - } - - errInfo->errCause = RGSCHERR_NONE; - RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR SCH ENBconfig done: \n")); - RETVALUE(ROK); -} /* rgSCHCfgRgrSchedEnbCfg */ - -#ifdef RG_5GTF -/** - * @brief Handler for the cell configuration of 5gtf. - * - * @details - * - * Function : rgSCH5gtfCellCfg - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCellCfg *cellCfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCH5gtfCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg -) -#else -PUBLIC S16 rgSCH5gtfCellCfg(cell, cellCfg) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -#endif -{ - U8 idx; - - TRC2(rgSCHCfgRgrCellCfg); - - for(idx = 0; idx < MAX_5GTF_GROUP; idx++) - { - cell->cell5gtfCb.ueGrp5gConf[idx].beamBitMask = 0; - } - - for(idx = 0 ; idx < MAX_5GTF_SUBFRAME_INFO ; ++idx) - { - cell->cell5gtfCb.dynConfig[idx] = cellCfg->Cell5gtfCfg.dynConfig[idx]; - } - cell->cell5gtfCb.numUes = cellCfg->Cell5gtfCfg.numUes; - cell->cell5gtfCb.uePerGrpPerTti = cellCfg->Cell5gtfCfg.uePerGrp; - cell->cell5gtfCb.ueGrpPerTti = cellCfg->Cell5gtfCfg.ueGrpPerTti; - cell->cell5gtfCb.numCCs = cellCfg->Cell5gtfCfg.numOfCC; - cell->cell5gtfCb.bwPerCC = cellCfg->Cell5gtfCfg.bwPerCC; - printf("\ncell cfg at schd,numUes:%u,uepergrp:%u,uegrppertti:%u,numCC:%u,bwPerc:%u cfi %u\n", - cell->cell5gtfCb.numUes,cell->cell5gtfCb.uePerGrpPerTti,cell->cell5gtfCb.ueGrpPerTti, - cell->cell5gtfCb.numCCs,cell->cell5gtfCb.bwPerCC, cell->cell5gtfCb.cfi); - RETVALUE(ROK); -} -#endif - -#ifdef XEON_LMT_ITBS -EXTERN U16 gWrMaxDlItbs; -EXTERN U16 gWrMaxUlItbs; -#endif -/** - * @brief Handler for the cell configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrCellCfg - * - * Processing Steps: - * - Invoke SCH with cell control block to update - * scheduler specific information. - * - Update cell control block with the values recieved in the - * configuration. - * - Add to the active list of cells if cell becomes ACTIVE. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgSchCellCfg *cellCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrCellCfg -( -RgSchCb *instCb, -SpId spId, -RgrCellCfg *cellCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrCellCfg(instCb, spId, cellCfg, errInfo) -RgSchCb *instCb; -SpId spId; -RgrCellCfg *cellCfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - U8 idx; - Pst pst; - RgInfCellReg cellRegReq; - RgSchCellCb *cell = NULLP; - Inst inst = instCb->rgSchInit.inst; - U32 Idx1 = (U8)((cellCfg->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); - - TRC2(rgSCHCfgRgrCellCfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_CELL_CFG; - - cmMemset((U8*)&pst, (U8)0, sizeof(Pst)); - - /* Allocate the scheduler's cell control block */ - if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&cell, sizeof(RgSchCellCb))) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); - RETVALUE(RFAILED); - } -#ifdef EMTC_ENABLE - if(cellCfg->emtcEnable) - { - if((ret = rgSCHEmtcCellAlloc(cell)) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for emtc cell"); - RETVALUE(RFAILED); - } - } -#endif - if ((U8 *)cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); - RETVALUE(RFAILED); - } - /* Initialize the lists of the cell */ - ret = rgSCHDbmInitCell(cell); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"DBM initialization FAILED for cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } -/* LTE_ADV_FLAG_REMOVED_START */ - if(cellCfg->rgrLteAdvCfg.pres & RGR_ABS) - { - cell->lteAdvCb.absCfg = - cellCfg->rgrLteAdvCfg.absCfg; - cmMemset((U8*)cell->lteAdvCb.absLoadInfo, 0, sizeof(U32)*RGR_ABS_PATTERN_LEN); - cell->lteAdvCb.absLoadTtiCnt = 0; - } - - if(cellCfg->rgrLteAdvCfg.pres & RGR_SFR) - { - cell->lteAdvCb.sfrCfg = - cellCfg->rgrLteAdvCfg.sfrCfg; - } - if(cellCfg->rgrLteAdvCfg.pres & RGR_DSFR) - { - cell->lteAdvCb.dsfrCfg = - cellCfg->rgrLteAdvCfg.dsfrCfg; - } -/* LTE_ADV_FLAG_REMOVED_END */ - -#ifdef EMTC_ENABLE - cell->emtcEnable = cellCfg->emtcEnable; -#endif - /* Initialize the cell */ - cell->cellId = cellCfg->cellId; - cell->instIdx = inst; - cell->macInst = cellCfg->macInst; - cell->isCpUlExtend = cellCfg->isCpUlExtend; - cell->isCpDlExtend = cellCfg->isCpDlExtend; - - cell->numTxAntPorts = rgSchCb[inst].rgrSchedEnbCfg.numTxAntPorts; - if(cell->numTxAntPorts == 1) - { - cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_ONE_ANT_PORT; - } - else if(cell->numTxAntPorts == 2) - { - cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_TWO_ANT_PORT; - } - else - { - cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_FOUR_ANT_PORT; - } - cell->bwCfg = cellCfg->bwCfg; - cell->pbchRbStart = ((((cell->bwCfg.dlTotalBw * 12)/2) - 36)/12); /* Ref section 6.6 in 36.211 */ - cell->pbchRbEnd = cell->pbchRbStart + 5; - cell->pucchCfg = cellCfg->pucchCfg; - cell->rachCfg = cellCfg->rachCfg; - cell->siCfg = cellCfg->siCfg; - cell->t300TmrVal = cellCfg->t300TmrVal; -#ifdef RGR_SI_SCH - /*Initialize the SI CB in Cell CB */ - cmMemset((U8 *)&cell->siCb, 0, sizeof(RgSchSiCb)); -#endif - /*Fix: Added Guard Pool for RNTI which will contain RNTIs - *for UEs deleted from Scheduler but not yet from MAC*/ - cmLListInit(&cell->rntiDb.rntiGuardPool); - - /* Initialize the inWindow to sync with scheduler time when ticks starts */ -#ifdef LTEMAC_HDFDD - cell->siCb.inWindow = (cellCfg->siCfg.siWinSize - - (RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL)); -#else - cell->siCb.inWindow = (cellCfg->siCfg.siWinSize - - (RG_SCH_CMN_DL_DELTA)); -#endif - - if(cell->siCb.inWindow < 0) - { - cell->siCb.inWindow = 0; - } - cell->macPreambleSet = cellCfg->macPreambleSet; - cell->phichCfg = cellCfg->phichCfg; - - /* Initialize UL and DL CCCH logical channels */ - cell->ulCcchId = RGSCH_INVALID_LC_ID; - cell->dlCcchId = RGSCH_INVALID_LC_ID; - - /* Update SRS configuration */ - cell->srsCfg.isSrsCfgPres = cellCfg->srsCfg.isSrsCfgSetup; - if(cellCfg->srsCfg.isSrsCfgSetup) - { - cell->srsCfg.srsCfgPrdEnum = cellCfg->srsCfg.srsCfgPrdEnum; - cell->srsCfg.srsBwEnum = cellCfg->srsCfg.srsBwEnum; - cell->srsCfg.srsTxOffst = - rgSrsTxOffstTbl[cellCfg->srsCfg.srsSubFrameCfg]; - /*ccpu00116923 - ADD - Srs Present support */ -#ifdef TFU_UPGRADE - cell->srsCfg.srsSubFrameCfg = cellCfg->srsCfg.srsSubFrameCfg; -#endif - } - - /* Configure all the common logical channels for the cell */ - for(idx = 0; idx < cellCfg->numCmnLcs; idx++) - { - /* This never returns failure and hence not checked for */ - rgSCHCfgRgrCmnLcCfg(cell, &(cellCfg->cmnLcCfg[idx]), errInfo); - } - - /* Invoke the MeasGap and ACK NACK Rep handler for cell cfg */ - - /* Dynamic CFI cell configuration */ - ret = rgSCHDynCfiCfg(cell, cellCfg); - if(ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr cell Config failed at " - "Scheduler for cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - /* Updating Auto TM Mode enable/diable flag */ - cell->isAutoCfgModeEnb = cellCfg->isAutoCfgModeEnb; - { - if(cell->isAutoCfgModeEnb) - { - RLOG0(L_INFO,"Auto Mode Cfg enabled durint cell cfg\n"); - } - } - /* CPU OvrLoad State Initialization */ -#ifdef XEON_LMT_ITBS - cell->thresholds.maxDlItbs = gWrMaxDlItbs; - cell->thresholds.maxUlItbs = gWrMaxUlItbs; - RLOG2(L_INFO,"LIMIT DL and UL ITBS %d:%d \n",gWrMaxDlItbs,gWrMaxUlItbs); -#else - cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS; - cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS; -#endif - cell->measurements.dlTpt = 0; - cell->measurements.ulTpt = 0; - cell->measurements.dlBytesCnt = 0; - cell->measurements.ulBytesCnt = 0; - cell->cpuOvrLdCntrl.cpuOvrLdIns = 0; /* 0 - No command */ - cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0; - cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0; - for ( idx = 0; idx < 10; idx++ ) - { - cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] = cellCfg->maxDlUeNewTxPerTti; - cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] = cellCfg->maxUlUeNewTxPerTti; - } - - /* Invoke scheduler to update scheduler specific information */ - ret = rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr cell Config failed at " - "Scheduler for cell "); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - - /* Invoke DHM to update DHM specific information */ - rgSCHDhmRgrCellCfg(cell, cellCfg, errInfo); - - - /* Initialize RNTI DB */ - ret = rgSCHDbmRntiDbInit(cell, cellCfg->macRnti.startRnti, - cellCfg->macRnti.size); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr Cell Config failed at" - " RNTI DB init for cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - - /* Update the cell with recieved configuration */ - cell->dlHqCfg = cellCfg->dlHqCfg; - - RLOG1(L_INFO,"Config DL HQTX = %d\n",cell->dlHqCfg.maxDlHqTx); - - cell->crntSfIdx = 0; - /* Allocate the subframe allocation information */ - if((ret = rgSCHUtlGetSfAlloc(cell)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for " - "cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - /* Update RACH Related information - * XXX: Below function yet to be written in RAM - * To store the preambles given in the configuration for PDCCH order in the - * scheduler cell control block. Initialize the PRACH Mask Index allocated - * for these preambles to invalid values */ - - cell->crntHqIdx = 0; - /* Allocate the subframe allocation information */ - if((ret = rgSCHUtlGetRlsHqAlloc(cell)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for" - "cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - - /* Associate a pair of upper and lower sapCbs with this cell */ - instCb->rgrSap[spId].cell = cell; - instCb->tfuSap[spId].cell = cell; - instCb->rgmSap[spId].cell = cell; - cell->tfuSap = &(instCb->tfuSap[spId]); - - /* CaDev Start */ - instCb->cells[Idx1] = cell; - /* CaDev End */ - - /* rg001.201: Added for sending TTI tick to RRM */ -#if (defined(RGR_RRM_TICK) || defined(RGR_CQI_REPT)) - /* Associate the RGR SAP as well utilized while sending TTI - * Ticks to RGR User. */ - cell->rgrSap = &(instCb->rgrSap[spId]); -#endif - cell->rgmSap = &(instCb->rgmSap[spId]); -#ifdef RGR_RRM_TICK - /* Store the periodicity configured */ - cell->rrmTtiIndPrd = cellCfg->rrmTtiIndPrd; -#endif - -#ifdef LTE_L2_MEAS - cmLListInit(&cell->l2mList); -#endif - - if (rgSCHDrxCellCfg(cell,cellCfg) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Drx Memory allocation FAILED for" - " cell"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - cell->overLoadBackOffEnab = FALSE;/* Disabling RachOverload by default */ - /* Updating CSG Parameters */ - cell->minDlResNonCsg = cellCfg->csgParamCfg.minDlResNonCsg; - cell->minUlResNonCsg = cellCfg->csgParamCfg.minUlResNonCsg; - - /* Register the cell with MAC */ - rgSCHUtlGetPstToLyr(&pst, instCb, cell->macInst); - cellRegReq.cellId = cell->cellId; - cellRegReq.cellSapId = spId; -#ifdef LTE_TDD - cellRegReq.maxDlHqProcPerUe = rgSchTddDlNumHarqProcTbl[cellCfg->ulDlCfgIdx]; -#else - cellRegReq.maxDlHqProcPerUe = RGSCH_MAX_DL_HQ_PROC; -#endif - RgSchMacCellReg(&pst, &cellRegReq); - -#ifdef TENB_STATS - cell->tenbStats = TSL2AllocCellStatsBlk(cell->cellId); - cell->tenbStats->cellId = cell->cellId; -#endif - - rgSCHUtlCalcDciSizes(cell); - -#ifdef LTE_ADV - /* Initilalization of the list of UE for which this cell is secondary cell*/ - cmLListInit(&cell->sCellUeLst); -#endif - - -#ifdef LTE_ADV - ret = rgSCHLaaSCellCbInit(cell, cellCfg); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr Cell Config failed at" - " Initializing the LAA Cell Control Cb"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } - cell->isPucchFormat3Sptd = cellCfg->isPucchFormat3Sptd; - RLOG_ARG0(L_INFO,DBG_CELLID,cellCfg->cellId,"Format 3 is Enabled"); - printf ("\n Format 3 is Enabled for CELL:%d",cell->cellId); -#endif - - -#ifdef EMTC_ENABLE - - if(cell->emtcEnable) - { - if (rgSCHCfgEmtcCellCfg(cell,&(cellCfg->emtcCellCfg)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"EMTC Config Failed" - " cell"); - RETVALUE(RFAILED); - } - } -#endif - -#ifdef RG_5GTF - ret = rgSCH5gtfCellCfg(cell, cellCfg); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR, DBG_CELLID,cellCfg->cellId,"5GTF Rgr Cell Config failed"); - rgSCHCfgFreeCellCb(cell); - RETVALUE(RFAILED); - } -#endif - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrCellCfg */ - -/** - * @brief Handler for the UE configuration request from RRC to MAC. - * - * @details - * - * Function : rgSCHCfgRgrUeCfg - * - * Processing Steps: - * - Allocate and create UE control block. - * - Update UE control block with the values recieved in the - * configuration. - * - Invoke RAM, SCH, UHM and DHM with created UE control block, to - * update random access, scheduler, uplink harq and downlink harq - * specific information respectively. - * - If successful, add the control block to hash list of UEs for the cell - * else Rollback and FAIL. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrUeCfg *ueCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrUeCfg -( -RgSchCellCb *cell, -RgrUeCfg *ueCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrUeCfg(cell, ueCfg, errInfo) -RgSchCellCb *cell; -RgrUeCfg *ueCfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - RgSchRaCb *raCb=NULLP; - RgSchUeCb *ue = NULLP; - Inst inst = cell->instIdx; - U32 lcgCnt; - RgSchDlHqEnt *hqEnt = NULLP; -#ifdef LTE_TDD - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 maxSubframes ; - U8 maxDlSubframes; -#endif - U32 idx = 0; -#ifdef TFU_UPGRADE - RgSchUePCqiCb *cqiCb = NULLP; -#endif - TRC2(rgSCHCfgRgrUeCfg); - - do { - errInfo->errCause = RGSCHERR_CFG_RGR_UE_CFG; - /* RACHO : Check for raCb only if preamble Id not provded */ -#ifndef PRE_DEF_UE_CTX - if (ueCfg->dedPreambleId.pres == NOTPRSNT) - { - if ((raCb = rgSCHDbmGetRaCb(cell, ueCfg->crnti)) == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"No RaCb exists for" - "CRNTI:%d ",ueCfg->crnti); - break; - } - } -#endif - - /* Allocate the Ue control block */ - if (((rgSCHUtlAllocSBuf(inst, (Data **)&ue, sizeof(RgSchUeCb))) != ROK) || - ((U8 *)ue == NULLP)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId, "Memory allocation" - " FAILED for CRNTI:%d", ueCfg->crnti); - break; - } - - /* Inititialize Ue control block */ - ue->ueId = ueCfg->crnti; - ue->cell = cell; - /*ccpu00117778- Initialize Transmission Indices upon UE CB creation */ -#ifdef LA - ue->lastRprdAckNackTime.sfn = cell->crntTime.sfn; - ue->lastRprdAckNackTime.subframe = cell->crntTime.subframe; - ue->ueIdle = FALSE; -#endif - - /* Allocate the Ue control block */ - if (((rgSCHUtlAllocSBuf(inst, (Data **)&(ue->cellInfo[RGSCH_PCELL_INDEX]), - sizeof(RgSchUeCellInfo))) != ROK)) - { -#ifndef ALIGN_64BIT - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%lu]SCellIdx :Memomy allocation " - "Failed while Adding SCell Information\n", idx)); -#else - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%u]SCellIdx :Memomy allocation " - "Failed while Adding SCell Information\n", idx)); -#endif - RETVALUE(RFAILED); - } - - ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)] = RGSCH_PCELL_INDEX; - ue->cellInfo[RGSCH_PCELL_INDEX]->cell = cell; - ue->cellInfo[RGSCH_PCELL_INDEX]->ue = ue; -#ifdef LTE_ADV - ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE; - ue->cellInfo[RGSCH_PCELL_INDEX]->sCellIdx = RGSCH_PCELL_INDEX; - ue->cellInfo[RGSCH_PCELL_INDEX]->sCellId = cell->cellId; - - if (ROK != rgSCHLaaInitDlRbAllocCb(cell, - &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb)) - { - RETVALUE(RFAILED); - } -#endif -#ifdef TFU_UPGRADE - cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell); - cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - ue->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; - ue->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; -#endif - /* LTE_ADV_FLAG_REMOVED_START */ - /* While doing UE configuration for SFR at SCH, by default - * CC UE power is configured as LOW */ - ue->lteAdvUeCb.isCCUePHigh = FALSE; - /* LTE_ADV_FLAG_REMOVED_END */ - - /* Initialize the lists of the UE */ - if((rgSCHDbmInitUe(ue)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"DBM initialization " - "failed for CRNTI:%d", ueCfg->crnti); - break; - } -#ifdef EMTC_ENABLE - if(raCb != NULLP) - { - if(TRUE == raCb->isEmtcRaCb) - { - ue->isEmtcUe = TRUE; - if (rgSCHUtlUpdUeEmtcInfo(cell, ueCfg, ue) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"EMTC UE Cfg" - "failed for CRNTI:%d", ueCfg->crnti); - break; - } - } - } -#endif - - /* Initialize scheduler related information for UE */ - if(rgSCHUtlRgrUeCfg(cell, ue, ueCfg, errInfo) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Scheduler handling " - "failed in config for CRNTI:%d", ueCfg->crnti); - break; - } - - ret = rgSCHUhmHqEntInit(cell, ue); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"UHM HARQ Ent Init " - "Failed for CRNTI:%d", ueCfg->crnti); - break; - } - - /* Initialize RAM related information for UE - * RACHO: if preamble Id is present in ueCfg then raCb will be NULL - * so rgSCHRamRgrUeCfg should take care of creating raCb */ - if ((ueCfg->dedPreambleId.pres == NOTPRSNT) && (NULLP != raCb) ) - { - if((rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Random access " - "handling config failed for CRNTI:%d", ueCfg->crnti); - break; - } - } - else /* if HO Ue */ - { - RG_SCH_CMN_GET_UE_HQE(ue, cell) = rgSCHDhmHqEntInit(cell); - hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell); - if (hqEnt == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Hq Entity Initialization " - "failed in config for CRNTI:%d", ueCfg->crnti); - break; - } -#ifdef EMTC_ENABLE - rgSCHEmtcHqPAlloc(cell, hqEnt); -#endif - hqEnt->ue = ue; - /* Fix : syed Assign hqEnt to UE only if msg4 is done */ - - rgSCHCmnDlInitHqEnt(cell, hqEnt); - - /* For Hand-In UE Request Aper CQI report - * immediately */ - if (ueCfg->ueDlCqiCfg.aprdCqiCfg.pres) - { - /* Set APCQI for Pcell only*/ - ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; - } - } - /* CA dev Start */ -#ifdef LTE_TDD - maxDlSubframes = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - maxSubframes = 2 * maxDlSubframes; - ue->dl.numHqDlSfInfo = maxSubframes; - rgSCHUtlAllocSBuf(cell->instIdx, - (Data **)&ue->dl.dlSfHqInfo, sizeof(RgSchDlHqInfo) * (ue->dl.numHqDlSfInfo)); - -#else - ue->dl.numHqDlSfInfo = RGSCH_NUM_DL_SUBFRAMES; -#endif -#ifndef RG_5GTF - for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++) - { - cmLListInit(&ue->dl.dlSfHqInfo[idx].hqPLst); - ue->dl.dlSfHqInfo[idx].dlSfUeLnk.node = NULLP; - - } -#else - { - U8 cellIdx=0; - for (cellIdx = 0;cellIdx < MAX_5GTF_CELL ; cellIdx++) - { - for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++) - { - cmLListInit(&ue->dl.dlSfHqInfo[cellIdx][idx].hqPLst); - ue->dl.dlSfHqInfo[cellIdx][idx].dlSfUeLnk.node = NULLP; - } - } - } -#endif -#ifdef LTE_ADV - rgSCHLaaInitDlHqInfo(cell, ue); -#endif - /* CA dev End */ - - /* Initialize lcgIds to Invalid */ - for (lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++) - { - ue->ul.lcgArr[lcgCnt].lcgId = RGSCH_INVALID_LCG_ID; - } - if(raCb != NULLP) - { - rgSCHCfgRgrUePhrMsg3(cell,raCb,ue,errInfo); - /* Moved this code out of rgSCHCfgRgrUePhrMsg3() - * as it was not the appropriate place to - * do this. */ - if (raCb->raState == RGSCH_RA_MSG4_DONE) - { - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "RNTI:%d RaCb deleted as Msg4 transmission is done", - raCb->tmpCrnti); - rgSCHRamDelRaCb(cell, raCb, FALSE); - } - } - /* Initialize uplink HARQ related information for UE */ - rgSCHUhmRgrUeCfg(cell, ue, ueCfg); - cmInitTimers(&ue->bsrTmr, 1); -#ifdef RGR_V1 - /* Added periodic BSR timer */ - cmInitTimers(&ue->bsrTmr, 1); - - /* Fix - Added proper configuration from U-ARM */ - if(ueCfg->ueBsrTmrCfg.isPrdBsrTmrPres == TRUE) - { - ue->ul.bsrTmrCfg.isPrdBsrTmrPres = TRUE; - ue->ul.bsrTmrCfg.prdBsrTmr = ueCfg->ueBsrTmrCfg.prdBsrTmr; - ue->ul.bsrTmrCfg.retxBsrTmr = ueCfg->ueBsrTmrCfg.retxBsrTmr; - } - -#endif - /* Initialize downlink HARQ related information for UE */ - rgSCHDhmRgrUeCfg(cell, ue, ueCfg, errInfo); - - /* Initialize MeasureGap and Acknack Rep Information for UE */ - if((rgSCHMeasGapANRepUeCfg(cell, ue, ueCfg)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Measurement Gap and" - " AckNack Rep failed in Config for CRNTI:%d", ueCfg->crnti); - break; - } - - -#ifdef LTE_TDD - if((rgSCHUtlAllocUeANFdbkInfo(ue,RGSCH_PCELL_INDEX)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Memomy allocation " - "Failed while UE related Ack Nack Information for CRNTI:%d", - ueCfg->crnti); - break; - } - ue->dl.ackNackMode = ueCfg->ackNackModeEnum; -#endif /* LTE_TDD */ - - /* Insert Ue */ - rgSCHDbmInsUeCb(cell, ue); - -#ifdef TFU_UPGRADE - /* Int ialize APeriodic CQI/PMI/RI Information for UE */ - - RGSCHDBGPRM(cell->instIdx,(rgSchPBuf(cell->instIdx), - "\n rgSCHCfgRgrUeCfg : CellID=%d UeId =%d AcqiCfg Pres =%d", - cell->cellId, ue->ueId, ueCfg->ueDlCqiCfg.aprdCqiCfg.pres)); - - /*Store Trigger Set Bit String to UE */ - - ret = rgSCHCfgACqiUeCfg(cell,ue, (RG_SCH_CMN_GET_ACQICB(ue,cell)),ue->mimoInfo.txMode, - &ueCfg->ueDlCqiCfg.aprdCqiCfg, ue->ueCatEnum); - - ue->cqiRiWritIdx = 0; - ue->cqiRiReadIdx = 0; - /* Initialize Periodic CQI/PMI, RI Information for UE */ - ret = rgSCHCfgPCqiUeCfg(cell, ue, &ueCfg->ueDlCqiCfg.prdCqiCfg, - ue->ueCatEnum); - - /* Initialize UL SRS Information for UE */ - ret = rgSCHCfgSrsUeCfg(cell, ue, &ueCfg->srsCfg); - - /* Initialize SR Information for UE */ - ret = rgSCHCfgSrUeCfg(cell, ue, &ueCfg->srCfg); -#endif - -#ifdef LTEMAC_HDFDD - if (rgSCHHdFddUeCfg(cell, ue, ueCfg->isHdFddEnbld) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId, - "Could not do HD-FDD config for CRNTI:%d",ueCfg->crnti); - break; - } - -#endif /* LTEMAC_HDFDD */ - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - ue->cqiReptCfgInfo.numColltdCqiRept = - ueCfg->ueCqiReptCfg.numColltdCqiRept; -#endif /* End of RGR_CQI_REPT */ -#ifdef TFU_UPGRADE - RG_SCH_CMN_GET_PA(ue,cell).pres = FALSE; - if (RG_SCH_UE_CFG_ISPAPRSNT(ueCfg->uePdschDedCfg.uepACfg)) - { - RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE; - RG_SCH_CMN_GET_PA(ue,cell).val = ueCfg->uePdschDedCfg.uepACfg.pA; - } -#endif - ue->isDrxEnabled = ueCfg->ueDrxCfg.isDrxEnabled; - - if ( ue->isDrxEnabled ) - { - if((rgSCHDrxUeCfg(cell,ue,ueCfg)) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"DRX configuration failed", - ueCfg->crnti); - break; - } - } - - /* LTE_ADV_FLAG_REMOVED_START */ - if ((cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) || \ - (cell->lteAdvCb.absCfg.status == RGR_ENABLE)) - { - ue->lteAdvUeCb.rgrLteAdvUeCfg = ueCfg->ueLteAdvCfg; - } - /* LTE_ADV_FLAG_REMOVED_END */ - -#ifdef TENB_STATS - ue->tenbStats = TSL2AllocUeStatsBlk(ue->ueId); - ue->tenbStats->stats.rnti = ue->ueId; -#endif -#ifdef LTE_ADV - /*Update A Value for PCell TBs*/ - ue->f1bCsAVal = rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode); - RLOG_ARG1(L_ERROR,DBG_CELLID, ueCfg->cellId, - "\n UeCfg A value is %d\n",ue->f1bCsAVal); -#endif - errInfo->errCause = RGSCHERR_NONE; - - ue->accessStratumRls = ueCfg->accessStratumRls; - if (ue->numSCells > 0) - { - /* 2 bit CSI */ - rgSCHUtlUpdUeDciSize(cell, ue, TRUE); - } - else - { - /* 1 bit CSI Access Stratum Release Change */ - rgSCHUtlUpdUeDciSize(cell, ue, FALSE); - } - - RETVALUE(ROK); - }while(0); - - if (ue) - { - rgSCHCfgFreeUeCb(cell, ue); - } - RETVALUE(RFAILED); -} /* rgSCHCfgRgrUeCfg */ - -/** - * @brief Handler for PHR for MSG3. - * - * @details - * - * Function : rgSCHCfgRgrUePhrMsg3 - * - * Processing Steps: - * Handle PHR related config for MSG3 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrUeCb *ueCb - * @param[in] RgSchRaCb *raCb - * @param[out] RgSchErrInfo *errInfo - **/ -#ifdef ANSI -PRIVATE Void rgSCHCfgRgrUePhrMsg3 -( -RgSchCellCb *cell, -RgSchRaCb *raCb, -RgSchUeCb *ue, -RgSchErrInfo *errInfo -) -#else -PRIVATE Void rgSCHCfgRgrUePhrMsg3(cell, raCb, ue, errInfo) -RgSchCellCb *cell; -RgSchRaCb *raCb; -RgSchUeCb *ue; -RgSchErrInfo *errInfo; -#endif -{ - - TRC2(rgSCHCfgRgrUePhrMsg3); - - /* Record msg3 allocation in the UE */ - rgSCHUtlRecMsg3Alloc(cell, ue, raCb); - - /* If raCb received PHR, update scheduler */ - if(raCb->phr.pres == TRUE) - { - ue->macCeRptTime = raCb->msg3AllocTime; - rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo); - } - - RETVOID; -} - -/** - * - * @details - * - * Function : rgSCHDynCfiReCfg - * - * @param[in] RgSchCellCb *cell - * Bool isDynCfiEnb - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHDynCfiReCfg -( -RgSchCellCb *cell, -Bool isDynCfiEnb -) -#else -PUBLIC Void rgSCHDynCfiReCfg(cell, isDynCfiEnb) -RgSchCellCb *cell; -Bool isDynCfiEnb; -#endif -{ - U8 idx; - RgSchCmnDlCell *cellSchDl = RG_SCH_CMN_GET_DL_CELL(cell); - - TRC2(rgSCHDynCfiReCfg); - - if(isDynCfiEnb) - { - cell->dynCfiCb.ttiCnt = 0; - cellSchDl->newCfi = cellSchDl->currCfi; - } - else - { - /* Resetting the parameters*/ - cell->dynCfiCb.cceFailCnt = 0; - cell->dynCfiCb.cceFailSum = 0; - cell->dynCfiCb.prevCceFailIdx = 0; - - for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++) - { - cell->dynCfiCb.cceFailSamples[idx] = 0; - } - - cell->dynCfiCb.cceUsed = 0; - cell->dynCfiCb.lowCceCnt = 0; - cell->dynCfiCb.ttiCnt = 0; - } -} -/** - * @brief Handler for the cell reconfiguration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrCellRecfg - * - * Processing Steps: - * - Invoke SCH with cell control block to update - * scheduler specific information. - * - Update cell control block with the values recieved in the - * configuration. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellRecfg *cellRecfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrCellRecfg -( -RgSchCellCb *cell, -RgrCellRecfg *cellRecfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrCellRecfg(cell, cellRecfg, errInfo) -RgSchCellCb *cell; -RgrCellRecfg *cellRecfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - Inst inst = cell->instIdx; -/* LTE_ADV_FLAG_REMOVED_START */ - U8 i = 0; - U16 len; /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ -/* LTE_ADV_FLAG_REMOVED_END */ - - TRC2(rgSCHCfgRgrCellRecfg); - - - errInfo->errCause = RGSCHERR_CFG_RGR_CELL_RECFG; - - /* Invoke scheduler to update scheduler specific information */ - ret = rgSCHUtlRgrCellRecfg(cell, cellRecfg, errInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId, "RGR Cell re-configuration failed " - "at Scheduler "); - RETVALUE(RFAILED); - } - - /* Invoke DHM to update DHM specific information */ - rgSCHDhmRgrCellRecfg(cell, cellRecfg, errInfo); - - /* PUCCH Reconfiguration */ - if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG) - { - cell->pucchCfg = cellRecfg->pucchRecfg; - } - - /* SRS Reconfiguration */ - if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG) - { - cell->srsCfg.isSrsCfgPres = cellRecfg->srsRecfg.isSrsCfgSetup; - if(cellRecfg->srsRecfg.isSrsCfgSetup) - { - cell->srsCfg.srsCfgPrdEnum = cellRecfg->srsRecfg.srsCfgPrdEnum; - cell->srsCfg.srsBwEnum = cellRecfg->srsRecfg.srsBwEnum; - cell->srsCfg.srsTxOffst = - rgSrsTxOffstTbl[cellRecfg->srsRecfg.srsSubFrameCfg]; - /*ccpu00116923 - ADD - Srs Present support */ -#ifdef TFU_UPGRADE - cell->srsCfg.srsSubFrameCfg = cellRecfg->srsRecfg.srsSubFrameCfg; -#endif - } - } - - /* RACH Reconfiguration */ - if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG) - { - cell->rachCfg = cellRecfg->rachRecfg; - } - - /* ccpu00132256:MOD: Moved this assignment from Validation to here.*/ - if (cellRecfg->recfgTypes & RGR_CELL_TMRS_RECFG) - { - cell->t300TmrVal = cellRecfg->t300TmrVal; - } -#ifdef RGR_SI_SCH - /* SI Reconfiguration */ - if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG) - { - /*Set the specified SI configuration. */ - cell->siCb.newSiCfg = cellRecfg->siReCfg; - /* Set the Bit mask for SI re-configuration */ - cell->siCb.siBitMask |= RGSCH_SI_SICFG_UPD; -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - rgSchEmtcUpdSiCfg(cell, cellRecfg); - } -#endif - } -#endif /*RGR_SI_SCH */ - - /* Overload RACH Control changes */ - if (cellRecfg->recfgTypes & RGR_CELL_CNTRL_CMD_RECFG) - { - if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_RACH_OVRLD) - { - cell->overLoadBackOffEnab = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffEnb; - cell->overLoadBackOffval = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffVal; - } - else if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_CPU_OVRLD) - { - if( ROK != rgSCHUtlResetCpuOvrLdState(cell, cellRecfg->cntrlCmdCfg.cmdDesc.\ - cpuOvrLd.instruction)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID, cellRecfg->cellId, - "Invalid CPU OvrLd Ins %d for cell", - cellRecfg->cntrlCmdCfg.cmdDesc.cpuOvrLd.instruction); - RETVALUE(RFAILED); - } - } - } - -/* LTE_ADV_FLAG_REMOVED_START */ - if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG) - { - if(cellRecfg->rgrLteAdvCfg.pres & RGR_ABS) - { - cell->lteAdvCb.absCfg = - cellRecfg->rgrLteAdvCfg.absCfg; - } - if(cellRecfg->rgrLteAdvCfg.pres & RGR_SFR) - { - cmMemcpy((U8 *)&cell->lteAdvCb.sfrCfg, (U8 *)&cellRecfg->rgrLteAdvCfg.sfrCfg, - sizeof(RgrSfrConfig)); - /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ - if (cellRecfg->rgrLteAdvCfg.sfrCfg.status == RGR_ENABLE) - { - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - /*initialise the pools of CC and CE*/ - if(rgSchSFRTotalPoolInit(cell, cell->subFrms[i])) - { - RETVALUE(RFAILED); - } - } - } - else - { - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - /*initialise the pools of CC and CE*/ - rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell); - } - - if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - /* releasing rntp info val from each subframe */ - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw); - } - - /* releasing RNTP Aggregation Info from CellCb*/ - rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); - - cell->lteAdvCb.dsfrCfg.status = RGR_DISABLE; - } - } - } - /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** Start */ - if(cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR) - { - cell->lteAdvCb.dsfrCfg = - cellRecfg->rgrLteAdvCfg.dsfrCfg; - if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - /*initialise the pools of CC and CE*/ - if(rgSchDSFRRntpInfoInit(&cell->subFrms[i]->rntpInfo,cell,cell->bwCfg.dlTotalBw)) - { - RETVALUE(RFAILED); - } - } - /*Calculating the length of RNTP array based on Dl Bandwidth */ - len = (U16)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /* KW fix for LTE_ADV */ - if(cell->rntpAggrInfo.pres == NOTPRSNT) - { - if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val), - (len * sizeof(U8)))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId, - "Memory allocation FAILED for RNTP Alloc"); - RETVALUE(RFAILED); - } - cell->rntpAggrInfo.pres = PRSNT_NODEF; - cell->rntpAggrInfo.len = len; - } - } - /* in case if DSFR is disabled, need to free RNTP pattern val*/ - else - { - /* releasing rntp info val from each subframe */ - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw); - } - - /* releasing RNTP Aggregation Info from CellCb*/ - rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); - } - } - /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** End */ - } -/* LTE_ADV_FLAG_REMOVED_END */ - - /* Dynamic CFI cell Reconfiguration */ - if(cellRecfg->recfgTypes & RGR_CELL_DYN_CFI_RECFG) - { - if(cell->dynCfiCb.isDynCfiEnb != cellRecfg->isDynCfiEnb) - { - if(cell->dynCfiCb.switchOvrInProgress) - { - cell->dynCfiCb.dynCfiRecfgPend = TRUE; - } - else - { - cell->dynCfiCb.isDynCfiEnb = cellRecfg->isDynCfiEnb; - rgSCHDynCfiReCfg(cell, cellRecfg->isDynCfiEnb); - } - } - else - { - /* To hanlde the case where reconfiguration comes for disabling - * and then enabling before switchover period expires */ - cell->dynCfiCb.dynCfiRecfgPend = FALSE; - } - } - /* Dynamic config of AUTO chnage flag */ - if(cellRecfg->recfgTypes & RGR_CELL_AUTO_CFG_MODE_RECFG) - { - if(cell->isAutoCfgModeEnb != cellRecfg->isAutoCfgModeEnb) - { - cell->isAutoCfgModeEnb = cellRecfg->isAutoCfgModeEnb; - } - } - { - if(cell->isAutoCfgModeEnb) - { - RLOG0(L_INFO,"Auto Mode Cfg enabled durint cell recfg\n"); - } - } - - if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG) - { - cell->minDlResNonCsg = cellRecfg->csgParamCfg.minDlResNonCsg; - cell->minUlResNonCsg = cellRecfg->csgParamCfg.minUlResNonCsg; - } - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrCellRecfg */ - -/** - * @brief Handler for the UE reconfiguration request from RRC to MAC. - * - * @details - * - * Function : rgSCHCfgRgrUeRecfgRntiChg - * - * Processing Steps: - * - If rnti changes, - * - Invoke RAM for UE reconfiguration. - * - Delete old UE from the list. - * - Update the new rnti and re-insert the UE in the list. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg(cell, ue, ueRecfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *errInfo; -#endif -{ -#ifdef LTE_ADV - U8 sCellIdx; -#endif - S16 ret; - RgSchRaCb *raCb; - RgSchRaCb *oldRaCb; - RgSchDlHqEnt **hqEnt = &(RG_SCH_CMN_GET_UE_HQE(ue, cell)); - U8 idx; - - TRC2(rgSCHCfgRgrUeRecfgRntiChg); - - /* Handle CRNTI change in reconfiguration */ - if (ueRecfg->oldCrnti != ueRecfg->newCrnti) - { - RgSchRntiLnk *oldRntiLnk=NULLP; - CmLteRnti oldRnti = 0; - if ((raCb = rgSCHDbmGetRaCb(cell, ueRecfg->newCrnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UEID:No RaCb exists while" - "Reconfig for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - - /* rntiLnk does not exist for a HandIn UE. Hence this check. */ - if(ue->rntiLnk) - { - oldRntiLnk = ue->rntiLnk; - } - else - { - /* Fix : syed HO UE does not have a valid ue->rntiLnk */ - oldRnti = ue->ueId; - } - - RLOG2(L_INFO,"UE ID CHNG OLD %d new %d",ueRecfg->oldCrnti, ueRecfg->newCrnti); - - /* Fix : syed Deleting Old DL HqEnt. It would be assigned after - * reest RACH(msg4) is completed. */ - rgSCHDhmDelHqEnt(cell, hqEnt); - - /* Initialize RAM related information for UE */ - ret = rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"RAM Handling for UE Reconfig failed" - "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - /* Delete Ue from the ue list */ - rgSCHDbmDelUeCb(cell, ue); - -#ifdef LTE_ADV - if (ue->numSCells) - { - for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++) - { - if(ue->cellInfo[sCellIdx] != NULLP) - { - rgSCHDbmDelUeCb(ue->cellInfo[sCellIdx]->cell, ue); - } - } - } -#endif - - /* Inititialize Ue control block */ - ue->ueId = ueRecfg->newCrnti; - RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, - "Changing RNTI from %d to %d", - ueRecfg->oldCrnti, - ueRecfg->newCrnti); -#ifdef EMTC_ENABLE - if(ue->isEmtcUe) - { - rgSCHUtlUpdEmtcY(ue); - } -#endif - - /* Fix ccpu00122631: PCell_Reest: Updating new Rnti in all the cells - * dlAllocCb - */ - for(idx = 0; idx < CM_LTE_MAX_CELLS; idx++) - { - if(ue->cellInfo[idx]) - { - ue->cellInfo[idx]->dlAllocCb.rnti = ueRecfg->newCrnti; - } - } - - rgSCHUtlRecMsg3Alloc(cell, ue, raCb); - - /* If raCb received PHR, update scheduler */ - if(raCb->phr.pres == TRUE) - { - ue->macCeRptTime = raCb->msg3AllocTime; - rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo); - } - -#ifdef RGR_V2 /* Acc Fix */ - if(TRUE == ue->isDrxEnabled) - { - ueRecfg->ueDrxRecfg.isDrxEnabled = TRUE; - ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg); - - if ( ret != ROK ) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE DRX re-est failed" - "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } -#endif /* Acc Fix */ - - /* Re-insert updated Ue */ - rgSCHDbmInsUeCb(cell, ue); - -#ifdef LTE_ADV - if (ue->numSCells) - { - for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++) - { - if(ue->cellInfo[sCellIdx] != NULLP) - { - rgSCHDbmInsUeCb(ue->cellInfo[sCellIdx]->cell, ue); - } - } - } -#endif - - -#ifdef TENB_STATS - ue->tenbStats->stats.rnti = ue->ueId; -#endif - - /* Fix : syed If MSG4 is done, since corresponding ueCb - * is ready, the raCb should be cleared immediately. - * Otherwise it would remain in the cell until timed out - * and till then the hq Feedbacks will be assumed to be - * for msg4 */ - if (raCb->raState == RGSCH_RA_MSG4_DONE) - { - RLOG_ARG1(L_DEBUG,DBG_CELLID,ueRecfg->cellId, - "RNTI:%d with RaCb deleted as Msg4 transmission is done", - raCb->tmpCrnti); - rgSCHRamDelRaCb(cell, raCb, FALSE); - } - /* Fix : syed moving the UL CQI initialization to UERESET */ - - /* Release Older rnti */ - if(oldRntiLnk) - { - /* This is the rare case in which back to back reestablishment is - * happening and previous re-est was not done completely (MSG4 was - * not done) for an UE, and again re-est is triggered for the same - * UE. We are deleting the old RA CB for the previous re-est which - * still exist due to MSG4 not transmitted successfully */ - if ((oldRaCb = rgSCHDbmGetRaCb(cell, oldRntiLnk->rnti)) != NULLP) - { - rgSCHRamDelRaCb(cell, oldRaCb, FALSE); - } - - rgSCHUtlRlsRnti(cell, oldRntiLnk, TRUE, ueRecfg->newCrnti); - } - else - { - /* Fix : syed HO UE does not have a valid ue->rntiLnk */ - /* Just indicate to MAC, no need to release at SCH */ - RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, - "HO OldRnti:%d RLS and NewRnti:%d CHNG IND TO MAC", - oldRnti, ueRecfg->newCrnti); - rgSCHUtlIndRntiRls2Mac(cell, oldRnti, TRUE, ueRecfg->newCrnti); - } - } - RETVALUE(ROK); -} -/** - * @brief Handler for the UE reconfiguration request from RRC to MAC. - * - * @details - * - * Function : rgSCHCfgRgrUeRecfg - * - * Processing Steps: - * - If rnti changes, - * - Invoke RAM for UE reconfiguration. - * - Delete old UE from the list. - * - Update the new rnti and re-insert the UE in the list. - * - Update the UE control block with the reconfigured values. - * - Invoke SCH, UHM and DHM with updated UE control block to - * update scheduler, uplink HARQ and downlink HARQ specific - * parameters. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrUeRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrUeRecfg(cell, ue, ueRecfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; -#ifdef LTE_ADV - Bool dciChange = TRUE; -#endif - - TRC2(rgSCHCfgRgrUeRecfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_UE_RECFG; - -#ifdef LTE_ADV - if (ue->numSCells > 0) - { - dciChange = FALSE; - } - if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ - (ue->accessStratumRls != ueRecfg->accessStratumRls)) - { - ue->accessStratumRls = ueRecfg->accessStratumRls; - dciChange = TRUE; - } - - /* if SCELL_RECFG is present , no other - * type will be present. Process Scell addition - * and return - * */ - if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_ADD_RECFG) - { - ret = rgSCHSCellCfgUeCfg(cell, ue, ueRecfg, errInfo); - if( ret != ROK) - { - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG; - /*FH: SCell config failed for a scell index hence revert all successful - * Scell config and send negative confirmation to APP*/ - rgSCHSCellCfgUeCfgRollBack(cell, ue, ueRecfg); - RETVALUE(RFAILED); - } - } - if (dciChange == TRUE) - { - if (ue->numSCells > 0) - { - /* 2 bit CSI */ - rgSCHUtlUpdUeDciSize(cell, ue, TRUE); - } - else - { - /* 1 bit CSI Access Stratum Release Change */ - rgSCHUtlUpdUeDciSize(cell, ue, FALSE); - } - } - if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_PUCCH_RECFG) - { - ret = rgSCHSCellCfgUePucchReCfg(cell, ue, ueRecfg, errInfo); - if( ret != ROK) - { - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_PUCCH_RECFG; - RETVALUE(RFAILED); - } - } -#else - if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ - (ue->accessStratumRls != ueRecfg->accessStratumRls)) - { - ue->accessStratumRls = ueRecfg->accessStratumRls; - rgSCHUtlUpdUeDciSize(cell, ue, FALSE); - } -#endif /* LTE_ADV */ - - if (ueRecfg->ueRecfgTypes) - { - /* Update scheduler related information for UE */ - ret = rgSCHUtlRgrUeRecfg(cell, ue, ueRecfg, errInfo); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, - "Scheduler handling while reconfig failed" - "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - - /* Update uplink HARQ related information for UE */ - rgSCHUhmRgrUeRecfg(cell, ue, ueRecfg); - - /* Update TA related information for UE */ - if (ueRecfg->ueRecfgTypes & RGR_UE_TATMR_RECFG) - { - rgSCHCfgUeTaRecfg(cell, ue, ueRecfg, errInfo); - } - - /*Update Measurement Gap and AckNack Details */ - /* After merging from 2.2 */ - if (ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG) - { - ret = rgSCHMeasGapANRepUeRecfg(cell, ue, ueRecfg); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Measurement Gap and" - "AckNack Rep Recfg failed for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - if (ueRecfg->ueRecfgTypes & RGR_UE_BSRTMR_RECFG) - { - cmInitTimers(&ue->bsrTmr, 1); - ue->ul.bsrTmrCfg = ueRecfg->ueBsrTmrRecfg; - if ((ue->ul.bsrTmrCfg.isPrdBsrTmrPres) && - (ue->ul.bsrTmrCfg.prdBsrTmr == 0xFFFF)) - { - ue->ul.bsrTmrCfg.isPrdBsrTmrPres = FALSE; - } - } - } - - if (RFAILED == rgSCHCfgRgrUeRecfgRntiChg (cell, ue, ueRecfg, errInfo)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"RNTI change " - "failed for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - -#ifdef TFU_UPGRADE - /* Re-Initialize Aperiodic CQI Information for UE*/ - if ( ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG ) - { - ret = rgSCHCfgAcqiUeReCfg(cell, ue, &ueRecfg->aprdDlCqiRecfg, - ue->ueCatEnum); - } - /* Re-Initialize Periodic CQI/PMI, RI Information for UE */ - if ( ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG) - { - ret = rgSCHCfgPCqiUeReCfg(cell, ue, &ueRecfg->cqiCfg, - ue->ueCatEnum); - } - /* Re-Initialize UL SRS Information for UE */ - if ( ueRecfg->ueRecfgTypes & RGR_UE_SRS_RECFG) - { - ret = rgSCHCfgSrsUeReCfg(cell, ue, &ueRecfg->srsCfg); - } - /* Re-Initialize SR Information for UE */ - if ( ueRecfg->ueRecfgTypes & RGR_UE_SR_RECFG) - { - ret = rgSCHCfgSrUeReCfg(cell, ue, &ueRecfg->srCfg); - } -#endif - -#ifdef LTEMAC_HDFDD - if(ueRecfg->isHdFddEnbld) - { - ret = rgSCHHdFddUeCfg(cell, ue, ueRecfg->isHdFddEnbld); - if (ret != ROK) - { - errInfo->errCause = RGSCHERR_HDFDD_SPSCFGRD; - RETVALUE(ret); - } - } -#endif /* LTEMAC_HDFDD */ -#ifdef RGR_V2 - if ( ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) - { - ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg); - - if ( ret != ROK ) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE DRX reconfig failed" - "failed for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } -#endif -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* CQI Reporting (N) Re-configuration */ - if(ueRecfg->ueRecfgTypes & RGR_UE_CQIREPT_RECFG) - { - ret = rgSCHCfgUeCqiReptReCfg(cell, ue, ueRecfg); - if(ret != OK) - { - errInfo->errCause = RGSCHERR_CQIREPT; - RETVALUE(ret); - } - } -#endif /* End of RGR_CQI_REPT */ -#ifdef TFU_UPGRADE - /* pA Re-configuration */ - if((ueRecfg->ueRecfgTypes & RGR_UE_PA_RECFG) && - RG_SCH_UE_CFG_ISPAPRSNT(ueRecfg->uePdschDedCfg.uepACfg)) - { - RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE; - RG_SCH_CMN_GET_PA(ue,cell).val = ueRecfg->uePdschDedCfg.uepACfg.pA; - } -#endif - -/* LTE_ADV_FLAG_REMOVED_START */ - if(ueRecfg->ueRecfgTypes & RGR_UE_LTEA_RECFG) - { - if(ueRecfg->ueLteAdvCfg.pres & RGR_ABS) - { - ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe = ueRecfg->ueLteAdvCfg.isAbsUe; - } - - if(ueRecfg->ueLteAdvCfg.pres & RGR_SFR) - { - ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge = ueRecfg->ueLteAdvCfg.isUeCellEdge; - } - } -/* LTE_ADV_FLAG_REMOVED_END */ -#ifdef EMTC_ENABLE - if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_DPLXMODE_RECFG) - { - rgSCHEmtcHdFddUeCfg (cell, ue, - ueRecfg->emtcUeRecfg.isHdFddEnbld); - } - if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_PO_TRIGGER) - { - rgSCHEmtcPOTrigger(cell, ue); - } -#endif - errInfo->errCause = RGSCHERR_NONE; - - RETVALUE(ROK); -} /* rgSCHCfgRgrUeRecfg */ - - -/** - * @brief Handler for the logical channel reconfiguration request from - * RRC to MAC. - * - * @details - * - * Function : rgSCHCfgRgrLchRecfg - * - * Processing Steps: - * - Invoke scheduler to update scheduler specific information. - * - Update the dedicated logical channel Cb with the reconfigured - * values. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgUlCellCb *cell - * @param[in] RgUlUeCb *ue - * @param[in] RgSchUlLcCb *ulLc - * @param[in] RgSchDlLcCb *dlLc - * @param[in] RgrLchRecfg *lcRecfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLchRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc, -RgrLchRecfg *lcRecfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLchRecfg(cell, ue, dlLc, lcRecfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -RgrLchRecfg *lcRecfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret = ROK; - - TRC2(rgSCHCfgRgrLchRecfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_LC_RECFG; - /* Invoke Scheduler to update the new configuration */ - ret = rgSCHUtlRgrLcRecfg(cell, ue, dlLc, lcRecfg, errInfo); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Scheduler handling for LC Recfg" - " failed for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrLchRecfg */ -/** - * @brief Handler for the logical channel reconfiguration request from - * RRC to MAC. - * - * @details - * - * Function : rgSCHCfgRgrLcgRecfg - * - * Processing Steps: - * - Invoke scheduler to update scheduler specific information. - * - Update the dedicated logical channel Cb with the re-configured - * values. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgUlCellCb *cell - * @param[in] RgUlUeCb *ue - * @param[in] RgrLcgRecfg *lcgRecfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLcgRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrLcgRecfg *lcgRecfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLcgRecfg(cell, ue, lcgRecfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrLcgRecfg *lcgRecfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret = ROK; - - TRC2(rgSCHCfgRgrLcgRecfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_LCG_RECFG; - - /*Added for handling LCG ReConfig if the LCG was deleted */ - ue->ul.lcgArr[lcgRecfg->ulRecfg.lcgId].lcgId = lcgRecfg->ulRecfg.lcgId; - - /* Invoke Scheduler to update the new configuration */ - ret = rgSCHUtlRgrLcgRecfg(cell, ue, lcgRecfg, errInfo); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Scheduler handling for LCG Recfg" - " failed for CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrLcgRecfg */ - -/** - * @brief Handler for the UE Reset request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrUeReset - * - * Processing Steps: - * - Call Measument Gap Module and Ack/Nack Module for resetting UE. - * - Call Common Schduler UE rest API which inturn will call scheduler - * specific UE Reset APis to reset UE. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrRst *reset - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrUeReset -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrRst *reset, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrUeReset(cell, ue, reset, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrRst *reset; -RgSchErrInfo *errInfo; -#endif -{ - U32 idx; - RgSchRaCb *raCb; - - TRC2(rgSCHCfgRgrUeReset); - - - errInfo->errCause = RGSCHERR_CFG_RGR_UE_RESET; - - /* Setting BO of Each Logical Channel of the UE to 0 */ - for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; idx++) - { - if(ue->dl.lcCb[idx] != NULLP) - ue->dl.lcCb[idx]->bo = 0; - } - - /* Reset the totalBo */ - ue->totalBo = 0; - /* Call DRX module to stop all DRX timers */ - /* ccpu00129899 */ - if(ue->drxCb != NULLP) - { - (Void)rgSCHDrxUeDel(cell,ue); - } - - /* ccpu00140894- Stop TXMode transiition timer if it is running*/ - if (ue->txModeTransTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue); - ue->txModeTransCmplt =TRUE; - } - - /* ccpu00133470- Meas Gap should be released during RRC re-establishment */ - rgSCHMeasGapANRepUeDel(cell, ue, FALSE); - - /* Call Common scheduler which in turn will call specific scheduler for UE - * Reset*/ - rgSCHUtlUeReset(cell, ue); -#ifdef LTE_ADV - /*PCell which is at idx 0 is always active. Adding a line after the loop - *setting RGSCH_PCELL_INDEX to SCELL ACTIVE*/ - ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE; -#endif - - /* In case of back to back reestablishments, when this UE's - * previous ReEst is still in progress and has got RESET - * as part of new ReEst */ - if((raCb = rgSCHDbmGetRaCb(cell, ue->ueId)) != NULLP) - { - rgSCHRamDelRaCb(cell, raCb, FALSE); - } - /* Fix : syed set UE inactive in DL until UE is reinitialization completed */ - ue->dl.dlInactvMask |= RG_HQENT_INACTIVE; - ue->ul.ulInactvMask |= RG_HQENT_INACTIVE; - /* [ccpu00127141] Resetting TA related parameters */ - ue->dl.taCb.ta = RGSCH_NO_TA_RQD; - ue->dl.taCb.state = RGSCH_TA_IDLE; - - /*[ccpu00121813]-ADD-Initializing outstanding TA value */ - ue->dl.taCb.outStndngTa = FALSE; - ue->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD; - - if (ue->dl.taCb.cfgTaTmr) - { - rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr); - } - -#ifdef DL_LA - /* Resetting the Tx mode change factor on UE reset */ - ue->mimoInfo.txModUpChgFactor = 0; - ue->mimoInfo.txModDownChgFactor = 0; -#endif - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrUeReset */ - -/** - * @brief Handler for the cell delete request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrCellDel - * - * Processing Steps: - * - Fetch the cell control block. - * - Remove the cell control block from the hash list of cells. - * - Free the cell control block. - * - If successful, return ROK else return RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrDel *cellDelInfo - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrCellDel -( -RgSchCellCb *cell, -RgrDel *cellDelInfo, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrCellDel(cell, cellDelInfo, errInfo) -RgSchCellCb *cell; -RgrDel *cellDelInfo; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgRgrCellDel); - - - errInfo->errCause = RGSCHERR_CFG_RGR_CELL_DEL; - - if (cell->cellId != cellDelInfo->u.cellDel.cellId) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellDelInfo->u.cellDel.cellId, - "Cell does not exist"); - RETVALUE(RFAILED); - } - - /* Free the active cell */ - rgSCHCfgFreeCellCb(cell); - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrCellDel */ - - -/** - * @brief Handler for the UE delete request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrUeDel - * - * Processing Steps: - * - Fetch the UE control block. - * - Remove the UE control block from the hash list of UEs for the cell. - * - Free the UE control block. - * - If successful, return ROK else return RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrDel *ueDelInfo - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrUeDel -( -RgSchCellCb *cell, -RgrDel *ueDelInfo, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrUeDel(cell, ueDelInfo, errInfo) -RgSchCellCb *cell; -RgrDel *ueDelInfo; -RgSchErrInfo *errInfo; -#endif -{ - RgSchUeCb *ue; - RgSchRaCb *raCb; -#ifdef LTE_ADV - Inst inst = cell->instIdx; - RgSchCellCb *secCellCb = NULLP; -#endif - - TRC2(rgSCHCfgRgrUeDel); - errInfo->errCause = RGSCHERR_CFG_RGR_UE_DEL; - - if (cell->cellId != ueDelInfo->u.ueDel.cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueDelInfo->u.ueDel.cellId, - "Cell does not exist CRNTI:%d", - ueDelInfo->u.ueDel.crnti); - RETVALUE(RFAILED); - } - if ((ue = rgSCHDbmGetUeCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP) - { - if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,ueDelInfo->u.ueDel.cellId, - "RaCb does not exist for CRNTI:%d",ueDelInfo->u.ueDel.crnti); - RETVALUE(RFAILED); - } - else - { - /* This happens in case of Msg4 rejection */ - raCb->toDel = TRUE; - RETVALUE(ROK); - } - } - else - { -#ifdef LTE_ADV - if(ueDelInfo->u.ueScellRel.ueDelTypes & RGR_UE_SCELL_DEL_RECFG) - { - for(U8 idx = 0; idx < ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.numSCells; idx++) - { - if(NULLP != (secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, \ - ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellId))) - { - rgSCHUtlSndUeSCellDel2Mac(secCellCb, ue->ueId); - rgSCHSCellDelUeSCell(cell,ue,ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellIdx); - ue->numSCells--; - if ( ue->numSCells == 0) - { - ue->allocCmnUlPdcch = TRUE; - } - } - } - if (ue->numSCells == 0) - { - /* As there is no SCell left so DCI 0 size at UE specific search space - * will be recalculated as the CSI is reduced to 1 bit */ - rgSCHUtlUpdUeDciSize(cell, ue, FALSE); - } - } - else -#endif - { - /* Delete Ue from the UE list of CELL*/ - rgSCHDbmDelUeCb(cell, ue); - -#ifdef LTE_L2_MEAS - rgSCHDbmDelL2MUe(cell, ue); -#endif - - /* Call MeasGap and AckNakRep processing module */ - rgSCHMeasGapANRepUeDel(cell, ue, TRUE); - - /* ccpu00140894- Stop TXMode transiition timer if it is running*/ - if (ue->txModeTransTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue); - } - - /* Call DRX module to remove UEs from various - * lists it maintain - */ - /* ccpu00129899 */ - if(ue->drxCb != NULLP) - { - (Void)rgSCHDrxUeDel(cell,ue); - /* Free Ue */ - } - /*Fix: If RA CB exists, delete it*/ - if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) != NULLP) - { - /* Fix : syed RNTI was getting released twice, once by racb del - * and subsequently by ueDel. Let it get released by ueDel alone */ - rgSCHRamDelRaCb(cell, raCb, FALSE); - } -#ifdef EMTC_ENABLE - if(ue->isEmtcUe) - { - rgSCHEmtcUeDel(cell, ue); - } -#endif - - rgSCHCfgFreeUeCb(cell, ue); - - errInfo->errCause = RGSCHERR_NONE; - - } - RETVALUE(ROK); - } -} /* rgSCHCfgRgrUeDel */ - - -/** - * @brief Handler for the logical channel delete request from - * RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrLcDel - * - * Processing Steps: - * - Fetch the logical channel control block. - * - Free the logical channel control block. - * - If successful, return ROK else return RFAILED. - * - * @param[in] RgrDel *lcDelInfo - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLcDel -( -RgSchCellCb *cell, -RgrDel *lcDelInfo, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLcDel(cell, lcDelInfo, errInfo) -RgSchCellCb *cell; -RgrDel *lcDelInfo; -RgSchErrInfo *errInfo; -#endif -{ - RgSchUeCb *ue; - RgSchDlLcCb *dlLc; -#ifdef LTE_L2_MEAS - U8 lcId; - U8 idx; - RgSchUlLcCb *ulLc; -#endif - - TRC2(rgSCHCfgRgrLcDel); - - errInfo->errCause = RGSCHERR_CFG_RGR_LC_DEL; - - /* Fetch the Active cell */ - if (cell->cellId != lcDelInfo->u.lchDel.cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Cell does not exist %d", - lcDelInfo->u.lchDel.cellId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue */ - if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lchDel.crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, - "UE does not exist for CRNTI:%d LCID:%d", - lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); - RETVALUE(RFAILED); - } - if (lcDelInfo->u.lchDel.lcgId > 3) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, - "[%d]UEID:For LC %d, LCGid %d is invalid", - lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId, - lcDelInfo->u.lchDel.lcgId); - RETVALUE(RFAILED); - } - if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, lcDelInfo->u.lchDel.lcId)) - == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, - "LC does not exist for CRNTI:%d LCID:%d", - lcDelInfo->u.lchDel.crnti, lcDelInfo->u.lchDel.lcId); - RETVALUE(RFAILED); - } - rgSCHUtlRgrLcDel(cell, ue, lcDelInfo->u.lchDel.lcId,lcDelInfo->u.lchDel.lcgId); - - /* Reduce any pending bo from this LC(if any) - * from the UE's total BO */ - if(dlLc->bo) - { - if(ue->totalBo >= dlLc->bo) - { - ue->totalBo -= dlLc->bo; - } - else - { - ue->totalBo = 0; /* this scenario should not occur */ - } - } - rgSCHDbmDelDlDedLcCb(ue, dlLc); - rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); - -#ifdef LTE_L2_MEAS - lcId = lcDelInfo->u.lchDel.lcId; - if (TRUE == ue->ul.lcCb[lcId -1].isValid) - { - ulLc = &(ue->ul.lcCb[lcId -1]); - ue->ul.lcCb[lcId -1].isValid = FALSE; - - if((ulLc->qciCb->ulUeCount) && - (ue->ulActiveLCs & (1 << (ulLc->qciCb->qci -1)))) - { - ulLc->qciCb->ulUeCount--; - ue->ulActiveLCs &= ~(1 << (ulLc->qciCb->qci -1)); - } - /* Shifting LCs in LCG Array because of LC deletion */ - for (idx = ulLc->lcgArrIdx +1; idx < ulLc->lcg->numLch; - idx++) - { - ulLc->lcg->lcArray[idx -1] = - ulLc->lcg->lcArray[idx]; - ulLc->lcg->lcArray[idx -1]->lcgArrIdx = idx -1; - } - ulLc->lcg->numLch--; - ulLc->lcg->lcArray[idx -1] = NULLP; - } -#endif /* LTE_L2_MEAS */ - - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrLcDel */ - - - -/** - * @brief Handler for the logical channel delete request from - * RRM to MAC. - * - * @details - * - * Function : rgSCHCfgRgrLcgDel - * - * Processing Steps: - * - Fetch the logical channel control block. - * - Free the logical channel control block. - * - If successful, return ROK else return RFAILED. - * - * @param[in] RgrDel *lcDelInfo - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLcgDel -( -RgSchCellCb *cell, -RgrDel *lcDelInfo, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLcgDel(cell, lcDelInfo, errInfo) -RgSchCellCb *cell; -RgrDel *lcDelInfo; -RgSchErrInfo *errInfo; -#endif -{ - RgSchUeCb *ue = NULLP; -#ifdef LTE_L2_MEAS - U8 lcCount = 0; -#endif - U8 lcgId = 0; - - TRC2(rgSCHCfgRgrLcgDel); - - - lcgId = lcDelInfo->u.lcgDel.lcgId; - - errInfo->errCause = RGSCHERR_CFG_RGR_LCG_DEL; - - /* Fetch the Active cell */ - if (cell->cellId != lcDelInfo->u.lcgDel.cellId) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, - "CELL does not exist for CRNTI:%d LCGID:%d", - lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue */ - if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lcgDel.crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, - "UE does not exist for CRNTI:%d LCGID:%d", - lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); - RETVALUE(RFAILED); - } - - /* set lcgId in UEs lcg cntrl blk to invalid */ - rgSCHUtlRgrLcgDel(cell, ue, lcgId); - ue->ul.lcgArr[lcgId].lcgId = RGSCH_INVALID_LCG_ID; - -#ifdef LTE_L2_MEAS - /* Since LCs are being deleted, if any of them are contributing - to Active UE count for a QCI, decrease the count */ - for (lcCount =0; (lcCount < RGSCH_MAX_LC_PER_UE) && - (lcCount < ue->ul.lcgArr[lcgId].numLch) ; lcCount++) - { - if (ue->ul.lcgArr[lcgId].lcArray[lcCount]) - { - if((ue->ul.lcgArr[lcgId]. - lcArray[lcCount]->qciCb->ulUeCount) && - (ue->ulActiveLCs & - (1 << ((ue->ul.lcgArr[lcgId]. - lcArray[lcCount])->qciCb->qci -1)))) - { - /* L2_COUNTERS */ - ue->ul.lcgArr[lcgId]. - lcArray[lcCount]->qciCb->ulUeCount--; - ue->ulActiveLCs &= ~(1 << - (ue->ul.lcgArr[lcgId]. - lcArray[lcCount]->qciCb->qci -1)); - } - } - } -#endif - - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); -} /* rgSCHCfgRgrLcgDel */ - - - -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrLcCfg - * - * - * Desc : Validates dedicated logical channel configuration recieved from RRM. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrLcCfg -( -Inst inst, -RgrLchCfg *lcCfg, -RgSchCellCb **cell, -RgSchUeCb **ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrLcCfg(inst, lcCfg, cell, ue, errInfo) -Inst inst; -RgrLchCfg *lcCfg; -RgSchCellCb **cell; -RgSchUeCb **ue; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrLcCfg); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LC_CFG; - - if (((*cell) == NULLP) || - ((*cell)->cellId != lcCfg->cellId)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Cell does not existi for " - "CRNTI:%d LCID:%d",lcCfg->crnti, lcCfg->lcId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue */ - if ((*ue = rgSCHDbmGetUeCb(*cell, lcCfg->crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"UE does not exist for dedicated" - " logical channel CRNTI:%d LCID:%d", lcCfg->crnti, lcCfg->lcId); - RETVALUE(RFAILED); - } - - /* Validate logical channel Id */ - if ((lcCfg->lcId < RGSCH_DEDLC_MIN_LCID) - ||(lcCfg->lcId > RGSCH_DEDLC_MAX_LCID)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid logical channel Id:%d" - "for CRNTI:%d",lcCfg->lcId,lcCfg->crnti); - RETVALUE(RFAILED); - } - - if (lcCfg->lcType != CM_LTE_LCH_DTCH && lcCfg->lcType != CM_LTE_LCH_DCCH) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid logical channel Type %d" - "CRNTI:%d LCID:%d",lcCfg->lcType,lcCfg->crnti, lcCfg->lcId); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrLcCfg */ - -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrLcgCfg - * - * - * Desc : Validates dedicated logical channel group configuration recieved from RRM. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrLcgCfg -( -Inst inst, -RgrLcgCfg *lcgCfg, -RgSchCellCb **cell, -RgSchUeCb **ue, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrLcgCfg(inst, lcgCfg, cell, ue, errInfo) -Inst inst; -RgrLcgCfg *lcgCfg; -RgSchCellCb **cell; -RgSchUeCb **ue; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrLcgCfg); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LCG_CFG; - - if (((*cell) == NULLP) || - ((*cell)->cellId != lcgCfg->cellId)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgCfg->cellId,"Cell does not exist for" - "CRNTI:%d LCGID:%d",lcgCfg->crnti,lcgCfg->ulInfo.lcgId); - RETVALUE(RFAILED); - } - - /* Fetch the Ue */ - if ((*ue = rgSCHDbmGetUeCb(*cell, lcgCfg->crnti)) == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcgCfg->cellId,"UE does not exist for " - "dedicated logical channel CRNTI:%d LCGID:%d", lcgCfg->crnti, lcgCfg->ulInfo.lcgId); - RETVALUE(RFAILED); - } - - if ((lcgCfg->ulInfo.gbr != 0) && (lcgCfg->ulInfo.mbr < lcgCfg->ulInfo.gbr)) - { - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrLcgCfg */ - - -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrCellPwrCfg - * - * Desc : Validates cell power configuration. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg -( -Inst inst, -RgrCellCfg *cellCfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg(inst, cellCfg, errInfo) -Inst inst; -RgrCellCfg *cellCfg; -RgSchErrInfo *errInfo; -#endif -{ - UNUSED(inst); - UNUSED(cellCfg); - UNUSED(errInfo); - - TRC2(rgSCHCfgVldtRgrCellPwrCfg); - - /* This function does nothing now, placeholder for - * subsequent power config validations that may be needed */ - - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrCellPwrCfg */ - - -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrCmnLcCfg - * - * - * Desc : Validates common logical channel configuration recieved from RRM. - * - * @param[in] Inst inst - * @param[in] RgrCellCfg *cellCfg - * @param[out] RgSchErrInfo *errInfo - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg -( -Inst inst, -RgrCellCfg *cellCfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg(inst, cellCfg, errInfo) -Inst inst; -RgrCellCfg *cellCfg; -RgSchErrInfo *errInfo; -#endif -{ - U8 idx; - RgrCmnLchCfg *lcCfg; - U8 dirVld = FALSE; - U8 bitMask = 0x00; - U8 cnt=0; - - TRC2(rgSCHCfgVldtRgrCmnLcCfg); - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CMN_LC_CFG; - - for (idx = 0; idx < cellCfg->numCmnLcs; idx++) - { - lcCfg = &(cellCfg->cmnLcCfg[idx]); - /* Validate downlink info */ - if (lcCfg->dir & RGR_DIR_TX) - { - if (lcCfg->lcType == CM_LTE_LCH_BCCH) - { - if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH) - { - if(cnt == 0) - { - bitMask |= RGSCH_BCCH_DLSCH_CFG1; - cnt++; - } - else - { - - if(( - (cellCfg->siCfg.siWinSize == 1) || - (cellCfg->siCfg.siWinSize == 2) || - (cellCfg->siCfg.siWinSize == 5) || - (cellCfg->siCfg.siWinSize == 10) || - (cellCfg->siCfg.siWinSize == 15) || - (cellCfg->siCfg.siWinSize == 20) || - (cellCfg->siCfg.siWinSize == 40)) && - (cellCfg->siCfg.retxCnt>0) - ) - { - bitMask |= RGSCH_BCCH_DLSCH_CFG2; - } - else - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, - "Invalid si config for cell"); - RETVALUE(RFAILED); - } - } - } - else if (lcCfg->dlTrchType == CM_LTE_TRCH_BCH) - { - bitMask |= RGSCH_BCCH_BCH_CFG; - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId, - "Invalid transport channel %d for cell", lcCfg->dlTrchType); - RETVALUE(RFAILED); - } - } - else if (lcCfg->lcType == CM_LTE_LCH_PCCH) - { - bitMask |= RGSCH_PCCH_CFG; - } - else if (lcCfg->lcType == CM_LTE_LCH_CCCH) - { - bitMask |= RGSCH_DL_CCCH_CFG; - } - dirVld = TRUE; - } - - /* Validate uplink info */ - if (lcCfg->dir & RGR_DIR_RX) - { - /* Uplink CCCH */ - if (lcCfg->lcType != CM_LTE_LCH_CCCH) - { - RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId,"Invalid UL common lcType %d " - "for cell", lcCfg->lcType); - RETVALUE(RFAILED); - } - else - { - bitMask |= RGSCH_UL_CCCH_CFG; - } - dirVld = TRUE; - } - - /* Invalid direction */ - if (!dirVld) - { - RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId,"Invalid Direction %d", - lcCfg->dir); - RETVALUE(RFAILED); - } - } - if (bitMask != RGSCH_CELL_ACTIVE_CFG) - { - RLOG_ARG0(L_ERROR,DBG_CELLID, cellCfg->cellId, - "Invalid Common channel config for cell"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrCmnLcCfg */ - - -/*********************************************************** - * - * Func : rgSCHCfgVldtUeCqiModeCfg - * - * - * Desc : Validates UE CQI modes Configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg -( -RgSchCellCb *cell, -RgrUeDlCqiCfg *ueDlCqiCfg -) -#else -PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg(cell, ueDlCqiCfg) -RgSchCellCb *cell; -RgrUeDlCqiCfg *ueDlCqiCfg; -#endif -{ - - TRC2(rgSCHCfgVldtUeCqiModeCfg) - -#ifndef TFU_UPGRADE - if((ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx < 1) || - (ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx > 1024)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid Periodic CQI Info"); - RETVALUE(RFAILED); - } -#endif - /* Validate UE Aperiodic CQI mode */ - if ((ueDlCqiCfg->aprdCqiCfg.pres == TRUE) && - ((ueDlCqiCfg->aprdCqiCfg.aprdModeEnum > RGR_APRD_CQI_MOD31) || - (cell->bwCfg.dlTotalBw <= 7))) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid Aperiodic mode config for DL CQI", - ueDlCqiCfg->aprdCqiCfg.aprdModeEnum); - RETVALUE(RFAILED); - } -#ifndef TFU_UPGRADE - /* Validate UE Periodic CQI mode */ - if (ueDlCqiCfg->prdCqiCfg.prdModeEnum > RGR_PRD_CQI_MOD21) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid periodic mode config for DL CQI", - ueDlCqiCfg->prdCqiCfg.prdModeEnum); - RETVALUE(RFAILED); - } - /* Validate K value in periodic CQI Config */ - if(((ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD20) || - (ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD21)) && - ((ueDlCqiCfg->prdCqiCfg.k < 1)|| - (ueDlCqiCfg->prdCqiCfg.k > 4))) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid K for Subband CQI reporting"); - RETVALUE(RFAILED); - } -#else - if ((ueDlCqiCfg->prdCqiCfg.type == 1) && - (ueDlCqiCfg->prdCqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid periodic mode config for DL CQI", - ueDlCqiCfg->prdCqiCfg.cqiSetup.prdModeEnum); - RETVALUE(RFAILED); - } - -#endif - - RETVALUE(ROK); - -} -/*********************************************************** - * - * Func : rgSCHCfgVldtUeMeasGapAckNakRepCfg - * - * - * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg -( -RgSchCellCb *cell, -RgrUeCfg *ueCfg -) -#else -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg(cell, ueCfg) -RgSchCellCb *cell; -RgrUeCfg *ueCfg; -#endif -{ - - TRC2(rgSCHCfgVldtUeMeasGapAckNakRepCfg) - -#ifdef LTE_TDD - if ((ueCfg->ackNackModeEnum == RGR_TDD_ACKNACK_MODE_MULT) && - (ueCfg->ueAckNackCfg.isAckNackEnabled == TRUE)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"TDD ACK NACK Multiplexing Mode" - "is not allowed when Ack/Nack is Enabled: %d CRNTI:%d", - ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti); - RETVALUE(RFAILED); - } -#endif /* LTE_TDD */ - /* Validate AckNackRep Factor */ - if((ueCfg->ueAckNackCfg.isAckNackEnabled == FALSE) && - (!ueCfg->ueMesGapCfg.isMesGapEnabled)) - { - RETVALUE(ROK); - } - - if(ueCfg->ueAckNackCfg.isAckNackEnabled) - { - if ( (ueCfg->ueAckNackCfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2) - || (ueCfg->ueAckNackCfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId, "Invalid ACK NACK REP Factor:%d CRNTI:%d", - ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti); - RETVALUE(RFAILED); - } - } - if(ueCfg->ueMesGapCfg.isMesGapEnabled) - { - switch(ueCfg->ueMesGapCfg.gapPrd) - { - case RG_MEAS_GAPPRD_40: - if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_40) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Offset:%d CRNTI:%d", - ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti); - RETVALUE(RFAILED); - } - break; - case RG_MEAS_GAPPRD_80: - if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_80) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Offset:%d CRNTI:%d", - ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti); - RETVALUE(RFAILED); - } - break; - default: - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Periodicity Settings:%d" - "CRNTI:%d", ueCfg->ueMesGapCfg.gapPrd,ueCfg->crnti); - RETVALUE(RFAILED); - } - } - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtUeMeasGapAckNakRepCfg*/ - - -/*********************************************************** - * - * Func : rgSCHCfgVldtUeMeasGapAckNakRepRecfg - * - * - * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg -( -RgSchCellCb *cell, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg(cell, ueRecfg) -RgSchCellCb *cell; -RgrUeRecfg *ueRecfg; -#endif -{ - - TRC2(rgSCHCfgVldtUeMeasGapAckNakRepRecfg) - if((ueRecfg->ueAckNackRecfg.isAckNackEnabled == FALSE) && - (!ueRecfg->ueMeasGapRecfg.isMesGapEnabled)) - { - RETVALUE(ROK); - } - - if(ueRecfg->ueAckNackRecfg.isAckNackEnabled ) - { - /* Validate AckNackRep Factor */ - if ( (ueRecfg->ueAckNackRecfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2) - || (ueRecfg->ueAckNackRecfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid ACK NACK REP Factor:%d" - "NEW CRNTI:%d",ueRecfg->ueAckNackRecfg.ackNackRepFactor,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - if(ueRecfg->ueMeasGapRecfg.isMesGapEnabled) - { - switch(ueRecfg->ueMeasGapRecfg.gapPrd) - { - case RG_MEAS_GAPPRD_40: - if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_40) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Offset:%d" - "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - break; - case RG_MEAS_GAPPRD_80: - if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_80) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Offset:%d" - "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - break; - default: - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Periodicity Settings:%d" - "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapPrd,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtUeMeasGapAckNakRepRecfg*/ - -#ifdef LTEMAC_SPS -/*********************************************************** - * - * Func : rgSCHCfgVldtUeDlSpsCfg - * - * - * Desc : Validates UE's DL SPS configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg -( -RgSchCellCb *cell, -RgrUeSpsDlCfg *dlSpsCfg -) -#else -PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg(cell, dlSpsCfg) -RgSchCellCb *cell; -RgrUeSpsDlCfg *dlSpsCfg; -#endif -{ - - U8 idx = 0; - - TRC2(rgSCHCfgVldtUeDlSpsCfg); - - /* peridicity validation done in SPS module */ - if ((dlSpsCfg->numPucchVal > RG_SCH_MAX_NUM_N1PUCCH_PER_UE) || - (dlSpsCfg->numPucchVal == 0)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid number of n1Pucch values" - " in DL SPS Config"); - RETVALUE(RFAILED); - } - - for (idx = 0; idx < dlSpsCfg->numPucchVal; ++idx) - { - if (dlSpsCfg->n1PucchVal[idx] > RG_SCH_MAX_N1PUCCH_VAL) - { -#ifdef ALIGN_64BIT - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid N1Pucch value" - " in DL SPS Config %u", dlSpsCfg->n1PucchVal[idx]); -#else - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid N1Pucch value" - " in DL SPS Config %lu", dlSpsCfg->n1PucchVal[idx]); -#endif - RETVALUE(RFAILED); - } - } - /* SPS_TODO: check will change for TDD */ - if ((dlSpsCfg->numSpsHqProc == 0) || - (dlSpsCfg->numSpsHqProc > RGSCH_MAX_DL_HQ_PROC)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid number of SPS HARQ procs" - " in DL SPS Config"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtDlSpsCfg */ -#endif /* LTEMAC_SPS */ - -/*********************************************************** - * - * Func : rgSCHCfgVldtUePwrCfg - * - * - * Desc : Validates UE Group power configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUePwrCfg -( -RgSchCellCb *cell, -RgrUeUlPwrCfg *pwrCfg -) -#else -PRIVATE S16 rgSCHCfgVldtUePwrCfg(cell, pwrCfg) -RgSchCellCb *cell; -RgrUeUlPwrCfg *pwrCfg; -#endif -{ - - TRC2(rgSCHCfgVldtUePwrCfg); - - /* Group power control works only in accumulated mode */ - if (!pwrCfg->isAccumulated) - { - /* Fix */ - if (pwrCfg->uePuschPwr.pres) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Accumulation configutation" - " not in sync with group power configuration"); - RETVALUE(RFAILED); - } - } - - if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePuschPwr) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid PUSCH Group power" - " configuration"); - RETVALUE(RFAILED); - } - if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePucchPwr) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid PUSCH Group power" - " configuration"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtUePwrCfg */ - -/*********************************************************** - * - * Func : rgSCHCfgVldtUeGrpPwrCfg - * - * - * Desc : Validates UE Group power configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg -( -RgSchCellCb *cell, -RgrUeGrpPwrCfg *grpPwrCfg -) -#else -PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg(cell, grpPwrCfg) -RgSchCellCb *cell; -RgrUeGrpPwrCfg *grpPwrCfg; -#endif -{ - - TRC2(rgSCHCfgVldtUeGrpPwrCfg); - - if ((grpPwrCfg->pres) && - (((grpPwrCfg->tpcRnti > cell->rntiDb.rntiStart) && - ((grpPwrCfg->tpcRnti < - (cell->rntiDb.rntiStart + cell->rntiDb.maxRntis)))))) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Uplink Group power " - "configuration"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtUeGrpPwrCfg */ - -#ifdef LTEMAC_SPS -/*********************************************************** - * - * Func : rgSCHCfgVldtSpsReCfg - * - * - * Desc : Validates UE SPS and other SPS dependent - * configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtSpsReCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE S16 rgSCHCfgVldtSpsReCfg(cell, ue, ueRecfg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -#endif -{ - - TRC2(rgSCHCfgVldtSpsReCfg); - if ((ueRecfg->ueRecfgTypes & RGR_UE_DLSPS_RECFG) && - (ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled)) - { - /* Validating SPS RNTI */ - if (((ueRecfg->ueSpsRecfg.spsRnti >= cell->rntiDb.rntiStart) && - (ueRecfg->ueSpsRecfg.spsRnti<= - (cell->rntiDb.rntiStart+cell->rntiDb.maxRntis)))|| - (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_SI_RNTI) || - (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_P_RNTI)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid SPS RNTI " - " in DL SPS Recfg OLD CRNTI:%d NEW CCRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - if (rgSCHCfgVldtUeDlSpsCfg(cell, &ueRecfg->ueSpsRecfg.dlSpsCfg) != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid DL SPS configuration" - " for the OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - -#if RG_SPS_UNUSED - if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled) - { - if (ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) - { - /* ccpu00117035 - MOD - changed instIdx to inst */ - /* ccpu00117035 - MOD - changed ueID to oldCrnti*/ - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, - " DRX reconfig not supported DL SPS enabled for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } -#endif -/* ccpu00117627 - ADD - SPS recfg validation against HDFDD */ -#ifdef LTEMAC_HDFDD - if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled) - { - if(ue->hdFddEnbld == TRUE) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, - "DL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } - if(ueRecfg->ueSpsRecfg.ulSpsCfg.isUlSpsEnabled) - { - if(ue->hdFddEnbld == TRUE) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, - "UL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d", - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - } -#endif - - RETVALUE(ROK); -} /*rgSCHCfgVldtSpsReCfg*/ -#endif - -#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) -/*********************************************************** - * - * Func : rgSCHCfgVldtCqiReptReCfg - * - * - * Desc : Validates UE CQI report for DL Power control - * configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtCqiReptReCfg -( -RgSchCellCb *cell, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE S16 rgSCHCfgVldtCqiReptReCfg(cell, ueRecfg) -RgSchCellCb *cell; -RgrUeRecfg *ueRecfg; -#endif -{ - - TRC2(rgSCHCfgVldtCqiReptReCfg); - /* Validate DL Power Control Config parameters */ - if (ueRecfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalide numColltdCqiRept," - "MAX supported %d for OLD CRNTI:%d NEW CRNTI:%d",RGR_CQIRPTS_MAXN, - ueRecfg->oldCrnti,ueRecfg->newCrnti); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /*rgSCHCfgVldtCqiReptReCfg*/ -#endif - -/*********************************************************** - * - * Func : rgSCHCfgRgrLcChfg - * - * - * Desc : Handles dedicated logical channel configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLchCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrLchCfg *lcCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLchCfg(cell, ue, lcCfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrLchCfg *lcCfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - RgSchDlLcCb *dlLc = NULLP; - Inst inst = cell->instIdx; -#ifdef LTE_L2_MEAS - RgSchUlLcCb *ulLc; -#endif - - TRC2(rgSCHCfgRgrLchCfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_DED_LC_CFG; - - /* Allocate the downlink logical channel control block */ - if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&dlLc, - sizeof(RgSchDlLcCb))) != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Memory allocation FAILED for " - "Downlink LCId:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti); - RETVALUE(RFAILED); - } - if ((U8 *)dlLc == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Memory allocation FAILED for " - "Downlink LCID:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti); - RETVALUE(RFAILED); - } - dlLc->lcId = lcCfg->lcId; -#ifdef LTE_ADV - rgSCHLaaLcCfg(cell, dlLc, lcCfg); -#endif - - rgSCHDbmInsDlDedLcCb(ue, dlLc); - - ret = rgSCHUtlRgrLcCfg(cell, ue, dlLc, lcCfg, errInfo); - - if (ret != ROK) - { - /* ROLLBACK */ - if (dlLc) - { - rgSCHDbmDelDlDedLcCb(ue, dlLc); - rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); - } - - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " - "configuration failed at SCH:UEID:%d LCID:%d CRNTI:%d", - ue->ueId, lcCfg->lcId,lcCfg->crnti); - RETVALUE(RFAILED); - } -#ifdef LTE_L2_MEAS - RGSCH_ARRAY_BOUND_CHECK(inst, ue->ul.lcCb, (lcCfg->lcId -1)); - if ( !lcCfg->lcId || - (TRUE == ue->ul.lcCb[lcCfg->lcId -1].isValid)) - { - /* ROLLBACK */ - if (dlLc) - { - rgSCHDbmDelDlDedLcCb(ue, dlLc); - rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); - } - - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " - "configuration failed at SCH: UL LC CB already existing" - " UEID:%d LCID:%d CRNTI:%d", - ue->ueId, lcCfg->lcId,lcCfg->crnti); - RETVALUE(RFAILED); - } - - /* Create UL LC context to maintain LCG to LC mapping and - LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE - PER QCI */ - ue->ul.lcCb[lcCfg->lcId -1].isValid = TRUE; - ulLc = &(ue->ul.lcCb[lcCfg->lcId -1]); - - ulLc->lcId = lcCfg->lcId; - ulLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]); - ulLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci; - ue->ul.lcgArr[lcCfg->lcgId].lcArray[ue->ul.lcgArr[lcCfg->lcgId].numLch] = ulLc; - ulLc->lcg = &ue->ul.lcgArr[lcCfg->lcgId]; - ulLc->lcgArrIdx = ue->ul.lcgArr[lcCfg->lcgId].numLch; - ue->ul.lcgArr[lcCfg->lcgId].numLch++; - - dlLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]); - dlLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci; - if(lcCfg->lcType == CM_LTE_LCH_DTCH) - { - rgSchAddToL2Meas(cell,dlLc); /*LTE_L2_MEAS_PHASE2*/ - } -#endif /* LTE_L2_MEAS */ - - RETVALUE(ROK); -} /* rgSCHCfgRgrLchCfg */ - -/*********************************************************** - * - * Func : rgSCHCfgRgrLcgCfg - * - * - * Desc : Handles dedicated logical channel group configuration - * recieved from RRM. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRgrLcgCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrLcgCfg *lcgCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgRgrLcgCfg(cell, ue, lcgCfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrLcgCfg *lcgCfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret = ROK; - -#ifdef RG_UNUSED -//#ifdef LTE_L2_MEAS - U32 idx; - RgSchUlLcCb *ulLc; -#endif - TRC2(rgSCHCfgRgrLcgCfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_DED_LCG_CFG; - - ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = lcgCfg->ulInfo.lcgId; - - ret = rgSCHUtlRgrLcgCfg(cell, ue, lcgCfg, errInfo); - if (ret != ROK) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " - "configuration failed at SCH: UEID:%d LCGID:%d CRNTI:%d", - ue->ueId, lcgCfg->ulInfo.lcgId,lcgCfg->crnti); - /* Roll back lcgCfg */ - ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = RGSCH_INVALID_LCG_ID; - rgSCHUtlRgrLcgDel(cell, ue, lcgCfg->ulInfo.lcgId); - RETVALUE(RFAILED); - } -#ifdef RG_UNUSED -//#ifdef LTE_L2_MEAS - /* Copy all info of UL LCH in cfg to ulLcgCb */ - for (idx = 0; idx < lcgCfg->ulInfo.numLch; idx++) - { - /* Allocate the uplink logical channel control block */ - if((ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&ulLc, - sizeof(RgSchUlLcCb))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Memory allocation FAILED for "); - RETVALUE(RFAILED); - } - if ((U8 *)ulLc == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Memory allocation FAILED for "); - RETVALUE(RFAILED); - } - /* Create UL LC context to maintain LCG to LC mapping and - LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE - PER QCI */ - ulLc->lcId = lcgCfg->ulInfo.lchUlCfg[idx].lcId; - ulLc->qciCb = &(cell->qciArray[lcgCfg->ulInfo.lchUlCfg[idx].qci]); - ulLc->qciCb->qci = lcgCfg->ulInfo.lchUlCfg[idx].qci; - ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcArray[idx] = ulLc; - /* L2_COUNTERS */ - ue->ul.lcCb[ulLc->lcId -1] = ulLc; - ulLc->lcg = &ue->ul.lcgArr[lcgCfg->ulInfo.lcgId]; - ulLc->lcgArrIdx = idx; - } - ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].numLch = lcgCfg->ulInfo.numLch; -#endif /* LTE_L2_MEAS */ - - RETVALUE(ROK); -} /* rgSCHCfgRgrLcgCfg */ - - - -/*********************************************************** - * - * Func : rgSCHCfgRgrCmnLcCfg - * - * - * Desc : Handles dedicated logical channel configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgRgrCmnLcCfg -( -RgSchCellCb *cell, -RgrCmnLchCfg *lcCfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHCfgRgrCmnLcCfg(cell, lcCfg, errInfo) -RgSchCellCb *cell; -RgrCmnLchCfg *lcCfg; -RgSchErrInfo *errInfo; -#endif -{ - RgSchClcDlLcCb cmnLcCb; - TRC2(rgSCHCfgRgrCmnLcCfg); - - errInfo->errCause = RGSCHERR_CFG_RGR_CMN_LC_CFG; - - cmMemset((U8 *)&cmnLcCb, 0, sizeof(cmnLcCb)); - - /* Handle configuration for CCCH/BCCH/PCCH */ - if (lcCfg->lcType == CM_LTE_LCH_CCCH) - { - /* UL and DL CCCH configuration */ - if (lcCfg->dir & RGR_DIR_TX) - { - cell->dlCcchId = lcCfg->lcId; - } - - if (lcCfg->dir & RGR_DIR_RX) - { - cell->ulCcchId = lcCfg->lcId; - } - } - else - { - cmnLcCb.lcId = lcCfg->lcId; - rgSCHDbmInitCmnLcBoLst(&cmnLcCb); - if (lcCfg->lcType == CM_LTE_LCH_BCCH) - { - /* BCCH on BCH and DLSCH configuration */ - if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH) - { - rgSCHDbmInsBcchOnDlsch(cell, &cmnLcCb); - } - else - { - rgSCHDbmInsBcchOnBch(cell, &cmnLcCb); - } - } - else /* PCCH configuration */ - { - rgSCHDbmInsPcch(cell, &cmnLcCb); - } - } - - RETVALUE(ROK); -} /* rgSCHCfgRgrCmnLcCfg */ - - - -/*********************************************************** - * - * Func : rgSCHCfgFreeDlDedLcCb - * - * - * Desc : - * - Processing Steps: - * - Frees downlink dedicated logical channel control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeDlDedLcCb -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc -) -#else -PRIVATE Void rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -#endif -{ - Inst inst = cell->instIdx; - TRC2(rgSCHCfgFreeDlDedLcCb); - - rgSCHUtlFreeDlLc(cell, ue, dlLc); - - /* De-allocate the Cb */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&dlLc, sizeof(*dlLc)); - - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeDlDedLcCb */ - - -/*********************************************************** - * - * Func : rgSCHCfgFreeDlCmnLcCb - * - * - * Desc : - * - Processing Steps: - * - Frees downlink common logical channel control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeDlCmnLcCb -( -RgSchClcDlLcCb *cmnDlLc -) -#else -PRIVATE Void rgSCHCfgFreeDlCmnLcCb(cmnDlLc) -RgSchClcDlLcCb *cmnDlLc; -#endif -{ - TRC2(rgSCHCfgFreeDlCmnLcCb); - - cmMemset((U8*)cmnDlLc, 0, sizeof(*cmnDlLc)); - cmnDlLc->lcId = RGSCH_INVALID_LC_ID; - RETVOID; -} /* rgSCHCfgFreeDlCmnLcCb */ - - -/*********************************************************** - * - * Func : rgSCHCfgFreeCellCb - * - * - * Desc : - * - Processing Steps: - * - Frees scheduler cell control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCfgFreeCellCb -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCfgFreeCellCb(cell) -RgSchCellCb *cell; -#endif -{ - Inst inst = cell->instIdx; - CmLList *node; - Buffer *pdu; - RgSchWarningSiInfo *warningSi; - RgSchWarningSiPdu *warningSiPdu; - U8 idx; - - TRC2(rgSCHCfgFreeCellCb); - /* ccpu00132385- SI Warning PDUs which are not processed need to be deleted */ - /* Search for used index in WarningSi */ - for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) - { - if(cell->siCb.warningSi[idx].siId == 0) - continue; - cell->siCb.siCtx.siId = cell->siCb.warningSi[idx].siId; - warningSi = (RgSchWarningSiInfo *) cell->siCb. - siArray[cell->siCb.siCtx.siId-1].si; - if(warningSi != NULLP) - { - /* ccpu00136659: CMAS ETWS design change */ - while (CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node)) - { - warningSiPdu = (RgSchWarningSiPdu *)node->node; - pdu = warningSiPdu->pdu; - /* ccpu00136659: CMAS ETWS design change */ - cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node); - RGSCH_FREE_MSG(pdu); - } - cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP; - } - } - /* Free lists of the cell */ - rgSCHCfgFreeUeLst(cell); -#ifdef LTEMAC_SPS - rgSCHCfgFreeSpsUeLst(cell); -#endif /* LTEMAC_SPS */ -#ifdef EMTC_ENABLE - if ( TRUE == cell->emtcEnable ) - { - rgSCHEmtcCellDel(cell); - } -#endif - rgSCHRamFreeCell(cell); - - rgSCHDbmRntiDbDeInit(cell); - /* Deallocate the subframe allocation information */ - rgSCHUtlPutSfAlloc(cell); - rgSCHUtlFreeCell(cell); - - rgSCHCfgFreeRgrCfgLst(cell); - rgSCHCfgFreeCmnLcLst(cell); - - rgSCHUtlPutRlsHqAlloc(cell); - -#ifdef LTE_TDD - rgSCHDbmDeInitUeTfuPendLst(cell); -#endif /* LTE_TDD */ - -#ifdef RGR_SI_SCH - rgSCHUtlPutSiInfo(cell); -#endif/*RGR_SI_SCH*/ - - (Void)rgSCHDrxCellDel(cell); - - rgSCHUtlFreeSBuf(inst, (Data**)&(cell->dynCfiCb.cceFailSamples), - (cell->dynCfiCb.numFailSamples * sizeof(U16))); - -#ifdef TENB_STATS - TSL2DeallocCellStatsBlk(cell->cellId); -#endif - -#ifdef LTE_ADV - /* LAA_SCELL: Trigger the De-Init function for the LAA Module */ - rgSCHLaaSCellCbDeInit(cell); -#endif - -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - rgSCHEmtcCellFree(cell); - } -#endif - /* De-allocate the Cell */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&cell, sizeof(*cell)); - - - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeCellCb */ - - -/*********************************************************** - * - * Func : rgSCHCfgFreeUeCb - * - * - * Desc : - * - Processing Steps: - * - Frees UE control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeUeCb -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCfgFreeUeCb(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - RgUeUlHqCb *ulHqEnt; - RgSchDlLcCb *dlLc; - Inst inst = cell->instIdx; - U8 lcCnt; - U8 lcgId; - TRC2(rgSCHCfgFreeUeCb); - - /* Free all logical channel info per UE */ - while((dlLc = rgSCHDbmGetNextDlDedLcCb(ue, NULLP)) != NULLP) - { - rgSCHDbmDelDlDedLcCb(ue, dlLc); - rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); - } - for (lcCnt =0; lcCntul.lcCb[lcCnt].isValid == TRUE) - { - lcgId = ue->ul.lcCb[lcCnt].lcg->lcgId; - if (lcgId <=3) - { - rgSCHUtlRgrLcDel(cell, ue, ue->ul.lcCb[lcCnt].lcId,lcgId); - ue->ul.lcCb[lcCnt].isValid = FALSE; - } - } - } - - ulHqEnt = &(ueUl->hqEnt); - /* Free Scheduler specific information per UE */ - rgSCHUtlFreeUe(cell, ue); - - /* Free Uplink HARQ specific information per UE */ - rgSCHUhmFreeUe(cell, ulHqEnt); - - if ( ue->drxCb != NULLP) - { - /* free drxCb */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(ue->drxCb)), - sizeof(RgSchDrxUeCb)); - } - - ue->drxCb = (RgSchDrxUeCb *)NULLP; - /* Free Downlink HARQ specific information per UE */ - rgSCHDhmFreeUe(ue); - /* Release the RNTI */ - if (ue->rntiLnk) - { - rgSCHUtlRlsRnti(cell, ue->rntiLnk, FALSE, 0); - } - else - { - /* Fix : syed HO UE does not have a valid ue->rntiLnk */ - /* Just indicate to MAC, no need to release at SCH */ - rgSCHUtlIndRntiRls2Mac(cell, ue->ueId, FALSE, 0); - } -/* rg009.201. Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE - rgSCHCfgPCqiSrsSrUeDel(cell,ue); -#endif -#ifdef LTEMAC_HDFDD - rgSCHHdFddUeDel(cell, ue); -#endif -#ifdef TENB_STATS - if (ue->tenbStats) - { - TSL2DeallocUeStatsBlk(ue->ueId, ue->tenbStats); - } -#endif - - /* CA TODO Some handling needed while SCell Delete*/ -#ifdef LTE_ADV - /* Delete the UE from the PCell secCellActCeLst*/ - rgSCHSCellRmvFrmActLst(cell, ue); - rgSCHSCellDelUe(cell,ue); -#endif - -#ifdef LTE_ADV - rgSCHLaaDeInitDlRbAllocCb(cell, &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb); -#endif - - rgSCHUtlFreeSBuf(inst, (Data **)&ue->cellInfo[0], sizeof(RgSchUeCellInfo)); - /* De-allocate the Ue */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ -#ifdef EMTC_ENABLE - if(ue->isEmtcUe) - { - rgSCHEmtcUeInfoFree(cell, ue); - } -#endif - rgSCHUtlFreeSBuf(inst, (Data **)&ue, sizeof(*ue)); - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeUeCb */ - -/*********************************************************** - * - * Func : rgSCHCfgFreeRgrCfgLst - * - * - * Desc : - * - Processing Steps: - * - Frees configuration lists in cell control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeRgrCfgLst -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCfgFreeRgrCfgLst(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCfgElem *rgCfgElem; - Inst inst = cell->instIdx; - - TRC2(rgSCHCfgFreeRgrCfgLst); - - /* Free CURRENT RGR cfg list */ - while ((rgCfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP) - { - rgSCHDbmDelCrntRgrCfgElem(cell, rgCfgElem); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem)); - } - - /* Free PENDING RGR cfg list */ - while ((rgCfgElem = rgSCHDbmGetNextPndngRgrCfgElem(cell, NULLP)) != NULLP) - { - rgSCHDbmDelPndngRgrCfgElem(cell, rgCfgElem); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem)); - } - - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeRgrCfgLst */ - - -/*********************************************************** - * - * Func : rgSCHCfgFreeCmnLcLst - * - * - * Desc : - * - Processing Steps: - * - Frees common logical channels in cell control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeCmnLcLst -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCfgFreeCmnLcLst(cell) -RgSchCellCb *cell; -#endif -{ - RgSchClcDlLcCb *dlCmnLc; - - TRC2(rgSCHCfgFreeCmnLcLst); - - if ((dlCmnLc = rgSCHDbmGetBcchOnBch(cell)) != NULLP) - { - rgSCHCfgFreeDlCmnLcCb(dlCmnLc); - } - if ((dlCmnLc = rgSCHDbmGetFirstBcchOnDlsch(cell)) != NULLP) - { - rgSCHCfgFreeDlCmnLcCb(dlCmnLc); - } - if ((dlCmnLc = rgSCHDbmGetSecondBcchOnDlsch(cell)) != NULLP) - { - rgSCHCfgFreeDlCmnLcCb(dlCmnLc); - } - if ((dlCmnLc = rgSCHDbmGetPcch(cell)) != NULLP) - { - rgSCHCfgFreeDlCmnLcCb(dlCmnLc); - } - - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeCmnLcLst */ - - -/*********************************************************** - * - * Func : rgSCHCfgFreeUeLst - * - * - * Desc : - * - Processing Steps: - * - Frees UE list in cell control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeUeLst -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCfgFreeUeLst(cell) -RgSchCellCb *cell; -#endif -{ - RgSchUeCb *ue; -#ifdef LTE_ADV - RgSchUeCellInfo *sCellInfo; - CmLList *node; -#endif - TRC2(rgSCHCfgFreeUeLst); - - /* Free Ues in the list */ - while ((ue = rgSCHDbmGetNextUeCb(cell, NULLP)) != NULLP) - { - rgSCHDbmDelUeCb(cell, ue); - -#ifdef LTE_ADV - if(ue->cell != cell) - { - continue; - } -#endif - - /* Call MeasGap and AckNakRep processing module */ - rgSCHMeasGapANRepUeDel(cell, ue, TRUE); - - rgSCHCfgFreeUeCb(cell, ue); - } - - /* De-initialize the Ue list */ - rgSCHDbmDeInitUeCbLst(cell); - - -#ifdef LTE_ADV - node = cell->sCellUeLst.first; - while(node) - { - sCellInfo = (RgSchUeCellInfo *)node->node; - node = node->next; - rgSCHSCellDelUeSCell(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx); - } -#endif - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} /* rgSCHCfgFreeUeLst */ - -#ifdef LTEMAC_SPS -/*********************************************************** - * - * Func : rgSCHCfgFreeSpsUeLst - * - * - * Desc : - * - Processing Steps: - * - Frees Sps UE list in cell control block. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgFreeSpsUeLst -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCfgFreeSpsUeLst(cell) -RgSchCellCb *cell; -#endif -{ - RgSchUeCb *ue; - - TRC2(rgSCHCfgFreeSpsUeLst); - - /* Free Ues in the list */ - while ((ue = rgSCHDbmGetNextSpsUeCb(cell, NULLP))) - { - rgSCHDbmDelSpsUeCb(cell, ue); - } - - /* De-initialize the Ue list */ - rgSCHDbmDeInitSpsUeCbLst(cell); - -} /* rgSCHCfgFreeSpsUeLst */ - -#endif /* LTEMAC_SPS */ - -#ifdef RGR_SI_SCH -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrCellSiCfg - * - * Desc : Validates SI Configuration for SI - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg -( -Inst inst, -RgrSiCfg *siCfg -) -#else -PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg(inst, siCfg) -Inst inst; -RgrSiCfg *siCfg; -#endif -{ - U8 idx; /* idx for iteration */ - - UNUSED(inst); - - TRC2(rgSCHCfgVldtRgrCellSiCfg); - - -#ifndef LTE_TDD - /* Check that retxCnt value should be <= value of siWinSize. - This validation is only applicable for FDD mode. */ - if(siCfg->retxCnt > siCfg->siWinSize) - { - RLOG0(L_ERROR,"retxCnt is greater than siWinSize, validation failed"); - RETVALUE(RFAILED); - } -#endif - - /* Validate that a valid value for numSi has been specified */ - if(siCfg->numSi > RGR_MAX_NUM_SI) - { - RLOG0(L_ERROR,"Validation for numSi in SI CFG failed"); - RETVALUE(RFAILED); - } - - /* MinPeriodicity will have the least configured periodicity - * Hence initializing with Max periodicity */ - siCfg->minPeriodicity = RGR_SI_PERD_512; - - /*Validate the value of periodicity specified for SIs */ - for(idx = 0;idx < siCfg->numSi;idx++) - { - siCfg->minPeriodicity = RGSCH_MIN(siCfg->minPeriodicity, - siCfg->siPeriodicity[idx]); - /* Set the siPeriodicity as a multiple of 80 subframes */ - switch(siCfg->siPeriodicity[idx]) - { - case RGR_SI_PERD_8: - case RGR_SI_PERD_16: - case RGR_SI_PERD_32: - case RGR_SI_PERD_64: - case RGR_SI_PERD_128: - case RGR_SI_PERD_256: - case RGR_SI_PERD_512: - continue; - - default: - RLOG0(L_ERROR,"Validation for SI Periodicity in SI-CFG failed"); - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrCellSiCfg */ - -/* LTE_ADV_FLAG_REMOVED_START */ -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrCellLtrAdvCfg - * - * Desc : Validates Lte Adv Configuration - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg -( - Inst inst, - RgrLteAdvancedCellConfig *lteAdvCfg, - U8 dlTotalBw - ) -#else -PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg(inst, lteAdvCfg, dlTotalBw) - Inst inst; - RgrLteAdvancedCellConfig *lteAdvCfg; - U8 dlTotalBw; -#endif -{ - U8 temp[RGR_ABS_PATTERN_LEN]; - U32 idx; - UNUSED(inst); - - TRC2(rgSCHCfgVldtRgrCellLteAdvCfg); - - - if((lteAdvCfg->pres & RGR_SFR) && (RGR_ENABLE == lteAdvCfg->sfrCfg.status)) - { - if(lteAdvCfg->sfrCfg.cellEdgeRbRange.startRb > lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb) - { - RLOG0(L_ERROR,"Invalid configuration of cell edge bandwidth for SFR feature"); - RETVALUE(RFAILED); - } - - if(lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb >= dlTotalBw) - { - RLOG0(L_ERROR,"Invalid configuration of cell edge end RB for SFR feature"); - RETVALUE(RFAILED); - } - -#ifdef TFU_UPGRADE - if(lteAdvCfg->sfrCfg.pwrThreshold.pLow >= lteAdvCfg->sfrCfg.pwrThreshold.pHigh) - { - RLOG0(L_ERROR,"Invalid configuration of power threshold for SFR feature"); - RETVALUE(RFAILED); - } -#endif - } - - if((lteAdvCfg->pres & RGR_ABS) && (RGR_ENABLE == lteAdvCfg->absCfg.status)) - { - if((RGR_ABS_MUTE != lteAdvCfg->absCfg.absPatternType) && - (RGR_ABS_TRANSMIT != lteAdvCfg->absCfg.absPatternType)) - { - RLOG0(L_ERROR,"Invalid configuration of ABS pattern type"); - RETVALUE(RFAILED); - } - - cmMemcpy(temp, (U8 *) lteAdvCfg->absCfg.absPattern,RGR_ABS_PATTERN_LEN); - - /* Added validation for ABS pattern len */ - for(idx = 0; idx < RGR_ABS_PATTERN_LEN; idx++) - { - if((temp[idx] != 1) && (temp[idx] != 0)) - { - RLOG0(L_ERROR,"Invalid configuration of ABS pattern type"); - RETVALUE(RFAILED); - } - } - } - - RETVALUE(ROK); -} -/* LTE_ADV_FLAG_REMOVED_END */ - - -/*********************************************************** - * - * Func : rgSCHCfgVldtRgrCellCsgParamCfg - * - * Desc : Validates CSG Parameter Configuration - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg -( -Inst inst, -RgrCellCsgParamCfg *csgParam -) -#else -PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg(inst, csgParam) -Inst inst; -RgrCellCsgParamCfg *csgParam; -#endif -{ - - TRC2(rgSCHCfgVldtRgrCellCsgParamCfg); - - RGSCHDBGPRM(inst, (rgSchPBuf(inst), "Validating CSG Parameters \n")); - - if(csgParam->minDlResNonCsg > 100) - { - RLOG0(L_ERROR,"Invalid Configuration of minimum DL resources " - "for NON-CSG"); - RETVALUE(RFAILED); - } - if(csgParam->minUlResNonCsg > 100) - { - RLOG0(L_ERROR,"Invalid Configuration of minimum UL resources " - "for NON-CSG"); - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} - -/** - * @brief Validates the SI configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrSiCfg - * - * Processing Steps: - * - Validate the range of configured values recieved in - * configuration request. - * - If validated successfully, - * - Return ROK - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * @param[in] Inst inst - * @param[in] RgrCellCfg *siCfg - * @param[out] RgSchCellCb *cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrSiCfg -( -Inst inst, -RgrSiCfgReqInfo *siCfg, -RgSchCellCb *cell, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHCfgVldtRgrSiCfg(inst, siCfg, cell, errInfo) -Inst inst; -RgrSiCfgReqInfo *siCfg; -RgSchCellCb *cell; -RgSchErrInfo *errInfo; -#endif -{ - MsgLen msgLen = 0; - U8 numSi; - - TRC2(rgSCHCfgVldtRgrSiCfg); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_SI_CFG; - - /*Validate the cfgType parameter */ - switch(siCfg->cfgType) - { - /*ccpu00140789*/ - case RGR_SI_STOP: - numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ? - cell->siCb.newSiCfg.numSi : cell->siCfg.numSi; - if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) || - (siCfg->siId > numSi)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid SI Id value" - " specified"); - RETVALUE(RFAILED); - } - errInfo->errCause = RGSCHERR_NONE; - RETVALUE(ROK); - break; - case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */ - case RGR_SI_CFG_TYPE_SIB1: /* SI CFG TYPE SIB1 */ - case RGR_SI_CFG_TYPE_SIB1_PWS: /* SI CFG TYPE SIB1_PWS */ - case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */ -#ifdef EMTC_ENABLE - case RGR_SI_CFG_EMTC_TYPE_SIB1_BR: - case RGR_SI_CFG_EMTC_TYPE_SIB1_BR_PER: -#endif - break; - - case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */ - /*Check that value of SI should be less than equal - to configured numSi parameter value */ - /* Added siId validation for lower limit */ - numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ? - cell->siCb.newSiCfg.numSi : cell->siCfg.numSi; - if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) || - (siCfg->siId > numSi)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid SI Id value" - " specified"); - RETVALUE(RFAILED); - } - - if(siCfg->siId > ((cell->siCfg.minPeriodicity * 10)/cell->siCfg.siWinSize)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "SiId can not be scheduled "); - RETVALUE(RFAILED); - } - break; - -#ifdef EMTC_ENABLE - case RGR_SI_CFG_EMTC_TYPE_SI: - case RGR_SI_CFG_EMTC_TYPE_SI_PER: - if(ROK != rgEmtcvalidateSiCfg(siCfg,cell)) - { - RETVALUE(RFAILED); - } - break; -#endif - default: - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid cfgType " - "parameter value"); - RETVALUE(RFAILED); - } - - /*Validate the specified pdu */ - if(NULLP == siCfg->pdu) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid NULLP pdu " - "specified"); - RETVALUE(RFAILED); - } - - /*Check if PDU is of 0 length*/ - SFndLenMsg(siCfg->pdu, &msgLen); - if(0 == msgLen) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid pdu " - "specified"); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrSiCfg */ -#endif /*RGR_SI_SCH*/ - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - * @brief Validates the RNTP INF request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrLoadInf - * - * Processing Steps: - * - Validate the range of configured values recieved in - * LOAD INF request. - * - If validated successfully, - * - Return ROK - * - Else - * - Return RFAILED. - * - Else return RFAILED. - * @param[in] Inst inst - * @param[in] RgrLoadInfReqInfo *loadInfReq - * @param[out] RgSchCellCb *cell - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrLoadInf -( - Inst inst, - RgrLoadInfReqInfo *loadInfReq, - RgSchCellCb *cell, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, errInfo) - Inst inst; - RgrLoadInfReqInfo *loadInfReq; - RgSchCellCb *cell; - RgSchErrInfo *errInfo; -#endif -{ - - TRC2(rgSCHCfgVldtRgrLoadInf); - - - errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LOAD_INF; - - /* Validate if the CC startRb which we have received from DSFR lies in CE sub-band of the receiving eNB */ - if((loadInfReq->rgrCcPHighStartRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) && - (loadInfReq->rgrCcPHighStartRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid rgrCcPHighStartRb received specified"); - RETVALUE(RFAILED); - } - - /* Validate if the CC endRb which we have received from DSFR lies in CE sub-band of the receiving eNB */ - if((loadInfReq->rgrCcPHighEndRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) && - (loadInfReq->rgrCcPHighEndRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid rgrCcPHighEndRb received specified"); - RETVALUE(RFAILED); - } - - errInfo->errCause = RGSCHERR_NONE; - - - RETVALUE(ROK); -} /* rgSCHCfgVldtRgrLoadInf */ -/* LTE_ADV_FLAG_REMOVED_END */ - -#ifdef TFU_UPGRADE - -/******************************************************************** - * UE ACQI, PCQI, RI, SRS and SR Re/Configuration Validation Functions * - * * - *********************************************************************/ - - /* - * @brief Validates the Tx Mode and PUSCH Mode configuration. - * - * @details - * - * Function : rgSCHCfgVldtRgrTxmodePuschMode - * - * Processing Steps: - * - Validate whether the configured PUSCH Mode and the - * Configured Tx Mode are in the right combination - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgrTxMode txMde - * @param[in] RgrAprdCqiMode puschMode - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode -( - RgSchCellCb *cellCb, - RgrTxMode txMde, - RgrAprdCqiMode puschMode, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode(cellCb, txMde, puschMode,errInfo) - RgSchCellCb *cellCb; - RgrTxMode txMde; - RgrAprdCqiMode puschMode; - RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrTxmodePuschMode); - - - if (txMde == RGR_UE_TM_1 || txMde == RGR_UE_TM_2 || - txMde == RGR_UE_TM_3 || txMde == RGR_UE_TM_7) - { - if (puschMode == RGR_APRD_CQI_MOD12 || - puschMode == RGR_APRD_CQI_MOD22 || - puschMode == RGR_APRD_CQI_MOD31) - { - RETVALUE(RFAILED); - } - } - - if (txMde == RGR_UE_TM_4 || txMde == RGR_UE_TM_6) - { - if (puschMode == RGR_APRD_CQI_MOD20 || - puschMode == RGR_APRD_CQI_MOD30) - { - RETVALUE(RFAILED); - } - } - - if (txMde == RGR_UE_TM_5 ) - { - if (puschMode != RGR_APRD_CQI_MOD31) - { - RETVALUE(RFAILED); - } - } -#ifdef LTE_ADV - /* TOODO:: Tm8 and TM9 validation has to - * be changed as mentioned inthe commented - * code below*/ - /* TM8 and TM9 supports all modes - * Mode 1-2, 2-2, 3-1 if pmi/ri reporting enabled - * 2-0,3-0 of pmi/ri reporitng isdisabled * - * if pmi/ri is enabled - * Mode 1-2, 2-2, 3-1 if with pmi/ri and csi-rs ports > 1 - * 2-0,3-0 of pmi/ri reporitng isdisabled and csi-rs ports == 1*/ - -#endif - RETVALUE(ROK); -}/*rgSCHCfgVldtRgrTxmodePuschMode ends*/ - - /* - * @brief Validates the UE ACQI configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeACqiCfg - * - * Processing Steps: - * - Validate the UE configuration request from RRC to MAC at CFG: - * validate the ACQI Configuration - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb, - * @param[in] CmLteRnti crnti, - * @param[in] RgrUeAprdDlCqiCfg *acqiCfg, - * @param[in] RgrUeTxModeCfg txMode, - * @param[out] RgSchErrInfo *errInfo - - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUeAprdDlCqiCfg *acqiCfg, - RgrUeTxModeCfg txMode, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg(cellCb, crnti, acqiCfg,txMode, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUeAprdDlCqiCfg *acqiCfg; - RgrUeTxModeCfg txMode; - RgSchErrInfo *errInfo; -#endif -{ - RgrTxMode txMde; - RgrAprdCqiMode puschMode; - TRC2(rgSCHCfgVldtRgrUeACqiCfg); - - - if(acqiCfg->pres) - { - if(txMode.pres == TRUE) - { - txMde = txMode.txModeEnum; - puschMode = acqiCfg->aprdModeEnum; - if ( ROK != rgSCHCfgVldtRgrTxmodePuschMode(cellCb, txMde, - puschMode, errInfo)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Aperiodic CQI configuration CRNTI:%d",crnti); - RETVALUE(RFAILED); - } - } - } - RETVALUE(ROK); -} - - /* - * @brief Validates the Tx Mode and PUCCH Mode configuration. - * - * @details - * - * Function : rgSCHCfgVldtRgrTxmodePucchMode - * - * Processing Steps: - * - Validate whether the configured PUCCH Mode and the - * Configured Tx Mode are in the right combination - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgrTxMode txMde - * @param[in] RgrPrdCqiMode pucchMode - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode -( - RgSchCellCb *cellCb, - RgrTxMode txMde, - RgrPrdCqiMode pucchMode, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode(cellCb, txMde, pucchMode,errInfo) - RgSchCellCb *cellCb; - RgrTxMode txMde; - RgrPrdCqiMode pucchMode; - RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHCfgVldtRgrTxmodePucchMode); - - - if (pucchMode == RGR_PRD_CQI_MOD10 || pucchMode == RGR_PRD_CQI_MOD20 ) - { - if (txMde ==RGR_UE_TM_4 || txMde ==RGR_UE_TM_5 || txMde ==RGR_UE_TM_6) - { - RETVALUE(RFAILED); - } - } - else if (pucchMode == RGR_PRD_CQI_MOD11 || pucchMode == RGR_PRD_CQI_MOD21) - { - if (txMde ==RGR_UE_TM_1 || txMde ==RGR_UE_TM_2 || txMde ==RGR_UE_TM_3 \ - || txMde ==RGR_UE_TM_7) - { - RETVALUE(RFAILED); - } - } - /* TODO:: Tm8 and TM9 validation needs to be added */ - RETVALUE(ROK); -} - -/* - * @brief Validates the UE Periodic CQI, PMI, RI, re/configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUePCqiCfg - * - * Processing Steps: - * - Validate the UE configuration request from RRC to MAC at CFG: - * validate the value range for Periodic CQI, PMI, RI values. - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb, - * @param[in] CmLteRnti crnti, - * @param[in] RgrUePrdDlCqiCfg *cqiCfg, - * @param[in] RgrUeTxModeCfg txMode, - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef LTEMAC_HDFDD -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUePrdDlCqiCfg *cqiCfg, - Bool hdFdd, - RgrUeTxModeCfg txMode, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg(cellCb, crnti, cqiCfg, hdFdd, - txMode, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUePrdDlCqiCfg *cqiCfg; - Bool hdFdd; - RgrUeTxModeCfg txMode; - RgSchErrInfo *errInfo; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg - ( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUePrdDlCqiCfg *cqiCfg, - RgrUeTxModeCfg txMode, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg(cellCb, crnti, cqiCfg, txMode, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUePrdDlCqiCfg *cqiCfg; - RgrUeTxModeCfg txMode; - RgSchErrInfo *errInfo; -#endif -#endif -{ - RgrTxMode txMde; - RgrPrdCqiMode pucchMode; - - TRC2(rgSCHCfgVldtRgrUePCqiCfg); - - txMde = RGR_UE_TM_1; - pucchMode = RGR_PRD_CQI_MOD20; - if ( RGR_SCH_PCQI_SETUP == cqiCfg->type ) - { - /*1. Validate for Tx Mode and PUCCH Mode combination*/ - if(txMode.pres == TRUE) - { - txMde = txMode.txModeEnum; - pucchMode = cqiCfg->cqiSetup.prdModeEnum; - if ( ROK != rgSCHCfgVldtRgrTxmodePucchMode(cellCb, txMde, - pucchMode, errInfo)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Tx Mode-PUCCH Mode combination CRNTI:%d",crnti); - RETVALUE(RFAILED); - } - } - - /*2. Validate for PCQI Reporting Type and PUCCH Mode combination*/ - if((cqiCfg->cqiSetup.cqiRepType==1) && - ((pucchMode == RGR_PRD_CQI_MOD20) || - (pucchMode == RGR_PRD_CQI_MOD21))) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti); - RETVALUE(RFAILED); - } - - if((cqiCfg->cqiSetup.cqiRepType==2) && - ((pucchMode == RGR_PRD_CQI_MOD10) || - (pucchMode == RGR_PRD_CQI_MOD11))) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti); - RETVALUE(RFAILED); - } - - /*3. Validate CQI/PMI and RI Configuration related parameter values */ - /*TODO- To be compared with configured n2Pucch Index*/ - if (cqiCfg->cqiSetup.cqiPResIdx > RG_SCH_PUCCH_RES_MAX_SUPP ) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid CQI-PUCCH resourceIndex=%d Cfg Val=%d CRNTI:%d", - RG_SCH_PUCCH_RES_MAX_SUPP, cqiCfg->type,crnti); - RETVALUE(RFAILED); - } - -#ifdef LTEMAC_HDFDD - if(hdFdd) - { - if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| - (cqiCfg->cqiSetup.cqiPCfgIdx < 7) || - (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg CQI Min Index Sup =%d" - "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP, - RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); - RETVALUE(RFAILED); - } - } - else - { - if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| - (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg CQI Min Index Sup =%d " - "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP, - RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); - RETVALUE(RFAILED); - } - } -#else - if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| - (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg CQI Min Index Sup =%d" - "Max Index Sup=%d Cfg Val=%d CRNTI;%d", RG_SCH_ICQI_MIN_SUPP, - RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); - RETVALUE(RFAILED); - } -#endif - - if((cqiCfg->cqiSetup.cqiRepType < RGR_UE_PCQI_WB_REP) || - (cqiCfg->cqiSetup.cqiRepType > RGR_UE_PCQI_SB_REP)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Cfg CQI Report" - "ModeCfg Val=%d CRNTI:%d", cqiCfg->type,crnti); - RETVALUE(RFAILED); - } - - if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) && - ((cqiCfg->cqiSetup.k < RG_SCH_CQI_K_MIN) || - (cqiCfg->cqiSetup.k > RG_SCH_CQI_K_MAX))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid CQI Cfg K Cfg Val=%d CRNTI:%d", cqiCfg->type,crnti); - RETVALUE(RFAILED); - } - - if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) && - (cellCb->bwCfg.dlTotalBw <= 7)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Periodic CQI mode Cfg for dlTotalBw (%d) for CRNTI:%d", - cellCb->bwCfg.dlTotalBw, crnti); - RETVALUE(RFAILED); - } - -#ifndef LTE_TDD - if (cqiCfg->cqiSetup.cqiPCfgIdx == RG_SCH_ICQI_RESV_FDD ) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Reserved value Cfg =%d CRNTI:%d", - cqiCfg->cqiSetup.cqiPResIdx,crnti); - RETVALUE(RFAILED); - } -#endif - - /* 4. Check RI Configuration values */ - if(cqiCfg->cqiSetup.riEna == TRUE) - { - if(txMode.pres == TRUE) - { - if((txMde != RGR_UE_TM_3) - && (txMde != RGR_UE_TM_4) - && (txMde != RGR_UE_TM_8) -#ifdef LTE_ADV - && (txMde != RGR_UE_TM_9) -#endif - ) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Transmission Mode =%d CRNTI:%d", - txMde,crnti); - RETVALUE(RFAILED); - } - } - - if(cqiCfg->cqiSetup.riCfgIdx > RG_SCH_IRI_MAX_SUPP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Index RI value Cfg =%d CRNTI:%d", - cqiCfg->cqiSetup.riCfgIdx,crnti); - RETVALUE(RFAILED); - } - } - } - - - RETVALUE(ROK); -} - -/* - * @brief Validates the UE SRS Re/Configuation request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeUlSrsCfg - * - * Processing Steps: - * - Validate the UE configuration request from RRC to MAC at CFG: - * validate the value range for SRS values. - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb, - * @param[in] CmLteRnti crnti, - * @param[in] RgrUeUlSrsCfg *srsCfg, - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef LTEMAC_HDFDD -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUeUlSrsCfg *srsCfg, - Bool hdFdd, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, crnti, srsCfg, hdFdd, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUeUlSrsCfg *srsCfg; - Bool hdFdd; - RgSchErrInfo *errInfo; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUeUlSrsCfg *srsCfg, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, crnti, srsCfg, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUeUlSrsCfg *srsCfg; - RgSchErrInfo *errInfo; -#endif -#endif -{ - U16 srsPeri=0; - U16 srsOffset=0; - U8 srsSubframe=0; - - TRC2(rgSCHCfgVldtRgrUeUlSrsCfg); - - - if ( RGR_SCH_SRS_SETUP == srsCfg->type ) - { - - /*ccpu00130768 - ADD - if cell specific SRS is not configured*/ - if(cellCb->srsCfg.isSrsCfgPres == FALSE) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Cell specific SRS is not configured CRNTI:%d",crnti); - RETVALUE(RFAILED); - } - - /* 1. Validate SRS Configuration related parameter values */ - /* 1.1 iSRS should be 0-636; Ref: 36.213. Table 8.2-1 */ -#ifdef LTEMAC_HDFDD - if(hdFdd) - { - if ( (srsCfg->srsSetup.srsCfgIdx < 7) || - (srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP) ) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg " - "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", - RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } - } - else - { - if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP ) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg" - "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", - RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } - - } -#else - if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP ) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg" - "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", - RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } -#endif -#ifdef LTE_TDD - /* Compute SRS Offset and Periodicity */ - rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL, - srsCfg->srsSetup.srsCfgIdx, - &srsPeri, &srsOffset); -#else - rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL, - srsCfg->srsSetup.srsCfgIdx, - &srsPeri, &srsOffset); -#endif - srsSubframe = srsOffset%RGSCH_NUM_SUB_FRAMES; -#ifdef LTE_TDD - if(rgSchTddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) { -#else - if(rgSchFddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) { -#endif - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, - "UE specific SRS is not occuring in Cell specific SRS subframe" - "srs Cfg Idx =%d CRNTI:%d", - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } - - - if ( srsCfg->srsSetup.fDomPosi > RG_SCH_SRS_FREQDOM_POS_MAX ) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg" - "SRS Min Freq Domain Position =%d" - "Max Freq Domain Position =%d Cfg Val=%d CRNTI:%d", - RG_SCH_SRS_FREQDOM_POS_MIN, RG_SCH_SRS_FREQDOM_POS_MAX, - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } - - if ( srsCfg->srsSetup.txComb > RG_SCH_SRS_TXCOMB_MAX ) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Not Supported or Invalid Cfg" - "SRS Min TX Comb =%d Max TX Comb =%d Cfg Val=%d CRNTI:%d", - RG_SCH_SRS_TXCOMB_MIN, RG_SCH_SRS_TXCOMB_MAX, - srsCfg->srsSetup.srsCfgIdx,crnti); - RETVALUE(RFAILED); - } - } - RETVALUE(ROK); -} - -/* - * @brief Validates the UE SR Re/configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtRgrUeSrCfg - * - * Processing Steps: - * - Validate the UE re/configuration request from RRC to MAC at CFG: - * validate the value range for SR values. - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb, - * @param[in] CmLteRnti crnti, - * @param[in] RgrUeSrCfg *srCfg, - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef LTEMAC_HDFDD -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUeSrCfg *srCfg, - Bool hdFdd, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg(cellCb, crnti, srCfg, hdFdd, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUeSrCfg *srCfg; - Bool hdFdd; - RgSchErrInfo *errInfo; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg -( - RgSchCellCb *cellCb, - CmLteRnti crnti, - RgrUeSrCfg *srCfg, - RgSchErrInfo *errInfo - ) -#else -PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg(cellCb, crnti, srCfg, errInfo) - RgSchCellCb *cellCb; - CmLteRnti crnti; - RgrUeSrCfg *srCfg; - RgSchErrInfo *errInfo; -#endif -#endif -{ - - TRC2(rgSCHCfgVldtRgrUeSrCfg); - - - - if ( RGR_SCH_SR_SETUP == srCfg->type ) - { - /* 1. Validate SR Configuration related parameter values */ -#ifdef LTEMAC_HDFDD - if(hdFdd) - { - if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || - ( srCfg->srSetup.srCfgIdx < 5 ) || - ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SR Index Cfg =%d" - "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, - RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); - - RETVALUE(RFAILED); - } - } - else - { - if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || - ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SR Index Cfg =%d" - "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, - RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); - - RETVALUE(RFAILED); - } - } -#else - if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || - ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SR Index Cfg =%d" - "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, - RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); - - RETVALUE(RFAILED); - } -#endif - } - RETVALUE(ROK); -} - - -/* - * @brief Validates the UE Aperiodic & Periodic CQI, PMI, RI, SRS and SR Configuration - * request from RRM to MAC. - * - * @details - * - * Function :rgSCHCfgVldtCqiSrSrsUeCfg - * - * Processing Steps: - * - Validate the UE configuration request from RRC to MAC at CFG: - * validate the value range for Aperiodic & Periodic CQI, PMI, RI , SRS and SR values. - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgrUeCfg *ueCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg -( - RgSchCellCb *cellCb, - RgrUeCfg *ueCfg, - RgSchErrInfo *errInfo - ) -#else -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg(cellCb, ueCfg, errInfo) - RgSchCellCb *cellCb; - RgrUeCfg *ueCfg; - RgSchErrInfo *errInfo; -#endif -{ - - TRC2(rgSCHCfgVldtCqiSrSrsUeCfg); - - - /* 1. Validate UE Aperiodic CQI related parameters */ - if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueCfg->crnti, - &ueCfg->ueDlCqiCfg.aprdCqiCfg, ueCfg->txMode, errInfo )) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Aperiodic CQI configuration CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - - /* 1. Validate UE Periodic CQI/PMI, SRS and SR related parameters */ -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti, - &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->isHdFddEnbld, - ueCfg->txMode, errInfo )) -#else - if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti, - &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->txMode, errInfo )) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Periodic CQI configuration CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - - /* 2. Validate SRS Configuration related parameter values */ -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti, &ueCfg->srsCfg, - ueCfg->isHdFddEnbld, errInfo )) -#else - if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti, - &ueCfg->srsCfg, errInfo )) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SRS configuration CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - - /* 3. Validate SR Configuration related parameter values */ -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti, &ueCfg->srCfg, - ueCfg->isHdFddEnbld, errInfo)) -#else - if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti, - &ueCfg->srCfg, errInfo)) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SR configuration CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); - -} - - - -/***************************************************************** - * UE PCQI, RI, SRS and SR Re Configuration Validation Functions * - * * - ******************************************************************/ -/* - * @brief Validates the UE Periodic CQI, PMI, RI, SRS and SR - * Re-configuration request from RRM to MAC. - * - * @details - * - * Function : rgSCHCfgVldtCqiSrSrsUeReCfg - * - * Processing Steps: - * - Validate the UE Re configuration request from RRC to MAC at CFG: - * validate the value range for Periodic CQI, PMI, RI, SRS and SR values. - * - If validated successfully, - * - Return ROK. - * - Else - * - Return RFAILED. - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgSchUeCb *ueCb - * @param[in] RgrUeCfg *ueCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeRecfg *ueReCfg, - RgSchErrInfo *errInfo - ) -#else -PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg(cellCb, ueCb, ueReCfg, errInfo) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeRecfg *ueReCfg; - RgSchErrInfo *errInfo; -#endif -{ - RgrUeTxModeCfg txMode; - TRC3(rgSCHCfgVldtCqiSrSrsUeReCfg); - - txMode.pres = TRUE; - txMode.tmTrnstnState = RGR_TXMODE_RECFG_CMPLT; - if ((ueReCfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) && - (ueReCfg->txMode.pres == TRUE)) - { - txMode.txModeEnum = ueReCfg->txMode.txModeEnum; - } - else - { - txMode.txModeEnum = ueCb->mimoInfo.txMode; - } - - /* 1. Validate UE CQI/PMI, SRS and SR related parameters */ - - if ( ueReCfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG ) - { - if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueReCfg->oldCrnti, - &ueReCfg->aprdDlCqiRecfg, txMode, errInfo )) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Aperiodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti); - RETVALUE(RFAILED); - } - } - - - /* 2. Validate UE CQI/PMI, SRS and SR related parameters */ - - if ( ueReCfg->ueRecfgTypes & RGR_UE_PCQI_RECFG ) - { -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti, - &ueReCfg->cqiCfg, ueReCfg->isHdFddEnbld, txMode, errInfo )) -#else - if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti, - &ueReCfg->cqiCfg, txMode, errInfo )) -#endif - - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid Periodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti); - RETVALUE(RFAILED); - } - } - - if(ueReCfg->ueRecfgTypes & RGR_UE_SRS_RECFG ) - { -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti, - &ueReCfg->srsCfg, ueReCfg->isHdFddEnbld, errInfo )) -#else - if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti, - &ueReCfg->srsCfg, errInfo )) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SRS configuration OLD CRNTI:%d",ueReCfg->oldCrnti); - RETVALUE(RFAILED); - } - - } - - if ( ueReCfg->ueRecfgTypes & RGR_UE_SR_RECFG ) - { -#ifdef LTEMAC_HDFDD - if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti, - &ueReCfg->srCfg, ueReCfg->isHdFddEnbld, errInfo)) -#else - if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti, - &ueReCfg->srCfg, errInfo)) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Invalid SR configuration OLD CRNTI:%d",ueReCfg->oldCrnti); - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); -} - - -/***************************************************************** - * UE ACQI, PCQI, RI, SRS SR Configuration Functions * - * * - ******************************************************************/ - /** - * @brief Handles Aperiodic CQI , PMI, RI configuration for a UE. - * - * @details - * - * Function : rgSCHCfgACqiUeCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE configuration. It - * shall do the validations for the spec-defined values. - * - * Processing Steps: - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrTxMode txMode - * @param[in] RgrUeAprdDlCqiCfg *aCqiCfg - * @param[in] CmLteUeCategory ueCat - * @return S16 - * -# ROK - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgACqiUeCfg -( -RgSchCellCb *cellCb, -RgSchUeCb *ue, -RgSchUeACqiCb *acqiCb, -RgrTxMode ueTxMode, -RgrUeAprdDlCqiCfg *aCqiCfg, -CmLteUeCategory ueCat -) -#else -PUBLIC S16 rgSCHCfgACqiUeCfg(cellCb,ue,acqiCb ueTxMode, aCqiCfg, ueCat) -RgSchCellCb *cellCb; -RgSchUeCb *ue; -RgSchUeACqiCb *acqiCb; -RgrTxMode ueTxMode; -RgrUeAprdDlCqiCfg *aCqiCfg; -CmLteUeCategory ueCat; -#endif -{ - U8 M; /*Num of Subbands -- Applicable only for Mode 2-0 and 2-2*/ - U8 k; /*SubBand Size (RB) -- - Holds different values depending on Mode*/ - U8 cqiPmiSzR1; /*CQIPMI Size for Rank =1*/ - U8 cqiPmiSzRn1; /*CQIPMI Size for Rank > 1*/ - - TRC3(rgSCHCfgACqiUeCfg); - - cqiPmiSzR1 = 0; - cqiPmiSzRn1 = 0; - - acqiCb->aCqiCfg.pres = aCqiCfg->pres; - acqiCb->aCqiCfg.aprdModeEnum = aCqiCfg->aprdModeEnum; - - if(aCqiCfg->pres) - { -#ifdef LTE_ADV - /*Store Trigger Set Bit String to UE */ - RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); - pCellInfo->acqiCb.aCqiCfg.triggerSet1 = aCqiCfg->triggerSet1; - pCellInfo->acqiCb.aCqiCfg.triggerSet2 = aCqiCfg->triggerSet2; -#endif - - - switch(aCqiCfg->aprdModeEnum) - { - case RGR_APRD_CQI_MOD12: - case RGR_APRD_CQI_MOD30: - case RGR_APRD_CQI_MOD31: - RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k); - acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k); - acqiCb->k = k; - break; - - case RGR_APRD_CQI_MOD20: - case RGR_APRD_CQI_MOD22: - RG_SCH_GET_SBCQI_M_K_VAL(cellCb->bwCfg.dlTotalBw, M, k); - acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k); - acqiCb->k = k; - acqiCb->M = M; - acqiCb->L = RgSCHUeAcqi2022LBitWidth[M-1][acqiCb->N-1]; - break; - - default: - break; - } - if((ueTxMode == RGR_UE_TM_3) || - (ueTxMode == RGR_UE_TM_4)) - { - if(cellCb->numTxAntPorts ==2) - { - acqiCb->riNumBits = 1; - } - else if(cellCb->numTxAntPorts ==4) - { - if(ueCat == CM_LTE_UE_CAT_8) - { - acqiCb->riNumBits = 3; - } - else if(ueCat >= CM_LTE_UE_CAT_5) - { - acqiCb->riNumBits = 2; - } - else - { - acqiCb->riNumBits = 1; - } - } - } - rgSCHCfgUtlFetchAcqiBitSz(acqiCb, cellCb->numTxAntPorts, - &cqiPmiSzR1, &cqiPmiSzRn1); - acqiCb->cqiPmiSzR1 = cqiPmiSzR1; - acqiCb->cqiPmiSzRn1 = cqiPmiSzRn1; - } - acqiCb->cqiReqField = TRUE; -#ifdef LTE_ADV - rgSchCmnSetCqiReqField(RG_SCH_CMN_GET_SCELL_INFO(ue, cellCb),ue,&acqiCb->cqiReqField); -#endif - - RETVALUE(ROK); -} - -/** - * @brief Handles Periodic CQI , PMI, RI configuration for a UE. - * - * @details - * - * Function : rgSCHCfgPCqiUeCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE configuration. It shall do the - * validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific Periodic CQI related configuration, - * - If Periodic CQI/PMI is configured, - * - Update UE with the configured values. - - Compute and Update next occurance of CQI/PMI or RI Tranmission instance. - - Update the CQI offset and CQI perodicity information - - Add Ue to cell's list - * - * - * - For UE-specific Periodic RI related configuration, - * - If Periodic RI is configured, - * - Update UE with the configured values. - - Compute and Update next occurance of RI Tranmission instance. - - Update the RI offset and RI perodicity information - * - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUePrdDlCqiCfg *cqiCfg - * @param[in] CmLteUeCategory ueCat - * @return S16 - * -# ROK - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgPCqiUeCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg, - CmLteUeCategory ueCat - ) -#else -PUBLIC S16 rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUePrdDlCqiCfg *cqiCfg; - CmLteUeCategory ueCat; -#endif -{ - CmLteTimingInfo timingInfo; - U16 crntTime; - U16 cqiTrInstTime; - U8 j; /*Bandwidth Parts*/ - U8 temp; - U8 loop; - RgSchUePCqiCb *cqiCb = NULLP; - TRC3(rgSCHCfgPCqiUeCfg); - - crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+ - (cellCb->crntTime.subframe); - cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); - cqiCb->servCellInfo = ueCb->cellInfo[0]; - /* Periodic CQI is setup */ - if (cqiCfg->type == RGR_SCH_PCQI_SETUP) - { - for(loop = 0; loop < MAX_CQI_RI_RPT_BUFF;loop++) - { - ueCb->rawCqiBitW[loop].type = TFU_RECP_REQ_INVLD; /* setting invalid type*/ - } - /* 1. Copy the Received CQI Cfg parameters to ueCb */ - cmMemcpy((U8 *)&cqiCb->cqiCfg, (U8 *)cqiCfg, - sizeof(RgrUePrdDlCqiCfg)); - - /* 2. Compute Periodic CQI Periodicity and subframe offset */ -#ifndef LTE_TDD - rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx, - &cqiCb->cqiPeri, &cqiCb->cqiOffset); -#else - rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL, - cqiCfg->cqiSetup.cqiPCfgIdx, - &cqiCb->cqiPeri, &cqiCb->cqiOffset); -#endif - RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, - "rgSCHCfgPCqiUeCfg(): UEID:%d CQI Peri=%d, CQI Offset=%d", - ueCb->ueId, - cqiCb->cqiPeri, - cqiCb->cqiOffset); - - - cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset) - %cqiCb->cqiPeri; - cqiCb->nCqiTrIdx = (crntTime + - (cqiCb->cqiPeri - cqiTrInstTime)); - /* Introduced timing delta for reception req - * in FDD*/ - if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) - { - cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri; - } - - /* To handle the SFN wrap around case */ - cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx % (RGSCH_MAX_SFN * RGSCH_NUM_SUB_FRAMES_5G); - - timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G; - timingInfo.subframe = cqiCb->nCqiTrIdx % RGSCH_NUM_SUB_FRAMES_5G; - - cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx - %RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - -#ifdef EMTC_ENABLE - /*CQI Repetition configuration*/ - if(ueCb->isEmtcUe) - { - rgSchfillPucchCqiRepNumCountemtc(cqiCb, ueCb); - } -#endif - - if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType) - { - U8 k; /*SubBand Size (RB) */ - RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j); - RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k); - cqiCb->J = j; /*Number of Bandwidth Parts*/ - /*h: reporting instances required for a complete CQI/PMI report */ - /*j:Number of bandwidth parts; k: Subband Size*/ - cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1; - /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/ - temp = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, (j*k)); - cqiCb->label = (temp & (temp-1)) ? - (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp); - - rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb, cqiCb); - } -#ifdef LTE_ADV - else - { - cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1; - } -#endif - - /* Place the UE in cellCb->tIUeLstCp */ - cqiCb->cqiLstEnt.node=(PTR) cqiCb; -#ifdef LTE_ADV - cqiCb->isCqiIgnoByCollsn = FALSE; - cqiCb->isRiIgnoByCollsn = FALSE; -#endif - - - cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, - &cqiCb->cqiLstEnt); - - - /* 4. Rank Indicator Cfg handler */ - rgSCHCfgRiUeCfg(cellCb, ueCb, cqiCfg, ueCat); - } - else - { - cqiCb->cqiCfg.type = RGR_SCH_PCQI_REL; - if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,\ - &cqiCb->cqiLstEnt); - } - if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, \ - &cqiCb->riLstEnt); - RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL, - &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); - } - cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->riDist = RG_SCH_INVALID_IDX; - } - ueCb->nPCqiCb = cqiCb; - ueCb->nPRiCb = cqiCb; - RETVALUE(ROK); -} - -/** - * @brief Handles Periodic RI configuration for a UE. - * - * @details - * - * Function : rgSCHCfgRiUeCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE configuration. It shall do the - * validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific Periodic RI related configuration, - * - If Periodic RI is configured, - * - Update UE with the configured values. - - Compute and Update next occurance of RI Tranmission instance. - - Update the RI offset and RI perodicity information - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUePrdDlCqiCfg *cqiCfg - * @param[in] CmLteUeCategory ueCat - * @return S16 - * -# ROK - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCfgRiUeCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg, - CmLteUeCategory ueCat - ) -#else -PUBLIC S16 rgSCHCfgRiUeCfg(cellCb, ueCb, cqiCfg, ueCat) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUePrdDlCqiCfg *cqiCfg; - CmLteUeCategory ueCat; -#endif -{ - U16 crntTime; - U16 riTrInsTime; - U8 j; /*Bandwidth parts. Valid for Modes 2-0, 2-1*/ - U16 periodicity; - U16 tempIdx; - RgSchUePCqiCb *cqiCb = NULLP; - - TRC3(rgSCHCfgRiUeCfg); - - - - crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) - +(cellCb->crntTime.subframe); - cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); - /* 1. Rank Indicator is enabled */ - if(cqiCfg->cqiSetup.riEna) - { - - rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL, - cqiCfg->cqiSetup.riCfgIdx, - &cqiCb->riPeri, &cqiCb->riOffset); - - RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, - "rgSCHCfgRiUeCfg(): RI Peri=%d, RI Offset=%d UEID:%d", - cqiCb->riPeri, cqiCb->riOffset,ueCb->ueId); - - cqiCb->perRiVal = 1; - cqiCb->invalidateCqi = FALSE; - - if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType) - { - /* - 1. wideband RI reporting is configured - (Mode 1-0 or 1-1) - (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod - *MriPeriod)=0 - */ - periodicity = cqiCb->cqiPeri * cqiCb->riPeri; - } - else - { - /* - * Where Widesband and Subband RI reporting is configured - * (Mode 2-0 or 2-1 ) - * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI ) - * Mod(H. NCqiperiod *MriPeriod )=0 - * where H= J * K +1; J=Number of bandwidth parts(BW/subsize). - * K is RGR interf input - */ - - RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j); - cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1; - periodicity = cqiCb->h * cqiCb->cqiPeri * - cqiCb->riPeri; - } - - /* In case of SFN wraparound, the SB CQI reporting cycle breaks - * and RI->WB CQI->SBCQI.. should resume. RI is repositioned - * accordingly. WBCQI handling is naturally accomplished */ - if (periodicity >= RGSCH_MAX_SUBFRM_5G) - { - periodicity = cqiCb->cqiOffset - cqiCb->riOffset + - RGSCH_MAX_SUBFRM_5G - (crntTime); - tempIdx = crntTime + periodicity; - printf("CHECK_SID - periodicity %d tempIdx %d\n", periodicity, tempIdx); - } - else - { - if ((crntTime + TFU_RECPREQ_DLDELTA + periodicity) > - (RGSCH_MAX_SUBFRM_5G - 1)) - { - riTrInsTime = (periodicity - cqiCb->cqiOffset + cqiCb->riOffset) % periodicity; - tempIdx = RGSCH_MAX_SUBFRM_5G + (periodicity - riTrInsTime); - } - else - { - riTrInsTime = ((periodicity +crntTime )- \ - cqiCb->cqiOffset + cqiCb->riOffset)\ - % periodicity; - tempIdx = (crntTime + (periodicity -riTrInsTime)); - } - } - if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) - { - tempIdx = tempIdx + periodicity; - } - cqiCb->nRiTrIdx = tempIdx - % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) - { - cqiCb->riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), - (U16) tempIdx); - } - else - { - cqiCb->riDist =0; - } - if(ueCb->mimoInfo.txMode == RGR_UE_TM_3 - || ueCb->mimoInfo.txMode == RGR_UE_TM_4) - { - if (cellCb->numTxAntPorts ==2) - { - cqiCb->riNumBits = 1; - } - else if(cellCb->numTxAntPorts ==4) - { - if(ueCat == CM_LTE_UE_CAT_8) - { - cqiCb->riNumBits = 3; - } - else if(ueCat >= CM_LTE_UE_CAT_5) - { - cqiCb->riNumBits = 2; - } - else - { - cqiCb->riNumBits = 1; - } - } - } - /* Place the UE in cellCb->tIUeLstCp */ - cqiCb->riLstEnt.node=(PTR) cqiCb; - - cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, - &cqiCb->riLstEnt); - RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD, - &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); - - - } - else - { - cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->riDist = RG_SCH_INVALID_IDX; - } - - RETVALUE(ROK); - -} - -/* @brief Handles SRS configuration for a UE. - * - * @details - * - * Function : rgSCHCfgSrsUeCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE configuration. It shall do the - * validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific SRS related configuration, - * - If SRS is configured, - * - Update UE with the configured values. - - Compute and Update next occurance of SRS Tranmission instance. - - Update the SRS offset and SRS perodicity information - - Add Ue to cell's srs list - * - else - * - next occurance transmission instance of SRS = RG_SCH_INVALID_IDX - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeUlSrsCfg *srsCfg - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgSrsUeCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeUlSrsCfg *srsCfg - ) -#else -PUBLIC S16 rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeUlSrsCfg *srsCfg; -#endif -{ - U16 srsTrInsTime; - U16 crntTime; - U16 tempIdx; - - TRC3(rgSCHCfgSrsUeCfg); - - - crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) - +(cellCb->crntTime.subframe); - - if(RGR_SCH_SRS_SETUP == srsCfg->type) - { - /* 1. Copy the Received Cfg parameters to local cb */ - cmMemcpy((U8 *)&ueCb->srsCb.srsCfg, (U8 *)srsCfg, sizeof(RgrUeUlSrsCfg)); - -#ifndef LTE_TDD - /* 2. Compute SRS Offset and Periodicity */ - rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL, - srsCfg->srsSetup.srsCfgIdx, - &ueCb->srsCb.peri, &ueCb->srsCb.offset); -#else - rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL, - srsCfg->srsSetup.srsCfgIdx, - &ueCb->srsCb.peri, &ueCb->srsCb.offset); -#endif - - RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, - "rgSCHCfgSrsUeCfg(): SRS Peri=%d, SRS Offset=%d UEID:%d", - ueCb->srsCb.peri,ueCb->srsCb.offset,ueCb->ueId); - - /* 3. Compute next Tranmission index for SRS */ - /* Referenence: 36.213 Section:8.2 - i. SRS transmission instances for TDD with period > 2 and for FDD are - ((10*sfn +Ksrs-suframeoffset))/mod(periodicity)) - FDD: Ksrs is 0...9 - TDD: Ksrs Table 8.2-3: - ii.The SRS transmission instances for TDD (periodicity == 2) - (Ksrs-Toffset)mod(5)==0. Note: This is not supported now - */ - - srsTrInsTime = ((ueCb->srsCb.peri+crntTime) - ueCb->srsCb.offset) - %ueCb->srsCb.peri; - tempIdx = (crntTime + (ueCb->srsCb.peri - srsTrInsTime)); -#ifdef LTE_TDD - if (tempIdx <= (crntTime + TFU_DELTA)) -#else - if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) -#endif - { - tempIdx = tempIdx + ueCb->srsCb.peri; - } - ueCb->srsCb.nSrsTrIdx =(U16) (tempIdx - % RG_SCH_PCQI_SRS_SR_TRINS_SIZE); - if(ueCb->srsCb.peri >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) - { -#ifdef LTE_TDD - ueCb->srsCb.srsDist = rgSCHUtlFindDist((U8)(crntTime+TFU_DELTA), - (U16)tempIdx); -#else - ueCb->srsCb.srsDist = rgSCHUtlFindDist((U8)(crntTime + TFU_RECPREQ_DLDELTA), - (U16)tempIdx); -#endif - } - else - { - ueCb->srsCb.srsDist = 0; - } - - /*UE Tx Antenna Selection - START*/ - if(ueCb->ul.ulTxAntSel.pres == TRUE ) - { - /*for both partial and full sounding bandwidth, - and when frequency hopping is disabled */ - ueCb->srsCb.selectedAnt = (crntTime/ueCb->srsCb.peri)%2; - } - else - { - /* TS 36.213 specifies that if Tx Antenna Selection is - disabled/not supported then its Port 0*/ - ueCb->srsCb.selectedAnt=0; - } - ueCb->validTxAnt = ueCb->srsCb.selectedAnt; - /*UE Tx Antenna Selection - ENDS*/ - - ueCb->srsCb.srsLstEnt.node=(PTR)ueCb; - cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, - &ueCb->srsCb.srsLstEnt); - - - } - else - { - /* SRS Release / Not configured */ - ueCb->srsCb.srsCfg.type = RGR_SCH_SRS_REL; - if(ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, - &ueCb->srsCb.srsLstEnt); - } - ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; - ueCb->srsCb.srsLstEnt.node =(PTR) NULLP; - } - - RETVALUE(ROK); -} - - -/* * @brief Handles SR configuration for a UE. - * - * @details - * - * Function : rgSCHCfgSrUeCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE configuration. It shall do the - * validations for the spec-defined values. - * - * - If SR is configured, - * - Update UE with the configured values. - - Compute and Update next occurance of SR Tranmission instance. - - Update the SR offset and SR perodicity information - - Add Ue to cell->tIUeLstCp[n] - * - else - * - next occurance transmission instance of SR = RG_INVALID_SR_ID - * - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeSrCfg *srCfg - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgSrUeCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeSrCfg *srCfg - ) -#else -PUBLIC S16 rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeSrCfg *srCfg; -#endif -{ - U16 srTrInsTime; - U16 crntTime; - - TRC3(rgSCHCfgSrUeCfg); - - - crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) - +(cellCb->crntTime.subframe); - if(srCfg->type == RGR_SCH_SR_SETUP) - { - /* 1. Copy the Received Cfg parameters to local cb */ - cmMemcpy((U8 *)&ueCb->srCb.srCfg, (U8 *)srCfg, sizeof(RgrUeSrCfg)); - - - /* 2. Compute SR periodicity and offset */ - rgSCHUtlGetCfgPerOff( RG_SCH_SR_TBL, - srCfg->srSetup.srCfgIdx, - &ueCb->srCb.peri, &ueCb->srCb.offset); - - RLOG_ARG4(L_DEBUG,DBG_CELLID,cellCb->cellId , - "SR Config: idx(%u), period (%u) offset (%u) UEID:%d", - srCfg->srSetup.srCfgIdx, - ueCb->srCb.peri, - ueCb->srCb.offset, - ueCb->ueId); -#ifdef EMTC_ENABLE - if(ueCb->isEmtcUe) - { - rgSchfillPucchSrRepNumCountemtc(ueCb); - } -#endif - /* 3. Compute Next Transmission Instance */ - - srTrInsTime = ((ueCb->srCb.peri+crntTime) - ueCb->srCb.offset) - %ueCb->srCb.peri; - ueCb->srCb.nSrTrIdx = (crntTime + (ueCb->srCb.peri- srTrInsTime)); -#ifdef LTE_TDD - if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_DELTA)) -#else - if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) -#endif - { - ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx + ueCb->srCb.peri; - } - ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx - % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - ueCb->srCb.srLstEnt.node= (PTR) ueCb; - - /* 4. Place UE in Cell SR Tranmisison Instance List */ - cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, - &ueCb->srCb.srLstEnt); - } - else - { - ueCb->srCb.srCfg.type = RGR_SCH_SR_REL; - - if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, - &ueCb->srCb.srLstEnt); - } - ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; - ueCb->srCb.srLstEnt.node = (PTR)NULLP; - } - - RETVALUE(ROK); -} - - -/***************************************************************** - * UE PCQI, RI, SRS and SR Re Configuration Functions * - * * - ******************************************************************/ - - -/* * @brief Handles Periodic CQI, PMI, RI Re-configuration for a UE. - * - * @details - * - * Function : rgSCHCfgPCqiUeReCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the - * validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific Periodic CQI related configuration, - * - If Periodic CQI/PMI is re configured(first time enabled), - * - Update UE with the configured values. - * - Compute and Update next occurance of CQI/PMI or RI Tranmission - * instance. - * - Update the CQI offset and CQI perodicity information - * - Add Ue to cell's list - * - If Periodic CQI/PMI is re configured(modify), - * - Update UE with the configured values. - * - Del Ue from cell->tIUeLstCp list - * - Compute and Update next occurance of CQI/PMI or RI Tranmission - * instance. - * - Update the CQI offset and CQI perodicity information - * - Add Ue to cell's list - * - If Periodic CQI/PMI is re configured(disabled), - * - Update UE with the configured values. - * - Del Ue from cell's list - * - Update next occurance of CQI/PMI or RI Tranmission instance. - * - next occurance of CQI/PMI = RG_INVALID_CQIPMI_ID - * - * - For UE-specific Periodic RI related configuration, - * - If Periodic RI is configured(first time enabled), - * - Update UE with the configured values. - * - Compute and Update next occurance of RI Tranmission instance. - * - Update the RI offset and RI perodicity information - * - If Periodic RI is configured(modify), - * - Update UE with the configured values. - * - Compute and Update next occurance of RI Tranmission instance. - * - Update the RI offset and RI perodicity information - * - else - * - next occurance of RI = RG_INVALID_CQIPMI_ID - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeCfg *ueCfg - * - * @return S16 - * -# ROK - * - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgPCqiUeReCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUePrdDlCqiCfg *cqiCfg, - CmLteUeCategory ueCat - ) -#else -PUBLIC S16 rgSCHCfgPCqiUeReCfg(cellCb, ueCb, cqiCfg, ueCat) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUePrdDlCqiCfg *cqiCfg; - CmLteUeCategory ueCat; -#endif -{ - - RgSchUePCqiCb *cqiCb = NULLP; - TRC3(rgSCHCfgPCqiUeReCfg); - - cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); - /* Fix: ccpu00124008 Fix for incorrect check causing missed CQI reception instance */ - if((cqiCfg->type == RGR_SCH_PCQI_SETUP) && - (cqiCb->cqiCfg.type != RGR_SCH_PCQI_SETUP)) - { - /* 1. cqi is in Release (Disable) state, Recfg is allowing Setup (Enable) - */ - rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); - - } - else if((cqiCfg->type == RGR_SCH_PCQI_SETUP) && - (cqiCb->cqiCfg.type == RGR_SCH_PCQI_SETUP )) - { - - /* - 2. Present is SETUP(Enable) state, Recfg is modifying SETUP(Enable) - - 2.1 Delete UE from the cqiList - 2.2 Set next occurance Transmission instace to "INVALID" - 2.3 Compute Next occurance Transmission instace - 2.4 Placed ue in Transmission instance list. - */ - if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX ) - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, - &cqiCb->cqiLstEnt); - - if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX ) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, - &cqiCb->riLstEnt); - RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL, - &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); - } - - - cqiCb->cqiLstEnt.next = NULLP; - cqiCb->cqiLstEnt.prev = NULLP; - cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - cqiCb->riDist = RG_SCH_INVALID_IDX; - - rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); - } - else - { - /* Present is SETUP(Enable) state, Recfg is Release(Disable) */ - rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); - } - - /* ccpu00140578:: */ - cqiCb->riRecpPrcsd = FALSE; - RETVALUE(ROK); -} - - -/* * @brief Handles SRS Re-configuration for a UE. - * - * @details - * - * Function : rgSCHCfgSrsUeReCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the - * validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific SRS related re configuration, - * - If SRS is configured modified(First time Enabled), - * - Update UE with the configured values. - * - Compute and Update next occurance of SRS Tranmission instance. - * - Update the SRS offset and SRS perodicity information - * - Add Ue to cell's list - * - If SRS is configured modified(Changed offset or index ), - * - Delete UE from cell->tIUeLstCp[n] if present - * - Update UE with the configured values. - * - Compute and Update next occurance of SRS Tranmission instance. - * - Update the SRS offset and SRS perodicity information - * - Add Ue to cell's list - * - If SRS is configured modified(disabled), - * - Delete UE from cell->tIUeLstCp[n] if present - * - Update next occurance of SRS Tranmission instance to "INVALID". - * - Update the SRS offset and SRS perodicity information "INVALID" - * - else - * - ROK - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeUlSrsCfg *srsCfg - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgSrsUeReCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeUlSrsCfg *srsCfg - ) -#else -PUBLIC S16 rgSCHCfgSrsUeReCfg(cellCb, ueCb, srsCfg) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeUlSrsCfg *srsCfg; -#endif -{ - - TRC3(rgSCHCfgSrsUeReCfg); - - - - if(( RGR_SCH_SRS_SETUP == srsCfg->type) || - ( RGR_SCH_SRS_SETUP != ueCb->srsCb.srsCfg.type )) - { - /* 1. Present is Release(Disable) state, Recfg is allowing - * SETUP(Enable) */ - rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); - } - else if (( RGR_SCH_SRS_SETUP == srsCfg->type ) && - ( RGR_SCH_SRS_SETUP == ueCb->srsCb.srsCfg.type)) - { - - /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable) - - 2.1 Delete UE from the cqiList - 2.2 Set next occurance Transmission instance to "INVALID" - 2.3 Compute Next occurance Transmission instance - 2.4 Placed ue in Transmission instance list. - */ - if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, - &ueCb->srsCb.srsLstEnt); - ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; - } - - rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); - } - else - { - /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable)*/ - rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); - } - /* ccpu00140578:: */ - ueCb->srsCb.srsRecpPrcsd = FALSE; - - RETVALUE(ROK); -} - -/* @brief Handles SR Re-configuration for a UE. - * - * @details - * - * Function : rgSCHCfgSrUeReCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE Re configuration. - * It shall do the validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific SR related re configuration, - * - If SR is configured modified(First time Enabled), - * - Update UE with the configured values. - * - Compute and Update next occurance of SR Tranmission instance. - * - Update the SR offset and SR perodicity information - * - Add Ue to cell->tIUeLstCp[n] - * - If SR is configured modified(Changed offset or index ), - * - Delete UE from cell->tIUeLstCp[n] if present - * - Update UE with the configured values. - * - Compute and Update next occurance of SR Tranmission instance. - * - Update the SR offset and SR perodicity information - * - Add Ue to cell->tIUeLstCp[n] - * - If SR is configured modified(disabled), - * - Delete UE from cell->tIUeLstCp[n] if present - * - Update next occurance of SR Tranmission instance to "INVALID". - * - Update the SR offset and SR perodicity information "INVALID" - * - else - * - ROK - * - * - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeCfg *ueCfg - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgSrUeReCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeSrCfg *srCfg - ) -#else -PUBLIC S16 rgSCHCfgSrUeReCfg(cellCb, ueCb, srCfg) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeSrCfg *srCfg; -#endif -{ - TRC3(rgSCHCfgSrUeReCfg); - - - /* Fix : syed Incorrect check for SR RECFG */ - if((srCfg->type == RGR_SCH_SR_SETUP) && - (ueCb->srCb.srCfg.type != RGR_SCH_SR_SETUP)) - { - /* - 1. Present is Release(Disable) state, Recfg is allowing SETUP(Enable) - */ - rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); - } - else if((srCfg->type == RGR_SCH_SR_SETUP) && - (ueCb->srCb.srCfg.type == RGR_SCH_SR_SETUP)) - { - - /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable) - - 2.1 Delete UE from the cqiList - 2.2 Compute Next occurance Transmission instace - */ - if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX ) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, - &ueCb->srCb.srLstEnt); - ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; - } - rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); - - } - else - { - /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable) */ - rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); - } - - RETVALUE(ROK); -} - -/* @brief Handles ACQI Re-configuration for a UE. - * - * @details - * - * Function : rgSCHCfgAcqiUeReCfg - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at UE Re configuration. - * It shall do the validations for the spec-defined values. - * - * Processing Steps: - * - For UE-specific ACQI related re configuration, - * - Check if the ACQI Mode has been changed from the - * existing Configuration. - * - If the configuration has been changed, - * - Call Aperiodic Config function to change the config - * - else - * - ROK - * - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeAprdDlCqiCfg *acqiCfg - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgAcqiUeReCfg -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb, - RgrUeAprdDlCqiCfg *acqiCfg, - CmLteUeCategory ueCat - ) -#else -PUBLIC S16 rgSCHCfgAcqiUeReCfg(cellCb, ueCb, acqiCfg, ueCat) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; - RgrUeAprdDlCqiCfg *acqiCfg; - CmLteUeCategory ueCat; -#endif -{ - TRC3(rgSCHCfgAcqiUeReCfg); - - RETVALUE(rgSCHCfgACqiUeCfg(cellCb,ueCb,(RG_SCH_CMN_GET_ACQICB(ueCb,cellCb)) - ,ueCb->mimoInfo.txMode, acqiCfg, ueCat)); - -} - -/***************************************************************** - * UE PCQI, RI, SRS and SR Configuration Delete * - * * - *****************************************************************/ - -/* @brief Free Periodic CQI/PMI/RI, SRS and SR transmission instance - * related data structures of this UE from CellCb - * - * @details - * - * Function : rgSCHCfgPCqiSrsSrUeDel - * - * Invoking Module Processing: - * - This shall be invoked by SCH_GOM at Ue deletion. - * - * Processing Steps: - * - For SRS Transmission Instance - * - if (srsTxInst!= RG_INVALID) - * - Remove from the cellCb->tIUeLstCp[srsTxInst*3+2] - * - else - * - Nothing to do - * - For SR Transmission Instance - * - if (srTxInst!= RG_INVALID) - * - Remove from the cellCb->tIUeLstCp[srTxInst*3+1] - * - else - * - Nothing to do - * - For Periodic CQI/PMI RI Transmission Instance - * - if (pCqiTxInst!= RG_INVALID) - * - Remove from the cellCb->tIUeLstCp[srTxInst*3+0] - * - else - * - Nothing to do - * - Return ROK - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * - * @return S16 - * -# ROK - */ -#ifdef ANSI -PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel -( - RgSchCellCb *cellCb, - RgSchUeCb *ueCb - ) -#else -PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel(cellCb, ueCb) - RgSchCellCb *cellCb; - RgSchUeCb *ueCb; -#endif -{ -#ifdef LTE_ADV - U32 cellIdx; - U32 sCellCnt = 0; -#endif - RgSchUePCqiCb *cqiRiCb = NULLP; - TRC3(rgSCHCfgPCqiSrsSrUeDel); - - cqiRiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); - - - - /* Delete SRS Transmission Instance */ - if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, - &ueCb->srsCb.srsLstEnt); - ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; - } - - /* Delete SR Transmission Instance */ - if (ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, - &ueCb->srCb.srLstEnt); - ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; - } - - /* Delete Periodic CQI/PMI Transmission Instance */ - if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst, - &cqiRiCb->cqiLstEnt); - cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; - - /* Delete Periodic RI Transmission Instance */ - - if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst, - &cqiRiCb->riLstEnt); - RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL, - &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst); - cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - } - } - -#ifdef LTE_ADV - for (cellIdx =1; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++) - { - /* If a serving cell is configured */ - if(ueCb->cellInfo[cellIdx] != NULLP) - { - /* If the serving cell is in ACTIVE state and - If it is not the same serving cell as cqiRiCb for which - collision is being checked */ - cqiRiCb = &ueCb->cellInfo[cellIdx]->cqiCb; - /* Delete Periodic CQI/PMI Transmission Instance */ - if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst, - &cqiRiCb->cqiLstEnt); - cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; - - /* Delete Periodic RI Transmission Instance */ - - if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX) - { - cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst, - &cqiRiCb->riLstEnt); - RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL, - &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst); - cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX; - } - } - sCellCnt++; - /* If all of the num of configured scells are checked then break */ - if (sCellCnt == ueCb->numSCells) - { - break; - } - } - } -#endif - - RETVALUE(ROK); -} - - -/* @brief Search the cfgIdx in given table and retrive periodicity & offset - * @details - * - * Function : rgSCHUtlGetCfgPerOff - * - * Invoking Module Processing: - * - This shall be invoked by Cfg Module - * - * Processing Steps: - * binary search for given entry in table - * find the periodicty, offset for a given config index from the table - * - Return ROK - * @param[in] RgSchPerTbl tbl - * @param[in] U16 cfgIdx - * @param[out] U16 *peri - * @param[out] U16 *offset - * - * @return S16 - * -# ROK - * - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetCfgPerOff -( - RgSchPerTbl tbl, - U16 cfgIdx, - U16 *peri, - U16 *offset - ) -#else -PUBLIC S16 rgSCHUtlGetCfgPerOff ( tbl, cfgIdx, peri, offset) - RgSchPerTbl tbl; - U16 cfgIdx; - U16 *peri; - U16 *offset; -#endif -{ - U8 mid; - U8 min = 0; - U8 max = 0; - CONSTANT RgSchUePCqiSrsSrCfgIdxTbl* table; - TRC3(rgSCHUtlGetCfgPerOff); - - /* Added the function instead of the MACRO to get the - * periodicity table */ - table = rgSCHCfgUtlGetPcqiSrsSrRiTbl ( tbl,&min,&max ); - do{ - mid = (min+max)/2; - if (( cfgIdx >= table[mid].min) && - ( cfgIdx <= table[mid].max)) - { - *peri = table[mid].peri; - *offset = cfgIdx - table[mid].offset; - break; - } - - if ( cfgIdx > table[mid].min) - { - min = mid+1; - } - else - { - max = mid-1; - } - - }while( min <= max ); - - RETVALUE(ROK); -} - - -/*********************************************************** - * - * Func : rgSCHCfgUtlFetchAcqiBitSz - * - * - * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them - * for decoding. - * - * Ret : Void - * ROK - RETVOID - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz -( - RgSchUeACqiCb *acqiCb, - U8 numTxAnt, - U8* cqiPmiSzR1, - U8* cqiPmiSzRn1 - ) -#else -PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz(acqiCb, numTxAnt, cqiPmiSzR1, cqiPmiSzRn1) - RgSchUeACqiCb *acqiCb; - U8 numTxAnt; - U8* cqiPmiSzR1; - U8* cqiPmiSzRn1; -#endif -{ - - U32 confRepMode; - - - TRC3(rgSCHCfgUtlFetchAcqiBitSz); - - confRepMode = acqiCb->aCqiCfg.aprdModeEnum; - switch(confRepMode) - { - case RGR_APRD_CQI_MOD12: - { - if(numTxAnt == 2) - { - *cqiPmiSzR1 = 4 + 2*acqiCb->N; - *cqiPmiSzRn1 = 8+ acqiCb->N; - } - else if(numTxAnt == 4) - { - *cqiPmiSzR1 = 4 + 4*acqiCb->N; - *cqiPmiSzRn1 = 8 + 4*acqiCb->N; - } - } - break; - - case RGR_APRD_CQI_MOD20: - { - *cqiPmiSzR1 = 6 + acqiCb->L; - *cqiPmiSzRn1 = 6 + acqiCb->L; - } - break; - - case RGR_APRD_CQI_MOD22: - { - if(numTxAnt == 2) - { - *cqiPmiSzR1 = 10 + acqiCb->L; - *cqiPmiSzRn1 = 14 + acqiCb->L; - } - else if(numTxAnt == 4) - { - *cqiPmiSzR1 = 14 + acqiCb->L; - *cqiPmiSzRn1 = 20 + acqiCb->L; - } - } - break; - - case RGR_APRD_CQI_MOD30: - { - *cqiPmiSzR1 = 4 + 2*acqiCb->N; - *cqiPmiSzRn1 = 4 + 2*acqiCb->N; - } - break; - - case RGR_APRD_CQI_MOD31: - { - if(numTxAnt == 2) - { - *cqiPmiSzR1 = 6 + 2*acqiCb->N; - *cqiPmiSzRn1 = 9 + 4*acqiCb->N; - } - else if(numTxAnt == 4) - { - *cqiPmiSzR1 = 8 + 2*acqiCb->N; - *cqiPmiSzRn1 = 12 + 4*acqiCb->N; - } - } - break; - default: - break; - } - RETVOID; -} -/* Added the function rgSCHCfgUtlGetPcqiCrsSrRiTbl to be used - * instead of the MACRO RG_SCH_GET_PERIODICITY_TBL */ -/*********************************************************** - * - * Func : rgSCHCfgUtlGetPcqiCrsSrRiTbl - * - * - * Desc : Get the Srs Cqi Crs Ri Table - * - * Ret : Void - * ROK - RETVOID - * - * Notes: - * - * File : - * - **********************************************************/ - -#ifdef ANSI -PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * rgSCHCfgUtlGetPcqiSrsSrRiTbl -( - RgSchPerTbl tblType, - U8* min, - U8* max -) -#else -PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * rgSCHCfgUtlGetPcqiSrsSrRiTbl(tblType, min, max) - RgSchPerTbl tblType; - U8* min; - U8* max; -#endif -{ - CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * table; - TRC3(rgSCHCfgUtlGetPcqiCrsSrRiTbl); - - switch (tblType) - { - - case RG_SCH_FDD_PCQI_TBL: - { - table = rgSchUePCqiCfgIdxFddTbl; - * min = 0; - * max=RG_SCH_CQIPMI_CFGIDX_MAX_FDD; - break; - } - case RG_SCH_TDD_PCQI_TBL: - { - table = rgSchUeCqiPmiCfgIdxTddTbl; - * min = 0; - * max=RG_SCH_CQIPMI_CFGIDX_MAX_TDD; - break; - } - case RG_SCH_RI_TBL: - { - table = rgSchUeRiCfgIdxTbl; - * min = 0; - * max=RG_SCH_RI_CFGIDX_MAX; - break; - } - case RG_SCH_FDD_SRS_TBL: - { - table = rgSchUeSrsCfgIdxFddTbl; - * min = 0; - * max=RG_SCH_SRS_ISRS_INDX_MAX_FDD; - break; - } - case RG_SCH_TDD_SRS_TBL: - { - table = rgSchUeSrsCfgIdxTddTbl; - * min = 0; - * max=RG_SCH_SRS_ISRS_INDX_MAX_TDD; - break; - } - case RG_SCH_SR_TBL: - { - table = rgSchUeSrCfgIdxTbl; - * min = 0; - * max=RG_SCH_ISR_INDX_MAX; - break; - } - default: - { - table = (CONSTANT RgSchUePCqiSrsSrCfgIdxTbl *) 0; - * min = 0; - * max = 0; - break; - } - - } - RETVALUE ( table ); -} -/* #endif */ -#endif /* TFU_UPGRADE */ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxUeCfg - * - * - * Desc : Validates UE DRX Timers Configuration recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxUeCfg -( -RgSchCellCb *cell, -RgrUeDrxCfg *ueDrxCfg -) -#else -PRIVATE S16 rgSCHCfgVldtDrxUeCfg(cell, ueDrxCfg) -RgSchCellCb *cell; -RgrUeDrxCfg *ueDrxCfg; -#endif -{ - TRC2(rgSCHCfgVldtDrxUeCfg) - - - if (ueDrxCfg->isDrxEnabled == FALSE) - { - RETVALUE(ROK); - } - -#ifdef LTEMAC_R9 - if ( ueDrxCfg->cqiMask.pres ) - { - if ( ueDrxCfg->cqiMask.val != RGR_DRX_SETUP ) - { -#ifdef ALIGN_64BIT - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid cqiMask configuration (%d)", - ueDrxCfg->cqiMask.val); -#else - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid cqiMask configuration(%ld)", - ueDrxCfg->cqiMask.val); -#endif - RETVALUE(RFAILED); - } - } -#endif /*LTEMAC_R9*/ -#ifdef EMTC_ENABLE - if(ueDrxCfg->isEmtcUe) - { - if(ueDrxCfg->drxOnDurTmrR13Pres) - { - if ( rgSCHEmtcCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d)", - ueDrxCfg->drxOnDurTmr); - RETVALUE(RFAILED); - } - } - else - { - if (rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d) for EMTC", - ueDrxCfg->drxOnDurTmr); - RETVALUE(RFAILED); - } - - } - } - else -#endif - { - if ( rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d) for EMTC", - ueDrxCfg->drxOnDurTmr); - RETVALUE(RFAILED); - } - } - - if ( rgSCHCfgVldtDrxInActvCfg(ueDrxCfg->drxInactvTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Inactivity configuration(%d)", - ueDrxCfg->drxInactvTmr); - RETVALUE(RFAILED); - } -#ifdef EMTC_ENABLE - if(ueDrxCfg->isEmtcUe) - { - if(ueDrxCfg->drxRetxTmrR13Pres) - { - if ( rgSCHEmtcCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d) for EMTC", - ueDrxCfg->drxRetxTmr); - RETVALUE(RFAILED); - } - } - else - { - if (rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d)", - ueDrxCfg->drxRetxTmr); - RETVALUE(RFAILED); - } - - } - } - else -#endif - { - if ( rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d)", - ueDrxCfg->drxRetxTmr); - RETVALUE(RFAILED); - } - } -#ifdef EMTC_ENABLE - if(ueDrxCfg->isEmtcUe) - { - if ( rgSCHEmtcCfgVldtDrxUlReTxCfg(ueDrxCfg->emtcDrxUlRetxTmr) != ROK ) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d) for EMTC", - ueDrxCfg->drxRetxTmr); - RETVALUE(RFAILED); - } - - } -#endif - - if ( rgSCHCfgVldtDrxLngCycCfg(ueDrxCfg->drxLongCycleOffst) != ROK ) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid LongCycle configuration"); - RETVALUE(RFAILED); - } - - if ( ueDrxCfg->drxLongCycleOffst.longDrxCycle < ueDrxCfg->drxOnDurTmr ) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " - " and onDuration timer values"); - RETVALUE(RFAILED); - } - -#ifdef LTE_TDD - if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxLongCycleOffst.longDrxCycle, - ueDrxCfg->drxOnDurTmr, ueDrxCfg->drxLongCycleOffst.drxStartOffst) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " - " and onDuration timer values"); - RETVALUE(RFAILED); - } -#endif - - if( TRUE == ueDrxCfg->drxShortDrx.pres ) - { - if ( ueDrxCfg->drxShortDrx.shortDrxCycle < ueDrxCfg->drxOnDurTmr ) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of short DRX " - "Cycle and onDuration timer values"); - RETVALUE(RFAILED); - } - - if ( (ueDrxCfg->drxLongCycleOffst.longDrxCycle % - ueDrxCfg->drxShortDrx.shortDrxCycle) != 0) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId," Long DRX cycle is not multiple of " - "short DRX cycle"); - RETVALUE(RFAILED); - } - - if ( rgSCHCfgVldtDrxShrtCycCfg(ueDrxCfg->drxShortDrx) != ROK ) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Short Cycle configuration"); - RETVALUE(RFAILED); - } - -#ifdef LTE_TDD - if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxShortDrx.shortDrxCycle, - ueDrxCfg->drxOnDurTmr, - ueDrxCfg->drxLongCycleOffst.drxStartOffst % - ueDrxCfg->drxShortDrx.shortDrxCycle) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " - " and onDuration timer values"); - RETVALUE(RFAILED); - } -#endif - } - - RETVALUE(ROK); -}/*rgSCHCfgVldtDrxUeCfg*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxOnDurCfg - * - * - * Desc : Validates UE DRX On Duration configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg -( -U8 onDurTmr -) -#else -PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg(onDurTmr) -U8 onDurTmr; -#endif -{ - TRC2(rgSCHCfgVldtDrxOnDurCfg) - - switch ( onDurTmr ) - { - case RGR_DRX_PRD_1PSF: - case RGR_DRX_PRD_2PSF: - case RGR_DRX_PRD_3PSF: - case RGR_DRX_PRD_4PSF: - case RGR_DRX_PRD_5PSF: - case RGR_DRX_PRD_6PSF: - case RGR_DRX_PRD_8PSF: - case RGR_DRX_PRD_10PSF: - case RGR_DRX_PRD_20PSF: - case RGR_DRX_PRD_30PSF: - case RGR_DRX_PRD_40PSF: - case RGR_DRX_PRD_50PSF: - case RGR_DRX_PRD_60PSF: - case RGR_DRX_PRD_80PSF: - case RGR_DRX_PRD_100PSF: - case RGR_DRX_PRD_200PSF: - break; - - default: - { - RETVALUE(RFAILED); - } - }/*switch(onDurTmr)*/ - - RETVALUE(ROK); -}/*rgSCHCfgVldtOnDurCfg*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxInActvCfg - * - * - * Desc : Validates UE DRX InActivity configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxInActvCfg -( -U16 inActvTmr -) -#else -PRIVATE S16 rgSCHCfgVldtDrxInActvCfg(inActvTmr) -U16 inActvTmr; -#endif -{ - TRC2(rgSCHCfgVldtDrxInActvCfg) - - switch ( inActvTmr ) - { - case RGR_DRX_PRD_1PSF: - case RGR_DRX_PRD_2PSF: - case RGR_DRX_PRD_3PSF: - case RGR_DRX_PRD_4PSF: - case RGR_DRX_PRD_5PSF: - case RGR_DRX_PRD_6PSF: - case RGR_DRX_PRD_8PSF: - case RGR_DRX_PRD_10PSF: - case RGR_DRX_PRD_20PSF: - case RGR_DRX_PRD_30PSF: - case RGR_DRX_PRD_40PSF: - case RGR_DRX_PRD_50PSF: - case RGR_DRX_PRD_60PSF: - case RGR_DRX_PRD_80PSF: - case RGR_DRX_PRD_100PSF: - case RGR_DRX_PRD_200PSF: - case RGR_DRX_PRD_300PSF: - case RGR_DRX_PRD_500PSF: - case RGR_DRX_PRD_750PSF: - case RGR_DRX_PRD_1280PSF: - case RGR_DRX_PRD_1920PSF: - case RGR_DRX_PRD_2560PSF: - break; - - default: - { - RETVALUE(RFAILED); - } - }/*switch(InactvTmr)*/ - - RETVALUE(ROK); -}/*rgSCHCfgVldtDrxInActvCfg*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxReTxCfg - * - * - * Desc : Validates DRX ReTx timer configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxReTxCfg -( -U8 reTxTmr -) -#else -PRIVATE S16 rgSCHCfgVldtDrxReTxCfg(reTxTmr) -U8 reTxTmr; -#endif -{ - TRC2(rgSCHCfgVldtDrxReTxCfg) - - switch ( reTxTmr ) - { - case RGR_DRX_PRD_1PSF: - case RGR_DRX_PRD_2PSF: - case RGR_DRX_PRD_4PSF: - case RGR_DRX_PRD_6PSF: - case RGR_DRX_PRD_8PSF: - case RGR_DRX_PRD_16PSF: - case RGR_DRX_PRD_24PSF: - case RGR_DRX_PRD_33PSF: - break; - - default: - { - RETVALUE(RFAILED); - } - }/*switch(drxRetxTmr)*/ - - RETVALUE(ROK); -}/*rgSCHCfgVldtDrxReTxCfg*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxShrtCycCfg - * - * - * Desc : Validates DRX Short Cycle timer configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg -( -RgrDrxLongCycleOffst lngCycleOffst -) -#else -PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg(lngCycleOffst) -RgrDrxLongCycleOffst lngCycleOffst; -#endif -{ - TRC2(rgSCHCfgVldtDrxLngCycCfg) - - if ( rgSCHCfgVldtDrxLngCyclTmrs(lngCycleOffst.longDrxCycle) != ROK ) - { - RETVALUE(RFAILED); - } - - if ( lngCycleOffst.drxStartOffst >= lngCycleOffst.longDrxCycle ) - { - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -}/*rgSCHCfgVldtDrxLngCycCfg*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxLngCyclTmrs - * - * - * Desc : Validates DRX Long Cycle timer values - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs -( -U16 val -) -#else -PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs(val) -U16 val; -#endif -{ - TRC2(rgSCHCfgVldtDrxLngCyclTmrs) - - switch ( val ) - { - case RGR_DRX_PRD_10SF: - case RGR_DRX_PRD_20SF: - case RGR_DRX_PRD_32SF: - case RGR_DRX_PRD_40SF: - case RGR_DRX_PRD_64SF: - case RGR_DRX_PRD_80SF: - case RGR_DRX_PRD_128SF: - case RGR_DRX_PRD_160SF: - case RGR_DRX_PRD_256SF: - case RGR_DRX_PRD_320SF: - case RGR_DRX_PRD_512SF: - case RGR_DRX_PRD_640SF: - case RGR_DRX_PRD_1024SF: - case RGR_DRX_PRD_1280SF: - case RGR_DRX_PRD_2048SF: - case RGR_DRX_PRD_2560SF: - break; - - default: - { - RETVALUE(RFAILED); - } - }/*switch(longDrxCycle)*/ - - RETVALUE(ROK); -}/*rgSCHCfgVldtDrxLngCyclTmrs*/ - -/*********************************************************** - * - * Func : rgSCHCfgVldtDrxShrtCycCfg - * - * - * Desc : Validates DRX Short Cycle timer configuration - * recieved from RRC. - * - * Ret : S16 - * ROK - Success - * - * RFAILED - Failed - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg -( -RgrDrxShortDrx shrtCycCfg -) -#else -PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg(shrtCycCfg) -RgrDrxShortDrx shrtCycCfg; -#endif -{ - TRC2(rgSCHCfgVldtDrxShrtCycCfg) - - switch(shrtCycCfg.shortDrxCycle) - { - case RGR_DRX_PRD_2SF: - case RGR_DRX_PRD_5SF: - case RGR_DRX_PRD_8SF: - case RGR_DRX_PRD_10SF: - case RGR_DRX_PRD_16SF: - case RGR_DRX_PRD_20SF: - case RGR_DRX_PRD_32SF: - case RGR_DRX_PRD_40SF: - case RGR_DRX_PRD_64SF: - case RGR_DRX_PRD_80SF: - case RGR_DRX_PRD_128SF: - case RGR_DRX_PRD_160SF: - case RGR_DRX_PRD_256SF: - case RGR_DRX_PRD_320SF: - case RGR_DRX_PRD_640SF: - break; - - default: - { - RETVALUE(RFAILED); - } - - }/*switch(shortDrxCycle)*/ - - if ( (shrtCycCfg.drxShortCycleTmr < RGR_DRX_SHRTCYCLE_MIN) || - (shrtCycCfg.drxShortCycleTmr > RGR_DRX_SHRTCYCLE_MAX) - ) - { - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} - -/** - * @brief Handler for TA related UE Reconfiguration. - * - * @details - * - * Function : rgSCHCfgUeTaRecfg - * - * This function shall fetch the TA timer related information into the - * respective ueCb from the UE configuration as provided by the - * upper layers. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * @param[in] RgrUeCfg *ueCfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE Void rgSCHCfgUeTaRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgrUeRecfg *ueCfg, -RgSchErrInfo *err -) -#else -PRIVATE Void rgSCHCfgUeTaRecfg(cell, ueCb, ueCfg, err) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -RgrUeRecfg *ueCfg; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHCfgUeTaRecfg) - - UNUSED(err); - - /* Update the TA related information */ - - if (ueCfg->ueTaTmrRecfg.pres) - { - /* Configuring taTmr with 30 deficit, to enable eNodeB sending - * TA command before the expiry of TA at UE. Also considering for - * possible retx for this TA command */ - /* [ccpu00121813]-ADD-Added chk if tatmr val > 30 */ - if(ueCfg->ueTaTmrRecfg.taTmr > 30) - { - ueCb->dl.taCb.cfgTaTmr = ueCfg->ueTaTmrRecfg.taTmr - 30; - } - /* If TA Timer is running. Stop it and then start it*/ - if (ueCb->taTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, ueCb->taTmr.tmrEvnt, ueCb); - rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr); - } - else - { - rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr); - } - } - RETVOID; -} /* rgSCHCfgUeTaRecfg */ - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) -/*********************************************************** - * - * Func : rgSCHCfgUeCqiReptReCfg - * - * - * Desc : Reconfiguration of PUSH N CQI Reporting - * - * Ret : RFAILED in case of failure - * ROK if success - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCfgUeCqiReptReCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE S16 rgSCHCfgUeCqiReptReCfg(cell, ue, ueRecfg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -#endif -{ - S16 retVal; - TRC3(rgSCHCfgUeCqiReptReCfg) - - /* Check has it been disabled */ - if(ueRecfg->ueCqiReptCfg.numColltdCqiRept) - { - /* Check if we need to send CQI reports collagted so far and send if so */ - if(ue->schCqiInfo.cqiCount >= - ueRecfg->ueCqiReptCfg.numColltdCqiRept) - { - RgrStaIndInfo *staInfo; - /* if yes, Send StaInd to RRM */ - retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo, - sizeof(RgrStaIndInfo)); - if(retVal != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Could not allocate memory for sending StaInd OLD CRNTI:%d",ueRecfg->oldCrnti); - RETVALUE(retVal); - } - - /* Fill StaInd for sending collated N CQI rpeort */ - rgSCHUtlFillSndStaInd(cell, ue, staInfo, - ueRecfg->ueCqiReptCfg.numColltdCqiRept); - } - } - else - { - ue->schCqiInfo.cqiCount = 0; - } - - ue->cqiReptCfgInfo.numColltdCqiRept = - ueRecfg->ueCqiReptCfg.numColltdCqiRept; - RETVALUE(ROK); -} /* End of rgSCHCfgUeCqiReptReCfg */ -#endif /* End of RGR_CQI_REPT */ -/*This function Added Ue in ongoing L2 Meas*/ -/*LTE_L2_MEAS_PHASE2*/ -#ifdef LTE_L2_MEAS -PRIVATE S16 rgSchAddToL2Meas(RgSchCellCb *cellCb,RgSchDlLcCb *dlLc) -{ - CmLList *lnk; - U16 idx; - RgSchL2MeasCb *measCb = NULLP; - lnk = cellCb->l2mList.first; - - while(lnk != NULLP) - { - /* Get the MeasCb : RgSchL2MeasCb */ - measCb = (RgSchL2MeasCb *)lnk->node; - if (measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) - { - for(idx = 0;idx < measCb->measReq.avgPrbQciDl.numQci;idx++) - { - if(measCb->measReq.avgPrbQciDl.qci[idx] == dlLc->qciCb->qci) - { - break; /*exit from for loop*/ - } - } - if(idx == measCb->measReq.avgPrbQciDl.numQci) - { - measCb->measReq.avgPrbQciDl.qci[measCb->measReq.avgPrbQciDl.numQci++] = dlLc->qciCb->qci; - } - } - lnk = lnk->next; - }/*End of while loop*/ - - RETVALUE(ROK); -} -#endif -#ifdef LTE_ADV -/** - * @brief UE SCell Buffer Free - * - * @details - * - * Function : rgSCHSCellFreeBuf - * - * This functions will free allocated memory - * for UE secondart cellCB - * - * - * @param[in] Inst inst - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] U8 idx - * @return VOID - **/ -#ifdef ANSI -PUBLIC Void rgSCHSCellFreeBuf -( -Inst inst, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -U8 idx -) -#else -PUBLIC Void rgSCHSCellFreeBuf(inst ,ue, ueRecfg, idx) -Inst inst; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -U8 idx; -#endif -{ - RgSchUeCellInfo *sCellInfo = NULLP; - RgrUeSecCellCfg *sCellInfoRecfg = NULLP; - - TRC2(rgSCHSCellFreeBuf); - - for(U8 i = 0; i <= idx; i++) - { - sCellInfoRecfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[i]; - sCellInfo = ue->cellInfo[(sCellInfoRecfg->sCellIdx)]; - - if (NULLP != sCellInfo) - { - rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo), - sizeof(RgSchUeCellInfo)); - ue->cellInfo[(sCellInfoRecfg->sCellIdx)] = NULLP; - - } - } - RETVOID; -} -#endif -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_cmn.c b/src/5gnrmac/rg_sch_cmn.c deleted file mode 100755 index 3c1b490bc..000000000 --- a/src/5gnrmac/rg_sch_cmn.c +++ /dev/null @@ -1,32150 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch_cmn.c - -**********************************************************************/ - -/** @file rg_sch_cmn.c -@brief This file implements the schedulers main access to MAC layer code. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=187; -static int RLOG_MODULE_ID=4096; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system service interface */ -#include "cm_hash.h" /* common hash list */ -#include "cm_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ -#include "cm5.h" -#include "lrg.h" -#include "rgr.h" -#include "tfu.h" -#include "rgm.h" -#include "rg_env.h" -#include "rg_sch_err.h" -#include "rg_sch_inf.h" -#include "rg_sch.h" -#include "rg_sch_cmn.h" -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* TFU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for Scheduler */ -#include "rg_sch_cmn.x" /* typedefs for Scheduler */ -#ifdef MAC_SCH_STATS -#include "lrg.x" /* Stats Structures */ -#endif /* MAC_SCH_STATS */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef EMTC_ENABLE -EXTERN U32 emtcStatsUlTomSrInd; -EXTERN U32 emtcStatsUlBsrTmrTxp; -#endif - -#define RG_ITBS_DIFF(_x, _y) ((_x) > (_y) ? (_x) - (_y) : (_y) - (_x)) -EXTERN Void rgSCHSc1UlInit ARGS((RgUlSchdApis *apis)); -#ifdef RG_PHASE2_SCHED -EXTERN Void rgSCHRrUlInit ARGS((RgUlSchdApis *apis)); -#ifdef EMTC_ENABLE -EXTERN Void rgSCHEmtcHqInfoFree ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); -EXTERN Void rgSCHEmtcRrUlInit ARGS((RgUlSchdApis *apis)); -EXTERN Void rgSCHEmtcCmnDlInit ARGS((Void)); -EXTERN Void rgSCHEmtcCmnUlInit ARGS((Void)); -EXTERN Void rgSCHEmtcCmnUeNbReset ARGS((RgSchUeCb *ueCb)); -EXTERN RgSchCmnCqiToTbs *rgSchEmtcCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI]; -#endif -EXTERN Void rgSCHMaxciUlInit ARGS((RgUlSchdApis *apis)); -EXTERN Void rgSCHPfsUlInit ARGS((RgUlSchdApis *apis)); -#endif -EXTERN Void rgSCHSc1DlInit ARGS((RgDlSchdApis *apis)); -#ifdef RG_PHASE2_SCHED -EXTERN Void rgSCHRrDlInit ARGS((RgDlSchdApis *apis)); -#ifdef EMTC_ENABLE -EXTERN Void rgSCHEmtcRrDlInit ARGS((RgDlEmtcSchdApis *apis)); -#endif -EXTERN Void rgSCHMaxciDlInit ARGS((RgDlSchdApis *apis)); -EXTERN Void rgSCHPfsDlInit ARGS((RgDlSchdApis *apis)); -#ifdef TFU_UPGRADE -EXTERN Void rgSCHDlfsInit ARGS((RgDlfsSchdApis *apis)); -#endif -#endif -#ifdef EMTC_ENABLE -EXTERN Void rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl ARGS((RgSchCellCb *cell)); -EXTERN Void rgSCHCmnGetEmtcDciFrmtSizes ARGS((RgSchCellCb *cell)); -EXTERN Void rgSCHEmtcRrUlProcRmvFrmRetx ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *proc)); -EXTERN S16 rgSCHCmnPrecompEmtcMsg3Vars -ARGS(( -RgSchCmnUlCell *cellUl, -U8 ccchCqi, -U16 msgSzA, -U8 sbSize, -Bool isEcp -)); -PUBLIC Void rgSCHEmtcCmnUeCcchSduDel -( -RgSchCellCb *cell, -RgSchUeCb *ueCb -); -EXTERN Void rgSCHEmtcRmvFrmTaLst -( -RgSchCmnDlCell *cellDl, -RgSchUeCb *ue -); -EXTERN Void rgSCHEmtcInitTaLst -( -RgSchCmnDlCell *cellDl -); -EXTERN Void rgSCHEmtcAddToTaLst -( -RgSchCmnDlCell *cellDl, -RgSchUeCb *ue -); - -#endif - -#ifdef RGR_SI_SCH -PRIVATE Void rgSCHDlSiSched ARGS((RgSchCellCb *cell, - RgSchCmnDlRbAllocInfo *allocInfo, - RgInfSfAlloc *subfrmAlloc)); -PRIVATE Void rgSCHChkNUpdSiCfg ARGS((RgSchCellCb *cell)); -PRIVATE Void rgSCHSelectSi ARGS((RgSchCellCb *cell)); -#endif /*RGR_SI_SCH*/ -/* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD -PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -); -PRIVATE S16 rgSCHCmnBuildRntpInfo ( -RgSchCellCb *cell, -U8 *rntpPtr, -U8 startRb, -U8 nmbRb, -U16 bw -); -#endif - -PUBLIC Void rgSCHCmnDlSpsSch -( - RgSchCellCb *cell -); -/* LTE_ADV_FLAG_REMOVED_END */ - -PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHBcchPcchDlRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnDlBcchPcchAlloc ARGS(( -RgSchCellCb *cell -)); -#ifdef RGR_CQI_REPT -PRIVATE Void rgSCHCmnDlCqiOnPucchInd ARGS (( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - RgrUeCqiRept *ueCqiRept, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - )); -PRIVATE Void rgSCHCmnDlCqiOnPuschInd ARGS (( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPusch *puschCqi, - RgrUeCqiRept *ueCqiRept, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - )); -#else -PRIVATE Void rgSCHCmnDlCqiOnPucchInd ARGS (( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - )); -PRIVATE Void rgSCHCmnDlCqiOnPuschInd ARGS (( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPusch *puschCqi - )); -#endif -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT -PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept ARGS(( - RgSchCellCb *cell, - RgSchUeCb *ue, - RgrUeCqiRept *ueCqiRept)); -#endif /* End of RGR_CQI_REPT */ -/* Fix: syed align multiple UEs to refresh at same time */ -PRIVATE Void rgSCHCmnGetRefreshPer ARGS(( - RgSchCellCb *cell, - RgSchUeCb *ue, - U32 *waitPer)); -PRIVATE S16 rgSCHCmnApplyUeRefresh ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue)); -#ifdef DL_LA -PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE Void rgSCHCheckAndSetTxScheme ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -#endif - -#ifdef LTE_TDD -PRIVATE U32 rgSCHCmnCalcDwPtsTbSz ARGS -(( -RgSchCellCb *cell, -U32 bo, -U8 *rb, -U8 *iTbs, -U8 lyr, -U8 cfi -)); - -PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw ARGS -(( -RgSchCellCb *cell, -U32 bo, -U8 *rb, -U8 maxRb, -U8 *iTbs1, -U8 *iTbs2, -U8 lyr1, -U8 lyr2, -U32 *tb1Sz, -U32 *tb2Sz, -U8 cfi -)); - -#endif -PRIVATE Void rgSCHCmnNonDlfsType0Alloc -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -RgSchUeCb *ue -); -PRIVATE Void rgSCHCmnInitRbAlloc ARGS -(( -RgSchCellCb *cell -)); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/* local defines */ -PUBLIC RgSchdApis rgSchCmnApis; -PRIVATE RgUlSchdApis rgSchUlSchdTbl[RGSCH_NUM_SCHEDULERS]; -PRIVATE RgDlSchdApis rgSchDlSchdTbl[RGSCH_NUM_SCHEDULERS]; -#ifdef EMTC_ENABLE -PRIVATE RgUlSchdApis rgSchEmtcUlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS]; -PRIVATE RgDlEmtcSchdApis rgSchEmtcDlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS]; -#endif -#ifdef RG_PHASE2_SCHED -PRIVATE RgDlfsSchdApis rgSchDlfsSchdTbl[RGSCH_NUM_DLFS_SCHEDULERS]; -#endif -PRIVATE RgUlSchdInits rgSchUlSchdInits = RGSCH_ULSCHED_INITS; -PRIVATE RgDlSchdInits rgSchDlSchdInits = RGSCH_DLSCHED_INITS; -#ifdef EMTC_ENABLE -PRIVATE RgEmtcUlSchdInits rgSchEmtcUlSchdInits = RGSCH_EMTC_ULSCHED_INITS; -PRIVATE RgEmtcDlSchdInits rgSchEmtcDlSchdInits = RGSCH_EMTC_DLSCHED_INITS; -#endif -#if (defined (RG_PHASE2_SCHED) && defined (TFU_UPGRADE)) -PRIVATE RgDlfsSchdInits rgSchDlfsSchdInits = RGSCH_DLFSSCHED_INITS; -#endif - -typedef Void (*RgSchCmnDlAllocRbFunc) ARGS((RgSchCellCb *cell, RgSchDlSf *subFrm, -RgSchUeCb *ue, U32 bo, U32 *effBo, RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo)); -typedef U8 (*RgSchCmnDlGetPrecInfFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - U8 numLyrs, Bool bothCwEnbld)); - -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1 ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -)); -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -)); -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -)); -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2 ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -)); -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -)); -PRIVATE Void rgSCHCmnDlAllocTxRbTM1 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocTxRbTM2 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocTxRbTM3 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocTxRbTM4 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -#ifdef RG_UNUSED -PRIVATE Void rgSCHCmnDlAllocTxRbTM5 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -#endif -PRIVATE Void rgSCHCmnDlAllocTxRbTM6 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocTxRbTM7 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocRetxRbTM1 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocRetxRbTM2 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocRetxRbTM3 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocRetxRbTM4 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -#ifdef RG_UNUSED -PRIVATE Void rgSCHCmnDlAllocRetxRbTM5 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -#endif -PRIVATE Void rgSCHCmnDlAllocRetxRbTM6 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlAllocRetxRbTM7 ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); - -#ifdef LTE_ADV -PRIVATE U8 rgSchGetN1ResCount ARGS (( - RgSchUeCb *ue, - U16 servCellId -)); -PUBLIC Bool rgSchCmnChkDataOnlyOnPcell -( - RgSchUeCb *ue, - RgSchDlSf *dlSf -); -#endif /*LTE_ADV */ -PUBLIC U8 rgSCHCmnCalcPcqiBitSz -( - RgSchUeCb *ueCb, - U8 numTxAnt -); - -#ifndef LTE_ADV -/* Functions specific to each transmission mode for DL Tx RB Allocation*/ -RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[7] = {rgSCHCmnDlAllocTxRbTM1, -rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4, -NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7}; - -/* Functions specific to each transmission mode for DL Retx RB Allocation*/ -RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[7] = {rgSCHCmnDlAllocRetxRbTM1, -rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4, -NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7}; -#else -/* Functions specific to each transmission mode for DL Tx RB Allocation*/ -RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[9] = {rgSCHCmnDlAllocTxRbTM1, -rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4, -NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7, NULLP, NULLP}; - -/* Functions specific to each transmission mode for DL Retx RB Allocation*/ -RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[9] = {rgSCHCmnDlAllocRetxRbTM1, -rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4, -NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7, NULLP, NULLP}; - -#endif - - -PRIVATE U8 rgSCHCmnDlTM3PrecInf2 ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -)); -PRIVATE U8 rgSCHCmnDlTM3PrecInf4 ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -)); -PRIVATE U8 rgSCHCmnDlTM4PrecInf2 ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -)); -PRIVATE U8 rgSCHCmnDlTM4PrecInf4 ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -)); -/* Functions specific to each transmission mode for DL RB Allocation*/ -RgSchCmnDlGetPrecInfFunc getPrecInfoFunc[2][2] = { -{rgSCHCmnDlTM3PrecInf2, rgSCHCmnDlTM3PrecInf4}, -{rgSCHCmnDlTM4PrecInf2, rgSCHCmnDlTM4PrecInf4} -}; - -PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *tbInfo, -U8 noLyr, -U8 *numRb, -U32 *effBo -)); -PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U8 *numRb, -Bool *swpFlg, -U32 *effBo -)); -PRIVATE Void rgSCHCmnDlTM3TxTx ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlTM3TxRetx ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); -PRIVATE Void rgSCHCmnDlTM3RetxRetx ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -)); - -PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -)); -/* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD -PRIVATE Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -)); -#endif -/* LTE_ADV_FLAG_REMOVED_END */ -PRIVATE Void rgSCHCmnDlRbInfoAddUeTx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc -)); -PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -)); -PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst ARGS(( -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc -)); -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *reTxTb, -RgSchDlHqTbCb *txTb, -U8 *numRb, -U32 *effBo -)); -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U32 bo, -U8 *numRb, -U32 *effBo -)); -PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *tbInfo, -U32 bo, -U8 *numRb, -U32 *effBo -)); -#ifndef LTEMAC_SPS -PRIVATE Void rgSCHCmnFillHqPTb ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -U8 tbAllocIdx, -RgSchPdcch *pdcch -)); -#endif -#ifdef LTEMAC_SPS -PRIVATE Void rgSCHCmnDlGetBestFitHole ARGS(( -U32 *allocMask, -U8 numMaskRbs, -U32 *crntAllocMask, -U8 rbsReq, -U8 *allocStart, -U8 *allocNumRbs, -Bool isPartialAlloc -)); -#ifdef RGSCH_SPS_UNUSED -PRIVATE U32 rgSCHCmnGetRaType1Mask ARGS(( -U8 rbIdx, -U8 rbgSize, -U8 *type1Subset -)); -#endif -PRIVATE U32 rgSCHCmnGetRaType0Mask ARGS(( -U8 rbIdx, -U8 rbgSize -)); -PRIVATE U32 rgSCHCmnGetRaType2Mask ARGS(( -U8 rbIdx, -U8 *maskIdx -)); -#endif - -PUBLIC Bool rgSCHCmnRetxAllocAvoid ARGS(( -RgSchDlSf *subFrm, -RgSchCellCb *cell, -RgSchDlHqProcCb *proc -)); - -PUBLIC U16 rgSCHCmnGetSiSetId ARGS(( -U16 sfn, -U8 sf, -U16 minPeriodicity -)); - -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 maxRb, -U32 *numSb, -U8 *iTbs, -U32 hqSz, -U32 stepDownItbs, -U32 effTgt -)); -#endif - -#ifdef RG_5GTF -//TODO_SID: Currenly table is only for 100 Prbs. Need to modify wrt VRBG table 8.1.5.2.1-1 V5G_213 -U32 rgSch5gtfTbSzTbl[MAX_5GTF_MCS] = - {1864, 5256, 8776, 13176, 17576, 21976, 26376, 31656, 35176, 39576, 43976, 47496, 52776, 59376, 66392}; -U32 g5gtfTtiCnt = 0; -U32 gUl5gtfSrRecv = 0; -U32 gUl5gtfBsrRecv = 0; -U32 gUl5gtfUeSchPick = 0; -U32 gUl5gtfPdcchSchd = 0; -U32 gUl5gtfAllocAllocated = 0; -U32 gUl5gtfUeRbAllocDone = 0; -U32 gUl5gtfUeRmvFnlzZeroBo = 0; -U32 gUl5gtfUeFnlzReAdd = 0; -U32 gUl5gtfPdcchSend = 0; -U32 gUl5gtfRbAllocFail = 0; -U32 ul5gtfsidUlMarkUl = 0; -U32 ul5gtfsidDlSchdPass = 0; -U32 ul5gtfsidDlAlreadyMarkUl = 0; -U32 ul5gtfTotSchdCnt = 0; -#endif - -/* CQI Offset Index to Beta CQI Offset value mapping, - * stored as parts per 1000. Reserved is set to 0. - * Refer 36.213 sec 8.6.3 Tbl 8.6.3-3 */ -PUBLIC U32 rgSchCmnBetaCqiOffstTbl[16] = {0, 0, 1125, - 1250, 1375, 1625, 1750, 2000, 2250, 2500, 2875, - 3125, 3500, 4000, 5000, 6250}; -PUBLIC U32 rgSchCmnBetaHqOffstTbl[16] = {2000, 2500, 3125, - 4000, 5000, 6250, 8000,10000, 12625, 15875, 20000, - 31000, 50000,80000,126000,0}; -PUBLIC U32 rgSchCmnBetaRiOffstTbl[16] = {1250, 1625, 2000, - 2500, 3125, 4000, 5000, 6250, 8000, 10000,12625, - 15875,20000,0,0,0}; -PUBLIC S8 rgSchCmnDlCqiDiffOfst[8] = {0, 1, 2, 3, -4, -3, -2, -1}; - -/* Include CRS REs while calculating Efficiency */ -CONSTANT PRIVATE U8 rgSchCmnAntIdx[5] = {0,0,1,0,2}; -CONSTANT PRIVATE U8 rgSchCmnNumResForCrs[5] = {0,6,12,0,16}; -U32 cfiSwitchCnt ; -U32 cfiIncr ; -U32 cfiDecr ; - - -#ifdef TFU_UPGRADE -PUBLIC S8 rgSchCmnApUeSelDiffCqi[4] = {1, 2, 3, 4}; -PUBLIC S8 rgSchCmnApEnbConfDiffCqi[4] = {0, 1, 2, -1}; -#endif - -typedef struct rgSchCmnDlUeDciFrmtOptns -{ - TfuDciFormat spfcDciFrmt; /* TM(Transmission Mode) specific DCI format. - * Search space : UE Specific by C-RNTI only. */ - U8 spfcDciRAType; /* Resource Alloctn(RA) type for spfcDciFrmt */ - TfuDciFormat prfrdDciFrmt; /* Preferred DCI format among the available - * options for TD (Transmit Diversity) */ - U8 prfrdDciRAType; /* Resource Alloctn(RA) type for prfrdDciFrmt */ -}RgSchCmnDlUeDciFrmtOptns; -#ifndef LTE_ADV - -/* DCI Format options for each Transmission Mode */ -RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[7] = { - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2} -}; - -#else -/* DCI Format options for each Transmission Mode */ -RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[9] = { - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, - {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2} -}; -#endif - - -typedef struct rgSchCmnDlImcsTbl -{ - U8 modOdr; /* Modulation Order */ - U8 iTbs; /* ITBS */ -}RgSchCmnDlImcsTbl[29]; - -CONSTANT struct rgSchCmnMult235Info -{ - U8 match; /* Closest number satisfying 2^a.3^b.5^c, with a bias - * towards the smaller number */ - U8 prvMatch; /* Closest number not greater than array index - * satisfying 2^a.3^b.5^c */ -} rgSchCmnMult235Tbl[110+1] = { - {0, 0}, /* dummy */ - {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {6, 6}, {8, 8}, - {9, 9}, {10, 10}, {10, 10}, {12, 12}, {12, 12}, {15, 12}, {15, 15}, - {16, 16}, {16, 16}, {18, 18}, {18, 18}, {20, 20}, {20, 20}, {20, 20}, - {24, 20}, {24, 24}, {25, 25}, {25, 25}, {27, 27}, {27, 27}, {30, 27}, - {30, 30}, {30, 30}, {32, 32}, {32, 32}, {32, 32}, {36, 32}, {36, 36}, - {36, 36}, {36, 36}, {40, 36}, {40, 40}, {40, 40}, {40, 40}, {45, 40}, - {45, 40}, {45, 45}, {45, 45}, {48, 45}, {48, 48}, {48, 48}, {50, 50}, - {50, 50}, {50, 50}, {54, 50}, {54, 54}, {54, 54}, {54, 54}, {54, 54}, - {60, 54}, {60, 54}, {60, 60}, {60, 60}, {60, 60}, {64, 60}, {64, 64}, - {64, 64}, {64, 64}, {64, 64}, {64, 64}, {72, 64}, {72, 64}, {72, 64}, - {72, 72}, {72, 72}, {75, 72}, {75, 75}, {75, 75}, {75, 75}, {80, 75}, - {80, 75}, {80, 80}, {81, 81}, {81, 81}, {81, 81}, {81, 81}, {81, 81}, - {90, 81}, {90, 81}, {90, 81}, {90, 81}, {90, 90}, {90, 90}, {90, 90}, - {90, 90}, {96, 90}, {96, 90}, {96, 96}, {96, 96}, {96, 96}, {100, 96}, - {100, 100}, {100, 100}, {100, 100}, {100, 100}, {100, 100}, {108, 100}, - {108, 100}, {108, 100}, {108, 108}, {108, 108}, {108, 108} -}; - -/* R8 Upgrade */ -/* BI table from 36.321 Table 7.2.1 */ -CONSTANT PRIVATE S16 rgSchCmnBiTbl[RG_SCH_CMN_NUM_BI_VAL] = { - 0, 10, 20, 30,40,60,80,120,160,240,320,480,960}; -PUBLIC RgSchCmnUlCqiInfo rgSchCmnUlCqiTbl[RG_SCH_CMN_UL_NUM_CQI] = { - { 0, 0 }, - {RGSCH_CMN_QM_CQI_1,RGSCH_CMN_UL_EFF_CQI_1 }, - {RGSCH_CMN_QM_CQI_2,RGSCH_CMN_UL_EFF_CQI_2 }, - {RGSCH_CMN_QM_CQI_3,RGSCH_CMN_UL_EFF_CQI_3 }, - {RGSCH_CMN_QM_CQI_4,RGSCH_CMN_UL_EFF_CQI_4 }, - {RGSCH_CMN_QM_CQI_5,RGSCH_CMN_UL_EFF_CQI_5 }, - {RGSCH_CMN_QM_CQI_6,RGSCH_CMN_UL_EFF_CQI_6 }, - {RGSCH_CMN_QM_CQI_7,RGSCH_CMN_UL_EFF_CQI_7 }, - {RGSCH_CMN_QM_CQI_8,RGSCH_CMN_UL_EFF_CQI_8 }, - {RGSCH_CMN_QM_CQI_9,RGSCH_CMN_UL_EFF_CQI_9 }, - {RGSCH_CMN_QM_CQI_10,RGSCH_CMN_UL_EFF_CQI_10 }, - {RGSCH_CMN_QM_CQI_11,RGSCH_CMN_UL_EFF_CQI_11 }, - {RGSCH_CMN_QM_CQI_12,RGSCH_CMN_UL_EFF_CQI_12 }, - {RGSCH_CMN_QM_CQI_13,RGSCH_CMN_UL_EFF_CQI_13 }, - {RGSCH_CMN_QM_CQI_14,RGSCH_CMN_UL_EFF_CQI_14 }, - {RGSCH_CMN_QM_CQI_15,RGSCH_CMN_UL_EFF_CQI_15 }, -}; - -#ifdef RG_UNUSED -/* This table maps a (delta_offset * 2 + 2) to a (beta * 8) - * where beta is 10^-(delta_offset/10) rounded off to nearest 1/8 - */ -PRIVATE U16 rgSchCmnUlBeta8Tbl[29] = { - 6, RG_SCH_CMN_UL_INVALID_BETA8, 8, 9, 10, 11, 13, 14, 16, 18, 20, 23, - 25, 28, 32, RG_SCH_CMN_UL_INVALID_BETA8, 40, RG_SCH_CMN_UL_INVALID_BETA8, - 50, RG_SCH_CMN_UL_INVALID_BETA8, 64, RG_SCH_CMN_UL_INVALID_BETA8, 80, - RG_SCH_CMN_UL_INVALID_BETA8, 101, RG_SCH_CMN_UL_INVALID_BETA8, 127, - RG_SCH_CMN_UL_INVALID_BETA8, 160 -}; -#endif - -/* QCI to SVC priority mapping. Index specifies the Qci*/ -PRIVATE U8 rgSchCmnDlQciPrio[RG_SCH_CMN_MAX_QCI] = RG_SCH_CMN_QCI_TO_PRIO; - -/* The configuration is efficiency measured per 1024 REs. */ -/* The first element stands for when CQI is not known */ -/* This table is used to translate CQI to its corrospoding */ -/* allocation parameters. These are currently from 36.213 */ -/* Just this talbe needs to be edited for modifying the */ -/* the resource allocation behaviour */ - -/* ADD CQI to MCS mapping correction - * single dimensional array is replaced by 2 dimensions for different CFI*/ -PRIVATE U16 rgSchCmnCqiPdschEff[4][16] = {RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI1, - RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI2,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI3}; - -PRIVATE U16 rgSchCmn2LyrCqiPdschEff[4][16] = {RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI1, - RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI2, RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI3}; - -/* This configuration determines the transalation of a UEs CQI to its */ -/* PDCCH coding efficiency. This may be edited based on the installation */ -PRIVATE U8 rgSchCmnDlRvTbl[4] = {0, 2, 3, 1}; /* RVIdx sequence is corrected*/ - -/* Indexed by [DciFrmt]. - * Considering the following definition in determining the dciFrmt index. - * typedef enum -{ - TFU_DCI_FORMAT_0, - TFU_DCI_FORMAT_1, - TFU_DCI_FORMAT_1A, - TFU_DCI_FORMAT_1B, - TFU_DCI_FORMAT_1C, - TFU_DCI_FORMAT_1D, - TFU_DCI_FORMAT_2, - TFU_DCI_FORMAT_2A, - TFU_DCI_FORMAT_3, - TFU_DCI_FORMAT_3A -} TfuDciFormat; -*/ -PRIVATE U16 rgSchCmnDciFrmtSizes[10]; - - -PRIVATE U16 rgSchCmnCqiPdcchEff[16] = RG_SCH_CMN_CQI_TO_PDCCH_EFF; - -#ifdef LTE_TDD - -PUBLIC RgSchTddUlDlSubfrmTbl rgSchTddUlDlSubfrmTbl = { - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, - {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME} -}; - -/* SPS_INTG_FIX */ -#ifdef LTEMAC_SPS -PUBLIC U8 rgSchTddSpsDlMaxRetxTbl[RGSCH_MAX_TDD_UL_DL_CFG] = { - /* 0 */ 6, - /* 1 */ 7, - /* 2 */ 8, - /* 3 */ 11, - /* 4 */ 12, - /* 5 */ 13, - /* 6 */ 7}; - -#endif - - -/* Special Subframes in OFDM symbols */ -/* ccpu00134197-MOD-Correct the number of symbols */ -PUBLIC RgSchTddSplSubfrmInfoTbl rgSchTddSplSubfrmInfoTbl = { - {3, 1, 1, 3, 1, 1}, - {9, 1, 1, 8, 1, 1}, - {10, 1, 1, 9, 1, 1}, - {11, 1, 1, 10, 1, 1}, - {12, 1, 1, 3, 2, 2}, - {3, 2, 2, 8, 2, 2}, - {9, 2, 2, 9, 2, 2}, - {10, 2, 2, 0, 0, 0}, - {11, 2, 2, 0, 0, 0} -}; - -/* PHICH 'm' value Table */ -PUBLIC RgSchTddPhichMValTbl rgSchTddPhichMValTbl = { - {2, 1, 0, 0, 0, 2, 1, 0, 0, 0}, - {0, 1, 0, 0, 1, 0, 1, 0, 0, 1}, - {0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {1, 1, 0, 0, 0, 1, 1, 0, 0, 1} -}; - -/* PHICH 'K' value Table */ -PUBLIC RgSchTddKPhichTbl rgSchTddKPhichTbl = { - {0, 0, 4, 7, 6, 0, 0, 4, 7, 6}, - {0, 0, 4, 6, 0, 0, 0, 4, 6, 0}, - {0, 0, 6, 0, 0, 0, 0, 6, 0, 0}, - {0, 0, 6, 6, 6, 0, 0, 0, 0, 0}, - {0, 0, 6, 6, 0, 0, 0, 0, 0, 0}, - {0, 0, 6, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 4, 6, 6, 0, 0, 4, 7, 0} -}; - -/* Uplink association index 'K' value Table */ -PUBLIC RgSchTddUlAscIdxKDashTbl rgSchTddUlAscIdxKDashTbl = { - {0, 0, 6, 4, 0, 0, 0, 6, 4, 0}, - {0, 0, 4, 0, 0, 0, 0, 4, 0, 0}, - {0, 0, 4, 4, 4, 0, 0, 0, 0, 0}, - {0, 0, 4, 4, 0, 0, 0, 0, 0, 0}, - {0, 0, 4, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 7, 7, 5, 0, 0, 7, 7, 0} -}; - - -/* PUSCH 'K' value Table */ -PUBLIC RgSchTddPuschTxKTbl rgSchTddPuschTxKTbl = { - {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, - {0, 6, 0, 0, 4, 0, 6, 0, 0, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 4, 0}, - {4, 0, 0, 0, 0, 0, 0, 0, 4, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 4, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 4, 0}, - {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} -}; - -/* PDSCH to PUCCH Table for DL Harq Feed back. Based on the - Downlink association set index 'K' table */ -PUBLIC U8 rgSchTddPucchTxTbl[7][10] = { - {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, - {7, 6, 0, 0, 4, 7, 6, 0, 0, 4}, - {7, 6, 0, 4, 8, 7, 6, 0, 4, 8}, - {4, 11, 0, 0, 0, 7, 6, 6, 5, 5}, - {12, 11, 0, 0, 8, 7, 7, 6, 5, 4}, - {12, 11, 0, 9, 8, 7, 6, 5, 4, 13}, - {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} -}; - -/* Table to fetch the next DL sf idx for applying the - new CFI. The next Dl sf Idx at which the new CFI - is applied is always the starting Sf of the next ACK/NACK - Fdbk bundle. - - Ex: In Cfg-2, sf4 and sf9 are the only subframes at which - a new ACK/NACK bundle of DL subframes can start - - D S U D D D S U D D D S U D D D S U D D - 4 9 - - dlSf Array for Cfg-2: - sfNum: 0 1 3 4 5 6 8 9 0 1 3 4 5 6 8 9 - sfIdx: 0 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 - - If CFI changes at sf0, nearest DL SF bundle >= 4 TTI is sf4 - So at sf4 the new CFI can be applied. To arrive at sf4 from - sf0, the sfIdx has to be increased by 3 */ - -PUBLIC U8 rgSchTddPdcchSfIncTbl[7][10] = { - /* A/N Bundl: 0,1,5,6*/ {2, 1, 0, 0, 0, 2, 1, 0, 0, 0}, - /* A/N Bundl: 0,4,5,9*/ {2, 2, 0, 0, 3, 2, 2, 0, 0, 3}, - /* A/N Bundl: 4,9*/ {3, 6, 0, 5, 4, 3, 6, 0, 5, 4}, - /* A/N Bundl: 1,7,9*/ {4, 3, 0, 0, 0, 4, 5, 4, 6, 5}, - /* A/N Bundl: 0,6*/ {4, 3, 0, 0, 6, 5, 4, 7, 6, 5}, - /* A/N Bundl: 9*/ {8, 7, 0, 6, 5, 4, 12, 11, 10, 9}, - /* A/N Bundl: 0,1,5,6,9*/ {2, 1, 0, 0, 0, 2, 2, 0, 0, 3} -}; - - -/* combine compilation fixes */ -#ifdef LTEMAC_SPS -/* subframe offset values to be used when twoIntervalsConfig is enabled in UL - * SPS for a UE */ -PUBLIC RgSchTddSfOffTbl rgSchTddSfOffTbl = { - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, -1, 0, 0, 0, 1, -1, 0}, - {0, 0, 5, 0, 0, 0, 0, -5, 0, 0}, - {0, 0, 1, 1, -2, 0, 0, 0, 0, 0}, - {0, 0, 1, -1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -}; - - -/* Table to determine when uplink SPS configured grants should - * explicitly be reserved in a subframe. When enries are same - * as that of Msg3SubfrmTbl, indicates competition with msg3. - * As of now, this is same as Msg3SubfrmTbl (leaving out uldlcfg 2), - * except that all 255s are now zeros. */ -PUBLIC RgSchTddSpsUlRsrvTbl rgSchTddSpsUlRsrvTbl = { - {0, 0, 0, 6, 8, 0, 0, 0, 6, 8}, - {0, 0, 6, 9, 0, 0, 0, 6, 9, 0}, - {0, 0, 10, 0, 0, 0, 0, 10, 0, 0}, - {0, 0, 0, 0, 8, 0, 7, 7, 14, 0}, - {0, 0, 0, 9, 0, 0, 7, 15, 0, 0}, - {0, 0, 10, 0, 0, 0, 16, 0, 0, 0}, - {0, 0, 0, 0, 8, 0, 0, 0, 9, 0} -}; - -/* Inverse DL Assoc Set index Table */ -PUBLIC RgSchTddInvDlAscSetIdxTbl rgSchTddInvDlAscSetIdxTbl = { - {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, - {7, 6, 0, 0, 4, 7, 6, 0, 0, 4}, - {7, 6, 0, 4, 8, 7, 6, 0, 4, 8}, - {4, 11, 0, 0, 0, 7, 6, 6, 5, 5}, - {12, 11, 0, 0, 8, 7, 7, 6, 5, 4}, - {12, 11, 0, 9, 8, 7, 6, 5, 4, 13}, - {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} -}; - -#endif /* (LTEMAC_SPS ) */ - -/* Number of Uplink subframes Table */ -PRIVATE U8 rgSchTddNumUlSf[] = {6, 4, 2, 3, 2, 1, 5}; - -/* Downlink HARQ processes Table */ -PUBLIC RgSchTddUlNumHarqProcTbl rgSchTddUlNumHarqProcTbl = { 7, 4, 2, 3, 2, 1, 6}; - -/* Uplink HARQ processes Table */ -PUBLIC RgSchTddDlNumHarqProcTbl rgSchTddDlNumHarqProcTbl = { 4, 7, 10, 9, 12, 15, 6}; - -/* Downlink association index set 'K' value Table */ -PUBLIC RgSchTddDlAscSetIdxKTbl rgSchTddDlAscSetIdxKTbl = { - { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} }, - - { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {3, {7, 6, 11}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {4, {12, 8, 7, 11}}, {4, {6, 5, 4, 7}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {9, {13, 12, 9, 8, 7, 5, 4, 11, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} } -}; - - /* ccpu132282-ADD-the table rgSchTddDlAscSetIdxKTbl is rearranged in - * decreasing order of Km, this is used to calculate the NCE used for - * calculating N1Pucch Resource for Harq*/ -PUBLIC RgSchTddDlAscSetIdxKTbl rgSchTddDlHqPucchResCalTbl = { - { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} }, - - { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {3, {11, 7, 6}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {4, {12, 11, 8, 7}}, {4, {7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {9, {13, 12, 11, 9, 8, 7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, - - { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} } -}; - -/* Minimum number of Ack/Nack feeback information to be - stored for each UL-DL configuration */ -PUBLIC RgSchTddANFdbkMapTbl rgSchTddANFdbkMapTbl = {4, 4, 2, 3, 2, 1, 5}; - -/* Uplink switch points and number of UL subframes Table */ -PUBLIC RgSchTddMaxUlSubfrmTbl rgSchTddMaxUlSubfrmTbl = { - {2,3,3}, {2,2,2}, {2,1,1}, {1,3,0}, {1,2,0}, {1,1,0}, {2,3,2} -}; - -/* Uplink switch points and number of DL subframes Table */ -PUBLIC RgSchTddMaxDlSubfrmTbl rgSchTddMaxDlSubfrmTbl = { - {2,2,2}, {2,3,3}, {2,4,4}, {1,7,0}, {1,8,0}, {1,9,0}, {2,2,3} -}; - -/* Number of UL subframes present before a particular subframe */ -PUBLIC RgSchTddNumUlSubfrmTbl rgSchTddNumUlSubfrmTbl = { - {0, 0, 1, 2, 3, 3, 3, 4, 5, 6}, - {0, 0, 1, 2, 2, 2, 2, 3, 4, 4}, - {0, 0, 1, 1, 1, 1, 1, 2, 2, 2}, - {0, 0, 1, 2, 3, 3, 3, 3, 3, 3}, - {0, 0, 1, 2, 2, 2, 2, 2, 2, 2}, - {0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, - {0, 0, 1, 2, 3, 3, 3, 4, 5, 5} -}; - -/* Number of DL subframes present till a particular subframe */ -PUBLIC RgSchTddNumDlSubfrmTbl rgSchTddNumDlSubfrmTbl = { - {1, 2, 2, 2, 2, 3, 4, 4, 4, 4}, - {1, 2, 2, 2, 3, 4, 5, 5, 5, 6}, - {1, 2, 2, 3, 4, 5, 6, 6, 7, 8}, - {1, 2, 2, 2, 2, 3, 4, 5, 6, 7}, - {1, 2, 2, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 2, 3, 4, 5, 6, 7, 8, 9}, - {1, 2, 2, 2, 2, 3, 4, 4, 4, 5} -}; - - -/* Nearest possible UL subframe Index from UL subframe - * DL Index < UL Index */ -PUBLIC RgSchTddLowDlSubfrmIdxTbl rgSchTddLowDlSubfrmIdxTbl = { - {0, 1, 1, 1, 1, 5, 6, 6, 6, 6}, - {0, 1, 1, 1, 4, 5, 6, 6, 6, 9}, - {0, 1, 1, 3, 4, 5, 6, 6, 8, 9}, - {0, 1, 1, 1, 1, 5, 6, 7, 8, 9}, - {0, 1, 1, 1, 4, 5, 6, 7, 8, 9}, - {0, 1, 1, 3, 4, 5, 6, 7, 8, 9}, - {0, 1, 1, 1, 1, 5, 6, 6, 6, 9} -}; - -/* Nearest possible DL subframe Index from UL subframe - * DL Index > UL Index - * 10 represents Next SFN low DL Idx */ -PUBLIC RgSchTddHighDlSubfrmIdxTbl rgSchTddHighDlSubfrmIdxTbl = { - {0, 1, 5, 5, 5, 5, 6, 10, 10, 10}, - {0, 1, 4, 4, 4, 5, 6, 9, 9, 9}, - {0, 1, 3, 3, 4, 5, 6, 8, 8, 9}, - {0, 1, 5, 5, 5, 5, 6, 7, 8, 9}, - {0, 1, 4, 4, 4, 5, 6, 7, 8, 9}, - {0, 1, 3, 3, 4, 5, 6, 7, 8, 9}, - {0, 1, 5, 5, 5, 5, 6, 9, 9, 9} -}; - -/* RACH Message3 related information */ -PUBLIC RgSchTddMsg3SubfrmTbl rgSchTddMsg3SubfrmTbl = { - {7, 6, 255, 255, 255, 7, 6, 255, 255, 255}, - {7, 6, 255, 255, 8, 7, 6, 255, 255, 8}, - {7, 6, 255, 9, 8, 7, 6, 255, 9, 8}, - {12, 11, 255, 255, 255, 7, 6, 6, 6, 13}, - {12, 11, 255, 255, 8, 7, 6, 6, 14, 13}, - {12, 11, 255, 9, 8, 7, 6, 15, 14, 13}, - {7, 6, 255, 255, 255, 7, 6, 255, 255, 8} -}; - -/* ccpu00132341-DEL Removed rgSchTddRlsDlSubfrmTbl and used Kset table for - * releasing DL HARQs */ - -/* DwPTS Scheduling Changes Start */ -/* Provides the number of Cell Reference Signals in DwPTS - * region per RB */ -PRIVATE U8 rgSchCmnDwptsCrs[2][3] = {/* [Spl Sf cfg][Ant Port] */ - {4, 8, 16}, /* Spl Sf cfg 1,2,3,6,7,8 */ - {6, 12, 20}, /* Spl Sf cfg 4 */ -}; - -PRIVATE S8 rgSchCmnSplSfDeltaItbs[9] = RG_SCH_DWPTS_ITBS_ADJ; -/* DwPTS Scheduling Changes End */ -#endif - - -PRIVATE U32 rgSchCmnBsrTbl[64] = { - 0, 10, 12, 14, 17, 19, 22, 26, - 31, 36, 42, 49, 57, 67, 78, 91, - 107, 125, 146, 171, 200, 234, 274, 321, - 376, 440, 515, 603, 706, 826, 967, 1132, - 1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995, - 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099, - 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, - 58255, 68201, 79846, 93479, 109439, 128125, 150000, 220000 -}; - -PRIVATE U32 rgSchCmnExtBsrTbl[64] = { - 0, 10, 13, 16, 19, 23, 29, 35, - 43, 53, 65, 80, 98, 120, 147, 181, - 223, 274, 337, 414, 509, 625, 769, 945, - 1162, 1429, 1757, 2161, 2657, 3267, 4017, 4940, - 6074, 7469, 9185, 11294, 13888, 17077, 20999, 25822, - 31752, 39045, 48012, 59039, 72598, 89272, 109774, 134986, - 165989, 204111, 250990, 308634, 379519, 466683, 573866, 705666, - 867737, 1067031, 1312097, 1613447, 1984009, 2439678, 3000000, 3100000 -}; - - -PRIVATE U8 rgSchCmnUlRvIdxToIMcsTbl[4] = {32, 30, 31, 29}; - -PUBLIC U8 rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_MAX_CP][RG_SCH_CMN_UL_NUM_CQI]; - -PUBLIC RgSchTbSzTbl rgTbSzTbl = { - { - {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680, 712, 744, 776, 776, 808, 840, 872, 904, 936, 968, 1000, 1032, 1032, 1064, 1096, 1128, 1160, 1192, 1224, 1256, 1256, 1288, 1320, 1352, 1384, 1416, 1416, 1480, 1480, 1544, 1544, 1608, 1608, 1608, 1672, 1672, 1736, 1736, 1800, 1800, 1800, 1864, 1864, 1928, 1928, 1992, 1992, 2024, 2088, 2088, 2088, 2152, 2152, 2216, 2216, 2280, 2280, 2280, 2344, 2344, 2408, 2408, 2472, 2472, 2536, 2536, 2536, 2600, 2600, 2664, 2664, 2728, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 2984, 2984, 3112}, - {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904, 936, 968, 1000, 1032, 1064, 1128, 1160, 1192, 1224, 1256, 1288, 1352, 1384, 1416, 1416, 1480, 1544, 1544, 1608, 1608, 1672, 1736, 1736, 1800, 1800, 1864, 1864, 1928, 1992, 1992, 2024, 2088, 2088, 2152, 2152, 2216, 2280, 2280, 2344, 2344, 2408, 2472, 2472, 2536, 2536, 2600, 2600, 2664, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008}, - {32, 72, 144, 176, 208, 256, 296, 328, 376, 424, 472, 520, 568, 616, 648, 696, 744, 776, 840, 872, 936, 968, 1000, 1064, 1096, 1160, 1192, 1256, 1288, 1320, 1384, 1416, 1480, 1544, 1544, 1608, 1672, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2024, 2088, 2088, 2152, 2216, 2216, 2280, 2344, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2664, 2728, 2792, 2856, 2856, 2856, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968}, - {40, 104, 176, 208, 256, 328, 392, 440, 504, 568, 616, 680, 744, 808, 872, 904, 968, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 1992, 2024, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6200, 6456, 6456}, - {56, 120, 208, 256, 328, 408, 488, 552, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1288, 1352, 1416, 1480, 1544, 1608, 1736, 1800, 1864, 1928, 1992, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2600, 2664, 2728, 2792, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992}, - {72, 144, 224, 328, 424, 504, 600, 680, 776, 872, 968, 1032, 1128, 1224, 1320, 1384, 1480, 1544, 1672, 1736, 1864, 1928, 2024, 2088, 2216, 2280, 2344, 2472, 2536, 2664, 2728, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4264, 4392, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9528}, - {328, 176, 256, 392, 504, 600, 712, 808, 936, 1032, 1128, 1224, 1352, 1480, 1544, 1672, 1736, 1864, 1992, 2088, 2216, 2280, 2408, 2472, 2600, 2728, 2792, 2984, 2984, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3880, 4008, 4136, 4136, 4264, 4392, 4584, 4584, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448}, - {104, 224, 328, 472, 584, 712, 840, 968, 1096, 1224, 1320, 1480, 1608, 1672, 1800, 1928, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536}, - {120, 256, 392, 536, 680, 808, 968, 1096, 1256, 1384, 1544, 1672, 1800, 1928, 2088, 2216, 2344, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15264}, - {136, 296, 456, 616, 776, 936, 1096, 1256, 1416, 1544, 1736, 1864, 2024, 2216, 2344, 2536, 2664, 2856, 2984, 3112, 3368, 3496, 3624, 3752, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 5160, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568}, - {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080}, - {176, 376, 584, 776, 1000, 1192, 1384, 1608, 1800, 2024, 2216, 2408, 2600, 2792, 2984, 3240, 3496, 3624, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152}, - {208, 440, 680, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2472, 2728, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 23688, 24496, 24496, 24496, 24496, 25456}, - {224, 488, 744, 1000, 1256, 1544, 1800, 2024, 2280, 2536, 2856, 3112, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 26416, 27376, 27376, 27376, 27376, 28336, 28336}, - {256, 552, 840, 1128, 1416, 1736, 1992, 2280, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 5992, 6200, 6456, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704}, - {280, 600, 904, 1224, 1544, 1800, 2152, 2472, 2728, 3112, 3368, 3624, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 6200, 6456, 6712, 6968, 7224, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008}, - {328, 632, 968, 1288, 1608, 1928, 2280, 2600, 2984, 3240, 3624, 3880, 4264, 4584, 4968, 5160, 5544, 5992, 6200, 6456, 6712, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 35160}, - {336, 696, 1064, 1416, 1800, 2152, 2536, 2856, 3240, 3624, 4008, 4392, 4776, 5160, 5352, 5736, 6200, 6456, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 39232}, - {376, 776, 1160, 1544, 1992, 2344, 2792, 3112, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14112, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816}, - {408, 840, 1288, 1736, 2152, 2600, 2984, 3496, 3880, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7736, 8248, 8504, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19080, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888}, - {440, 904, 1384, 1864, 2344, 2792, 3240, 3752, 4136, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 8760, 9144, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 20616, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 48936, 51024, 51024, 51024}, - {488, 1000, 1480, 1992, 2472, 2984, 3496, 4008, 4584, 4968, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 9912, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056}, - {520, 1064, 1608, 2152, 2664, 3240, 3752, 4264, 4776, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 10296, 10680, 11448, 11832, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 19080, 19080, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256}, - {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776}, - {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 22920, 23688, 24496, 25456, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592}, - {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592, 68808, 68808, 68808, 71112}, - {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376} - }, - { - {32, 88, 152, 208, 256, 328, 376, 424, 488, 536, 600, 648, 712, 776, 808, 872, 936, 1000, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2088, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 5992, 6200}, - {56, 144, 208, 256, 344, 424, 488, 568, 632, 712, 776, 872, 936, 1000, 1064, 1160, 1224, 1288, 1384, 1416, 1544, 1608, 1672, 1736, 1800, 1864, 1992, 2024, 2088, 2152, 2280, 2344, 2408, 2472, 2536, 2600, 2728, 2792, 2856, 2856, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5352, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992}, - {72, 176, 256, 328, 424, 520, 616, 696, 776, 872, 968, 1064, 1160, 1256, 1320, 1416, 1544, 1608, 1672, 1800, 1864, 1992, 2088, 2152, 2216, 2344, 2408, 2536, 2600, 2664, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3368, 3496, 3624, 3624, 3752, 3880, 4008, 4008, 4136, 4264, 4264, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912}, - {104, 208, 328, 440, 568, 680, 808, 904, 1032, 1160, 1256, 1384, 1480, 1608, 1736, 1864, 1992, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2856, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4392, 4584, 4776, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12576, 12960, 12960}, - {120, 256, 408, 552, 696, 840, 1000, 1128, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2600, 2728, 2856, 2984, 3112, 3240, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840}, - {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19080}, - {176, 392, 600, 808, 1032, 1224, 1480, 1672, 1864, 2088, 2280, 2472, 2728, 2984, 3112, 3368, 3496, 3752, 4008, 4136, 4392, 4584, 4776, 4968, 5160, 5352, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7992, 8248, 8248, 8504, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920}, - {224, 472, 712, 968, 1224, 1480, 1672, 1928, 2216, 2472, 2664, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376}, - {256, 536, 808, 1096, 1384, 1672, 1928, 2216, 2536, 2792, 3112, 3368, 3624, 3880, 4264, 4584, 4776, 4968, 5352, 5544, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576}, - {296, 616, 936, 1256, 1544, 1864, 2216, 2536, 2856, 3112, 3496, 3752, 4136, 4392, 4776, 5160, 5352, 5736, 5992, 6200, 6712, 6968, 7224, 7480, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160}, - {328, 680, 1032, 1384, 1736, 2088, 2472, 2792, 3112, 3496, 3880, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 6712, 6968, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 21384, 21384, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888}, - {376, 776, 1192, 1608, 2024, 2408, 2792, 3240, 3624, 4008, 4392, 4776, 5352, 5736, 5992, 6456, 6968, 7224, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816}, - {440, 904, 1352, 1800, 2280, 2728, 3240, 3624, 4136, 4584, 4968, 5544, 5992, 6456, 6712, 7224, 7736, 8248, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 17568, 17568, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024}, - {488, 1000, 1544, 2024, 2536, 3112, 3624, 4136, 4584, 5160, 5736, 6200, 6712, 7224, 7736, 8248, 8760, 9144, 9912, 10296, 10680, 11448, 11832, 12216, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336}, - {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776}, - {600, 1224, 1800, 2472, 3112, 3624, 4264, 4968, 5544, 6200, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 23688, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808}, - {632, 1288, 1928, 2600, 3240, 3880, 4584, 5160, 5992, 6456, 7224, 7736, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 68808, 71112, 71112, 71112, 71112}, - {696, 1416, 2152, 2856, 3624, 4392, 5160, 5736, 6456, 7224, 7992, 8760, 9528, 10296, 10680, 11448, 12216, 12960, 13536, 14688, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 71112, 73712, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 78704}, - {776, 1544, 2344, 3112, 4008, 4776, 5544, 6200, 7224, 7992, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 27376, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936}, - {840, 1736, 2600, 3496, 4264, 5160, 5992, 6968, 7736, 8504, 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 16416, 16992, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800}, - {904, 1864, 2792, 3752, 4584, 5544, 6456, 7480, 8248, 9144, 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16992, 17568, 18336, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 42368, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 97896, 101840, 101840, 101840}, - {1000, 1992, 2984, 4008, 4968, 5992, 6968, 7992, 9144, 9912, 11064, 12216, 12960, 14112, 15264, 15840, 16992, 18336, 19080, 19848, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 31704, 32856, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136}, - {1064, 2152, 3240, 4264, 5352, 6456, 7480, 8504, 9528, 10680, 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 20616, 21384, 22920, 23688, 24496, 25456, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816}, - {1128, 2280, 3496, 4584, 5736, 6968, 7992, 9144, 10296, 11448, 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 45352, 45352, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840,101840,101840,101840,105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496}, - {1192, 2408, 3624, 4968, 5992, 7224, 8504, 9912, 11064, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 42368, 43816, 45352, 46888, 46888, 48936, 51024, 51024, 52752, 52752, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208}, - {1256, 2536, 3752, 5160, 6200, 7480, 8760, 10296, 11448, 12576, 14112, 15264, 16416, 17568, 19080, 20616, 21384, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 43816, 43816, 45352, 46888, 48936, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040,115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208, 137792, 137792, 137792, 142248}, - {1480, 2984, 4392, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 29296, 30576, 32856, 34008, 35160, 36696, 37888, 40576, 40576, 42368, 43816, 45352, 46888, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 63776, 63776, 66592, 68808, 68808, 71112, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 81176, 84760, 84760, 87936, 87936, 90816, 90816, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 128496, 128496, 128496, 133208, 133208, 133208, 137792, 137792, 137792, 142248, 142248, 142248, 146856, 146856,149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776} - } -}; -RgSchUlIMcsTbl rgUlIMcsTbl = { - {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, - {2, 6}, {2, 7}, {2, 8}, {2, 9}, {2, 10}, - {4, 10}, {4, 11}, {4, 12}, {4, 13}, {4, 14}, - {4, 15}, {4, 16}, {4, 17}, {4, 18}, {4, 19}, - {6, 19}, {6, 20}, {6, 21}, {6, 22}, {6, 23}, - {6, 24}, {6, 25}, {6, 26} -}; -RgSchUeCatTbl rgUeCatTbl = { - /*Column1:Maximum number of bits of an UL-SCH - transport block transmitted within a TTI - - maxUlBits - Column2:Maximum number of bits of a DLSCH - transport block received within a TTI - - maxDlBits - Column3:Total number of soft channel bits - - maxSftChBits - Column4:Support for 64QAM in UL - - ul64qamSup - Column5:Maximum number of DL-SCH transport - block bits received within a TTI - - maxDlTbBits - Column6:Maximum number of supported layers for - spatial multiplexing in DL - - maxTxLyrs*/ - {5160, {10296,0}, 250368, FALSE, 10296, 1}, - {25456, {51024,0}, 1237248, FALSE, 51024, 2}, - {51024, {75376,0}, 1237248, FALSE, 102048, 2}, - {51024, {75376,0}, 1827072, FALSE, 150752, 2}, - {75376, {149776,0}, 3667200, TRUE, 299552, 4}, - {51024, {75376,149776}, 3654144, FALSE, 301504, 4}, - {51024, {75376,149776}, 3654144, FALSE, 301504, 4}, - {149776,{299856,0}, 35982720,TRUE, 2998560, 8} -}; - -/* [ccpu00138532]-ADD-The below table stores the min HARQ RTT time - in Downlink for TDD and FDD. Indices 0 to 6 map to tdd UL DL config 0-6. - Index 7 map to FDD */ -U8 rgSchCmnHarqRtt[8] = {4,7,10,9,12,15,6,8}; -/* Number of CFI Switchover Index is equals to 7 TDD Indexes + 1 FDD index */ -U8 rgSchCfiSwitchOvrWinLen[] = {7, 4, 2, 3, 2, 1, 6, 8}; - -/* EffTbl is calculated for single layer and two layers. - * CqiToTbs is calculated for single layer and two layers */ -RgSchCmnTbSzEff rgSchCmnNorCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnTbSzEff rgSchCmnNorCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW]; -/* New variable to store UL effiency values for normal and extended CP*/ -RgSchCmnTbSzEff rgSchCmnNorUlEff[1],rgSchCmnExtUlEff[1]; -RgSchCmnCqiToTbs rgSchCmnNorCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnCqiToTbs rgSchCmnNorCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnCqiToTbs *rgSchCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI]; -RgSchCmnTbSzEff rgSchCmnExtCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnTbSzEff rgSchCmnExtCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnCqiToTbs rgSchCmnExtCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; -RgSchCmnCqiToTbs rgSchCmnExtCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; -/* Include CRS REs while calculating Efficiency */ -RgSchCmnTbSzEff *rgSchCmnEffTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_ANT_CONF][RG_SCH_CMN_MAX_CFI]; -RgSchCmnTbSzEff *rgSchCmnUlEffTbl[RG_SCH_CMN_MAX_CP]; -#ifdef LTE_TDD -RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3, 1}; -#else -/* Added matrix 'rgRaPrmblToRaFrmTbl'for computation of RA sub-frames from RA preamble */ -RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3}; -#endif - -EXTERN RgUlSchdInits rgSchUlSchdInits; -EXTERN RgDlSchdInits rgSchDlSchdInits; -EXTERN RgDlfsSchdInits rgSchDlfsSchdInits; -#ifdef EMTC_ENABLE -EXTERN RgEmtcUlSchdInits rgSchEmtcUlSchdInits; -EXTERN RgEmtcDlSchdInits rgSchEmtcDlSchdInits; -#endif - -/* RACHO : start */ -PRIVATE S16 rgSCHCmnUeIdleExdThrsld ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PUBLIC RgSchUeCb* rgSCHCmnGetHoUe ARGS(( -RgSchCellCb *cell, -U16 rapId -)); -PRIVATE Void rgSCHCmnDelDedPreamble ARGS(( -RgSchCellCb *cell, -U8 preambleId -)); -PUBLIC RgSchUeCb* rgSCHCmnGetPoUe ARGS(( -RgSchCellCb *cell, -U16 rapId, -CmLteTimingInfo timingInfo -)); -PRIVATE Void rgSCHCmnDelRachInfo ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe ARGS(( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUeCb *ue, -U8 maxRb -)); -PRIVATE Void rgSCHCmnHdlHoPo ARGS(( -RgSchCellCb *cell, -CmLListCp *raRspLst, -RgSchRaReqInfo *raReq -)); -PRIVATE Void rgSCHCmnAllocPoHoGrnt ARGS(( -RgSchCellCb *cell, -CmLListCp *raRspLst, -RgSchUeCb *ue, -RgSchRaReqInfo *raReq -)); -PRIVATE Void rgSCHCmnFillPdcchOdr2Sf ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchPdcch *pdcc, -U8 rapId, -U8 prachMskIdx -)); -PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx ARGS(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHCmnUpdRachParam ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnAllocPOParam ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchUeCb *ue, -RgSchPdcch **pdcch, -U8 *rapId, -U8 *prachMskIdx -)); -PRIVATE Void rgSCHCmnGenPdcchOrder ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf -)); -PRIVATE Void rgSCHCmnCfgRachDedPrm ARGS(( -RgSchCellCb *cell -)); -/* RACHO : end */ - -PRIVATE Void rgSCHCmnHdlUlInactUes ARGS(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHCmnHdlDlInactUes ARGS(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHCmnUlInit ARGS((Void -)); -PRIVATE Void rgSCHCmnDlInit ARGS((Void -)); -PRIVATE Void rgSCHCmnInitDlRbAllocInfo ARGS(( -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnUpdUlCompEffBsr ARGS(( -RgSchUeCb *ue -)); -#if RG_UNUSED -PRIVATE Void rgSCHCmnUlSetAllUnSched ARGS(( -RgSchCmnUlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnUlUpdSf ARGS(( - RgSchCellCb *cell, - RgSchCmnUlRbAllocInfo *allocInfo, - RgSchUlSf *sf - )); -PRIVATE Void rgSCHCmnUlHndlAllocRetx ARGS(( - RgSchCellCb *cell, - RgSchCmnUlRbAllocInfo *allocInfo, - RgSchUlSf *sf, - RgSchUlAlloc *alloc - )); -#endif -PRIVATE Void rgSCHCmnGrpPwrCntrlPucch ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf -)); -PRIVATE Void rgSCHCmnGrpPwrCntrlPusch ARGS(( -RgSchCellCb *cell, -RgSchUlSf *ulSf -)); -PRIVATE Void rgSCHCmnDelUeFrmRefreshQ ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE S16 rgSCHCmnTmrExpiry ARGS(( -PTR cb, /* Pointer to timer control block */ -S16 tmrEvnt /* Timer Event */ -)); -PRIVATE S16 rgSCHCmnTmrProc ARGS(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHCmnAddUeToRefreshQ ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 wait -)); -PRIVATE Void rgSCHCmnDlCcchRetx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnUpdUeMimoInfo ARGS(( -RgrUeCfg *ueCfg, -RgSchCmnDlUe *ueDl, -RgSchCellCb *cell, -RgSchCmnCell *cellSchd -)); -PRIVATE Void rgSCHCmnUpdUeUlCqiInfo ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchCmnUlUe *ueUl, -RgSchCmnUe *ueSchCmn, -RgSchCmnCell *cellSchd, -Bool isEcp -)); -#ifdef RGR_V1 -PRIVATE Void rgSCHCmnDlCcchSduRetx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnDlCcchSduTx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE S16 rgSCHCmnCcchSduAlloc ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE S16 rgSCHCmnCcchSduDedAlloc ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ueCb -)); -PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgSchDlSf *dlSf -)); -#endif -PRIVATE Void rgSCHCmnInitVars ARGS(( - RgSchCellCb *cell - )); - -/*ccpu00117180 - DEL - Moved rgSCHCmnUpdVars to .x as its access is now PUBLIC */ -PRIVATE Void rgSCHCmnUlRbAllocForLst ARGS(( - RgSchCellCb *cell, - RgSchUlSf *sf, - U32 count, - CmLListCp *reqLst, - CmLListCp *schdLst, - CmLListCp *nonSchdLst, - Bool isNewTx - )); -PRIVATE S16 rgSCHCmnUlRbAllocForUe ARGS(( - RgSchCellCb *cell, - RgSchUlSf *sf, - RgSchUeCb *ue, - U8 maxRb, - RgSchUlHole *hole - )); -PRIVATE Void rgSCHCmnMsg3GrntReq ARGS(( - RgSchCellCb *cell, - CmLteRnti rnti, - Bool preamGrpA, - RgSchUlHqProcCb *hqProc, - RgSchUlAlloc **ulAllocRef, - U8 *hqProcIdRef - )); -PRIVATE Void rgSCHCmnUlNonadapRetx ARGS(( - RgSchCmnUlCell *cellUl, - RgSchUlAlloc *alloc, - U8 idx - )); - -PRIVATE Void rgSCHCmnDlCcchRarAlloc ARGS(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHCmnDlCcchTx ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnDlBcchPcch ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgInfSfAlloc *subfrmAlloc -)); -PUBLIC Bool rgSCHCmnChkInWin ARGS(( -CmLteTimingInfo frm, -CmLteTimingInfo start, -CmLteTimingInfo end -)); -PUBLIC Bool rgSCHCmnChkPastWin ARGS(( -CmLteTimingInfo frm, -CmLteTimingInfo end -)); -PRIVATE Void rgSCHCmnClcAlloc ARGS(( -RgSchCellCb *cell, -RgSchDlSf *sf, -RgSchClcDlLcCb *lch, -U16 rnti, -RgSchCmnDlRbAllocInfo *allocInfo -)); -#ifndef LTEMAC_SPS -PRIVATE Void rgSCHCmnClcRbAlloc ARGS(( -RgSchCellCb *cell, -U32 bo, -U8 cqi, -U8 *rb, -U32 *tbs, -U8 *mcs, -RgSchDlSf *sf -)); -#endif - -PRIVATE S16 rgSCHCmnMsg4Alloc ARGS(( -RgSchCellCb *cell, -RgSchRaCb *raCb, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE S16 rgSCHCmnMsg4DedAlloc ARGS(( -RgSchCellCb *cell, -RgSchRaCb *raCb -)); -PRIVATE Void rgSCHCmnDlRaRsp ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE S16 rgSCHCmnRaRspAlloc ARGS(( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -U16 rntiIdx, -U16 rarnti, -U8 noRaRnti, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnUlUeDelAllocs ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); -PRIVATE Void rgSCHCmnDlSetUeAllocLmt ARGS(( -RgSchCellCb *cell, -RgSchCmnDlUe *ueDl, -Bool isEmtcUe -)); -PRIVATE S16 rgSCHCmnDlRgrCellCfg ARGS(( -RgSchCellCb *cell, -RgrCellCfg *cfg, -RgSchErrInfo *err -)); -PRIVATE Void rgSCHCmnUlAdapRetx ARGS(( -RgSchUlAlloc *alloc, -RgSchUlHqProcCb *proc -)); -PRIVATE Void rgSCHCmnUlUpdAllocRetx ARGS(( -RgSchCellCb *cell, -RgSchUlAlloc *alloc -)); -PRIVATE Void rgSCHCmnUlSfReTxAllocs ARGS(( -RgSchCellCb *cell, -RgSchUlSf *sf -)); -/* Fix: syed Adaptive Msg3 Retx crash. */ -PRIVATE Void rgSCHCmnUlSfRlsRetxProcs ARGS(( -RgSchCellCb *cell, -RgSchUlSf *sf -)); - -#ifdef TFU_UPGRADE -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -U8 numTxPorts -)); -#else -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -)); -#endif - - -/* - * DL RB allocation specific functions - */ - -PRIVATE Void rgSCHCmnDlRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE Void rgSCHCmnNonDlfsRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -)); -PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *cmnAllocInfo)); - -#ifndef LTE_TDD -PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj ARGS(( -RgSchCellCb *cell, -RgSchDlRbAlloc *cmnAllocInfo, -U8 pbchSsRsSym, -Bool isBcchPcch -)); -/* Added function to adjust TBSize*/ -PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj ARGS(( -RgSchDlRbAlloc *allocInfo, -U8 numOvrlapgPbchRb, -U8 pbchSsRsSym, -U8 idx, -U32 bytesReq -)); - -/* Added function to find num of overlapping PBCH rb*/ -PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -U8 *numOvrlapgPbchRb -)); - -PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo -)); -#ifdef DEBUGP -PRIVATE Void rgSCHCmnFindCodeRate ARGS(( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -U8 idx -)); -#endif -#endif -PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc ARGS(( -RgSchCellCb *cell, -RgSchCmnMsg4RbAlloc *msg4AllocInfo, -U8 isRetx -)); -PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc ARGS(( -RgSchCellCb *cell, -RgSchRaCb *raCb, -RgSchDlSf *dlSf -)); - -PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *dlSf, -U8 *isDlBwAvail -)); -#ifndef LTEMAC_SPS -PRIVATE U32 rgSCHCmnCalcRiv ARGS(( U8 bw, - U8 rbStart, - U8 numRb)); -#endif - -#ifdef LTE_TDD -PRIVATE Void rgSCHCmnUpdHqAndDai ARGS(( -RgSchDlHqProcCb *hqP, -RgSchDlSf *subFrm, -RgSchDlHqTbCb *tbCb, -U8 tbAllocIdx -)); -PRIVATE S16 rgSCHCmnUlCalcAvailBw ARGS(( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -U8 cfi, -U8 *rbStartRef, -U8 *bwAvailRef -)); -PRIVATE S16 rgSCHCmnDlKdashUlAscInit ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnDlANFdbkInit ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnDlNpValInit ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnDlCreateRachPrmLst ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnDlCpyRachInfo ARGS(( -RgSchCellCb *cell, -RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES], -U8 raArrSz -)); -PRIVATE S16 rgSCHCmnDlRachInfoInit ARGS(( -RgSchCellCb *cell -)); -PRIVATE S16 rgSCHCmnDlPhichOffsetInit ARGS(( -RgSchCellCb *cell -)); -#endif -#ifdef TFU_UPGRADE -PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt ARGS -(( - RgSchCellCb *cell, - RgSchUeCb *ue, - U8 wideCqi - )); - PRIVATE RgSchCmnRank rgSCHCmnComputeRank ARGS -(( - RgrTxMode txMode, - U32 *pmiBitMap, - U8 numTxPorts - )); - - PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3 ARGS -(( - U32 *pmiBitMap - )); - - PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3 ARGS -(( - U32 *pmiBitMap - )); - - PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4 ARGS -(( - U32 *pmiBitMap - )); - - PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4 ARGS -(( - U32 *pmiBitMap - )); - - PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr ARGS -(( - RgSchCellCb *cell, - TfuSrsRpt *srsRpt - )); -#endif - -/* comcodsepa : start */ - -/** - * @brief This function computes efficiency and stores in a table. - * - * @details - * - * Function: rgSCHCmnCompEff - * Purpose: this function computes the efficiency as number of - * bytes per 1024 symbols. The CFI table is also filled - * with the same information such that comparison is valid - * - * Invoked by: Scheduler - * - * @param[in] U8 noPdcchSym - * @param[in] U8 cpType - * @param[in] U8 txAntIdx - * @param[in] RgSchCmnTbSzEff* effTbl - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnCompEff -( -U8 noPdcchSym, -U8 cpType, -U8 txAntIdx, -RgSchCmnTbSzEff *effTbl -) -#else -PRIVATE Void rgSCHCmnCompEff(noPdcchSym, cpType, txAntIdx, effTbl) -U8 noPdcchSym; -U8 cpType; -U8 txAntIdx; -RgSchCmnTbSzEff *effTbl; -#endif -{ - U8 noResPerRb; - U8 noSymPerRb; - U8 resOfCrs; /* Effective REs occupied by CRS */ - U8 i, j; - - TRC2(rgSCHCmnCompEff); - - switch (cpType) - { - case RG_SCH_CMN_NOR_CP: - noSymPerRb = 14; - break; - case RG_SCH_CMN_EXT_CP: - noSymPerRb = 12; - break; - default: - /* Generate a log error. This case should never be executed */ - RETVOID; - } - - /* Depending on the Tx Antenna Index, deduct the - * Resource elements for the CRS */ - switch (txAntIdx) - { - case 0: - resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT; - break; - case 1: - resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT; - break; - case 2: - resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT; - break; - default: - /* Generate a log error. This case should never be executed */ - RETVOID; - } - noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs; - for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) - { - (*effTbl)[i] = 0; - for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) - { - /* This line computes the coding efficiency per 1024 REs */ - (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1)); - } - (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS; - } - RETVOID; -} -/** - * @brief This function computes efficiency and stores in a table. - * - * @details - * - * Function: rgSCHCmnCompUlEff - * Purpose: this function computes the efficiency as number of - * bytes per 1024 symbols. The CFI table is also filled - * with the same information such that comparison is valid - * - * Invoked by: Scheduler - * - * @param[in] U8 noUlRsSym - * @param[in] U8 cpType - * @param[in] U8 txAntIdx - * @param[in] RgSchCmnTbSzEff* effTbl - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnCompUlEff -( -U8 noUlRsSym, -U8 cpType, -RgSchCmnTbSzEff *effTbl -) -#else -PRIVATE Void rgSCHCmnCompUlEff(noUlRsSym, cpType, effTbl) -U8 noUlRsSym; -U8 cpType; -RgSchCmnTbSzEff *effTbl; -#endif -{ - U8 noResPerRb; - U8 noSymPerRb; - U8 i, j; - - TRC2(rgSCHCmnCompUlEff); - - switch (cpType) - { - case RG_SCH_CMN_NOR_CP: - noSymPerRb = 14; - break; - case RG_SCH_CMN_EXT_CP: - noSymPerRb = 12; - break; - default: - /* Generate a log error. This case should never be executed */ - RETVOID; - } - - noResPerRb = ((noSymPerRb - noUlRsSym) * RB_SCH_CMN_NUM_SCS_PER_RB); - for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) - { - (*effTbl)[i] = 0; - for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) - { - /* This line computes the coding efficiency per 1024 REs */ - (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1)); - } - (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS; - } - RETVOID; -} - -/** - * @brief This function computes efficiency for 2 layers and stores in a table. - * - * @details - * - * Function: rgSCHCmn2LyrCompEff - * Purpose: this function computes the efficiency as number of - * bytes per 1024 symbols. The CFI table is also filled - * with the same information such that comparison is valid - * - * Invoked by: Scheduler - * - * @param[in] U8 noPdcchSym - * @param[in] U8 cpType - * @param[in] U8 txAntIdx - * @param[in] RgSchCmnTbSzEff* effTbl2Lyr - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmn2LyrCompEff -( -U8 noPdcchSym, -U8 cpType, -U8 txAntIdx, -RgSchCmnTbSzEff *effTbl2Lyr -) -#else -PRIVATE Void rgSCHCmn2LyrCompEff(noPdcchSym, cpType, txAntIdx, effTbl2Lyr) -U8 noPdcchSym; -U8 cpType; -U8 txAntIdx; -RgSchCmnTbSzEff *effTbl2Lyr; -#endif -{ - U8 noResPerRb; - U8 noSymPerRb; - U8 resOfCrs; /* Effective REs occupied by CRS */ - U8 i, j; - - TRC2(rgSCHCmn2LyrCompEff); - - switch (cpType) - { - case RG_SCH_CMN_NOR_CP: - noSymPerRb = 14; - break; - case RG_SCH_CMN_EXT_CP: - noSymPerRb = 12; - break; - default: - /* Generate a log error. This case should never be executed */ - RETVOID; - } - - /* Depending on the Tx Antenna Index, deduct the - * Resource elements for the CRS */ - switch (txAntIdx) - { - case 0: - resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT; - break; - case 1: - resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT; - break; - case 2: - resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT; - break; - default: - /* Generate a log error. This case should never be executed */ - RETVOID; - } - - noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs; - for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) - { - (*effTbl2Lyr)[i] = 0; - for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) - { - /* This line computes the coding efficiency per 1024 REs */ - (*effTbl2Lyr)[i] += (rgTbSzTbl[1][i][j] * 1024) / (noResPerRb * (j+1)); - } - (*effTbl2Lyr)[i] /= RG_SCH_CMN_NUM_RBS; - } - RETVOID; -} - - -/** - * @brief This function initializes the rgSchCmnDciFrmtSizes table. - * - * @details - * - * Function: rgSCHCmnGetDciFrmtSizes - * Purpose: This function determines the sizes of all - * the available DCI Formats. The order of - * bits addition for each format is inaccordance - * with the specs. - * Invoked by: rgSCHCmnRgrCellCfg - * - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGetDciFrmtSizes -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnGetDciFrmtSizes(cell) -RgSchCellCb *cell; -#endif -{ - - TRC2(rgSCHCmnGetDciFrmtSizes); - - /* DCI Format 0 size determination */ - rgSchCmnDciFrmtSizes[0] = 1 + - 1 + - rgSCHUtlLog32bitNbase2((cell->bwCfg.ulTotalBw * \ - (cell->bwCfg.ulTotalBw + 1))/2) + - 5 + - 1 + - 2 + - 3 + -#ifdef LTE_TDD - 2 + - 2 + -#endif - 1; - /* DCI Format 1 size determination */ - rgSchCmnDciFrmtSizes[1] = 1 + - RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + - 5 + -#ifndef LTE_TDD - 3 + -#else - 4 + 2 + /* HqProc Id and DAI */ -#endif - 1 + - 2 + - 2; - - /* DCI Format 1A size determination */ - rgSchCmnDciFrmtSizes[2] = 1 + /* Flag for format0/format1a differentiation */ - 1 + /* Localized/distributed VRB assignment flag */ - 5 + /* For mcs */ -#ifndef LTE_TDD - 3 + /* Harq process Id */ -#else - 4 + /* Harq process Id */ - 2 + /* UL Index or DAI */ -#endif - 1 + /* New Data Indicator */ - 2 + /* For RV */ - 2 + /* For tpc */ - 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ - (cell->bwCfg.dlTotalBw + 1))/2); - /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \ - Since VRB is local */ - - /* DCI Format 1B size determination */ - rgSchCmnDciFrmtSizes[3] = 1 + - rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ - (cell->bwCfg.dlTotalBw + 1))/2) + - 5 + - 3 + -#ifdef LTE_TDD - 1 + /* HqP */ - 2 + /* Dai */ -#endif - 1 + - 2 + - 2 + - ((cell->numTxAntPorts == 4)? 4:2) + - 1; - - /* DCI Format 1C size determination */ - /* Approximation: NDLVrbGap1 ~= Nprb for DL */ - rgSchCmnDciFrmtSizes[4] = (cell->bwCfg.dlTotalBw < 50)? 0:1 + - (cell->bwCfg.dlTotalBw < 50)? - (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/2 * \ - (cell->bwCfg.dlTotalBw/2 + 1))/2)) : - (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/4 * \ - (cell->bwCfg.dlTotalBw/4 + 1))/2)) + - 5; - - /* DCI Format 1D size determination */ - rgSchCmnDciFrmtSizes[5] = 1 + - rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ - (cell->bwCfg.dlTotalBw + 1))/2) + - 5 + - 3 + -#ifdef LTE_TDD - 1 + 2 + -#endif - 1 + - 2 + - 2 + - ((cell->numTxAntPorts == 4)? 4:2) + - 1; - - /* DCI Format 2 size determination */ - rgSchCmnDciFrmtSizes[6] = ((cell->bwCfg.dlTotalBw < 10)?0:1) + - RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + - 2 + -#ifdef LTE_TDD - 2 + 1 + -#endif - 3 + - 1 + - (5 + 1 + 2)*2 + - ((cell->numTxAntPorts == 4)? 6:3); - - /* DCI Format 2A size determination */ - rgSchCmnDciFrmtSizes[7] = ((cell->bwCfg.dlTotalBw < 10)?0:1) + - RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + - 2 + -#ifdef LTE_TDD - 2 + 1 + -#endif - 3 + - 1 + - (5 + 1 + 2)*2 + - ((cell->numTxAntPorts == 4)? 2:0); - - /* DCI Format 3 size determination */ - rgSchCmnDciFrmtSizes[8] = rgSchCmnDciFrmtSizes[0]; - - /* DCI Format 3A size determination */ - rgSchCmnDciFrmtSizes[9] = rgSchCmnDciFrmtSizes[0]; - - RETVOID; -} - - -/** - * @brief This function initializes the cmnCell->dciAggrLvl table. - * - * @details - * - * Function: rgSCHCmnGetCqiDciFrmt2AggrLvl - * Purpose: This function determines the Aggregation level - * for each CQI level against each DCI format. - * Invoked by: rgSCHCmnRgrCellCfg - * - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGetCqiDciFrmt2AggrLvl -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnGetCqiDciFrmt2AggrLvl(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 i; - U8 j; - - TRC2(rgSCHCmnGetCqiDciFrmt2AggrLvl); - - for (i = 0; i < RG_SCH_CMN_MAX_CQI; i++) - { - for (j = 0; j < 10; j++) - { - U32 pdcchBits; /* Actual number of phy bits needed for a given DCI Format - * for a given CQI Level */ - pdcchBits = (rgSchCmnDciFrmtSizes[j] * 1024)/rgSchCmnCqiPdcchEff[i]; - /* V5G_211 : 6.6 */ - if (pdcchBits < 192) - { - cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL2; - continue; - } - if (pdcchBits < 384) - { - cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL4; - continue; - } - if (pdcchBits < 768) - { - cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL8; - continue; - } - cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL16; - } - } - RETVOID; -} - -/** - * @brief This function initializes all the data for the scheduler. - * - * @details - * - * Function: rgSCHCmnDlInit - * Purpose: This function initializes the following information: - * 1. Efficiency table - * 2. CQI to table index - It is one row for upto 3 RBs - * and another row for greater than 3 RBs - * currently extended prefix is compiled out. - * Invoked by: MAC intialization code..may be ActvInit - * - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlInit -( -) -#else -PRIVATE Void rgSCHCmnDlInit() -#endif -{ - U8 i; - S16 j; - S16 k; - U8 idx; - RgSchCmnTbSzEff *effTbl; - RgSchCmnCqiToTbs *tbsTbl; - - TRC2(rgSCHCmnDlInit); - - /* 0 corresponds to Single layer case, 1 corresponds to 2 layers case*/ - /* Init Efficiency table for normal cyclic prefix */ - /*Initialize Efficiency table for Layer Index 0 */ - /*Initialize Efficiency table for Tx Antenna Port Index 0 */ - /*Initialize Efficiency table for each of the CFI indices. The - * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[0]; - /*Initialize Efficency table for Tx Antenna Port Index 1 */ - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[0]; - /*Initialize Efficency table for Tx Antenna Port Index 2 */ - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[0]; - - /*Initialize CQI to TBS table for Layer Index 0 for Normal CP */ - rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[0]; - - /*Intialize Efficency table for Layer Index 1 */ - /*Initialize Efficiency table for Tx Antenna Port Index 0 */ - /*Initialize Efficiency table for each of the CFI indices. The - * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[1]; - /*Initialize Efficiency table for Tx Antenna Port Index 1 */ - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[1]; - /*Initialize Efficiency table for Tx Antenna Port Index 2 */ - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[1]; - - /*Initialize CQI to TBS table for Layer Index 1 for Normal CP */ - rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[1]; - - for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) - { - for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) - { - /* EfficiencyTbl calculation incase of 2 layers for normal CP */ - rgSCHCmnCompEff((U8)(i + 1), RG_SCH_CMN_NOR_CP, idx,\ - rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i]); - rgSCHCmn2LyrCompEff((U8)(i + 1), RG_SCH_CMN_NOR_CP, idx, \ - rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i]); - } - } - - for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) - { - for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) - { - effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i]; - tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][i]; - for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; - (j >= 0) && (k > 0); --j) - { - /* ADD CQI to MCS mapping correction - * single dimensional array is replaced by 2 dimensions for different CFI*/ - if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k]) - { - (*tbsTbl)[k--] = (U8)j; - } - } - for (; k > 0; --k) - { - (*tbsTbl)[k] = 0; - } - /* effTbl,tbsTbl calculation incase of 2 layers for normal CP */ - effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i]; - tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][i]; - for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; - (j >= 0) && (k > 0); --j) - { - /* ADD CQI to MCS mapping correction - * single dimensional array is replaced by 2 dimensions for different CFI*/ - if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k]) - { - (*tbsTbl)[k--] = (U8)j; - } - } - for (; k > 0; --k) - { - (*tbsTbl)[k] = 0; - } - } - } - - /* Efficiency Table for Extended CP */ - /*Initialize Efficiency table for Layer Index 0 */ - /*Initialize Efficiency table for Tx Antenna Port Index 0 */ - /*Initialize Efficiency table for each of the CFI indices. The - * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[0]; - /*Initialize Efficency table for Tx Antenna Port Index 1 */ - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[0]; - /*Initialize Efficency table for Tx Antenna Port Index 2 */ - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[0]; - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[0]; - - /*Initialize CQI to TBS table for Layer Index 0 for Extended CP */ - rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[0]; - rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[0]; - - /*Initialize Efficiency table for Layer Index 1 */ - /*Initialize Efficiency table for each of the CFI indices. The - * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ - /*Initialize Efficency table for Tx Antenna Port Index 0 */ - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[1]; - /*Initialize Efficency table for Tx Antenna Port Index 1 */ - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[1]; - /*Initialize Efficency table for Tx Antenna Port Index 2 */ - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[1]; - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[1]; - - /*Initialize CQI to TBS table for Layer Index 1 for Extended CP */ - rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[1]; - rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[1]; - /* Activate this code when extended cp is supported */ - for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) - { - for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) - { - /* EfficiencyTbl calculation incase of 2 layers for extendedl CP */ - rgSCHCmnCompEff( (U8)(i + 1 ), (U8)RG_SCH_CMN_EXT_CP, idx,\ - rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i]); - rgSCHCmn2LyrCompEff((U8)(i + 1), (U8) RG_SCH_CMN_EXT_CP,idx, \ - rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i]); - } - } - - for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) - { - for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) - { - effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i]; - tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][i]; - for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; - (j >= 0) && (k > 0); --j) - { - /* ADD CQI to MCS mapping correction - * single dimensional array is replaced by 2 dimensions for different CFI*/ - if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k]) - { - (*tbsTbl)[k--] = (U8)j; - } - } - for (; k > 0; --k) - { - (*tbsTbl)[k] = 0; - } - /* effTbl,tbsTbl calculation incase of 2 layers for extended CP */ - effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i]; - tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][i]; - for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; - (j >= 0) && (k > 0); --j) - { - /* ADD CQI to MCS mapping correction - * single dimensional array is replaced by 2 dimensions for different CFI*/ - if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k]) - { - (*tbsTbl)[k--] = (U8)j; - } - } - for (; k > 0; --k) - { - (*tbsTbl)[k] = 0; - } - } - } - RETVOID; -} - -/** - * @brief This function initializes all the data for the scheduler. - * - * @details - * - * Function: rgSCHCmnUlInit - * Purpose: This function initializes the following information: - * 1. Efficiency table - * 2. CQI to table index - It is one row for upto 3 RBs - * and another row for greater than 3 RBs - * currently extended prefix is compiled out. - * Invoked by: MAC intialization code..may be ActvInit - * - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlInit -( -) -#else -PRIVATE Void rgSCHCmnUlInit() -#endif -{ - U8 *mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_NOR_CP][0]; - RgSchCmnTbSzEff *effTbl = &rgSchCmnNorUlEff[0]; - CONSTANT RgSchCmnUlCqiInfo *cqiTbl = &rgSchCmnUlCqiTbl[0]; - S16 i; - S16 j; - TRC2(rgSCHCmnUlInit); - - /* Initaializing new variable added for UL eff */ - rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP] = &rgSchCmnNorUlEff[0]; - /* Reason behind using 3 as the number of symbols to rule out for - * efficiency table computation would be that we are using 2 symbols for - * DMRS(1 in each slot) and 1 symbol for SRS*/ - rgSCHCmnCompUlEff(RGSCH_UL_SYM_DMRS_SRS,RG_SCH_CMN_NOR_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP]); - - for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1; - i >= 0 && j > 0; --i) - { - if ((*effTbl)[i] <= cqiTbl[j].eff) - { - mapTbl[j--] = (U8)i; - } - } - for (; j > 0; --j) - { - mapTbl[j] = 0; - } - effTbl = &rgSchCmnExtUlEff[0]; - mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_EXT_CP][0]; - - /* Initaializing new variable added for UL eff */ - rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP] = &rgSchCmnExtUlEff[0]; - /* Reason behind using 3 as the number of symbols to rule out for - * efficiency table computation would be that we are using 2 symbols for - * DMRS(1 in each slot) and 1 symbol for SRS*/ - rgSCHCmnCompUlEff(3,RG_SCH_CMN_EXT_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP]); - - for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1; - i >= 0 && j > 0; --i) - { - if ((*effTbl)[i] <= cqiTbl[j].eff) - { - mapTbl[j--] = (U8)i; - } - } - for (; j > 0; --j) - { - mapTbl[j] = 0; - } - rgSCHPwrInit(); - RETVOID; -} - - -/** - * @brief This function initializes all the data for the scheduler. - * - * @details - * - * Function: rgSCHCmnInit - * Purpose: This function initializes the following information: - * 1. Efficiency table - * 2. CQI to table index - It is one row for upto 3 RBs - * and another row for greater than 3 RBs - * currently extended prefix is compiled out. - * Invoked by: MAC intialization code..may be ActvInit - * - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnInit -( -) -#else -PUBLIC Void rgSCHCmnInit() -#endif -{ - U8 idx; - TRC2(rgSCHCmnInit); - - rgSCHCmnDlInit(); - rgSCHCmnUlInit(); -#ifdef EMTC_ENABLE - rgSCHEmtcCmnDlInit(); - rgSCHEmtcCmnUlInit(); -#endif -#ifdef LTEMAC_SPS - rgSCHCmnSpsInit(); -#endif - - /* Init the function pointers */ - rgSchCmnApis.rgSCHRgrUeCfg = rgSCHCmnRgrUeCfg; - rgSchCmnApis.rgSCHRgrUeRecfg = rgSCHCmnRgrUeRecfg; - rgSchCmnApis.rgSCHFreeUe = rgSCHCmnUeDel; - rgSchCmnApis.rgSCHRgrCellCfg = rgSCHCmnRgrCellCfg; - rgSchCmnApis.rgSCHRgrCellRecfg = rgSCHCmnRgrCellRecfg; - rgSchCmnApis.rgSCHFreeCell = rgSCHCmnCellDel; - rgSchCmnApis.rgSCHRgrLchCfg = rgSCHCmnRgrLchCfg; - rgSchCmnApis.rgSCHRgrLcgCfg = rgSCHCmnRgrLcgCfg; - rgSchCmnApis.rgSCHRgrLchRecfg = rgSCHCmnRgrLchRecfg; - rgSchCmnApis.rgSCHRgrLcgRecfg = rgSCHCmnRgrLcgRecfg; - rgSchCmnApis.rgSCHFreeDlLc = rgSCHCmnFreeDlLc; - rgSchCmnApis.rgSCHFreeLcg = rgSCHCmnLcgDel; - rgSchCmnApis.rgSCHRgrLchDel = rgSCHCmnRgrLchDel; - rgSchCmnApis.rgSCHActvtUlUe = rgSCHCmnActvtUlUe; - rgSchCmnApis.rgSCHActvtDlUe = rgSCHCmnActvtDlUe; - rgSchCmnApis.rgSCHHdlUlTransInd = rgSCHCmnHdlUlTransInd; - rgSchCmnApis.rgSCHDlDedBoUpd = rgSCHCmnDlDedBoUpd; - rgSchCmnApis.rgSCHUlRecMsg3Alloc = rgSCHCmnUlRecMsg3Alloc; - rgSchCmnApis.rgSCHUlCqiInd = rgSCHCmnUlCqiInd; - rgSchCmnApis.rgSCHPucchDeltaPwrInd = rgSCHPwrPucchDeltaInd; - rgSchCmnApis.rgSCHUlHqProcForUe = rgSCHCmnUlHqProcForUe; -#ifdef RG_UNUSED - rgSchCmnApis.rgSCHUpdUlHqProc = rgSCHCmnUpdUlHqProc; -#endif - rgSchCmnApis.rgSCHUpdBsrShort = rgSCHCmnUpdBsrShort; - rgSchCmnApis.rgSCHUpdBsrTrunc = rgSCHCmnUpdBsrTrunc; - rgSchCmnApis.rgSCHUpdBsrLong = rgSCHCmnUpdBsrLong; - rgSchCmnApis.rgSCHUpdPhr = rgSCHCmnUpdPhr; - rgSchCmnApis.rgSCHUpdExtPhr = rgSCHCmnUpdExtPhr; - rgSchCmnApis.rgSCHContResUlGrant = rgSCHCmnContResUlGrant; - rgSchCmnApis.rgSCHSrRcvd = rgSCHCmnSrRcvd; - rgSchCmnApis.rgSCHFirstRcptnReq = rgSCHCmnFirstRcptnReq; - rgSchCmnApis.rgSCHNextRcptnReq = rgSCHCmnNextRcptnReq; - rgSchCmnApis.rgSCHFirstHqFdbkAlloc = rgSCHCmnFirstHqFdbkAlloc; - rgSchCmnApis.rgSCHNextHqFdbkAlloc = rgSCHCmnNextHqFdbkAlloc; - rgSchCmnApis.rgSCHDlProcAddToRetx = rgSCHCmnDlProcAddToRetx; - rgSchCmnApis.rgSCHDlCqiInd = rgSCHCmnDlCqiInd; -#ifdef EMTC_ENABLE - rgSchCmnApis.rgSCHUlProcAddToRetx = rgSCHCmnEmtcUlProcAddToRetx; -#endif -#ifdef TFU_UPGRADE - rgSchCmnApis.rgSCHSrsInd = rgSCHCmnSrsInd; -#endif - rgSchCmnApis.rgSCHDlTARpt = rgSCHCmnDlTARpt; - rgSchCmnApis.rgSCHDlRlsSubFrm = rgSCHCmnDlRlsSubFrm; - rgSchCmnApis.rgSCHUeReset = rgSCHCmnUeReset; -#ifdef LTEMAC_SPS - rgSchCmnApis.rgSCHHdlCrntiCE = rgSCHCmnHdlCrntiCE; - rgSchCmnApis.rgSCHDlProcAck = rgSCHCmnDlProcAck; - rgSchCmnApis.rgSCHDlRelPdcchFbk = rgSCHCmnDlRelPdcchFbk; - rgSchCmnApis.rgSCHUlSpsRelInd = rgSCHCmnUlSpsRelInd; - rgSchCmnApis.rgSCHUlSpsActInd = rgSCHCmnUlSpsActInd; - rgSchCmnApis.rgSCHUlCrcFailInd = rgSCHCmnUlCrcFailInd; - rgSchCmnApis.rgSCHUlCrcInd = rgSCHCmnUlCrcInd; -#endif - rgSchCmnApis.rgSCHDrxStrtInActvTmrInUl = rgSCHCmnDrxStrtInActvTmrInUl; - rgSchCmnApis.rgSCHUpdUeDataIndLcg = rgSCHCmnUpdUeDataIndLcg; - - for (idx = 0; idx < RGSCH_NUM_SCHEDULERS; ++idx) - { - rgSchUlSchdInits[idx](&rgSchUlSchdTbl[idx]); - rgSchDlSchdInits[idx](&rgSchDlSchdTbl[idx]); - } -#ifdef EMTC_ENABLE - for (idx = 0; idx < RGSCH_NUM_EMTC_SCHEDULERS; ++idx) - { - rgSchEmtcUlSchdInits[idx](&rgSchEmtcUlSchdTbl[idx]); - rgSchEmtcDlSchdInits[idx](&rgSchEmtcDlSchdTbl[idx]); - } -#endif -#if (defined (RG_PHASE2_SCHED) && defined(TFU_UPGRADE)) - for (idx = 0; idx < RGSCH_NUM_DLFS_SCHEDULERS; ++idx) - { - rgSchDlfsSchdInits[idx](&rgSchDlfsSchdTbl[idx]); - } -#endif -#ifdef LTE_ADV - rgSchCmnApis.rgSCHRgrSCellUeCfg = rgSCHCmnRgrSCellUeCfg; - rgSchCmnApis.rgSCHRgrSCellUeDel = rgSCHCmnRgrSCellUeDel; -#endif - RETVOID; -} - - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHCmnDlRlsSubFrm - * Purpose: Releases scheduler Information from DL SubFrm. - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[out] CmLteTimingInfo frm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlRlsSubFrm -( -RgSchCellCb *cell, -CmLteTimingInfo frm -) -#else -PUBLIC Void rgSCHCmnDlRlsSubFrm(cell, frm) -RgSchCellCb *cell; -CmLteTimingInfo frm; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchDlSf *sf; - - TRC2(rgSCHCmnDlRlsSubFrm); - - /* Get the pointer to the subframe */ - sf = rgSCHUtlSubFrmGet(cell, frm); - - rgSCHUtlSubFrmPut(cell, sf); - if (sf->dlfsSf) - { - /* Re-initialize DLFS specific information for the sub-frame */ - cellSch->apisDlfs->rgSCHDlfsReinitSf(cell, sf); - } - RETVOID; -} - - - -/** - * @brief This function is the starting function for DL allocation. - * - * @details - * - * Function: rgSCHCmnDlCmnChAlloc - * Purpose: Scheduling for downlink. It performs allocation in the order - * of priority wich BCCH/PCH first, CCCH, Random Access and TA. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[out] RgSchCmnDlRbAllocInfo* allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchRarAlloc -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnDlCcchRarAlloc(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnDlCcchRarAlloc); - - rgSCHCmnDlCcchRetx(cell, &cellSch->allocInfo); - /* LTE_ADV_FLAG_REMOVED_START */ - if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) - { - if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) - { - /*eNodeB need to blank the subframe */ - } - else - { - rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo); - } - } - else - { - rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo); - } - /* LTE_ADV_FLAG_REMOVED_END */ - -#ifdef RGR_V1 - - /*Added these function calls for processing CCCH SDU arriving - * after guard timer expiry.Functions differ from above two functions - * in using ueCb instead of raCb.*/ - rgSCHCmnDlCcchSduRetx(cell, &cellSch->allocInfo); - /* LTE_ADV_FLAG_REMOVED_START */ - if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) - { - if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) - { - /*eNodeB need to blank the subframe */ - } - else - { - rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo); - } - } - else - { - rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo); - } - /* LTE_ADV_FLAG_REMOVED_END */ -#endif - -#ifdef LTE_TDD - if(cellSch->ul.msg3SchdIdx != RGSCH_INVALID_INFO) - { - /* Do not schedule msg3 if there is a CFI change ongoing */ - if (cellSch->dl.currCfi == cellSch->dl.newCfi) - { - rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); - } - } -#else - /* LTE_ADV_FLAG_REMOVED_START */ - if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) - { - if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) - { - /*eNodeB need to blank the subframe */ - } - else - { - /* Do not schedule msg3 if there is a CFI change ongoing */ - if (cellSch->dl.currCfi == cellSch->dl.newCfi) - { - rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); - } - } - } - else - { - /* Do not schedule msg3 if there is a CFI change ongoing */ - if (cellSch->dl.currCfi == cellSch->dl.newCfi) - { - rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); - } - } - /* LTE_ADV_FLAG_REMOVED_END */ -#endif - - RETVOID; -} - -#ifdef RGR_V1 -/** - * @brief Scheduling for CCCH SDU. - * - * @details - * - * Function: rgSCHCmnCcchSduAlloc - * Purpose: Scheduling for CCCH SDU - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ueCb - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnCcchSduAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE S16 rgSCHCmnCcchSduAlloc(cell, ueCb, allocInfo) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchDlRbAlloc *rbAllocInfo; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); - - TRC2(rgSCHCmnCcchSduAlloc); - - /* Return if subframe BW exhausted */ - if (allocInfo->ccchSduAlloc.ccchSduDlSf->bw <= - allocInfo->ccchSduAlloc.ccchSduDlSf->bwAssigned) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "bw<=bwAssigned for UEID:%d",ueCb->ueId); - RETVALUE(RFAILED); - } - - if (rgSCHDhmGetCcchSduHqProc(ueCb, cellSch->dl.time, &(ueDl->proc)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHDhmGetCcchSduHqProc failed UEID:%d",ueCb->ueId); - RETVALUE(RFAILED); - } - - rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); - rbAllocInfo->dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; - - if (rgSCHCmnCcchSduDedAlloc(cell, ueCb) != ROK) - { - /* Fix : syed Minor failure handling, release hqP if Unsuccessful */ - rgSCHDhmRlsHqpTb(ueDl->proc, 0, FALSE); - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnCcchSduDedAlloc failed UEID:%d",ueCb->ueId); - RETVALUE(RFAILED); - } - cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduTxLst, &ueDl->proc->reqLnk); - ueDl->proc->reqLnk.node = (PTR)ueDl->proc; - allocInfo->ccchSduAlloc.ccchSduDlSf->schdCcchUe++; - - RETVALUE(ROK); -} -/** - * @brief This function scheduler for downlink CCCH messages. - * - * @details - * - * Function: rgSCHCmnDlCcchSduTx - * Purpose: Scheduling for downlink CCCH - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchSduTx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchSduTx(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchUeCb *ueCb; - RgSchCmnDlUe *ueCmnDl; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; - - TRC2(rgSCHCmnDlCcchSduTx); - - node = cell->ccchSduUeLst.first; - while(node) - { - if(cellSch->dl.maxCcchPerDlSf && - dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) - { - break; - } - else - { - ueCb = (RgSchUeCb *)(node->node); - ueCmnDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); - node = node->next; - /* Fix : syed postpone scheduling for this - * until msg4 is done */ - /* Fix : syed RLC can erroneously send CCCH SDU BO - * twice. Hence an extra guard to avoid if already - * scheduled for RETX */ - if ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) && - (!ueCmnDl->proc)) - { - if ((rgSCHCmnCcchSduAlloc(cell, ueCb, allocInfo)) != ROK) - { - break; - } - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"ERROR!! THIS SHOULD " - "NEVER HAPPEN for UEID:%d", ueCb->ueId); - continue; - } - } - } - RETVOID; -} -#endif - -/** - * @brief This function scheduler for downlink CCCH messages. - * - * @details - * - * Function: rgSCHCmnDlCcchTx - * Purpose: Scheduling for downlink CCCH - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchTx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchTx(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchRaCb *raCb; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf; - - TRC2(rgSCHCmnDlCcchTx); - - node = cell->raInfo.toBeSchdLst.first; - while(node) - { - if(cellSch->dl.maxCcchPerDlSf && - dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) - { - break; - } - else - { - - raCb = (RgSchRaCb *)(node->node); - node = node->next; - /* Address allocation for this UE for MSG 4 */ - /* Allocation for Msg4 */ - if ((rgSCHCmnMsg4Alloc(cell, raCb, allocInfo)) != ROK) - { - break; - } - } - } - RETVOID; -} - -#ifdef RGR_V1 -/** - * @brief This function scheduler for downlink CCCH messages. - * - * @details - * - * Function: rgSCHCmnDlCcchSduRetx - * Purpose: Scheduling for downlink CCCH - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchSduRetx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchSduRetx(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchDlRbAlloc *rbAllocInfo; - CmLList *node; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchUeCb *ueCb; - RgSchDlHqProcCb *hqP; - U8 retxBw = 0; - RgSchCmnDlUe *ueDl; - RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; - - TRC2(rgSCHCmnDlCcchSduRetx); - - node = cellSch->dl.ccchSduRetxLst.first; - while(node) - { - if(cellSch->dl.maxCcchPerDlSf && - dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) - { - break; - } - else - { - - hqP = (RgSchDlHqProcCb *)(node->node); - node = node->next; - - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if (rgSCHCmnRetxAvoidTdd(allocInfo->ccchSduAlloc.ccchSduDlSf, - cell, hqP) == TRUE) - { - continue; - } -#endif - /* DwPts Scheduling Changes End */ - - if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned)) - { - break; - } - ueCb = (RgSchUeCb*)(hqP->hqE->ue); - ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); - - rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); - /* Fill RB Alloc Info */ - rbAllocInfo->dlSf = dlSf; - rbAllocInfo->tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes; - rbAllocInfo->rbsReq = hqP->tbInfo[0].dlGrnt.numRb; - /* Fix : syed iMcs setting did not correspond to RETX */ - RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]), - rbAllocInfo->tbInfo[0].imcs); - rbAllocInfo->rnti = ueCb->ueId; - rbAllocInfo->tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs; - /* Fix : syed Copying info in entirety without depending on stale TX information */ - rbAllocInfo->tbInfo[0].tbCb = &hqP->tbInfo[0]; - rbAllocInfo->tbInfo[0].schdlngForTb = TRUE; - /* Fix : syed Assigning proc to scratchpad */ - ueDl->proc = hqP; - - retxBw += rbAllocInfo->rbsReq; - - cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduRetxLst, \ - &hqP->reqLnk); - hqP->reqLnk.node = (PTR)hqP; - dlSf->schdCcchUe++; - } - } - dlSf->bwAssigned += retxBw; - RETVOID; -} -#endif - -/** - * @brief This function scheduler for downlink CCCH messages. - * - * @details - * - * Function: rgSCHCmnDlCcchRetx - * Purpose: Scheduling for downlink CCCH - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchRetx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchRetx(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchRaCb *raCb; - RgSchDlHqProcCb *hqP; - U8 retxBw = 0; - RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf; - - TRC2(rgSCHCmnDlCcchRetx); - - node = cellSch->dl.msg4RetxLst.first; - while(node) - { - if(cellSch->dl.maxCcchPerDlSf && - dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) - { - break; - } - else - { - hqP = (RgSchDlHqProcCb *)(node->node); - - node = node->next; - - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if (rgSCHCmnRetxAvoidTdd(allocInfo->msg4Alloc.msg4DlSf, - cell, hqP) == TRUE) - { - continue; - } -#endif - /* DwPts Scheduling Changes End */ - - if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned)) - { - break; - } - raCb = (RgSchRaCb*)(hqP->hqE->raCb); - /* Fill RB Alloc Info */ - raCb->rbAllocInfo.dlSf = dlSf; - raCb->rbAllocInfo.tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes; - raCb->rbAllocInfo.rbsReq = hqP->tbInfo[0].dlGrnt.numRb; - /* Fix : syed iMcs setting did not correspond to RETX */ - RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]), - raCb->rbAllocInfo.tbInfo[0].imcs); - raCb->rbAllocInfo.rnti = raCb->tmpCrnti; - raCb->rbAllocInfo.tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs; - /* Fix; syed Copying info in entirety without depending on stale TX information */ - raCb->rbAllocInfo.tbInfo[0].tbCb = &hqP->tbInfo[0]; - raCb->rbAllocInfo.tbInfo[0].schdlngForTb = TRUE; - - retxBw += raCb->rbAllocInfo.rbsReq; - - cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4RetxLst, \ - &hqP->reqLnk); - hqP->reqLnk.node = (PTR)hqP; - dlSf->schdCcchUe++; - } - } - dlSf->bwAssigned += retxBw; - RETVOID; -} - - -/** - * @brief This function implements scheduler DL allocation for - * for broadcast (on PDSCH) and paging. - * - * @details - * - * Function: rgSCHCmnDlBcchPcch - * Purpose: This function implements scheduler for DL allocation - * for broadcast (on PDSCH) and paging. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlBcchPcch -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgInfSfAlloc *subfrmAlloc -) -#else -PRIVATE Void rgSCHCmnDlBcchPcch(cell, allocInfo, subfrmAlloc) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -RgInfSfAlloc *subfrmAlloc; -#endif -{ - CmLteTimingInfo frm; - RgSchDlSf *sf; - RgSchClcDlLcCb *pcch; - RgSchClcBoRpt *bo; -#ifndef RGR_SI_SCH - Bool valid; - RgSchClcDlLcCb *bcch, *bch; -#endif/*RGR_SI_SCH*/ - - - TRC2(rgSCHCmnDlBcchPcch); - - frm = cell->crntTime; -#ifdef LTEMAC_HDFDD - /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA - + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); -#else - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); -#endif - - /* Compute the subframe for which allocation is being made */ - /* essentially, we need pointer to the dl frame for this subframe */ - sf = rgSCHUtlSubFrmGet(cell, frm); - - -#ifndef RGR_SI_SCH - bch = rgSCHDbmGetBcchOnBch(cell); -#if (ERRCLASS & ERRCLS_DEBUG) - if (bch == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on BCH is not configured"); - RETVOID; - } -#endif - if (bch->boLst.first != NULLP) - { - bo = (RgSchClcBoRpt *)(bch->boLst.first->node); - if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) - { - sf->bch.tbSize = bo->bo; - cmLListDelFrm(&bch->boLst, bch->boLst.first); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(*bo)); - rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, bch->lcId,TRUE); - } - } - else - { - if ((frm.sfn % 4 == 0) && (frm.subframe == 0)) - { - } - } - - allocInfo->bcchAlloc.schdFirst = FALSE; - bcch = rgSCHDbmGetFirstBcchOnDlsch(cell); -#if (ERRCLASS & ERRCLS_DEBUG) - if (bcch == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on DLSCH is not configured"); - RETVOID; - } -#endif - if (bcch->boLst.first != NULLP) - { - bo = (RgSchClcBoRpt *)(bcch->boLst.first->node); - - if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) - { - allocInfo->bcchAlloc.schdFirst = TRUE; - /* Time to perform allocation for this BCCH transmission */ - rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo); - } - } - - if(!allocInfo->bcchAlloc.schdFirst) - { - CmLList *lnk; - bcch = rgSCHDbmGetSecondBcchOnDlsch(cell); -#if (ERRCLASS & ERRCLS_DEBUG) - if (bcch == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on DLSCH is not configured"); - RETVOID; - } -#endif - lnk = bcch->boLst.first; - while (lnk != NULLP) - { - bo = (RgSchClcBoRpt *)(lnk->node); - lnk = lnk->next; - valid = rgSCHCmnChkInWin(frm, bo->timeToTx, bo->maxTimeToTx); - - if(valid) - { - bo->i = RGSCH_CALC_SF_DIFF(frm, bo->timeToTx); - /* Time to perform allocation for this BCCH transmission */ - rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo); - break; - } - else - { - valid = rgSCHCmnChkPastWin(frm, bo->maxTimeToTx); - if(valid) - { - cmLListDelFrm(&bcch->boLst, &bo->boLstEnt); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, - sizeof(RgSchClcBoRpt)); - } - } - } - } -#else - rgSCHDlSiSched(cell, allocInfo, subfrmAlloc); -#endif/*RGR_SI_SCH*/ - - pcch = rgSCHDbmGetPcch(cell); -#ifdef ERRCLS_KW - if (pcch == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"PCCH on DLSCH is not configured"); - RETVOID; - } -#endif - if (pcch->boLst.first != NULLP) - { - bo = (RgSchClcBoRpt *)(pcch->boLst.first->node); - - if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) - { - /* Time to perform allocation for this PCCH transmission */ - rgSCHCmnClcAlloc(cell, sf, pcch, RGSCH_P_RNTI, allocInfo); - } - } - RETVOID; -} - -/* -* -* Fun: rgSCHCmnChkInWin -* -* Desc: This function checks if frm occurs in window -* -* Ret: TRUE - if in window -* FALSE - otherwise -* -* Notes: None -* -* File: rg_sch_cmn.c -* -*/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnChkInWin -( -CmLteTimingInfo frm, -CmLteTimingInfo start, -CmLteTimingInfo end -) -#else -PUBLIC Bool rgSCHCmnChkInWin(frm, start, end) -CmLteTimingInfo frm; -CmLteTimingInfo start; -CmLteTimingInfo end; -#endif -{ - Bool inWin = FALSE; - - TRC2(rgSCHCmnChkInWin); - - if (end.sfn > start.sfn) - { - if (frm.sfn > start.sfn - || (frm.sfn == start.sfn && frm.subframe >= start.subframe)) - { - if (frm.sfn < end.sfn -#ifdef EMTC_ENABLE - || (frm.sfn == end.sfn && frm.subframe <= end.subframe)) -#else - || (frm.sfn == end.sfn && frm.subframe <= start.subframe)) -#endif - { - inWin = TRUE; - } - } - } - /* Testing for wrap around, sfn wraparound check should be enough */ - else if (end.sfn < start.sfn) - { - if (frm.sfn > start.sfn - || (frm.sfn == start.sfn && frm.subframe >= start.subframe)) - { - inWin = TRUE; - } - else - { - if (frm.sfn < end.sfn - || (frm.sfn == end.sfn && frm.subframe <= end.subframe)) - { - inWin = TRUE; - } - } - } - else /* start.sfn == end.sfn */ - { - if (frm.sfn == start.sfn - && (frm.subframe >= start.subframe - && frm.subframe <= end.subframe)) - { - inWin = TRUE; - } - } - - RETVALUE(inWin); -} /* end of rgSCHCmnChkInWin*/ - -/* -* -* Fun: rgSCHCmnChkPastWin -* -* Desc: This function checks if frm has gone past window edge -* -* Ret: TRUE - if past window edge -* FALSE - otherwise -* -* Notes: None -* -* File: rg_sch_cmn.c -* -*/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnChkPastWin -( -CmLteTimingInfo frm, -CmLteTimingInfo end -) -#else -PUBLIC Bool rgSCHCmnChkPastWin(frm, end) -CmLteTimingInfo frm; -CmLteTimingInfo end; -#endif -{ - CmLteTimingInfo refFrm = end; - Bool pastWin; - - TRC2(rgSCHCmnChkPastWin); - - RGSCH_INCR_FRAME(refFrm.sfn); - RGSCH_INCR_SUB_FRAME(end, 1); - pastWin = rgSCHCmnChkInWin(frm, end, refFrm); - - RETVALUE(pastWin); -} /* end of rgSCHCmnChkPastWin*/ - -/** - * @brief This function implements allocation of the resources for common - * channels BCCH, PCCH. - * - * @details - * - * Function: rgSCHCmnClcAlloc - * Purpose: This function implements selection of number of RBs based - * the allowed grant for the service. It is also responsible - * for selection of MCS for the transmission. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell, - * @param[in] RgSchDlSf *sf, - * @param[in] RgSchClcDlLcCb *lch, - * @param[in] U16 rnti, - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnClcAlloc -( -RgSchCellCb *cell, -RgSchDlSf *sf, -RgSchClcDlLcCb *lch, -U16 rnti, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnClcAlloc(cell, sf, lch, rnti, allocInfo) -RgSchCellCb *cell; -RgSchDlSf *sf; -RgSchClcDlLcCb *lch; -U16 rnti; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchClcBoRpt *bo; - U32 rb=0; - U8 mcs; - U32 tbs; -#ifdef LTE_TDD - U8 lostRe; - U8 cfi = cellDl->currCfi; -#endif - - TRC2(rgSCHCmnClcAlloc); - - bo = (RgSchClcBoRpt *)(lch->boLst.first->node); - - mcs = bo->mcs; - tbs = bo->bo; - /* rgSCHCmnClcRbAllocForFxdTb(cell, bo->bo, cellDl->ccchCqi, &rb);*/ - if(cellDl->bitsPerRb==0) - { - while ((rgTbSzTbl[0][0][rb]) < (tbs*8)) - { - rb++; - } - rb = rb+1; - } - else - { - rb = RGSCH_CEIL((tbs*8), cellDl->bitsPerRb); - } - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - if(sf->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); - - /* Calculate the less RE's because of DwPTS */ - lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]); - - /* Increase number of RBs in Spl SF to compensate for lost REs */ - rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); - } -#endif - /* DwPTS Scheduling Changes End */ - /*ccpu00115595- end*/ - /* additional check to see if required RBs - * exceeds the available */ - if (rb > sf->bw - sf->bwAssigned) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"BW allocation " - "failed for CRNTI:%d",rnti); - RETVOID; - } - - /* Update the subframe Allocated BW field */ - sf->bwAssigned = sf->bwAssigned + rb; - /* Fill in the BCCH/PCCH transmission info to the RBAllocInfo struct */ - if (rnti == RGSCH_SI_RNTI) - { - allocInfo->bcchAlloc.rnti = rnti; - allocInfo->bcchAlloc.dlSf = sf; - allocInfo->bcchAlloc.tbInfo[0].bytesReq = tbs; - allocInfo->bcchAlloc.rbsReq = rb; - allocInfo->bcchAlloc.tbInfo[0].imcs = mcs; - allocInfo->bcchAlloc.tbInfo[0].noLyr = 1; - /* Nprb indication at PHY for common Ch */ - allocInfo->bcchAlloc.nPrb = bo->nPrb; - } - else - { - allocInfo->pcchAlloc.rnti = rnti; - allocInfo->pcchAlloc.dlSf = sf; - allocInfo->pcchAlloc.tbInfo[0].bytesReq = tbs; - allocInfo->pcchAlloc.rbsReq = rb; - allocInfo->pcchAlloc.tbInfo[0].imcs = mcs; - allocInfo->pcchAlloc.tbInfo[0].noLyr = 1; - allocInfo->pcchAlloc.nPrb = bo->nPrb; - } - RETVOID; -} - - -/** - * @brief This function implements PDCCH allocation for common channels. - * - * @details - * - * Function: rgSCHCmnCmnPdcchAlloc - * Purpose: This function implements allocation of PDCCH for a UE. - * 1. This uses index 0 of PDCCH table for efficiency. - * 2. Uses he candidate PDCCH count for the aggr level. - * 3. Look for availability for each candidate and choose - * the first one available. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *sf - * @return RgSchPdcch * - * -# NULLP when unsuccessful - * - **/ -#ifdef ANSI -PUBLIC RgSchPdcch *rgSCHCmnCmnPdcchAlloc -( -RgSchCellCb *cell, -RgSchDlSf *subFrm -) -#else -PUBLIC RgSchPdcch *rgSCHCmnCmnPdcchAlloc(cell, subFrm) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -#endif -{ - U8 i; - CmLteAggrLvl aggrLvl; - RgSchPdcchInfo *pdcchInfo; - RgSchPdcch *pdcch; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 numCce; /*store num CCEs based on - aggregation level */ - TRC2(rgSCHCmnCmnPdcchAlloc); - - aggrLvl = cellSch->dl.cmnChAggrLvl; - - pdcchInfo = &(subFrm->pdcchInfo); - - /* Updating the no. of nCce in pdcchInfo, in case if CFI - * was changed */ -#ifdef LTE_TDD - if(subFrm->nCce != pdcchInfo->nCce) - { - rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce); - } -#else - if(cell->nCce != pdcchInfo->nCce) - { - rgSCHUtlPdcchInit(cell, subFrm, cell->nCce); - } -#endif - - switch (aggrLvl) - { - case CM_LTE_AGGR_LVL4: - numCce = 4; - break; - case CM_LTE_AGGR_LVL8: - numCce = 8; - break; - case CM_LTE_AGGR_LVL16: - numCce = 16; - break; - default: - RETVALUE(NULLP); - } - - if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE) - { -#ifdef LTEMAC_SPS - pdcch->isSpsRnti = FALSE; -#endif - /* Increment the CCE used counter in the current subframe */ - subFrm->cceCnt += numCce; - pdcch->pdcchSearchSpace = RG_SCH_CMN_SEARCH_SPACE; - - RETVALUE(pdcch); - } - - /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ - subFrm->isCceFailure = TRUE; - - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "PDCCH ERR: NO PDDCH AVAIL IN COMMON SEARCH SPACE aggr:%u", - aggrLvl); - RETVALUE(NULLP); -} - - -/** - * @brief This function implements bandwidth allocation for common channels. - * - * @details - * - * Function: rgSCHCmnClcRbAlloc - * Purpose: This function implements bandwith allocation logic - * for common control channels. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] U32 bo - * @param[in] U8 cqi - * @param[in] U8 *rb - * @param[in] U32 *tbs - * @param[in] U8 *mcs - * @param[in] RgSchDlSf *sf - * @return Void - * - **/ -#ifdef LTEMAC_SPS -#ifdef ANSI -PUBLIC Void rgSCHCmnClcRbAlloc -( -RgSchCellCb *cell, -U32 bo, -U8 cqi, -U8 *rb, -U32 *tbs, -U8 *mcs, -U8 *iTbs, -Bool isSpsBo, -RgSchDlSf *sf -) -#else -PUBLIC Void rgSCHCmnClcRbAlloc(cell, bo, cqi, rb, tbs, mcs, iTbs, isSpsBo) -RgSchCellCb *cell; -U32 bo; -U8 cqi; -U8 *rb; -U32 *tbs; -U8 *mcs; -U8 *iTbs; -Bool isSpsBo; -RgSchDlSf *sf; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSCHCmnClcRbAlloc -( -RgSchCellCb *cell, -U32 bo, -U8 cqi, -U8 *rb, -U32 *tbs, -U8 *mcs, -RgSchDlSf *sf -) -#else -PRIVATE Void rgSCHCmnClcRbAlloc(cell, bo, cqi, rb, tbs, mcs, sf) -RgSchCellCb *cell; -U32 bo; -U8 cqi; -U8 *rb; -U32 *tbs; -U8 *mcs; -RgSchDlSf *sf; -#endif -#endif /* LTEMAC_SPS */ -{ - U8 iTbsVal; - RgSchCmnTbSzEff *effTbl; - U32 eff; - U32 noRes; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 cfi = cellSch->dl.currCfi; - U32 tmpRb=0; - TRC2(rgSCHCmnClcRbAlloc); - - /* first get the CQI to MCS table and determine the number of RBs */ - effTbl = (RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]); - iTbsVal = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[cqi]; - RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs); - - /* Efficiency is number of bits per 1024 REs */ - eff = (*effTbl)[iTbsVal]; - - /* Get the number of REs needed for this bo */ - noRes = ((bo * 8 * 1024) / eff ); - - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - tmpRb = RGSCH_CEIL(noRes, cellSch->dl.noResPerRb[cfi]); - /* KWORK_FIX: added check to see if rb has crossed maxRb*/ - RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1)); - if (tmpRb > cellSch->dl.maxDlBwPerUe) - { - tmpRb = cellSch->dl.maxDlBwPerUe; - } - while ((rgTbSzTbl[0][iTbsVal][tmpRb-1]/8) < bo && - (tmpRb < cellSch->dl.maxDlBwPerUe)) - { - tmpRb++; - RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1)); - } - *tbs = rgTbSzTbl[0][iTbsVal][tmpRb-1]/8; - *rb = (U8)tmpRb; - RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs); - - RETVOID; -} - - - -/** - * @brief Scheduling for MSG4. - * - * @details - * - * Function: rgSCHCmnMsg4Alloc - * Purpose: Scheduling for MSG4 - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchRaCb* raCb - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnMsg4Alloc -( -RgSchCellCb *cell, -RgSchRaCb *raCb, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE S16 rgSCHCmnMsg4Alloc(cell, raCb, allocInfo) -RgSchCellCb *cell; -RgSchRaCb *raCb; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnMsg4Alloc); - - /* SR_RACH_STATS : MSG4 TO BE TXED */ - rgNumMsg4ToBeTx++; - /* Return if subframe BW exhausted */ - if (allocInfo->msg4Alloc.msg4DlSf->bw <= - allocInfo->msg4Alloc.msg4DlSf->bwAssigned) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId , - "bw<=bwAssigned"); - RETVALUE(RFAILED); - } - - if (rgSCHDhmGetMsg4HqProc(raCb, cellSch->dl.time) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHDhmGetMsg4HqProc failed"); - RETVALUE(RFAILED); - } - - raCb->rbAllocInfo.dlSf = allocInfo->msg4Alloc.msg4DlSf; - - if (rgSCHCmnMsg4DedAlloc(cell, raCb) != ROK) - { - /* Fix : syed Minor failure handling, release hqP if Unsuccessful */ - rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, FALSE); - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnMsg4DedAlloc failed."); - RETVALUE(RFAILED); - } - cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4TxLst, &raCb->dlHqE->msg4Proc->reqLnk); - raCb->dlHqE->msg4Proc->reqLnk.node = (PTR)raCb->dlHqE->msg4Proc; - allocInfo->msg4Alloc.msg4DlSf->schdCcchUe++; - - RETVALUE(ROK); -} - - -/** - * @brief This function implements PDCCH allocation for an UE. - * - * @details - * - * Function: PdcchAlloc - * Purpose: This function implements allocation of PDCCH for an UE. - * 1. Get the aggregation level for the CQI of the UE. - * 2. Get the candidate PDCCH count for the aggr level. - * 3. Look for availability for each candidate and choose - * the first one available. - * - * Invoked by: Scheduler - * - * @param[in] cell - * @param[in] subFrm - * @param[in] cqi - * @param[in] dciFrmt - * @return RgSchPdcch * - * -# NULLP when unsuccessful - * - **/ -#ifdef ANSI -PUBLIC RgSchPdcch *rgSCHCmnPdcchAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *subFrm, -U8 cqi, -TfuDciFormat dciFrmt, -Bool isDtx -) -#else -PUBLIC RgSchPdcch *rgSCHCmnPdcchAlloc(cell, subFrm, cqi, dciFrmt, isDtx) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlSf *subFrm; -U8 cqi; -TfuDciFormat dciFrmt; -Bool isDtx; -#endif -{ - CmLteAggrLvl aggrLvl; - RgSchPdcchInfo *pdcchInfo; - RgSchPdcch *pdcch; - U8 numxREGs; - - TRC2(rgSCHCmnPdcchAlloc); - - /* 3.1 consider the selected DCI format size in determining the - * aggregation level */ - //TODO_SID Need to update. Currently using 4 aggregation level - aggrLvl = CM_LTE_AGGR_LVL2;//cellSch->dciAggrLvl[cqi][dciFrmt]; - -#ifdef LTE_ADV - if((dciFrmt == TFU_DCI_FORMAT_1A) && - ((ue) && (ue->allocCmnUlPdcch)) ) - { - pdcch = rgSCHCmnCmnPdcchAlloc(cell, subFrm); - /* Since CRNTI Scrambled */ - if(NULLP != pdcch) - { - pdcch->dciNumOfBits = ue->dciSize.cmnSize[dciFrmt]; - // prc_trace_format_string(PRC_TRACE_GROUP_PS, PRC_TRACE_INFO_LOW,"Forcing alloc in CMN search spc size %d fmt %d \n", - // pdcch->dciNumOfBits, dciFrmt); - } - RETVALUE(pdcch); - } -#endif - - /* Incrementing aggrLvl by 1 if it not AGGR_LVL8(MAX SIZE) - * inorder to increse the redudancy bits for better decoding of UE */ - if (isDtx) - { - if (aggrLvl != CM_LTE_AGGR_LVL16) - { - switch(aggrLvl) - { - case CM_LTE_AGGR_LVL2: - aggrLvl = CM_LTE_AGGR_LVL4; - break; - case CM_LTE_AGGR_LVL4: - aggrLvl = CM_LTE_AGGR_LVL8; - break; - case CM_LTE_AGGR_LVL8: - aggrLvl = CM_LTE_AGGR_LVL16; - break; - default: - break; - } - /* aggrLvl += 1; */ - } - } - - pdcchInfo = &subFrm->pdcchInfo; - - /* Updating the no. of nCce in pdcchInfo, in case if CFI - * was changed */ -#ifdef LTE_TDD - if(subFrm->nCce != pdcchInfo->nCce) - { - rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce); - } -#else - if(cell->nCce != pdcchInfo->nCce) - { - rgSCHUtlPdcchInit(cell, subFrm, cell->nCce); - } -#endif - - if (pdcchInfo->nCce < (1 << (aggrLvl - 1))) - { - /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ - subFrm->isCceFailure = TRUE; - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)", - aggrLvl); - - RETVALUE(NULLP); - } - - if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE) - { - /* SR_RACH_STATS : Reset isTBMsg4 */ - pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4= FALSE; - pdcch->dci.u.format0Info.isSrGrant = FALSE; -#ifdef LTEMAC_SPS - pdcch->isSpsRnti = FALSE; -#endif - /* Increment the CCE used counter in the current subframe */ - subFrm->cceCnt += aggrLvl; - pdcch->pdcchSearchSpace = RG_SCH_UE_SPECIFIC_SEARCH_SPACE; - if (ue != NULLP) - { -#ifdef LTE_ADV - if (ue->cell != cell) - { - /* Secondary Cell */ - //pdcch->dciNumOfBits = ue->dciSize.noUlCcSize[dciFrmt]; - pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE; - } - else -#endif - { - //pdcch->dciNumOfBits = ue->dciSize.dedSize[dciFrmt]; - //TODO_SID Need to update dci size. - pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE; - } - } - else - { - /* MSG4 */ - pdcch->dciNumOfBits = cell->dciSize.size[dciFrmt]; - } - RETVALUE(pdcch); - } - - /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ - subFrm->isCceFailure = TRUE; - - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)", - aggrLvl); - RETVALUE(NULLP); -} - -#ifdef RGR_V1 -/** - * @brief This function implements BW allocation for CCCH SDU - * - * @details - * - * Function: rgSCHCmnCcchSduDedAlloc - * Purpose: Downlink bandwidth Allocation for CCCH SDU. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[out] RgSchUeCb *ueCb - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnCcchSduDedAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ueCb -) -#else -PRIVATE S16 rgSCHCmnCcchSduDedAlloc(cell, ueCb) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -#endif -{ - RgSchDlHqEnt *hqE = NULLP; - U32 effBo; - RgSchDlRbAlloc *rbAllocinfo = NULLP; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 iTbs; - U8 numRb; -#ifdef LTE_TDD - U8 cfi = cellDl->currCfi; -#endif - - TRC2(rgSCHCmnCcchSduDedAlloc); - - rbAllocinfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); - - effBo = ueCb->dlCcchInfo.bo + RGSCH_CCCH_SDU_HDRSIZE; - -#ifndef LTEMAC_SPS - rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \ - &rbAllocinfo->tbInfo[0].bytesReq, - &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf); -#else /* LTEMAC_SPS */ - rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \ - &rbAllocinfo->tbInfo[0].bytesReq,\ - &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE, - rbAllocinfo->dlSf); -#endif /* LTEMAC_SPS */ - - iTbs = 0; - /* Cannot exceed the total number of RBs in the cell */ - if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \ - rbAllocinfo->dlSf->bwAssigned))) - { - /* Check if atleast one allocation was possible. - This may be the case where the Bw is very less and - with the configured CCCH CQI, CCCH SDU exceeds the min Bw */ - if (rbAllocinfo->dlSf->bwAssigned == 0) - { - numRb = rbAllocinfo->dlSf->bw; - RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs); - while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo) - { - iTbs++; - } - rbAllocinfo->rbsReq = numRb; - rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8; - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - rbAllocinfo->tbInfo[0].bytesReq = - rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1,cfi); - } -#endif - /* DwPTS Scheduling Changes End */ - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs); - } - else - { - RETVALUE(RFAILED); - } - } - - /* Update the subframe Allocated BW field */ - rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \ - rbAllocinfo->rbsReq; - hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell); - rbAllocinfo->tbInfo[0].tbCb = &hqE->ccchSduProc->tbInfo[0]; - rbAllocinfo->rnti = ueCb->ueId; - rbAllocinfo->tbInfo[0].noLyr = 1; - - RETVALUE(ROK); -} -#endif - -/** - * @brief This function implements BW allocation for MSG4 - * - * @details - * - * Function: rgSCHCmnMsg4DedAlloc - * Purpose: Downlink bandwidth Allocation for MSG4. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[out] RgSchRaCb *raCb - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnMsg4DedAlloc -( -RgSchCellCb *cell, -RgSchRaCb *raCb -) -#else -PRIVATE S16 rgSCHCmnMsg4DedAlloc(cell, raCb) -RgSchCellCb *cell; -RgSchRaCb *raCb; -#endif -{ - U32 effBo; - RgSchDlRbAlloc *rbAllocinfo = &raCb->rbAllocInfo; - U8 iTbs; - U8 numRb; -#ifdef LTE_TDD - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 cfi = cellDl->currCfi; -#endif - - TRC2(rgSCHCmnMsg4DedAlloc); - - effBo = raCb->dlCcchInfo.bo + RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE; - -#ifndef LTEMAC_SPS - rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \ - &rbAllocinfo->tbInfo[0].bytesReq,\ - &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf); -#else /* LTEMAC_SPS */ - rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \ - &rbAllocinfo->tbInfo[0].bytesReq,\ - &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE, - rbAllocinfo->dlSf); -#endif /* LTEMAC_SPS */ - - iTbs = 0; - /* Cannot exceed the total number of RBs in the cell */ - if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \ - rbAllocinfo->dlSf->bwAssigned))) - { - /* Check if atleast one allocation was possible. - This may be the case where the Bw is very less and - with the configured CCCH CQI, CCCH SDU exceeds the min Bw */ - if (rbAllocinfo->dlSf->bwAssigned == 0) - { - numRb = rbAllocinfo->dlSf->bw; - RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs); - while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo) - { - iTbs++; - } - rbAllocinfo->rbsReq = numRb; - rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8; - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - rbAllocinfo->tbInfo[0].bytesReq = - rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1, cfi); - } -#endif - /* DwPTS Scheduling Changes End */ - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs); - } - else - { - RETVALUE(RFAILED); - } - } - - /* Update the subframe Allocated BW field */ - rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \ - rbAllocinfo->rbsReq; - rbAllocinfo->rnti = raCb->tmpCrnti; - rbAllocinfo->tbInfo[0].tbCb = &raCb->dlHqE->msg4Proc->tbInfo[0]; - rbAllocinfo->tbInfo[0].schdlngForTb = TRUE; - rbAllocinfo->tbInfo[0].noLyr = 1; - - RETVALUE(ROK); -} - -#ifdef LTE_TDD -/** - * @brief This function implements scheduling for RA Response. - * - * @details - * - * Function: rgSCHCmnDlRaRsp - * Purpose: Downlink scheduling for RA responses. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRaRsp -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlRaRsp(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLteTimingInfo frm; - CmLteTimingInfo schFrm; - RgSchDlSf *subFrm; - U16 rarnti; - U8 i; - U8 noRaRnti=0; - U8 raIdx; - RgSchTddRachRspLst *rachRsp; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 sfnIdx; - U8 subfrmIdx; - U16 rntiIdx=0; - TRC2(rgSCHCmnDlRaRsp); - - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - - /* Compute the subframe for which allocation is being made */ - /* essentially, we need pointer to the dl frame for this subframe */ - subFrm = rgSCHUtlSubFrmGet(cell, frm); - - /* Get the RACH Response scheduling related information - * for the subframe with RA index */ - raIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][frm.subframe]-1; - - rachRsp = &cell->rachRspLst[raIdx]; - - for(sfnIdx = 0; sfnIdx < rachRsp->numRadiofrms; sfnIdx++) - { - /* For all scheduled RACH Responses in SFNs */ - schFrm = frm; - RG_SCH_CMN_DECR_FRAME(schFrm.sfn, rachRsp->rachRsp[sfnIdx].sfnOffset); - /* For all scheduled RACH Responses in subframes */ - for(subfrmIdx = 0; - subfrmIdx < rachRsp->rachRsp[sfnIdx].numSubfrms; subfrmIdx++) - { - schFrm.subframe = rachRsp->rachRsp[sfnIdx].subframe[subfrmIdx]; - /* compute the last RA RNTI used in the previous subframe */ - raIdx = (((schFrm.sfn % cell->raInfo.maxRaSize) * \ - RGSCH_NUM_SUB_FRAMES * RGSCH_MAX_RA_RNTI_PER_SUBFRM) \ - + schFrm.subframe); - - /* For all RA RNTIs within a subframe */ - - for(i=0; (i < RGSCH_MAX_RA_RNTI_PER_SUBFRM) && \ - (noRaRnti < RGSCH_MAX_TDD_RA_RSP_ALLOC); i++) - { - rarnti = (schFrm.subframe + RGSCH_NUM_SUB_FRAMES*i + 1); - rntiIdx = (raIdx + RGSCH_NUM_SUB_FRAMES*i); - - if (cell->raInfo.raReqLst[rntiIdx].first != NULLP) - { - /* compute the next RA RNTI */ - if (rgSCHCmnRaRspAlloc(cell, subFrm, rntiIdx, - rarnti, noRaRnti, allocInfo) != ROK) - { - /* The resources are exhausted */ - break; - } - noRaRnti++; - } - } - noRaRnti=0; - } - } - - RETVOID; -} -#else -/** - * @brief This function implements scheduling for RA Response. - * - * @details - * - * Function: rgSCHCmnDlRaRsp - * Purpose: Downlink scheduling for RA responses. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRaRsp //FDD -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlRaRsp(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLteTimingInfo frm; - CmLteTimingInfo winStartFrm; - RgSchDlSf *subFrm; - U8 winStartIdx; - U8 winGap; - U8 rarnti; - U8 raIdx; - RgSchCmnCell *sched; - U8 i,noRaRnti=0; - TRC2(rgSCHCmnDlRaRsp); - - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - - /* Compute the subframe for which allocation is being made */ - /* essentially, we need pointer to the dl frame for this subframe */ - subFrm = rgSCHUtlSubFrmGet(cell, frm); - sched = RG_SCH_CMN_GET_CELL(cell); - - /* ccpu00132523 - Window Start calculated by considering RAR window size, - * RAR Wait period, Subframes occuppied for respective preamble format*/ - winGap = (sched->dl.numRaSubFrms-1) + (cell->rachCfg.raWinSize-1) - +RGSCH_RARSP_WAIT_PERIOD; - - /* Window starting occassion is retrieved using the gap and tried to - * fit to the size of raReqLst array*/ - RGSCHDECRFRMCRNTTIME(frm, winStartFrm, winGap); - - //5G_TODO TIMING update. Need to check - winStartIdx = (winStartFrm.sfn & 1) * RGSCH_MAX_RA_RNTI+ winStartFrm.subframe; - - for(i = 0; ((i < cell->rachCfg.raWinSize) && (noRaRnti < RG_SCH_CMN_MAX_CMN_PDCCH)); i++) - { - raIdx = (winStartIdx + i) % RGSCH_RAREQ_ARRAY_SIZE; - - if (cell->raInfo.raReqLst[raIdx].first != NULLP) - { - allocInfo->raRspAlloc[noRaRnti].biEstmt = \ - (!i * RGSCH_ONE_BIHDR_SIZE); - rarnti = raIdx % RGSCH_MAX_RA_RNTI+ 1; - if (rgSCHCmnRaRspAlloc(cell, subFrm, raIdx, - rarnti, noRaRnti, allocInfo) != ROK) - { - /* The resources are exhausted */ - break; - } - /* ccpu00132523- If all the RAP ids are not scheduled then need not - * proceed for next RA RNTIs*/ - if(allocInfo->raRspAlloc[noRaRnti].numRapids < cell->raInfo.raReqLst[raIdx].count) - { - break; - } - noRaRnti++; /* Max of RG_SCH_CMN_MAX_CMN_PDCCH RARNTIs - for response allocation */ - } - } - RETVOID; -} -#endif - - -/** - * @brief This function allocates the resources for an RARNTI. - * - * @details - * - * Function: rgSCHCmnRaRspAlloc - * Purpose: Allocate resources to a RARNTI. - * 0. Allocate PDCCH for sending the response. - * 1. Locate the number of RA requests pending for the RARNTI. - * 2. Compute the size of data to be built. - * 3. Using common channel CQI, compute the number of RBs. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell, - * @param[in] RgSchDlSf *subFrm, - * @param[in] U16 rarnti, - * @param[in] U8 noRaRnti - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnRaRspAlloc -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -U16 raIndex, -U16 rarnti, -U8 noRaRnti, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE S16 rgSCHCmnRaRspAlloc(cell,subFrm,raIndex,rarnti,noRaRnti,allocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -U16 raIndex; -U16 rarnti; -U8 noRaRnti; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - U16 noBytes; - U32 rb = 0; - U32 tbs; - /*ccpu00116700,ccpu00116708- Corrected the wrong type for mcs*/ - U8 mcs; - CmLListCp *reqLst; - /* RACH handling related changes */ - Bool isAlloc = FALSE; - static U8 schdNumRapid = 0; - U8 remNumRapid = 0; - U8 nPrb = 0; - S32 allwdTbSz = 0; -#ifdef LTE_TDD - U16 lostRe; - U8 cfi = cellDl->currCfi; -#endif - - TRC2(rgSCHCmnRaRspAlloc); -#ifndef RGR_V1 - UNUSED(cellUl); -#endif - - /* ccpu00132523: Resetting the schdRap Id count in every scheduling subframe*/ - if(noRaRnti == 0) - { - schdNumRapid = 0; - } - - - if (subFrm->bw == subFrm->bwAssigned) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "bw == bwAssigned RARNTI:%d",rarnti); - RETVALUE(RFAILED); - } - - reqLst = &cell->raInfo.raReqLst[raIndex]; - if (reqLst->count == 0) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "reqLst Count=0 RARNTI:%d",rarnti); - RETVALUE(RFAILED); - } - remNumRapid = reqLst->count; - -#ifdef RGR_V1 - /* Limit number of rach rsps to maxMsg3PerUlsf */ - if ( schdNumRapid+remNumRapid > cellUl->maxMsg3PerUlSf ) - { - remNumRapid = cellUl->maxMsg3PerUlSf-schdNumRapid; - } -#endif - - while (remNumRapid) - { - /* Try allocating for as many RAPIDs as possible */ - /* BI sub-header size to the tbSize requirement */ - noBytes = RGSCH_GET_RAR_BYTES(remNumRapid) +\ - allocInfo->raRspAlloc[noRaRnti].biEstmt; - if ((allwdTbSz = rgSCHUtlGetAllwdCchTbSz(noBytes*8, &nPrb, &mcs)) == -1) - { - remNumRapid--; - continue; - } - - /* rgSCHCmnClcRbAllocForFxdTb(cell, allwdTbSz/8, cellDl->ccchCqi, &rb);*/ - if(cellDl->bitsPerRb==0) - { - while ((rgTbSzTbl[0][0][rb]) <(U32) allwdTbSz) - { - rb++; - } - rb = rb+1; - } - else - { - rb = RGSCH_CEIL(allwdTbSz, cellDl->bitsPerRb); - } - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - if (subFrm->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); - - /* Calculate the less RE's because of DwPTS */ - lostRe = rb * (cellDl->noResPerRb[cfi] - - cellDl->numReDwPts[cfi]); - - /* Increase number of RBs in Spl SF to compensate for lost REs */ - rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); - } -#endif - /* DwPTS Scheduling Changes End */ - - /*ccpu00115595- end*/ - if (rb > subFrm->bw - subFrm->bwAssigned) - { - remNumRapid--; - continue; - } - /* Allocation succeeded for 'remNumRapid' */ - isAlloc = TRUE; - tbs = allwdTbSz/8; - printf("\n!!!RAR alloc noBytes:%u,allwdTbSz:%u,tbs:%u,rb:%u\n", - noBytes,allwdTbSz,tbs,rb); - break; - } - if (!isAlloc) - { - RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"BW alloc Failed"); - RETVALUE(RFAILED); - } - - subFrm->bwAssigned = subFrm->bwAssigned + rb; - - /* Fill AllocInfo structure */ - allocInfo->raRspAlloc[noRaRnti].rnti = rarnti; - allocInfo->raRspAlloc[noRaRnti].tbInfo[0].bytesReq = tbs; - allocInfo->raRspAlloc[noRaRnti].rbsReq = rb; - allocInfo->raRspAlloc[noRaRnti].dlSf = subFrm; - allocInfo->raRspAlloc[noRaRnti].tbInfo[0].imcs = mcs; - allocInfo->raRspAlloc[noRaRnti].raIndex = raIndex; - /* RACH changes for multiple RAPID handling */ - allocInfo->raRspAlloc[noRaRnti].numRapids = remNumRapid; - allocInfo->raRspAlloc[noRaRnti].nPrb = nPrb; - allocInfo->raRspAlloc[noRaRnti].tbInfo[0].noLyr = 1; - allocInfo->raRspAlloc[noRaRnti].vrbgReq = RGSCH_CEIL(nPrb,MAX_5GTF_VRBG_SIZE); - schdNumRapid += remNumRapid; - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlAllocFillRbInfo - * - * Desc : Fills the start RB and the number of RBs for - * uplink allocation. - * - * Ret : void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAllocFillRbInfo -( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc) -RgSchCellCb *cell; -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 cfi = cellDl->currCfi; - - - TRC2(rgSCHCmnUlAllocFillRbInfo); - alloc->grnt.rbStart = (alloc->sbStart * cellUl->sbSize) + - cell->dynCfiCb.bwInfo[cfi].startRb; - - /* Num RBs = numSbAllocated * sbSize - less RBs in the last SB */ - alloc->grnt.numRb = (alloc->numSb * cellUl->sbSize); - - RETVOID; -} - -/** - * @brief Grant request for Msg3. - * - * @details - * - * Function : rgSCHCmnMsg3GrntReq - * - * This is invoked by downlink scheduler to request allocation - * for msg3. - * Steps: - * - Attempt to allocate msg3 in the current msg3 subframe - * Allocation attempt based on whether preamble is from group A - * and the value of MESSAGE_SIZE_GROUP_A - * - Link allocation with passed RNTI and msg3 HARQ process - * - Set the HARQ process ID (*hqProcIdRef) - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteRnti rnti - * @param[in] Bool preamGrpA - * @param[in] RgSchUlHqProcCb *hqProc - * @param[out] RgSchUlAlloc **ulAllocRef - * @param[out] U8 *hqProcIdRef - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnMsg3GrntReq -( -RgSchCellCb *cell, -CmLteRnti rnti, -Bool preamGrpA, -RgSchUlHqProcCb *hqProc, -RgSchUlAlloc **ulAllocRef, -U8 *hqProcIdRef -) -#else -PRIVATE Void rgSCHCmnMsg3GrntReq(cell, rnti, preamGrpA, hqProc, - ulAllocRef, hqProcIdRef) -RgSchCellCb *cell; -CmLteRnti rnti; -Bool preamGrpA; -RgSchUlHqProcCb *hqProc; -RgSchUlAlloc **ulAllocRef; -U8 *hqProcIdRef; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx]; - RgSchUlHole *hole; - RgSchUlAlloc *alloc; - U8 iMcs; - U8 numSb; - - TRC2(rgSCHCmnMsg3GrntReq); - - *ulAllocRef = NULLP; - - /* Fix: ccpu00120610 Use remAllocs from subframe during msg3 allocation */ - if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf) - { - RETVOID; - } - if (preamGrpA == FALSE) - { - numSb = cellUl->ra.prmblBNumSb; - iMcs = cellUl->ra.prmblBIMcs; - } - else - { - numSb = cellUl->ra.prmblANumSb; - iMcs = cellUl->ra.prmblAIMcs; - } - - if ((hole = rgSCHUtlUlHoleFirst(sf)) != NULLP) - { - if(*sf->allocCountRef == 0) - { - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - /* Reinitialize the hole */ - if (sf->holeDb->count == 1 && (hole->start == 0)) /* Sanity check of holeDb */ - { - hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; - /* Re-Initialize available subbands because of CFI change*/ - hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Error! holeDb sanity check failed RNTI:%d",rnti); - } - } - if (numSb <= hole->num) - { - U8 iTbs; - alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole); - rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); - alloc->grnt.iMcs = iMcs; - alloc->grnt.iMcsCrnt = iMcs; - iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs); - /* To include the length and ModOrder in DataRecp Req.*/ - alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; - RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr); - /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/ - alloc->grnt.nDmrs = 0; - alloc->grnt.hop = 0; - alloc->grnt.delayBit = 0; - alloc->grnt.isRtx = FALSE; - *ulAllocRef = alloc; - *hqProcIdRef = (cellUl->msg3SchdHqProcIdx); - hqProc->procId = *hqProcIdRef; - hqProc->ulSfIdx = (cellUl->msg3SchdIdx); - alloc->rnti = rnti; - alloc->ue = NULLP; - alloc->pdcch = FALSE; - alloc->forMsg3 = TRUE; - alloc->hqProc = hqProc; - rgSCHUhmNewTx(hqProc, (U8)(cell->rachCfg.maxMsg3Tx - 1), alloc); - //RLOG_ARG4(L_DEBUG,DBG_CELLID,cell->cellId, - printf( - "\nRNTI:%d MSG3 ALLOC proc(%p)procId(%d)schdIdx(%d)\n", - alloc->rnti, - ((PTR)alloc->hqProc), - alloc->hqProc->procId, - alloc->hqProc->ulSfIdx); - RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, - "alloc(%p)maxMsg3Tx(%d)", - ((PTR)alloc), - cell->rachCfg.maxMsg3Tx); - } - } - - RETVOID; -} - - -/** - * @brief This function determines the allocation limits and - * parameters that aid in DL scheduling. - * - * @details - * - * Function: rgSCHCmnDlSetUeAllocLmt - * Purpose: This function determines the Maximum RBs - * a UE is eligible to get based on softbuffer - * limitation and cell->>>maxDlBwPerUe. The Codeword - * specific parameters like iTbs, eff and noLyrs - * are also set in this function. This function - * is called while UE configuration and UeDlCqiInd. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgSchCmnDlUe *ueDl - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlSetUeAllocLmt -( -RgSchCellCb *cell, -RgSchCmnDlUe *ueDl, -Bool isEmtcUe -) -#else -PRIVATE Void rgSCHCmnDlSetUeAllocLmt(cell, ueDl, isEmtcUe) -RgSchCellCb *cell; -RgSchCmnDlUe *ueDl; -Bool isEmtcUe; -#endif -{ - U8 modOrder; - U32 maxRb; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 cfi = cellSch->dl.currCfi; - - TRC2(rgSCHCmnDlSetUeAllocLmt); - -#ifdef EMTC_ENABLE - if(TRUE == isEmtcUe) - { - /* ITbs for CW0 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].cqi]; - /* ITbs for CW0 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].cqi]; - /* Eff for CW0 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].iTbs[0]]; - /* Eff for CW0 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].iTbs[1]]; - - /* ITbs for CW1 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].cqi]; - /* ITbs for CW1 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].cqi]; - /* Eff for CW1 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].iTbs[0]]; - /* Eff for CW1 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].iTbs[1]]; - } - else -#endif - { - /* ITbs for CW0 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].cqi]; - /* ITbs for CW0 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].cqi]; - /* Eff for CW0 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].iTbs[0]]; - /* Eff for CW0 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[0].iTbs[1]]; - - /* ITbs for CW1 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].cqi]; - /* ITbs for CW1 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].cqi]; - /* Eff for CW1 for 1 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].iTbs[0]]; - /* Eff for CW1 for 2 Layer Tx */ - ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ - [ueDl->mimoInfo.cwInfo[1].iTbs[1]]; - } - -//#ifdef DL_LA - // ueDl->laCb.cqiBasediTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0] * 100; -//#endif - /* Assigning noLyrs to each CW assuming optimal Spatial multiplexing - * capability */ - (ueDl->mimoInfo.ri/2 == 0)? (ueDl->mimoInfo.cwInfo[0].noLyr = 1) : \ - (ueDl->mimoInfo.cwInfo[0].noLyr = ueDl->mimoInfo.ri/2); - ueDl->mimoInfo.cwInfo[1].noLyr = ueDl->mimoInfo.ri - ueDl->mimoInfo.cwInfo[0].noLyr; - /* rg002.101:ccpu00102106: correcting DL harq softbuffer limitation logic. - * The maxTbSz is the maximum number of PHY bits a harq process can - * hold. Hence we limit our allocation per harq process based on this. - * Earlier implementation we misinterpreted the maxTbSz to be per UE - * per TTI, but in fact it is per Harq per TTI. */ - /* rg002.101:ccpu00102106: cannot exceed the harq Tb Size - * and harq Soft Bits limit.*/ - - /* Considering iTbs corresponding to 2 layer transmission for - * codeword0(approximation) and the maxLayers supported by - * this UE at this point of time. */ - RG_SCH_CMN_TBS_TO_MODODR(ueDl->mimoInfo.cwInfo[0].iTbs[1], modOrder); - - /* Bits/modOrder gives #REs, #REs/noResPerRb gives #RBs */ - /* rg001.301 -MOD- [ccpu00119213] : avoiding wraparound */ - maxRb = ((ueDl->maxSbSz)/(cellSch->dl.noResPerRb[cfi] * modOrder *\ - ueDl->mimoInfo.ri)); - if (cellSch->dl.isDlFreqSel) - { - /* Rounding off to left nearest multiple of RBG size */ - maxRb -= maxRb % cell->rbgSize; - } - ueDl->maxRb = RGSCH_MIN(maxRb, cellSch->dl.maxDlBwPerUe); - if (cellSch->dl.isDlFreqSel) - { - /* Rounding off to right nearest multiple of RBG size */ - if (ueDl->maxRb % cell->rbgSize) - { - ueDl->maxRb += (cell->rbgSize - - (ueDl->maxRb % cell->rbgSize)); - } - } - - /* Set the index of the cwInfo, which is better in terms of - * efficiency. If RI<2, only 1 CW, hence btrCwIdx shall be 0 */ - if (ueDl->mimoInfo.ri < 2) - { - ueDl->mimoInfo.btrCwIdx = 0; - } - else - { - if (ueDl->mimoInfo.cwInfo[0].eff[ueDl->mimoInfo.cwInfo[0].noLyr-1] <\ - ueDl->mimoInfo.cwInfo[1].eff[ueDl->mimoInfo.cwInfo[1].noLyr-1]) - { - ueDl->mimoInfo.btrCwIdx = 1; - } - else - { - ueDl->mimoInfo.btrCwIdx = 0; - } - } - - RETVOID; - } - -#ifdef DL_LA - -/** - * @brief This function updates TX Scheme. - * - * @details - * - * Function: rgSCHCheckAndSetTxScheme - * Purpose: This function determines the Maximum RBs - * a UE is eligible to get based on softbuffer - * limitation and cell->>>maxDlBwPerUe. The Codeword - * specific parameters like iTbs, eff and noLyrs - * are also set in this function. This function - * is called while UE configuration and UeDlCqiInd. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCheckAndSetTxScheme -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCheckAndSetTxScheme(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue ,cell); - U8 cfi = cellSch->dl.currCfi; - U8 maxiTbs; - U8 cqiBasediTbs; - U8 actualiTbs; - - TRC2(rgSCHCheckAndSetTxScheme); - - maxiTbs = (*(RgSchCmnCqiToTbs*)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ - [RG_SCH_CMN_MAX_CQI - 1]; - cqiBasediTbs = (ueDl->laCb[0].cqiBasediTbs)/100; - actualiTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0]; - - if((actualiTbs < RG_SCH_TXSCHEME_CHNG_ITBS_FACTOR) && (cqiBasediTbs > - actualiTbs) && ((cqiBasediTbs - actualiTbs) > RG_SCH_TXSCHEME_CHNG_THRSHD)) - { - RG_SCH_CMN_SET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG); - } - - if(actualiTbs >= maxiTbs) - { - RG_SCH_CMN_UNSET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG); - } - - RETVOID; -} - -/** - * @brief This function determines the allocation limits and - * parameters that aid in DL scheduling. - * - * @details - * - * Function: rgSCHCmnDlSetUeAllocLmtLa - * Purpose: This function determines the Maximum RBs - * a UE is eligible to get based on softbuffer - * limitation and cell->>>maxDlBwPerUe. The Codeword - * specific parameters like iTbs, eff and noLyrs - * are also set in this function. This function - * is called while UE configuration and UeDlCqiInd. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - U8 modOrder; - U32 maxRb; - U8 reportediTbs; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 cfi = cellSch->dl.currCfi; - U8 maxiTbs; - U8 cwIdx = 0; - - TRC2(rgSCHCmnDlSetUeAllocLmtLa); - - maxiTbs = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[RG_SCH_CMN_MAX_CQI - 1]; - if(ueDl->cqiFlag == TRUE) - { - for(cwIdx=0; cwIdx < RG_SCH_CMN_MAX_CW_PER_UE; cwIdx++) - { - S32 iTbsNew; - - /* Calcluating the reported iTbs for code word 0 */ - reportediTbs = ue->ue5gtfCb.mcs; - - iTbsNew = (S32) reportediTbs; - - if(!ueDl->laCb[cwIdx].notFirstCqi) - { - /* This is the first CQI report from UE */ - ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100); - ueDl->laCb[cwIdx].notFirstCqi = TRUE; - } - else if ((RG_ITBS_DIFF(reportediTbs, ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0])) > 5) - { - /* Ignore this iTBS report and mark that last iTBS report was */ - /* ignored so that subsequently we reset the LA algorithm */ - ueDl->laCb[cwIdx].lastiTbsIgnored = TRUE; - ueDl->laCb[cwIdx].numLastiTbsIgnored++; - if( ueDl->laCb[cwIdx].numLastiTbsIgnored > 10) - { - /* CQI reported by UE is not catching up. Reset the LA algorithm */ - ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100); - ueDl->laCb[cwIdx].deltaiTbs = 0; - ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE; - ueDl->laCb[cwIdx].numLastiTbsIgnored = 0; - } - } - else - { - if (ueDl->laCb[cwIdx].lastiTbsIgnored != TRUE) - { - ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) + - (80 * ueDl->laCb[cwIdx].cqiBasediTbs))/100; - } - else - { - /* Reset the LA as iTbs in use caught up with the value */ - /* reported by UE. */ - ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) + - (80 * ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] * 100))/100; - ueDl->laCb[cwIdx].deltaiTbs = 0; - ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE; - } - } - - iTbsNew = (ueDl->laCb[cwIdx].cqiBasediTbs + ueDl->laCb[cwIdx].deltaiTbs)/100; - - RG_SCH_CHK_ITBS_RANGE(iTbsNew, maxiTbs); - - ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] = RGSCH_MIN(iTbsNew, cell->thresholds.maxDlItbs); - //ueDl->mimoInfo.cwInfo[cwIdx].iTbs[1] = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0]; -#ifdef RG_5GTF - ue->ue5gtfCb.mcs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0]; - /* - printf("reportediTbs[%d] cqiBasediTbs[%d] deltaiTbs[%d] iTbsNew[%d] mcs[%d] cwIdx[%d]\n", - reportediTbs, ueDl->laCb[cwIdx].cqiBasediTbs, ueDl->laCb[cwIdx].deltaiTbs, - iTbsNew, ue->ue5gtfCb.mcs, cwIdx); - */ -#endif - - if((ue->mimoInfo.txMode != RGR_UE_TM_3) && (ue->mimoInfo.txMode != RGR_UE_TM_4)) - { - break; - } - } - ueDl->cqiFlag = FALSE; - } - - - RETVOID; -} -#endif -/*********************************************************** - * - * Func : rgSCHCmnDlUeResetTemp - * - * Desc : Reset whatever variables where temporarily used - * during UE scheduling. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlHqPResetTemp -( -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnDlHqPResetTemp(hqP) -RgSchDlHqProcCb *hqP; -#endif -{ - - TRC2(rgSCHCmnDlHqPResetTemp); - - /* Fix: syed having a hqP added to Lists for RB assignment rather than - * a UE, as adding UE was limiting handling some scenarios */ - hqP->reqLnk.node = (PTR)NULLP; - hqP->schdLstLnk.node = (PTR)NULLP; - - RETVOID; -} /* rgSCHCmnDlHqPResetTemp */ - -/*********************************************************** - * - * Func : rgSCHCmnDlUeResetTemp - * - * Desc : Reset whatever variables where temporarily used - * during UE scheduling. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlUeResetTemp -( -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnDlUeResetTemp(ue, hqP) -RgSchUeCb *ue; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *cmnUe = RG_SCH_CMN_GET_DL_UE(ue,hqP->hqE->cell); -#ifdef LTE_ADV - Void *tmpCb; -#endif - - TRC2(rgSCHCmnDlUeResetTemp); - - /* Fix : syed check for UE's existence was useless. - * Instead we need to check that reset is done only for the - * information of a scheduled harq proc, which is cmnUe->proc. - * Reset should not be done for non-scheduled hqP */ - if((cmnUe->proc == hqP) || (cmnUe->proc == NULLP)) - { - cmnUe->proc = NULLP; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, hqP->hqE->cell); -#ifdef LTE_ADV - tmpCb = allocInfo->laaCb; -#endif - cmMemset((U8 *)allocInfo, (U8)0, sizeof(RgSchDlRbAlloc)); - allocInfo->rnti = ue->ueId; -#ifdef LTE_ADV - allocInfo->laaCb = tmpCb; -#endif - /* Fix: syed moving this to a common function for both scheduled - * and non-scheduled UEs */ - cmnUe->outStndAlloc = 0; - } - rgSCHCmnDlHqPResetTemp(hqP); - - RETVOID; -} /* rgSCHCmnDlUeResetTemp */ - -/*********************************************************** - * - * Func : rgSCHCmnUlUeResetTemp - * - * Desc : Reset whatever variables where temporarily used - * during UE scheduling. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlUeResetTemp -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlUeResetTemp(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUlUe *cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue,cell); - - TRC2(rgSCHCmnUlUeResetTemp); - - cmMemset((U8 *)&cmnUlUe->alloc, (U8)0, sizeof(cmnUlUe->alloc)); - - RETVOID; -} /* rgSCHCmnUlUeResetTemp */ - - - -/** - * @brief This function fills the PDCCH information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillPdcch - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlRbAlloc - * during common channel scheduling(P, SI, RA - RNTI's). - * - * Invoked by: Downlink Scheduler - * - * @param[out] RgSchPdcch* pdcch - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnFillPdcch -( -RgSchCellCb *cell, -RgSchPdcch *pdcch, -RgSchDlRbAlloc *rbAllocInfo -) -#else -PUBLIC Void rgSCHCmnFillPdcch(cell, pdcch, rbAllocInfo) -RgSchCellCb *cell; -RgSchPdcch *pdcch; -RgSchDlRbAlloc *rbAllocInfo; -#endif -{ - - TRC2(rgSCHCmnFillPdcch); - - /* common channel pdcch filling, - * only 1A and Local is supported */ - pdcch->rnti = rbAllocInfo->rnti; - pdcch->dci.dciFormat = rbAllocInfo->dciFormat; - switch(rbAllocInfo->dciFormat) - { -#ifdef RG_5GTF /* ANOOP: ToDo: DCI format B1/B2 filling */ - case TFU_DCI_FORMAT_B1: - { - /* ToDo: Anoop */ - pdcch->dci.u.formatB1Info.formatType = 0; - pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].cmnGrnt.xPDSCHRange; - pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].cmnGrnt.rbAssign; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = 0; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = 0; - //pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].ndi; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].cmnGrnt.rv; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0; - pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0; - pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0; - //TODO_SID: Need to update - pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0; - pdcch->dci.u.formatB1Info.beamSwitch = 0; - pdcch->dci.u.formatB1Info.SRS_Config = 0; - pdcch->dci.u.formatB1Info.SRS_Symbol = 0; - //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC). - pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0; - pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].cmnGrnt.SCID; - //TODO_SID: Hardcoding TPC command to 1 i.e. No change - pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc; - pdcch->dci.u.formatB1Info.DL_PCRS = 0; - - break; /* case TFU_DCI_FORMAT_B1: */ - } - - case TFU_DCI_FORMAT_B2: - { - //printf(" RG_5GTF:: Pdcch filling with DCI format B2\n"); - /* ToDo: Anoop */ - break; /* case TFU_DCI_FORMAT_B2: */ - } -#endif - case TFU_DCI_FORMAT_1A: - pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE; - - /*Nprb indication at PHY for common Ch - *setting least significant bit of tpc field to 1 if - nPrb=3 and 0 otherwise. */ - if (rbAllocInfo->nPrb == 3) - { - pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 1; - } - else - { - pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 0; - } - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \ - rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = 0; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = 0; - /* Add RIV CALC */ - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type = - TFU_ALLOC_TYPE_RIV; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv = - rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, - rbAllocInfo->allocInfo.raType2.rbStart, - rbAllocInfo->allocInfo.raType2.numRb); - -#ifdef LTE_TDD - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = \ - FALSE; -#ifdef TFU_TDD - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1; -#endif -#endif - break; /* case TFU_DCI_FORMAT_1A: */ - case TFU_DCI_FORMAT_1: - pdcch->dci.u.format1Info.tpcCmd = 0; - /* Avoiding this check,as we dont support Type1 RA */ -#ifdef RG_UNUSED - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { -#endif - pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE; - pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) - & 0xff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) - & 0x00ff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) - & 0x0000ff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); -#ifdef RG_UNUSED - } -#endif - pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; - pdcch->dci.u.format1Info.allocInfo.ndi = 0; - pdcch->dci.u.format1Info.allocInfo.mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format1Info.allocInfo.rv = 0; -#ifdef TFU_TDD - pdcch->dci.u.format1Info.dai = 1; -#endif - break; - default: - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Allocator's icorrect " - "dciForamt Fill RNTI:%d",rbAllocInfo->rnti); - break; - } - RETVOID; -} - -#ifdef LTE_TDD -/** - * @brief This function finds whether the subframe is special subframe or not. - * - * @details - * - * Function: rgSCHCmnIsSplSubfrm - * Purpose: This function finds the subframe index of the special subframe - * and finds whether the current DL index matches it or not. - * - * Invoked by: Scheduler - * - * @param[in] U8 splfrmCnt - * @param[in] U8 curSubfrmIdx - * @param[in] U8 periodicity - * @param[in] RgSchTddSubfrmInfo *subfrmInfo - * @return Bool - * - **/ -#ifdef ANSI -PRIVATE Bool rgSCHCmnIsSplSubfrm -( -U8 splfrmCnt, -U8 curSubfrmIdx, -U8 periodicity, -RgSchTddSubfrmInfo *subfrmInfo -) -#else -PRIVATE Bool rgSCHCmnIsSplSubfrm(splfrmCnt, curSubfrmIdx, periodicity, subfrmInfo) -U8 splfrmCnt; -U8 curSubfrmIdx; -U8 periodicity; -RgSchTddSubfrmInfo *subfrmInfo; -#endif -{ - U8 dlSfCnt = 0; - U8 splfrmIdx = 0; - - TRC2(rgSCHCmnIsSplSubfrm); - - if(splfrmCnt > 0) - { - if(periodicity == RG_SCH_CMN_5_MS_PRD) - { - if(splfrmCnt%2) - { - dlSfCnt = ((splfrmCnt-1)/2) *\ - (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2); - dlSfCnt = dlSfCnt + subfrmInfo->numFrmHf1; - } - else - { - dlSfCnt = (splfrmCnt/2) * \ - (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2); - } - } - else - { - dlSfCnt = splfrmCnt * subfrmInfo->numFrmHf1; - } - splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1 +\ - (periodicity*splfrmCnt - dlSfCnt); - } - else - { - splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1; - } - - if(splfrmIdx == curSubfrmIdx) - { - RETVALUE(TRUE); - } - - RETVALUE(FALSE); -} - -/** - * @brief This function updates DAI or UL index. - * - * @details - * - * Function: rgSCHCmnUpdHqAndDai - * Purpose: Updates the DAI based on UL-DL Configuration - * index and UE. It also updates the HARQ feedback - * time and 'm' index. - * - * Invoked by: TOM - * - * @param[in] RgDlHqProcCb *hqP - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchDlHqTbCb *tbCb - * @param[in] U8 tbAllocIdx - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdHqAndDai -( -RgSchDlHqProcCb *hqP, -RgSchDlSf *subFrm, -RgSchDlHqTbCb *tbCb, -U8 tbAllocIdx -) -#else -PRIVATE Void rgSCHCmnUpdHqAndDai(hqP, subFrm, tbCb,tbAllocIdx) -RgSchDlHqProcCb *hqP; -RgSchDlSf *subFrm; -RgSchDlHqTbCb *tbCb; -U8 tbAllocIdx; -#endif -{ - RgSchUeCb *ue = hqP->hqE->ue; - - TRC2(rgSCHCmnUpdHqAndDai); - - if(subFrm != NULLP) - { - /* set the time at which UE shall send the feedback - * for this process */ - tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \ - subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN; - tbCb->fdbkTime.subframe = subFrm->dlFdbkInfo.subframe; - tbCb->m = subFrm->dlFdbkInfo.m; - } - else - { - /* set the time at which UE shall send the feedback - * for this process */ - tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \ - hqP->subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN; - tbCb->fdbkTime.subframe = hqP->subFrm->dlFdbkInfo.subframe; - tbCb->m = hqP->subFrm->dlFdbkInfo.m; - } - - /* ccpu00132340-MOD- DAI need to be updated for first TB only*/ - if(ue && !tbAllocIdx) - { - Bool havePdcch = (tbCb->hqP->pdcch ? TRUE : FALSE); - U8 dlDai; - - dlDai = rgSCHCmnUpdDai(ue, &tbCb->fdbkTime, tbCb->m, havePdcch,tbCb->hqP, - &tbCb->dai); - if(havePdcch) - {/* Non SPS occasions */ - tbCb->hqP->pdcch->dlDai = dlDai; - /* hqP->ulDai is used for N1 resource filling - * when SPS occaions present in a bundle */ - tbCb->hqP->ulDai = tbCb->dai; - tbCb->hqP->dlDai = dlDai; - } - } - - /* Updatijng pucchFdbkIdx for both PUCCH or PUSCH - fdbk reception */ - tbCb->pucchFdbkIdx = tbCb->hqP->ulDai; - - RETVOID; -} - - -/** - * @brief This function updates DAI or UL index. - * - * @details - * - * Function: rgSCHCmnUpdDai - * Purpose: Updates the DAI in the ack-nack info, a valid - * ue should be passed - * - * Invoked by: TOM - * - * @param[in] RgDlHqProcCb *hqP - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchDlHqTbCb *tbCb - * @return U8 dlDai - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUpdDai -( -RgSchUeCb *ue, -CmLteTimingInfo *fdbkTime, -U8 m, -Bool havePdcch, -RgSchDlHqProcCb *hqP, -U8 *ulDai -) -#else -PUBLIC U8 rgSCHCmnUpdDai(ue, fdbkTime, m, havePdcch,tbCb,servCellId,hqP,ulDai) -RgSchUeCb *ue; -CmLteTimingInfo *fdbkTime; -U8 m; -Bool havePdcch; -RgSchDlHqProcCb *hqP; -U8 *ulDai; -#endif -{ - RgSchTddANInfo *anInfo; - U8 servCellIdx; - U8 ackNackFdbkArrSize; - - - TRC2(rgSCHCmnUpdDai); - - if(hqP != NULLP) - {/* Non SPS */ -#ifdef LTE_ADV - servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - ue); -#else - servCellIdx = RGSCH_PCELL_INDEX; -#endif - ackNackFdbkArrSize = hqP->hqE->cell->ackNackFdbkArrSize; - }else - {/* SPS on primary cell */ - servCellIdx = RGSCH_PCELL_INDEX; - ackNackFdbkArrSize = ue->cell->ackNackFdbkArrSize; - } - - - anInfo = rgSCHUtlGetUeANFdbkInfo(ue, fdbkTime,servCellIdx); - - /* If no ACK/NACK feedback already present, create a new one */ - if(NULLP == anInfo) - { - anInfo = &ue->cellInfo[servCellIdx]->anInfo[ue->cellInfo[servCellIdx]->nextFreeANIdx]; - anInfo->sfn = fdbkTime->sfn; - anInfo->subframe = fdbkTime->subframe; - anInfo->latestMIdx = m; - /* Fixing DAI value - ccpu00109162 */ - /* Handle TDD case as in MIMO definition of the function */ - anInfo->ulDai = 1; - if (havePdcch) - { - anInfo->dlDai = 1; - } - anInfo->isSpsOccasion = FALSE; - /* set the free Index to store Ack/Nack Information*/ - ue->cellInfo[servCellIdx]->nextFreeANIdx = (ue->cellInfo[servCellIdx]->nextFreeANIdx + 1) % - ackNackFdbkArrSize; - - } - else - { - anInfo->latestMIdx = m; - /* Fixing DAI value - ccpu00109162 */ - /* Handle TDD case as in MIMO definition of the function */ - anInfo->ulDai = anInfo->ulDai + 1; - if (havePdcch) - { - anInfo->dlDai = anInfo->dlDai + 1; - } - } -#ifdef LTE_ADV - /* ignoring the Scell check, - * for primary cell this field is unused*/ - if(hqP != NULLP) - {/* SPS*/ - anInfo->n1ResTpcIdx = hqP->tpc; - } - - if(ulDai) - {/* As this not required for release pdcch */ - *ulDai = anInfo->ulDai; - } -#endif - RETVALUE(anInfo->dlDai); - -} -#endif /* ifdef LTE_TDD */ - -PUBLIC U32 rgHqRvRetxCnt[4][2]; -PUBLIC U32 rgUlrate_grant; - -/** - * @brief This function fills the HqP TB with rbAllocInfo. - * - * @details - * - * Function: rgSCHCmnFillHqPTb - * Purpose: This function fills in the HqP TB with rbAllocInfo. - * - * Invoked by: rgSCHCmnFillHqPTb - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc *rbAllocInfo, - * @param[in] U8 tbAllocIdx - * @param[in] RgSchPdcch *pdcch - * @return Void - * - **/ -#ifdef LTEMAC_SPS -#ifdef ANSI -PUBLIC Void rgSCHCmnFillHqPTb -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -U8 tbAllocIdx, -RgSchPdcch *pdcch -) -#else -PUBLIC Void rgSCHCmnFillHqPTb(cell, rbAllocInfo, tbAllocIdx, pdcch) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -U8 tbAllocIdx; -RgSchPdcch *pdcch; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPTb -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -U8 tbAllocIdx, -RgSchPdcch *pdcch -) -#else -PRIVATE Void rgSCHCmnFillHqPTb(cell, rbAllocInfo, tbAllocIdx, pdcch) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -U8 tbAllocIdx; -RgSchPdcch *pdcch; -#endif -#endif /* LTEMAC_SPS */ -{ - RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchDlTbAllocInfo *tbAllocInfo = &rbAllocInfo->tbInfo[tbAllocIdx]; - RgSchDlHqTbCb *tbInfo = tbAllocInfo->tbCb; - RgSchDlHqProcCb *hqP = tbInfo->hqP; - - TRC2(rgSCHCmnFillHqPTb); - - /*ccpu00120365-ADD-if tb is disabled, set mcs=0,rv=1. - * Relevant for DCI format 2 & 2A as per 36.213-7.1.7.2 - */ - if ( tbAllocInfo->isDisabled) - { - - tbInfo->dlGrnt.iMcs = 0; - tbInfo->dlGrnt.rv = 1; - } - /* Fill for TB retransmission */ - else if (tbInfo->txCntr > 0) - { - - tbInfo->timingInfo = cmnCellDl->time; - /* Fix */ - if ((tbInfo->isAckNackDtx == TFU_HQFDB_DTX)) - { - tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs; - rgHqRvRetxCnt[tbInfo->dlGrnt.rv][tbInfo->tbIdx]++; - } - else - { - tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[++(tbInfo->ccchSchdInfo.rvIdx) & 0x03]; - } - - /* fill the scheduler information of hqProc */ - tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc; - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx,hqP->tbInfo,tbInfo->tbIdx ); - rgSCHDhmHqTbRetx(hqP->hqE, tbInfo->timingInfo, hqP, tbInfo->tbIdx); - } - /* Fill for TB transmission */ - else - { - /* Fill the HqProc */ - tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs; - tbInfo->tbSz = tbAllocInfo->bytesAlloc; - tbInfo->timingInfo = cmnCellDl->time; - - tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[0]; - /* fill the scheduler information of hqProc */ - tbInfo->ccchSchdInfo.rvIdx = 0; - tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc; - /* DwPts Scheduling Changes Start */ - /* DwPts Scheduling Changes End */ - cell->measurements.dlBytesCnt += tbAllocInfo->bytesAlloc; - } - - /*ccpu00120365:-ADD-only add to subFrm list if tb is not disabled */ - if ( tbAllocInfo->isDisabled == FALSE ) - { - /* Set the number of transmitting SM layers for this TB */ - tbInfo->numLyrs = tbAllocInfo->noLyr; - /* Set the TB state as WAITING to indicate TB has been - * considered for transmission */ - tbInfo->state = HQ_TB_WAITING; - hqP->subFrm = rbAllocInfo->dlSf; - tbInfo->hqP->pdcch = pdcch; - //tbInfo->dlGrnt.numRb = rbAllocInfo->rbsAlloc; - rgSCHUtlDlHqPTbAddToTx(hqP->subFrm, hqP, tbInfo->tbIdx); - } - RETVOID; -} - -/** - * @brief This function fills the PDCCH DCI format 2 information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt2 - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmtB1B2 -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmtB1B2(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ - - TRC2(rgSCHCmnFillHqPPdcchDciFrmtB1B2) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - //Currently hardcoding values here. - //printf("Filling 5GTF UL DCI for rnti %d \n",alloc->rnti); - switch(rbAllocInfo->dciFormat) - { - case TFU_DCI_FORMAT_B1: - { - pdcch->dci.u.formatB1Info.formatType = 0; - pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange; - pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = hqP->procId; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0; - pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0; - pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0; - pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0; - //TODO_SID: Need to update - pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0; - pdcch->dci.u.formatB1Info.beamSwitch = 0; - pdcch->dci.u.formatB1Info.SRS_Config = 0; - pdcch->dci.u.formatB1Info.SRS_Symbol = 0; - //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC). - pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0; - pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID; - //TODO_SID: Hardcoding TPC command to 1 i.e. No change - pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc; - pdcch->dci.u.formatB1Info.DL_PCRS = 0; - break; - } - case TFU_DCI_FORMAT_B2: - { - pdcch->dci.u.formatB2Info.formatType = 1; - pdcch->dci.u.formatB2Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange; - pdcch->dci.u.formatB2Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign; - pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.hqProcId = hqP->procId; - pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.bmiHqAckNack = 0; - pdcch->dci.u.formatB2Info.CSI_BSI_BRI_Req = 0; - pdcch->dci.u.formatB2Info.CSIRS_BRRS_TxTiming = 0; - pdcch->dci.u.formatB2Info.CSIRS_BRRS_SymbIdx = 0; - pdcch->dci.u.formatB2Info.CSIRS_BRRS_ProcInd = 0; - pdcch->dci.u.formatB2Info.xPUCCH_TxTiming = 0; - //TODO_SID: Need to update - pdcch->dci.u.formatB2Info.freqResIdx_xPUCCH = 0; - pdcch->dci.u.formatB2Info.beamSwitch = 0; - pdcch->dci.u.formatB2Info.SRS_Config = 0; - pdcch->dci.u.formatB2Info.SRS_Symbol = 0; - //TODO_SID: Need to check.Currently setting 4(2 layer, ports(8,9) w/o OCC). - pdcch->dci.u.formatB2Info.AntPorts_numLayers = 4; - pdcch->dci.u.formatB2Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID; - //TODO_SID: Hardcoding TPC command to 1 i.e. No change - pdcch->dci.u.formatB2Info.tpcCmd = 1; //tpc; - pdcch->dci.u.formatB2Info.DL_PCRS = 0; - break; - } - default: - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId," 5GTF_ERROR Allocator's icorrect " - "dciForamt Fill RNTI:%d",rbAllocInfo->rnti); - break; - } - - RETVOID; -} - -extern U32 totPcellSCell; -extern U32 addedForScell; -extern U32 addedForScell1; -extern U32 addedForScell2; -/** - * @brief This function fills the PDCCH information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcch - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnFillHqPPdcch -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnDlCell *cmnCell = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchPdcch *pdcch = rbAllocInfo->pdcch; - U8 tpc = 1; - - TRC2(rgSCHCmnFillHqPPdcch); - - if (hqP->hqE->ue) - { -#ifdef LTE_ADV - if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) - { - tpc = hqP->tpc; - } - else -#endif - { - tpc = rgSCHPwrPucchTpcForUe(cell, hqP->hqE->ue); - } - /* Fix: syed moving this to a common function for both scheduled - * and non-scheduled UEs */ - - pdcch->ue = hqP->hqE->ue; - if (hqP->hqE->ue->csgMmbrSta == FALSE) - { - cmnCell->ncsgPrbCnt += rbAllocInfo->rbsAlloc; - } - cmnCell->totPrbCnt += rbAllocInfo->rbsAlloc; -#ifdef TENB_STATS - { - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlPrbUsg += - rbAllocInfo->rbsAlloc; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw0iTbs += - rbAllocInfo->tbInfo[0].iTbs; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw0iTbs ++; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt += - (rbAllocInfo->tbInfo[0].bytesAlloc << 3); - -#ifdef LTE_ADV - totPcellSCell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); - if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) - { - addedForScell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); - addedForScell1 += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); -/* - printf (" Hqp %d cell %d addedForScell %lu addedForScell1 %lu sfn:sf %d:%d \n", - hqP->procId, - hqP->hqE->cell->cellId, - addedForScell, - addedForScell1, - cell->crntTime.sfn, - cell->crntTime.subframe); - */ - } -#endif - hqP->hqE->cell->tenbStats->sch.dlPrbUsage[0] += - rbAllocInfo->rbsAlloc; - hqP->hqE->cell->tenbStats->sch.dlSumCw0iTbs += - rbAllocInfo->tbInfo[0].iTbs; - hqP->hqE->cell->tenbStats->sch.dlNumCw0iTbs ++; - hqP->hqE->cell->tenbStats->sch.dlTtlTpt += - (rbAllocInfo->tbInfo[0].bytesAlloc << 3); - if (rbAllocInfo->tbInfo[1].schdlngForTb) - { - hqP->hqE->cell->tenbStats->sch.dlSumCw1iTbs += - rbAllocInfo->tbInfo[1].iTbs; - hqP->hqE->cell->tenbStats->sch.dlNumCw1iTbs ++; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw1iTbs += - rbAllocInfo->tbInfo[1].iTbs; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw1iTbs ++; - hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt += - (rbAllocInfo->tbInfo[1].bytesAlloc << 3); - - -#ifdef LTE_ADV - if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) - { - addedForScell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); - addedForScell2 += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); -/* - printf (" Hqp %d cell %d addedForScell %lu addedForScell2 %lu \n", - hqP->procId, - hqP->hqE->cell->cellId, - addedForScell, - addedForScell2); - */ - } - totPcellSCell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); -#endif - - - hqP->hqE->cell->tenbStats->sch.dlTtlTpt += - (rbAllocInfo->tbInfo[1].bytesAlloc << 3); - } - /* - printf ("add DL TPT is %lu sfn:sf %d:%d \n", hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt , - cell->crntTime.sfn, - cell->crntTime.subframe); - */ - } -#endif - } - - pdcch->rnti = rbAllocInfo->rnti; - pdcch->dci.dciFormat = rbAllocInfo->dciFormat; - /* Update subframe and pdcch info in HqTb control block */ - switch(rbAllocInfo->dciFormat) - { -#ifdef RG_5GTF - case TFU_DCI_FORMAT_B1: - case TFU_DCI_FORMAT_B2: - { - // printf(" RG_5GTF:: Pdcch filling with DCI format B1/B2\n"); - rgSCHCmnFillHqPPdcchDciFrmtB1B2(cell, rbAllocInfo, hqP, \ - pdcch, tpc); - break; - } -#endif - default: - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Allocator's incorrect dciForamt Fill for RNTI:%d",rbAllocInfo->rnti); - break; - } - RETVOID; -} - -/** - * @brief This function fills the PDCCH DCI format 1 information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt1 - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1 -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ - -#ifdef LTE_TDD - RgSchTddANInfo *anInfo; -#endif - -#ifdef LTEMAC_SPS -/* For activation or reactivation, - * Harq ProcId should be 0 */ - RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); -#endif - - TRC2(rgSCHCmnFillHqPPdcchDciFrmt1) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - pdcch->dci.u.format1Info.tpcCmd = tpc; - /* Avoiding this check,as we dont support Type1 RA */ -#ifdef RG_UNUSED - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { -#endif - pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE; - pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) - & 0xff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) - & 0x00ff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) - & 0x0000ff); - pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); -#ifdef RG_UNUSED - } -#endif -#ifdef LTEMAC_SPS - if ((!(hqP->tbInfo[0].txCntr)) && - (cmnHqDl != (RgSchCmnDlHqProc*)NULLP && - ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || - (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))) - ) - { - pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; - } - else - { - pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId; - } -#else - pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId; -#endif - - pdcch->dci.u.format1Info.allocInfo.ndi = - rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.format1Info.allocInfo.mcs = - rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format1Info.allocInfo.rv = - rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; -#ifdef LTE_TDD - if(hqP->hqE->ue != NULLP) - { -#ifdef LTE_ADV - U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - hqP->hqE->ue); - - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); -#else - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); -#endif -#ifdef TFU_TDD - if(anInfo) - { - pdcch->dci.u.format1Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); - } - else - { - /* Fixing DAI value - ccpu00109162 */ - pdcch->dci.u.format1Info.dai = RG_SCH_MAX_DAI_IDX; - } -#endif - } - else - { - /* always 0 for RACH */ - pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; -#ifdef TFU_TDD - /* Fixing DAI value - ccpu00109162 */ - pdcch->dci.u.format1Info.dai = 1; -#endif - } -#endif - - - RETVOID; -} -/** - * @brief This function fills the PDCCH DCI format 1A information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt1A - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ - -#ifdef LTE_TDD - RgSchTddANInfo *anInfo; -#endif - -#ifdef LTEMAC_SPS - RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); -#endif - - TRC2(rgSCHCmnFillHqPPdcchDciFrmt1A) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE; - pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = tpc; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \ - rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = TRUE; -#ifdef LTEMAC_SPS - if ((!(hqP->tbInfo[0].txCntr)) && - ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && - ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || - (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) - )) - { - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val = 0; - } - else - { - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val - = hqP->procId; - } -#else - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val = - hqP->procId; -#endif - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = \ - rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = \ - rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - /* As of now, we do not support Distributed allocations */ - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type = - TFU_ALLOC_TYPE_RIV; - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv = - rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, - rbAllocInfo->allocInfo.raType2.rbStart, - rbAllocInfo->allocInfo.raType2.numRb); -#ifdef LTE_TDD - if(hqP->hqE->ue != NULLP) - { -#ifdef LTE_ADV - U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - hqP->hqE->ue); - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); -#else - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); -#endif -#ifdef TFU_TDD - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; - if(anInfo) - { - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = - RG_SCH_GET_DAI_VALUE(anInfo->dlDai); - } - else - { - /* Fixing DAI value - ccpu00109162 */ - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = RG_SCH_MAX_DAI_IDX; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "PDCCH is been scheduled without updating anInfo RNTI:%d", - rbAllocInfo->rnti); - } -#endif - } - else - { - /* always 0 for RACH */ - pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres - = FALSE; -#ifdef TFU_TDD - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; - /* Fixing DAI value - ccpu00109162 */ - pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1; -#endif - } -#endif - - RETVOID; -} -/** - * @brief This function fills the PDCCH DCI format 1B information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt1B - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ - -#ifdef LTE_TDD - RgSchTddANInfo *anInfo; -#endif - -#ifdef LTEMAC_SPS - RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); -#endif - - TRC2(rgSCHCmnFillHqPPdcchDciFrmt1B) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - pdcch->dci.u.format1bInfo.tpcCmd = tpc; - pdcch->dci.u.format1bInfo.allocInfo.mcs = \ - rbAllocInfo->tbInfo[0].imcs; -#ifdef LTEMAC_SPS - if ((!(hqP->tbInfo[0].txCntr)) && - ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && - ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || - (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) - )) - { - pdcch->dci.u.format1bInfo.allocInfo.harqProcId = 0; - } - else - { - pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId; - } -#else - pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId; -#endif - pdcch->dci.u.format1bInfo.allocInfo.ndi = \ - rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.format1bInfo.allocInfo.rv = \ - rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - /* As of now, we do not support Distributed allocations */ - pdcch->dci.u.format1bInfo.allocInfo.isLocal = TRUE; - pdcch->dci.u.format1bInfo.allocInfo.nGap2.pres = NOTPRSNT; - pdcch->dci.u.format1bInfo.allocInfo.alloc.type = - TFU_ALLOC_TYPE_RIV; - pdcch->dci.u.format1bInfo.allocInfo.alloc.u.riv = - rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, - rbAllocInfo->allocInfo.raType2.rbStart, - rbAllocInfo->allocInfo.raType2.numRb); - /* Fill precoding Info */ - pdcch->dci.u.format1bInfo.allocInfo.pmiCfm = \ - rbAllocInfo->mimoAllocInfo.precIdxInfo >> 4; - pdcch->dci.u.format1bInfo.allocInfo.tPmi = \ - rbAllocInfo->mimoAllocInfo.precIdxInfo & 0x0F; -#ifdef LTE_TDD - if(hqP->hqE->ue != NULLP) - { -#ifdef LTE_ADV - U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - hqP->hqE->ue); - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); -#else - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); -#endif -#ifdef TFU_TDD - if(anInfo) - { - pdcch->dci.u.format1bInfo.dai = - RG_SCH_GET_DAI_VALUE(anInfo->dlDai); - } - else - { - pdcch->dci.u.format1bInfo.dai = RG_SCH_MAX_DAI_IDX; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "PDCCH is been scheduled without updating anInfo RNTI:%d", - rbAllocInfo->rnti); - } -#endif - } -#endif - - RETVOID; - -} -/** - * @brief This function fills the PDCCH DCI format 2 information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt2 - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2 -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ - -#ifdef LTE_TDD - RgSchTddANInfo *anInfo; -#endif - -#ifdef LTEMAC_SPS -/* ccpu00119023-ADD-For activation or reactivation, - * Harq ProcId should be 0 */ - RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); -#endif - - TRC2(rgSCHCmnFillHqPPdcchDciFrmt2) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - /*ccpu00120365:-ADD-call also if tb is disabled */ - if (rbAllocInfo->tbInfo[1].schdlngForTb || - rbAllocInfo->tbInfo[1].isDisabled) - { - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch); - } - pdcch->dci.u.format2Info.tpcCmd = tpc; - /* Avoiding this check,as we dont support Type1 RA */ -#ifdef RG_UNUSED - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { -#endif - pdcch->dci.u.format2Info.allocInfo.isAllocType0 = TRUE; - pdcch->dci.u.format2Info.allocInfo.resAllocMap[0] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) - & 0xff); - pdcch->dci.u.format2Info.allocInfo.resAllocMap[1] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) - & 0x00ff); - pdcch->dci.u.format2Info.allocInfo.resAllocMap[2] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) - & 0x0000ff); - pdcch->dci.u.format2Info.allocInfo.resAllocMap[3] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); -#ifdef RG_UNUSED - } -#endif -#ifdef LTEMAC_SPS - if ((!(hqP->tbInfo[0].txCntr)) && - ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && - ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || - (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) - )) - { - pdcch->dci.u.format2Info.allocInfo.harqProcId = 0; - } - else - { - pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId; - } -#else - pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId; -#endif - /* Initialize the TB info for both the TBs */ - pdcch->dci.u.format2Info.allocInfo.tbInfo[0].mcs = 0; - pdcch->dci.u.format2Info.allocInfo.tbInfo[0].rv = 1; - pdcch->dci.u.format2Info.allocInfo.tbInfo[1].mcs = 0; - pdcch->dci.u.format2Info.allocInfo.tbInfo[1].rv = 1; - /* Fill tbInfo for scheduled TBs */ - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - /* If we reach this function. It is safely assumed that - * rbAllocInfo->tbInfo[0] always has non default valid values. - * rbAllocInfo->tbInfo[1]'s scheduling is optional */ - if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE) - { - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi; - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs; - pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv; - } - pdcch->dci.u.format2Info.allocInfo.transSwap = - rbAllocInfo->mimoAllocInfo.swpFlg; - pdcch->dci.u.format2Info.allocInfo.precoding = - rbAllocInfo->mimoAllocInfo.precIdxInfo; -#ifdef LTE_TDD - if(hqP->hqE->ue != NULLP) - { - -#ifdef LTE_ADV - U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - hqP->hqE->ue); - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); -#else - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); -#endif -#ifdef TFU_TDD - if(anInfo) - { - pdcch->dci.u.format2Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); - } - else - { - pdcch->dci.u.format2Info.dai = RG_SCH_MAX_DAI_IDX; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "PDCCH is been scheduled without updating anInfo RNTI:%d", - rbAllocInfo->rnti); - } -#endif - } -#endif - - RETVOID; -} -/** - * @brief This function fills the PDCCH DCI format 2A information from dlProc. - * - * @details - * - * Function: rgSCHCmnFillHqPPdcchDciFrmt2A - * Purpose: This function fills in the PDCCH information - * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc - * for dedicated service scheduling. It also - * obtains TPC to be filled in from the power module. - * Assign the PDCCH to HQProc. - * - * Invoked by: Downlink Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlRbAlloc* rbAllocInfo - * @param[in] RgDlHqProc* hqP - * @param[out] RgSchPdcch *pdcch - * @param[in] U8 tpc - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A -( -RgSchCellCb *cell, -RgSchDlRbAlloc *rbAllocInfo, -RgSchDlHqProcCb *hqP, -RgSchPdcch *pdcch, -U8 tpc -) -#else -PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A(cell, rbAllocInfo, hqP, pdcch, tpc) -RgSchCellCb *cell; -RgSchDlRbAlloc *rbAllocInfo; -RgSchDlHqProcCb *hqP; -RgSchPdcch *pdcch; -U8 tpc; -#endif -{ -#ifdef LTE_TDD - RgSchTddANInfo *anInfo; -#endif - -#ifdef LTEMAC_SPS - RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); -#endif - - TRC2(rgSCHCmnFillHqPPdcchDciFrmt2A) - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); - /*ccpu00120365:-ADD-call also if tb is disabled */ - if (rbAllocInfo->tbInfo[1].schdlngForTb || - rbAllocInfo->tbInfo[1].isDisabled) - { - - rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch); - } - - pdcch->dci.u.format2AInfo.tpcCmd = tpc; - /* Avoiding this check,as we dont support Type1 RA */ -#ifdef RG_UNUSED - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { -#endif - pdcch->dci.u.format2AInfo.allocInfo.isAllocType0 = TRUE; - pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[0] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) - & 0xff); - pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[1] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) - & 0x00ff); - pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[2] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) - & 0x0000ff); - pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[3] = - ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); -#ifdef RG_UNUSED - } -#endif -#ifdef LTEMAC_SPS - if ((!(hqP->tbInfo[0].txCntr)) && - ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && - ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || - (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) - )) - { - pdcch->dci.u.format2AInfo.allocInfo.harqProcId = 0; - } - else - { - pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId; - } -#else - pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId; -#endif - /* Initialize the TB info for both the TBs */ - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].mcs = 0; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].rv = 1; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].mcs = 0; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].rv = 1; - /* Fill tbInfo for scheduled TBs */ - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ - tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; - /* If we reach this function. It is safely assumed that - * rbAllocInfo->tbInfo[0] always has non default valid values. - * rbAllocInfo->tbInfo[1]'s scheduling is optional */ - - if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE) - { - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs; - pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ - tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv; - - } - pdcch->dci.u.format2AInfo.allocInfo.transSwap = - rbAllocInfo->mimoAllocInfo.swpFlg; - pdcch->dci.u.format2AInfo.allocInfo.precoding = - rbAllocInfo->mimoAllocInfo.precIdxInfo; -#ifdef LTE_TDD - if(hqP->hqE->ue != NULLP) - { -#ifdef LTE_ADV - U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, - hqP->hqE->cell->cellId, - hqP->hqE->ue); - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); -#else - anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, - &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); -#endif -#ifdef TFU_TDD - if(anInfo) - { - pdcch->dci.u.format2AInfo.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); - } - else - { - pdcch->dci.u.format2AInfo.dai = RG_SCH_MAX_DAI_IDX; - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "PDCCH is been scheduled without updating anInfo RNTI:%d", - rbAllocInfo->rnti); - } -#endif - } -#endif - - - RETVOID; -} - -/** - * @brief init of Sch vars. - * - * @details - * - * Function: rgSCHCmnInitVars - Purpose: Initialization of various UL subframe indices - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnInitVars -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnInitVars(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - - TRC2(rgSCHCmnInitVars); - - cellUl->idx = RGSCH_INVALID_INFO; - cellUl->schdIdx = RGSCH_INVALID_INFO; - cellUl->schdHqProcIdx = RGSCH_INVALID_INFO; - cellUl->msg3SchdIdx = RGSCH_INVALID_INFO; -#ifdef EMTC_ENBLE - cellUl->emtcMsg3SchdIdx = RGSCH_INVALID_INFO; -#endif - cellUl->msg3SchdHqProcIdx = RGSCH_INVALID_INFO; - cellUl->rcpReqIdx = RGSCH_INVALID_INFO; - cellUl->hqFdbkIdx[0] = RGSCH_INVALID_INFO; - cellUl->hqFdbkIdx[1] = RGSCH_INVALID_INFO; - cellUl->reTxIdx[0] = RGSCH_INVALID_INFO; - cellUl->reTxIdx[1] = RGSCH_INVALID_INFO; - /* Stack Crash problem for TRACE5 Changes. Added the return below */ - RETVOID; - -} - -#ifndef LTE_TDD -/** - * @brief Updation of Sch vars per TTI. - * - * @details - * - * Function: rgSCHCmnUpdVars - * Purpose: Updation of Sch vars per TTI. - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUpdVars -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnUpdVars(cell) -RgSchCellCb *cell; -#endif -{ - CmLteTimingInfo timeInfo; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - U16 idx; - - TRC2(rgSCHCmnUpdVars); - - idx = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.subframe); - cellUl->idx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); -#ifdef UL_ADPT_DBG - printf("idx %d cellUl->idx %d RGSCH_NUM_SUB_FRAMES_5G %d time(%d %d) \n",idx,cellUl->idx ,RGSCH_NUM_SUB_FRAMES_5G,cell->crntTime.sfn,cell->crntTime.subframe); -#endif - /* Need to scheduler for after SCHED_DELTA */ - /* UL allocation has been advanced by 1 subframe - * so that we do not wrap around and send feedback - * before the data is even received by the PHY */ - /* Introduced timing delta for UL control */ - idx = (cellUl->idx + TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA); - cellUl->schdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); - - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, - TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA) - cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); - - /* ccpu00127193 filling schdTime for logging and enhancement purpose*/ - cellUl->schdTime = timeInfo; - - /* msg3 scheduling two subframes after general scheduling */ - idx = (cellUl->idx + RG_SCH_CMN_DL_DELTA + RGSCH_RARSP_MSG3_DELTA); - cellUl->msg3SchdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); - - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, - RG_SCH_CMN_DL_DELTA+ RGSCH_RARSP_MSG3_DELTA) - cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); - - idx = (cellUl->idx + TFU_RECPREQ_DLDELTA); - - cellUl->rcpReqIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); - - /* Downlink harq feedback is sometime after data reception / harq failure */ - /* Since feedback happens prior to scheduling being called, we add 1 to */ - /* take care of getting the correct subframe for feedback */ - idx = (cellUl->idx - TFU_CRCIND_ULDELTA + RG_SCH_CMN_UL_NUM_SF); -#ifdef UL_ADPT_DBG - printf("Finally setting cellUl->hqFdbkIdx[0] = %d TFU_CRCIND_ULDELTA %d RG_SCH_CMN_UL_NUM_SF %d\n",idx,TFU_CRCIND_ULDELTA,RG_SCH_CMN_UL_NUM_SF); -#endif - cellUl->hqFdbkIdx[0] = (idx % (RG_SCH_CMN_UL_NUM_SF)); - - idx = ((cellUl->schdIdx) % (RG_SCH_CMN_UL_NUM_SF)); - - cellUl->reTxIdx[0] = (U8) idx; -#ifdef UL_ADPT_DBG - printf("cellUl->hqFdbkIdx[0] %d cellUl->reTxIdx[0] %d \n",cellUl->hqFdbkIdx[0], cellUl->reTxIdx[0] ); -#endif - /* RACHO: update cmn sched specific RACH variables, - * mainly the prachMaskIndex */ - rgSCHCmnUpdRachParam(cell); - - RETVOID; -} -#endif - -#ifdef LTE_TDD - -/** - * @brief To get uplink subframe index associated with current PHICH - * transmission. - * - * @details - * - * Function: rgSCHCmnGetPhichUlSfIdx - * Purpose: Gets uplink subframe index associated with current PHICH - * transmission based on SFN and subframe no - * - * @param[in] CmLteTimingInfo *timeInfo - * @param[in] RgSchCellCb *cell - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnGetPhichUlSfIdx -( -CmLteTimingInfo *timeInfo, -RgSchCellCb *cell -) -#else -PUBLIC U8 rgSCHCmnGetPhichUlSfIdx(timeInfo, cell) -CmLteTimingInfo *timeInfo; -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchDlSf *dlsf; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 idx; - U16 numUlSf; - U16 sfn; - U8 subframe; - - TRC2(rgSCHCmnGetPhichUlSfIdx); - - dlsf = rgSCHUtlSubFrmGet(cell, *timeInfo); - - if(dlsf->phichOffInfo.sfnOffset == RGSCH_INVALID_INFO) - { - RETVALUE(RGSCH_INVALID_INFO); - } - subframe = dlsf->phichOffInfo.subframe; - - sfn = (RGSCH_MAX_SFN + timeInfo->sfn - - dlsf->phichOffInfo.sfnOffset) % RGSCH_MAX_SFN; - - /* ccpu00130980: numUlSf(U16) parameter added to avoid integer - * wrap case such that idx will be proper*/ - numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - numUlSf = ((numUlSf * sfn) + rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subframe]) - 1; - idx = numUlSf % (cellUl->numUlSubfrms); - - RETVALUE(idx); -} - -/** - * @brief To get uplink subframe index. - * - * @details - * - * - * Function: rgSCHCmnGetUlSfIdx - * Purpose: Gets uplink subframe index based on SFN and subframe number. - * - * @param[in] CmLteTimingInfo *timeInfo - * @param[in] U8 ulDlCfgIdx - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnGetUlSfIdx -( -CmLteTimingInfo *timeInfo, -RgSchCellCb *cell -) -#else -PUBLIC U8 rgSCHCmnGetUlSfIdx(timeInfo, cell) -CmLteTimingInfo *timeInfo; -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 idx = 0; - U16 numUlSf; - - TRC2(rgSCHCmnGetUlSfIdx); - - /* ccpu00130980: numUlSf(U16) parameter added to avoid integer - * wrap case such that idx will be proper*/ - numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - numUlSf = ((numUlSf * timeInfo->sfn) + \ - rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->subframe]) - 1; - idx = numUlSf % (cellUl->numUlSubfrms); - - RETVALUE(idx); -} - -#endif - -/** - * @brief To get uplink hq index. - * - * @details - * - * - * Function: rgSCHCmnGetUlHqProcIdx - * Purpose: Gets uplink subframe index based on SFN and subframe number. - * - * @param[in] CmLteTimingInfo *timeInfo - * @param[in] U8 ulDlCfgIdx - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnGetUlHqProcIdx -( -CmLteTimingInfo *timeInfo, -RgSchCellCb *cell -) -#else -PUBLIC U8 rgSCHCmnGetUlHqProcIdx(timeInfo, cell) -CmLteTimingInfo *timeInfo; -RgSchCellCb *cell; -#endif -{ - U8 procId; - U32 numUlSf; - -#ifndef LTE_TDD - numUlSf = (timeInfo->sfn * RGSCH_NUM_SUB_FRAMES_5G + timeInfo->subframe); - procId = numUlSf % RGSCH_NUM_UL_HQ_PROC; -#else - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - /*ccpu00130639 - MOD - To get correct UL HARQ Proc IDs for all UL/DL Configs*/ - U8 numUlSfInSfn; - S8 sfnCycle = cell->tddHqSfnCycle; - U8 numUlHarq = rgSchTddUlNumHarqProcTbl[ulDlCfgIdx] - - /* TRACE 5 Changes */ - TRC2(rgSCHCmnGetUlHqProcIdx); - - /* Calculate the number of UL SF in one SFN */ - numUlSfInSfn = RGSCH_NUM_SUB_FRAMES - - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - - /* Check for the SFN wrap around case */ - if(cell->crntTime.sfn == 1023 && timeInfo->sfn == 0) - { - sfnCycle++; - } - else if(cell->crntTime.sfn == 0 && timeInfo->sfn == 1023) - { - /* sfnCycle decremented by 1 */ - sfnCycle = (sfnCycle + numUlHarq-1) % numUlHarq; - } - /* Calculate the total number of UL sf */ - /* -1 is done since uplink sf are counted from 0 */ - numUlSf = numUlSfInSfn * (timeInfo->sfn + (sfnCycle*1024)) + - rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->subframe] - 1; - - procId = numUlSf % numUlHarq; -#endif - RETVALUE(procId); -} - - -/* UL_ALLOC_CHANGES */ -/*********************************************************** - * - * Func : rgSCHCmnUlFreeAlloc - * - * Desc : Free an allocation - invokes UHM and releases - * alloc for the scheduler - * Doest need subframe as argument - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlFreeAlloc -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHCmnUlFreeAlloc(cell, alloc) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -#endif -{ - RgSchUlHqProcCb *hqProc; - TRC2(rgSCHCmnUlFreeAllocation); - - if (alloc->forMsg3) - { - /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */ - if ((alloc->hqProc->remTx == 0) && - (alloc->hqProc->rcvdCrcInd == FALSE) && - (alloc->raCb)) - { - RgSchRaCb *raCb = alloc->raCb; - rgSCHUhmFreeProc(alloc->hqProc, cell); - rgSCHUtlUlAllocRelease(alloc); - rgSCHRamDelRaCb(cell, raCb, TRUE); - RETVOID; - } - } - - hqProc = alloc->hqProc; - rgSCHUtlUlAllocRelease(alloc); - rgSCHUhmFreeProc(hqProc, cell); - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHCmnUlFreeAllocation - * - * Desc : Free an allocation - invokes UHM and releases - * alloc for the scheduler - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlFreeAllocation -( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHCmnUlFreeAllocation(cell, sf, alloc) -RgSchCellCb *cell; -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - RgSchUlHqProcCb *hqProc; - - TRC2(rgSCHCmnUlFreeAllocation); - - if (alloc->forMsg3) - { - /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */ - if ((alloc->hqProc->remTx == 0) && - (alloc->hqProc->rcvdCrcInd == FALSE) && - (alloc->raCb)) - { - RgSchRaCb *raCb = alloc->raCb; - rgSCHUhmFreeProc(alloc->hqProc, cell); - rgSCHUtlUlAllocRls(sf, alloc); - rgSCHRamDelRaCb(cell, raCb, TRUE); - RETVOID; - } - } - - hqProc = alloc->hqProc; - rgSCHUhmFreeProc(hqProc, cell); -#ifdef LTE_L2_MEAS - /* re-setting the PRB count while freeing the allocations */ - sf->totPrb = 0; -#endif - rgSCHUtlUlAllocRls(sf, alloc); - - RETVOID; -} - -/** - * @brief This function implements PDCCH allocation for an UE - * in the currently running subframe. - * - * @details - * - * Function: rgSCHCmnPdcchAllocCrntSf - * Purpose: This function determines current DL subframe - * and UE DL CQI to call the actual pdcch allocator - * function. - * Note that this function is called only - * when PDCCH request needs to be made during - * uplink scheduling. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return RgSchPdcch * - * -# NULLP when unsuccessful - **/ -#ifdef ANSI -PUBLIC RgSchPdcch *rgSCHCmnPdcchAllocCrntSf -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC RgSchPdcch *rgSCHCmnPdcchAllocCrntSf(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - CmLteTimingInfo frm = cell->crntTime; - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgSchDlSf *sf; - RgSchPdcch *pdcch = NULLP; - - TRC2(rgSCHCmnPdcchAllocCrntSf); - RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); - sf = rgSCHUtlSubFrmGet(cell, frm); - -#ifdef LTE_ADV - if (ue->allocCmnUlPdcch) - { - pdcch = rgSCHCmnCmnPdcchAlloc(cell, sf); - /* Since CRNTI Scrambled */ - if(NULLP != pdcch) - { - pdcch->dciNumOfBits = ue->dciSize.cmnSize[TFU_DCI_FORMAT_0]; - } - } - else -#endif - { - //pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, y, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_0, FALSE); - pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_A1, FALSE); - } - RETVALUE(pdcch); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlAllocFillNdmrs - * - * Desc : Determines and fills N_dmrs for a UE uplink - * allocation. - * - * Ret : - * - * Notes: N_dmrs determination is straightforward, so - * it is configured per subband - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAllocFillNdmrs -( -RgSchCmnUlCell *cellUl, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHCmnUlAllocFillNdmrs(cellUl, alloc) -RgSchCmnUlCell *cellUl; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHCmnUlAllocFillNdmrs); - alloc->grnt.nDmrs = cellUl->dmrsArr[alloc->sbStart]; - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnUlAllocLnkHqProc - * - * Desc : Links a new allocation for an UE with the - * appropriate HARQ process of the UE. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAllocLnkHqProc -( -RgSchUeCb *ue, -RgSchUlAlloc *alloc, -RgSchUlHqProcCb *proc, -Bool isRetx -) -#else -PUBLIC Void rgSCHCmnUlAllocLnkHqProc(ue, alloc, proc, isRetx) -RgSchUeCb *ue; -RgSchUlAlloc *alloc; -RgSchUlHqProcCb *proc; -Bool isRetx; -#endif -{ - TRC2(rgSCHCmnUlAllocLnkHqProc); - - if(TRUE == isRetx) - { - rgSCHCmnUlAdapRetx(alloc, proc); - } - else - { -#ifdef LTE_L2_MEAS /* L2_COUNTERS */ - alloc->ue = ue; -#endif - rgSCHUhmNewTx(proc, (((RgUeUlHqCb*)proc->hqEnt)->maxHqRetx), alloc); - } - RETVOID; -} - -/** - * @brief This function releases a PDCCH in the subframe that is - * currently being allocated for. - * - * @details - * - * Function: rgSCHCmnPdcchRlsCrntSf - * Purpose: This function determines current DL subframe - * which is considered for PDCCH allocation, - * and then calls the actual function that - * releases a PDCCH in a specific subframe. - * Note that this function is called only - * when PDCCH release needs to be made during - * uplink scheduling. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchPdcch *pdcch - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnPdcchRlsCrntSf -( -RgSchCellCb *cell, -RgSchPdcch *pdcch -) -#else -PUBLIC Void rgSCHCmnPdcchRlsCrntSf(cell, pdcch) -RgSchCellCb *cell; -RgSchPdcch *pdcch; -#endif -{ - CmLteTimingInfo frm = cell->crntTime; - RgSchDlSf *sf; - - TRC2(rgSCHCmnPdcchRlsCrntSf); - - RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); - sf = rgSCHUtlSubFrmGet(cell, frm); - rgSCHUtlPdcchPut(cell, &sf->pdcchInfo, pdcch); - RETVOID; -} -/*********************************************************** - * - * Func : rgSCHCmnUlFillPdcchWithAlloc - * - * Desc : Fills a PDCCH with format 0 information. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlFillPdcchWithAlloc -( -RgSchPdcch *pdcch, -RgSchUlAlloc *alloc, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlFillPdcchWithAlloc(pdcch, alloc, ue) -RgSchPdcch *pdcch; -RgSchUlAlloc *alloc; -RgSchUeCb *ue; -#endif -{ - - TRC2(rgSCHCmnUlFillPdcchWithAlloc); - - pdcch->ue = ue; - pdcch->rnti = alloc->rnti; - //pdcch->dci.dciFormat = TFU_DCI_FORMAT_A2; - pdcch->dci.dciFormat = alloc->grnt.dciFrmt; - - //Currently hardcoding values here. - //printf("Filling 5GTF UL DCI for rnti %d \n",alloc->rnti); - switch(pdcch->dci.dciFormat) - { - case TFU_DCI_FORMAT_A1: - { - pdcch->dci.u.formatA1Info.formatType = 0; - pdcch->dci.u.formatA1Info.xPUSCHRange = alloc->grnt.xPUSCHRange; - pdcch->dci.u.formatA1Info.xPUSCH_TxTiming = 0; - pdcch->dci.u.formatA1Info.RBAssign = alloc->grnt.rbAssign; - pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId; - pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt; - pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi; - pdcch->dci.u.formatA1Info.CSI_BSI_BRI_Req = 0; - pdcch->dci.u.formatA1Info.CSIRS_BRRS_TxTiming = 0; - pdcch->dci.u.formatA1Info.CSIRS_BRRS_SymbIdx = 0; - pdcch->dci.u.formatA1Info.CSIRS_BRRS_ProcInd = 0; - pdcch->dci.u.formatA1Info.numBSI_Reports = 0; - pdcch->dci.u.formatA1Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH; - pdcch->dci.u.formatA1Info.beamSwitch = 0; - pdcch->dci.u.formatA1Info.SRS_Config = 0; - pdcch->dci.u.formatA1Info.SRS_Symbol = 0; - pdcch->dci.u.formatA1Info.REMapIdx_DMRS_PCRS_numLayers = 0; - pdcch->dci.u.formatA1Info.SCID = alloc->grnt.SCID; - pdcch->dci.u.formatA1Info.PMI = alloc->grnt.PMI; - pdcch->dci.u.formatA1Info.UL_PCRS = 0; - pdcch->dci.u.formatA1Info.tpcCmd = alloc->grnt.tpc; - break; - } - case TFU_DCI_FORMAT_A2: - { - pdcch->dci.u.formatA2Info.formatType = 1; - pdcch->dci.u.formatA2Info.xPUSCHRange = alloc->grnt.xPUSCHRange; - pdcch->dci.u.formatA2Info.xPUSCH_TxTiming = 0; - pdcch->dci.u.formatA2Info.RBAssign = alloc->grnt.rbAssign; - pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId; - pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt; - pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi; - pdcch->dci.u.formatA2Info.CSI_BSI_BRI_Req = 0; - pdcch->dci.u.formatA2Info.CSIRS_BRRS_TxTiming = 0; - pdcch->dci.u.formatA2Info.CSIRS_BRRS_SymbIdx = 0; - pdcch->dci.u.formatA2Info.CSIRS_BRRS_ProcInd = 0; - pdcch->dci.u.formatA2Info.numBSI_Reports = 0; - pdcch->dci.u.formatA2Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH; - pdcch->dci.u.formatA2Info.beamSwitch = 0; - pdcch->dci.u.formatA2Info.SRS_Config = 0; - pdcch->dci.u.formatA2Info.SRS_Symbol = 0; - pdcch->dci.u.formatA2Info.REMapIdx_DMRS_PCRS_numLayers = 0; - pdcch->dci.u.formatA2Info.SCID = alloc->grnt.SCID; - pdcch->dci.u.formatA2Info.PMI = alloc->grnt.PMI; - pdcch->dci.u.formatA2Info.UL_PCRS = 0; - pdcch->dci.u.formatA2Info.tpcCmd = alloc->grnt.tpc; - break; - } - default: - RLOG1(L_ERROR," 5GTF_ERROR UL Allocator's icorrect " - "dciForamt Fill RNTI:%d",alloc->rnti); - break; - } - - - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnUlAllocFillTpc - * - * Desc : Determines and fills TPC for an UE allocation. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAllocFillTpc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHCmnUlAllocFillTpc(cell, ue, alloc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHCmnUlAllocFillTpc); - alloc->grnt.tpc = rgSCHPwrPuschTpcForUe(cell, ue); - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHCmnAddUeToRefreshQ - * - * Desc : Adds a UE to refresh queue, so that the UE is - * periodically triggered to refresh it's GBR and - * AMBR values. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnAddUeToRefreshQ -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 wait -) -#else -PRIVATE Void rgSCHCmnAddUeToRefreshQ(cell, ue, wait) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 wait; -#endif -{ - RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); - CmTmrArg arg; - RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue); - - TRC2(rgSCHCmnAddUeToRefreshQ); - UNUSED(cell); - - cmMemset((U8 *)&arg, 0, sizeof(arg)); - arg.tqCp = &sched->tmrTqCp; - arg.tq = sched->tmrTq; - arg.timers = &ueSchd->tmr; - arg.cb = (PTR)ue; - arg.tNum = 0; - arg.max = 1; - arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH; - arg.wait = wait; - cmPlcCbTq(&arg); - RETVOID; -} - -/** - * @brief Perform UE reset procedure. - * - * @details - * - * Function : rgSCHCmnUlUeReset - * - * This functions performs BSR resetting and - * triggers UL specific scheduler - * to Perform UE reset procedure. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlUeReset -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnUlUeReset(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - U8 lcgCnt=0; - RgSchCmnLcg *lcgCmn; - CmLList *node; - RgSchCmnAllocRecord *allRcd; - TRC2(rgSCHCmnUlUeReset); - - ue->ul.minReqBytes = 0; - ue->ul.totalBsr = 0; - ue->ul.effBsr = 0; - ue->ul.nonGbrLcgBs = 0; - ue->ul.effAmbr = ue->ul.cfgdAmbr; - - node = ueUl->ulAllocLst.first; - while (node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - allRcd->alloc = 0; - node = node->next; - } - for(lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++) - { - lcgCmn = RG_SCH_CMN_GET_UL_LCG(&ue->ul.lcgArr[lcgCnt]); - lcgCmn->bs = 0; - lcgCmn->reportedBs = 0; - lcgCmn->effGbr = lcgCmn->cfgdGbr; - lcgCmn->effDeltaMbr = lcgCmn->deltaMbr; - } - rgSCHCmnUlUeDelAllocs(cell, ue); - - ue->isSrGrant = FALSE; - - cellSchd->apisUl->rgSCHUlUeReset(cell, ue); - - /* Stack Crash problem for TRACE5 changes. Added the return below */ - RETVOID; - -} - -/** - * @brief RESET UL CQI and DL CQI&RI to conservative values - * for a reestablishing UE. - * - * @details - * - * Function : rgSCHCmnResetRiCqi - * - * RESET UL CQI and DL CQI&RI to conservative values - * for a reestablishing UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnResetRiCqi -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnResetRiCqi(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - - TRC2(rgSCHCmnResetRiCqi); - - rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, - cell->isCpUlExtend); - - ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi; - ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi; - ueDl->mimoInfo.ri = 1; - if ((ue->mimoInfo.txMode == RGR_UE_TM_4) || - (ue->mimoInfo.txMode == RGR_UE_TM_6)) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); - } - if (ue->mimoInfo.txMode == RGR_UE_TM_3) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } -#ifdef EMTC_ENABLE - rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe); -#else - rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE); -#endif - -#ifdef TFU_UPGRADE - /* Request for an early Aper CQI in case of reest */ - RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell); - if(acqiCb && acqiCb->aCqiCfg.pres) - { - acqiCb->aCqiTrigWt = 0; - } -#endif - - RETVOID; -} - -/** - * @brief Perform UE reset procedure. - * - * @details - * - * Function : rgSCHCmnDlUeReset - * - * This functions performs BO resetting and - * triggers DL specific scheduler - * to Perform UE reset procedure. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlUeReset -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnDlUeReset(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnDlUeReset); - - if (ueDl->rachInfo.poLnk.node != NULLP) - { - rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); - } - - /* Fix: syed Remove from TA List if this UE is there. - * If TA Timer is running. Stop it */ - if (ue->dlTaLnk.node) - { - cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk); - ue->dlTaLnk.node = (PTR)NULLP; - } - else if (ue->taTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, ue->taTmr.tmrEvnt, ue); - } - - cellSchd->apisDl->rgSCHDlUeReset(cell, ue); -#ifdef LTE_ADV - if (ue->numSCells) - { - rgSCHSCellDlUeReset(cell,ue); - } -#endif -} - -/** - * @brief Perform UE reset procedure. - * - * @details - * - * Function : rgSCHCmnUeReset - * - * This functions triggers specific scheduler - * to Perform UE reset procedure. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUeReset -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUeReset(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - U8 idx; - Pst pst; - RgInfResetHqEnt hqEntRstInfo; - - TRC2(rgSCHCmnUeReset); - /* RACHO: remove UE from pdcch, handover and rapId assoc Qs */ - rgSCHCmnDelRachInfo(cell, ue); - - rgSCHPwrUeReset(cell, ue); - - rgSCHCmnUlUeReset(cell, ue); - rgSCHCmnDlUeReset(cell, ue); - -#ifdef LTE_ADV - /* Making allocCmnUlPdcch TRUE to allocate DCI0/1A from Common search space. - As because multiple cells are added hence 2 bits CqiReq is there - This flag will be set to FALSE once we will get Scell READY */ - ue->allocCmnUlPdcch = TRUE; -#endif - - /* Fix : syed RESET UL CQI and DL CQI&RI to conservative values - * for a reestablishing UE */ - /*Reset Cqi Config for all the configured cells*/ - for (idx = 0;idx < CM_LTE_MAX_CELLS; idx++) - { - if (ue->cellInfo[idx] != NULLP) - { - rgSCHCmnResetRiCqi(ue->cellInfo[idx]->cell, ue); - } - } - /*After Reset Trigger APCQI for Pcell*/ - RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); - if(pCellInfo->acqiCb.aCqiCfg.pres) - { - ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; - } - -/* sending HqEnt reset to MAC */ - hqEntRstInfo.cellId = cell->cellId; - hqEntRstInfo.crnti = ue->ueId; - - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); - RgSchMacRstHqEnt(&pst,&hqEntRstInfo); - - RETVOID; -} - -/** - * @brief UE out of MeasGap or AckNackReptn. - * - * @details - * - * Function : rgSCHCmnActvtUlUe - * - * This functions triggers specific scheduler - * to start considering it for scheduling. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnActvtUlUe -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnActvtUlUe(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnActvtUlUe); - - /* : take care of this in UL retransmission */ - cellSchd->apisUl->rgSCHUlActvtUe(cell, ue); - RETVOID; -} - -/** - * @brief UE out of MeasGap or AckNackReptn. - * - * @details - * - * Function : rgSCHCmnActvtDlUe - * - * This functions triggers specific scheduler - * to start considering it for scheduling. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnActvtDlUe -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnActvtDlUe(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnActvtDlUe); - - cellSchd->apisDl->rgSCHDlActvtUe(cell, ue); - RETVOID; -} - -/** - * @brief This API is invoked to indicate scheduler of a CRC indication. - * - * @details - * - * Function : rgSCHCmnHdlUlTransInd - * This API is invoked to indicate scheduler of a CRC indication. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo timingInfo - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnHdlUlTransInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHCmnHdlUlTransInd(cell, ue, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo timingInfo; -#endif -{ - TRC2(rgSCHCmnHdlUlTransInd); - - /* Update the latest UL dat/sig transmission time */ - RGSCHCPYTIMEINFO(timingInfo, ue->ul.ulTransTime); - if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) - { - /* Some UL Transmission from this UE. - * Activate this UE if it was inactive */ - RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); - RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); - } - RETVOID; -} - -#ifdef TFU_UPGRADE - -/** - * @brief Compute the minimum Rank based on Codebook subset - * restriction configuration for 4 Tx Ports and Tx Mode 4. - * - * @details - * - * Function : rgSCHCmnComp4TxMode4 - * - * Depending on BitMap set at CBSR during Configuration - * - return the least possible Rank - * - * - * @param[in] U32 *pmiBitMap - * @return RgSchCmnRank - **/ -#ifdef ANSI -PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4 -( - U32 *pmiBitMap - ) -#else -PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4(pmiBitMap) - U32 *pmiBitMap; -#endif -{ - U32 bitMap0, bitMap1; - TRC2(rgSCHCmnComp4TxMode4); - bitMap0 = pmiBitMap[0]; - bitMap1 = pmiBitMap[1]; - if((bitMap1) & 0xFFFF) - { - RETVALUE (RG_SCH_CMN_RANK_1); - } - else if((bitMap1>>16) & 0xFFFF) - { - RETVALUE (RG_SCH_CMN_RANK_2); - } - else if((bitMap0) & 0xFFFF) - { - RETVALUE (RG_SCH_CMN_RANK_3); - } - else if((bitMap0>>16) & 0xFFFF) - { - RETVALUE (RG_SCH_CMN_RANK_4); - } - else - { - RETVALUE (RG_SCH_CMN_RANK_1); - } -} - - -/** - * @brief Compute the minimum Rank based on Codebook subset - * restriction configuration for 2 Tx Ports and Tx Mode 4. - * - * @details - * - * Function : rgSCHCmnComp2TxMode4 - * - * Depending on BitMap set at CBSR during Configuration - * - return the least possible Rank - * - * - * @param[in] U32 *pmiBitMap - * @return RgSchCmnRank - **/ -#ifdef ANSI -PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4 -( - U32 *pmiBitMap - ) -#else -PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4(pmiBitMap) - U32 *pmiBitMap; -#endif -{ - U32 bitMap0; - TRC2(rgSCHCmnComp2TxMode4); - bitMap0 = pmiBitMap[0]; - if((bitMap0>>26)& 0x0F) - { - RETVALUE (RG_SCH_CMN_RANK_1); - } - else if((bitMap0>>30) & 3) - { - RETVALUE (RG_SCH_CMN_RANK_2); - } - else - { - RETVALUE (RG_SCH_CMN_RANK_1); - } -} - -/** - * @brief Compute the minimum Rank based on Codebook subset - * restriction configuration for 4 Tx Ports and Tx Mode 3. - * - * @details - * - * Function : rgSCHCmnComp4TxMode3 - * - * Depending on BitMap set at CBSR during Configuration - * - return the least possible Rank - * - * - * @param[in] U32 *pmiBitMap - * @return RgSchCmnRank - **/ -#ifdef ANSI -PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3 -( - U32 *pmiBitMap - ) -#else -PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3(pmiBitMap) - U32 *pmiBitMap; -#endif -{ - U32 bitMap0; - TRC2(rgSCHCmnComp4TxMode3); - bitMap0 = pmiBitMap[0]; - if((bitMap0>>28)& 1) - { - RETVALUE (RG_SCH_CMN_RANK_1); - } - else if((bitMap0>>29) &1) - { - RETVALUE (RG_SCH_CMN_RANK_2); - } - else if((bitMap0>>30) &1) - { - RETVALUE (RG_SCH_CMN_RANK_3); - } - else if((bitMap0>>31) &1) - { - RETVALUE (RG_SCH_CMN_RANK_4); - } - else - { - RETVALUE (RG_SCH_CMN_RANK_1); - } -} - -/** - * @brief Compute the minimum Rank based on Codebook subset - * restriction configuration for 2 Tx Ports and Tx Mode 3. - * - * @details - * - * Function : rgSCHCmnComp2TxMode3 - * - * Depending on BitMap set at CBSR during Configuration - * - return the least possible Rank - * - * - * @param[in] U32 *pmiBitMap - * @return RgSchCmnRank - **/ -#ifdef ANSI -PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3 -( - U32 *pmiBitMap - ) -#else -PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3(pmiBitMap) - U32 *pmiBitMap; -#endif -{ - U32 bitMap0; - TRC2(rgSCHCmnComp2TxMode3); - bitMap0 = pmiBitMap[0]; - if((bitMap0>>30)& 1) - { - RETVALUE (RG_SCH_CMN_RANK_1); - } - else if((bitMap0>>31) &1) - { - RETVALUE (RG_SCH_CMN_RANK_2); - } - else - { - RETVALUE (RG_SCH_CMN_RANK_1); - } -} - -/** - * @brief Compute the minimum Rank based on Codebook subset - * restriction configuration. - * - * @details - * - * Function : rgSCHCmnComputeRank - * - * Depending on Num Tx Ports and Transmission mode - * - return the least possible Rank - * - * - * @param[in] RgrTxMode txMode - * @param[in] U32 *pmiBitMap - * @param[in] U8 numTxPorts - * @return RgSchCmnRank - **/ -#ifdef ANSI -PRIVATE RgSchCmnRank rgSCHCmnComputeRank -( - RgrTxMode txMode, - U32 *pmiBitMap, - U8 numTxPorts - ) -#else -PRIVATE RgSchCmnRank rgSCHCmnComputeRank(txMode, pmiBitMap, numTxPorts) - RgrTxMode txMode; - U32 *pmiBitMap; - U8 numTxPorts; -#endif -{ - TRC2(rgSCHCmnComputeRank); - - if (numTxPorts ==2 && txMode == RGR_UE_TM_3) - { - RETVALUE (rgSCHCmnComp2TxMode3(pmiBitMap)); - } - else if (numTxPorts ==4 && txMode == RGR_UE_TM_3) - { - RETVALUE (rgSCHCmnComp4TxMode3(pmiBitMap)); - } - else if (numTxPorts ==2 && txMode == RGR_UE_TM_4) - { - RETVALUE (rgSCHCmnComp2TxMode4(pmiBitMap)); - } - else if (numTxPorts ==4 && txMode == RGR_UE_TM_4) - { - RETVALUE (rgSCHCmnComp4TxMode4(pmiBitMap)); - } - else - { - RETVALUE (RG_SCH_CMN_RANK_1); - } -} - -#endif - -/** - * @brief Harq Entity Deinitialization for CMN SCH. - * - * @details - * - * Function : rgSCHCmnDlDeInitHqEnt - * - * Harq Entity Deinitialization for CMN SCH - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlHqEnt *hqE - * @return VOID - **/ -/*KWORK_FIX:Changed function return type to void */ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlDeInitHqEnt -( -RgSchCellCb *cell, -RgSchDlHqEnt *hqE -) -#else -PUBLIC Void rgSCHCmnDlDeInitHqEnt(cell, hqE) -RgSchCellCb *cell; -RgSchDlHqEnt *hqE; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - RgSchDlHqProcCb *hqP; - U8 cnt; - S16 ret; - - TRC2(rgSCHCmnDlDeInitHqEnt); - - ret = cellSchd->apisDl->rgSCHDlUeHqEntDeInit(cell, hqE); - /* Free only If the Harq proc are created*/ - if(RFAILED == ret) - { - } - - for(cnt = 0; cnt < hqE->numHqPrcs; cnt++) - { - hqP = &hqE->procs[cnt]; - if ((RG_SCH_CMN_GET_DL_HQP(hqP))) - { - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(hqP->sch)), (sizeof(RgSchCmnDlHqProc))); - } - } -#ifdef LTE_ADV - rgSCHLaaDeInitDlHqProcCb (cell, hqE); -#endif - - RETVOID; -} - -/** - * @brief Harq Entity initialization for CMN SCH. - * - * @details - * - * Function : rgSCHCmnDlInitHqEnt - * - * Harq Entity initialization for CMN SCH - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnDlInitHqEnt -( -RgSchCellCb *cell, -RgSchDlHqEnt *hqEnt -) -#else -PUBLIC S16 rgSCHCmnDlInitHqEnt(cell, hqEnt) -RgSchCellCb *cell; -RgSchDlHqEnt *hqEnt; -#endif - -{ - RgSchDlHqProcCb *hqP; - U8 cnt; - - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnDlInitHqEnt); - - for(cnt = 0; cnt < hqEnt->numHqPrcs; cnt++) - { - hqP = &hqEnt->procs[cnt]; - if (rgSCHUtlAllocSBuf(cell->instIdx, - (Data**)&(hqP->sch), (sizeof(RgSchCmnDlHqProc))) != ROK) - { - RETVALUE(RFAILED); - } - } -#ifdef EMTC_ENABLE - if((cell->emtcEnable) &&(hqEnt->ue->isEmtcUe)) - { - if(ROK != cellSchd->apisEmtcDl->rgSCHDlUeHqEntInit(cell, hqEnt)) - { - RETVALUE(RFAILED); - } - - } - else -#endif - { - if(ROK != cellSchd->apisDl->rgSCHDlUeHqEntInit(cell, hqEnt)) - { - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); -} /* rgSCHCmnDlInitHqEnt */ - -/** - * @brief This function computes distribution of refresh period - * - * @details - * - * Function: rgSCHCmnGetRefreshDist - * Purpose: This function computes distribution of refresh period - * This is required to align set of UEs refresh - * around the different consecutive subframe. - * - * Invoked by: rgSCHCmnGetRefreshPerDist - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnGetRefreshDist -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE U8 rgSCHCmnGetRefreshDist(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - U8 refOffst; -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - TRC2(rgSCHCmnGetRefreshDist); - - for(refOffst = 0; refOffst < RGSCH_MAX_REFRESH_OFFSET; refOffst++) - { - if(cell->refreshUeCnt[refOffst] < RGSCH_MAX_REFRESH_GRPSZ) - { - cell->refreshUeCnt[refOffst]++; - ue->refreshOffset = refOffst; - /* printf("UE[%d] refresh offset[%d]. Cell refresh ue count[%d].\n", ue->ueId, refOffst, cell->refreshUeCnt[refOffst]); */ - RETVALUE(refOffst); - } - } - - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Allocation of refresh distribution failed\n")); - /* We should not enter here normally, but incase of failure, allocating from last offset*/ - cell->refreshUeCnt[refOffst-1]++; - ue->refreshOffset = refOffst-1; - - RETVALUE(refOffst-1); -} -/** - * @brief This function computes initial Refresh Wait Period. - * - * @details - * - * Function: rgSCHCmnGetRefreshPer - * Purpose: This function computes initial Refresh Wait Period. - * This is required to align multiple UEs refresh - * around the same time. - * - * Invoked by: rgSCHCmnGetRefreshPer - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 *waitPer - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGetRefreshPer -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 *waitPer -) -#else -PRIVATE Void rgSCHCmnGetRefreshPer(cell, ue, waitPer) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 *waitPer; -#endif -{ - U32 refreshPer; - U32 crntSubFrm; - - TRC2(rgSCHCmnGetRefreshPer); - - refreshPer = RG_SCH_CMN_REFRESH_TIME * RG_SCH_CMN_REFRESH_TIMERES; - crntSubFrm = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.subframe; - /* Fix: syed align multiple UEs to refresh at same time */ - *waitPer = refreshPer - (crntSubFrm % refreshPer); - *waitPer = RGSCH_CEIL(*waitPer, RG_SCH_CMN_REFRESH_TIMERES); - *waitPer = *waitPer + rgSCHCmnGetRefreshDist(cell, ue); - - RETVOID; -} - - -#ifdef LTE_ADV -/** - * @brief UE initialisation for scheduler. - * - * @details - * - * Function : rgSCHCmnRgrSCellUeCfg - * - * This functions intialises UE specific scheduler - * information for SCELL - * 0. Perform basic validations - * 1. Allocate common sched UE cntrl blk - * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks) - * 3. Perform UL cfg - * 4. Perform DLFS cfg - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrSCellUeCfg -( -RgSchCellCb *sCell, -RgSchUeCb *ue, -RgrUeSecCellCfg *sCellInfoCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrSCellUeCfg(sCell, ue, sCellInfoCfg, err) -RgSchCellCb *sCell; -RgSchUeCb *ue; -RgrUeSecCellCfg *sCellInfoCfg; -RgSchErrInfo *err; -#endif -{ - U8 i; - S16 ret; - U8 cnt; - RgSchCmnAllocRecord *allRcd; - RgSchDlRbAlloc *allocInfo; - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell); - RgSchCmnUlUe *ueUl; - RgSchCmnUlUe *ueUlPcell; - RgSchCmnUe *pCellUeSchCmn; - RgSchCmnUe *ueSchCmn; - RgSchCmnDlUe *ueDl; - RgSchCmnDlUe *pCellUeDl; -#ifdef DEBUGP - Inst inst = ue->cell->instIdx; -#endif - U32 idx = (U8)((sCell->cellId - rgSchCb[sCell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); - TRC2(rgSCHCmnRgrSCellUeCfg); - - pCellUeSchCmn = RG_SCH_CMN_GET_UE(ue,ue->cell); - pCellUeDl = &pCellUeSchCmn->dl; - - /* 1. Allocate Common sched control block */ - if((rgSCHUtlAllocSBuf(sCell->instIdx, - (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK)) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Memory allocation FAILED\n")); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ueSchCmn = RG_SCH_CMN_GET_UE(ue,sCell); - - /*2. Perform UEs downlink configuration */ - ueDl = &ueSchCmn->dl; - - /*CA TODO*/ - ueDl->mimoInfo = pCellUeDl->mimoInfo; - - if ((ue->mimoInfo.txMode == RGR_UE_TM_4) || - (ue->mimoInfo.txMode == RGR_UE_TM_6)) - { - RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_NO_PMI); - } - if (ue->mimoInfo.txMode == RGR_UE_TM_3) - { - RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_RI_1); - } - RGSCH_ARRAY_BOUND_CHECK(sCell->instIdx, rgUeCatTbl, pCellUeSchCmn->cmn.ueCat); - ueDl->maxTbBits = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlTbBits; - /*CA dev-Start*/ - U8 ri = 0; - ri = RGSCH_MIN(ri, sCell->numTxAntPorts); - if(((CM_LTE_UE_CAT_6 == pCellUeSchCmn->cmn.ueCat ) - ||(CM_LTE_UE_CAT_7 == pCellUeSchCmn->cmn.ueCat)) - && (4 == ri)) - { - ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[1]; - } - else - { - ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[0]; - } - /*CA dev-End*/ - /* Fix : syed Assign hqEnt to UE only if msg4 is done */ -#ifdef LTE_TDD - ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/ - rgSchTddDlNumHarqProcTbl[sCell->ulDlCfgIdx]); -#else - ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/ - RGSCH_NUM_DL_HQ_PROC); -#endif -#ifdef EMTC_ENABLE - rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, ue->isEmtcUe); -#else - rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, FALSE); -#endif - - /* DL ambr */ - /* ambrCfgd config moved to ueCb.dl, as it's not needed for per cell wise*/ - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, sCell); - allocInfo->rnti = ue->ueId; - - /* Initializing the lastCfi value to current cfi value */ - ueDl->lastCfi = cellSchd->dl.currCfi; - - if ((cellSchd->apisDl->rgSCHRgrSCellDlUeCfg(sCell, ue, err)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Spec Sched DL UE CFG FAILED\n")); - RETVALUE(RFAILED); - } - - /* TODO: enhance for DLFS RB Allocation for SCELLs in future dev */ - - /* DLFS UE Config */ - if (cellSchd->dl.isDlFreqSel) - { - if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeCfg(sCell, ue, sCellInfoCfg, err)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "DLFS UE config FAILED\n")); - RETVALUE(RFAILED); - } - } - - /* TODO: Do UL SCELL CFG during UL CA dev */ - { - ueUl = RG_SCH_CMN_GET_UL_UE(ue, sCell); - - /* TODO_ULCA: SRS for SCELL needs to be handled in the below function call */ - rgSCHCmnUpdUeUlCqiInfo(sCell, ue, ueUl, ueSchCmn, cellSchd, - sCell->isCpUlExtend); - - ret = rgSCHUhmHqEntInit(sCell, ue); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId,"SCELL UHM HARQ Ent Init " - "Failed for CRNTI:%d", ue->ueId); - RETVALUE(RFAILED); - } - - ueUlPcell = RG_SCH_CMN_GET_UL_UE(ue, ue->cell); - /* Initialize uplink HARQ related information for UE */ - ueUl->hqEnt.maxHqRetx = ueUlPcell->hqEnt.maxHqRetx; - cmLListInit(&ueUl->hqEnt.free); - cmLListInit(&ueUl->hqEnt.inUse); - for(i=0; i < ueUl->hqEnt.numHqPrcs; i++) - { - ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt); - ueUl->hqEnt.hqProcCb[i].procId = i; - ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO; - ueUl->hqEnt.hqProcCb[i].alloc = NULLP; -#ifdef LTEMAC_SPS - /* ccpu00139513- Initializing SPS flags*/ - ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE; - ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE; -#endif - cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk); - ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i]; - } - - /* Allocate UL BSR allocation tracking List */ - cmLListInit(&ueUl->ulAllocLst); - - for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++) - { - if((rgSCHUtlAllocSBuf(sCell->instIdx, - (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId,"SCELL Memory allocation FAILED" - "for CRNTI:%d",ue->ueId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - allRcd->allocTime = sCell->crntTime; - cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk); - allRcd->lnk.node = (PTR)allRcd; - } - - /* After initialising UL part, do power related init */ - ret = rgSCHPwrUeSCellCfg(sCell, ue, sCellInfoCfg); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Could not do " - "power config for UE CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Spec Sched UL UE CFG FAILED" - "for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - else -#endif - { - if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Spec Sched UL UE CFG FAILED" - "for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - - ue->ul.isUlCaEnabled = TRUE; - } - - RETVALUE(ROK); -} /* rgSCHCmnRgrSCellUeCfg */ - - -/** - * @brief UE initialisation for scheduler. - * - * @details - * - * Function : rgSCHCmnRgrSCellUeDel - * - * This functions Delete UE specific scheduler - * information for SCELL - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrSCellUeDel -( -RgSchUeCellInfo *sCellInfo, -RgSchUeCb *ue -) -#else -PUBLIC S16 rgSCHCmnRgrSCellUeDel(sCellInfo, ue) -RgSchUeCellInfo *sCellInfo; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell); - Inst inst = ue->cell->instIdx; - - TRC2(rgSCHCmnRgrSCellUeDel); - - cellSchd->apisDl->rgSCHRgrSCellDlUeDel(sCellInfo, ue); - - /* UL CA */ - rgSCHCmnUlUeDelAllocs(sCellInfo->cell, ue); - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - cellSchd->apisEmtcUl->rgSCHFreeUlUe(sCellInfo->cell, ue); - } - else -#endif - { - cellSchd->apisUl->rgSCHFreeUlUe(sCellInfo->cell, ue); - } - - /* DLFS UE Config */ - if (cellSchd->dl.isDlFreqSel) - { - if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeDel(sCellInfo->cell, ue)) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "DLFS Scell del FAILED\n")); - RETVALUE(RFAILED); - } - } - - rgSCHUtlFreeSBuf(sCellInfo->cell->instIdx, - (Data**)(&(sCellInfo->sch)), (sizeof(RgSchCmnUe))); - - - RETVALUE(ROK); -} /* rgSCHCmnRgrSCellUeDel */ - -#endif - -#ifdef RG_5GTF -/** - * @brief Handles 5gtf configuration for a UE - * - * @details - * - * Function : rgSCHCmn5gtfUeCfg - * - * Processing Steps: - * - * - Return ROK - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeCfg *cfg - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmn5gtfUeCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeCfg *cfg -) -#else -PUBLIC S16 rgSCHCmn5gtfUeCfg(cell, ue, cfg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeCfg *cfg; -#endif -{ - TRC2(rgSCHCmnRgrUeCfg); - - RgSchUeGrp *ue5gtfGrp; - ue->ue5gtfCb.grpId = cfg->ue5gtfCfg.grpId; - ue->ue5gtfCb.BeamId = cfg->ue5gtfCfg.BeamId; - ue->ue5gtfCb.numCC = cfg->ue5gtfCfg.numCC; - ue->ue5gtfCb.mcs = cfg->ue5gtfCfg.mcs; - ue->ue5gtfCb.maxPrb = cfg->ue5gtfCfg.maxPrb; - - ue->ue5gtfCb.cqiRiPer = 100; - /* 5gtf TODO: CQIs to start from (10,0)*/ - ue->ue5gtfCb.nxtCqiRiOccn.sfn = 10; - ue->ue5gtfCb.nxtCqiRiOccn.subframe = 0; - ue->ue5gtfCb.rank = 1; - - printf("\nschd cfg at mac,%u,%u,%u,%u,%u\n",ue->ue5gtfCb.grpId,ue->ue5gtfCb.BeamId,ue->ue5gtfCb.numCC, - ue->ue5gtfCb.mcs,ue->ue5gtfCb.maxPrb); - - ue5gtfGrp = &(cell->cell5gtfCb.ueGrp5gConf[ue->ue5gtfCb.BeamId]); - - /* TODO_5GTF: Currently handling 1 group only. Need to update when multi group - scheduling comes into picture */ - if(ue5gtfGrp->beamBitMask & (1 << ue->ue5gtfCb.BeamId)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "5GTF_ERROR Invalid beam id CRNTI:%d",cfg->crnti); - RETVALUE(RFAILED); - } - ue5gtfGrp->beamBitMask |= (1 << ue->ue5gtfCb.BeamId); - - RETVALUE(ROK); -} -#endif - -/** - * @brief UE initialisation for scheduler. - * - * @details - * - * Function : rgSCHCmnRgrUeCfg - * - * This functions intialises UE specific scheduler - * information - * 0. Perform basic validations - * 1. Allocate common sched UE cntrl blk - * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks) - * 3. Perform UL cfg - * 4. Perform DLFS cfg - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeCfg *ueCfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrUeCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeCfg *ueCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrUeCfg(cell, ue, ueCfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeCfg *ueCfg; -RgSchErrInfo *err; -#endif -{ - RgSchDlRbAlloc *allocInfo; - S16 ret; - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUe *ueSchCmn; - RgSchCmnUlUe *ueUl; - RgSchCmnDlUe *ueDl; - U8 cnt; - RgSchCmnAllocRecord *allRcd; - U32 waitPer; - U32 idx = (U8)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); - RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); - TRC2(rgSCHCmnRgrUeCfg); - - - /* 1. Allocate Common sched control block */ - if((rgSCHUtlAllocSBuf(cell->instIdx, - (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Memory allocation FAILED for CRNTI:%d",ueCfg->crnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); - ue->dl.ueDlCqiCfg = ueCfg->ueDlCqiCfg; - pCellInfo->acqiCb.aCqiCfg = ueCfg->ueDlCqiCfg.aprdCqiCfg; - if(ueCfg->ueCatEnum > 0 ) - { - /*KWORK_FIX removed NULL chk for ueSchCmn*/ - ueSchCmn->cmn.ueCat = ueCfg->ueCatEnum - 1; - } - else - { - ueSchCmn->cmn.ueCat = 0; /* Assuming enum values correctly set */ - } - cmInitTimers(&ueSchCmn->cmn.tmr, 1); - - /*2. Perform UEs downlink configuration */ - ueDl = &ueSchCmn->dl; - /* RACHO : store the rapId assigned for HandOver UE. - * Append UE to handover list of cmnCell */ - if (ueCfg->dedPreambleId.pres == PRSNT_NODEF) - { - rgSCHCmnDelDedPreamble(cell, ueCfg->dedPreambleId.val); - ueDl->rachInfo.hoRapId = ueCfg->dedPreambleId.val; - cmLListAdd2Tail(&cellSchd->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk); - ueDl->rachInfo.hoLnk.node = (PTR)ue; - } - - rgSCHCmnUpdUeMimoInfo(ueCfg, ueDl, cell, cellSchd); - - if (ueCfg->txMode.pres == TRUE) - { - if ((ueCfg->txMode.txModeEnum == RGR_UE_TM_4) || - (ueCfg->txMode.txModeEnum == RGR_UE_TM_6)) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); - } - if (ueCfg->txMode.txModeEnum == RGR_UE_TM_3) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } - } - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat); - ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits; - /*CA dev-Start*/ - U8 ri = 0; - ri = RGSCH_MIN(ri, cell->numTxAntPorts); - if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat ) - ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat)) - && (4 == ri)) - { - ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1]; - } - else - { - ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0]; - } - /*CA dev-End*/ - /* Fix : syed Assign hqEnt to UE only if msg4 is done */ -#ifdef LTE_TDD - ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ - rgSchTddDlNumHarqProcTbl[cell->ulDlCfgIdx]); -#else - ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ - RGSCH_NUM_DL_HQ_PROC); -#endif -#ifdef EMTC_ENABLE - rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe); -#else - rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE); -#endif - /* if none of the DL and UL AMBR are configured then fail the configuration - */ - if((ueCfg->ueQosCfg.dlAmbr == 0) && (ueCfg->ueQosCfg.ueBr == 0)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"UL Ambr and DL Ambr are" - "configured as 0 for CRNTI:%d",ueCfg->crnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - /* DL ambr */ - ue->dl.ambrCfgd = (ueCfg->ueQosCfg.dlAmbr * RG_SCH_CMN_REFRESH_TIME)/100; - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell); - allocInfo->rnti = ue->ueId; - - /* Initializing the lastCfi value to current cfi value */ - ueDl->lastCfi = cellSchd->dl.currCfi; -#ifdef EMTC_ENABLE - if(cell->emtcEnable && ue->isEmtcUe) - { - if ((cellSchd->apisEmtcDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - - } - else -#endif - { - if ((cellSchd->apisDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - } - - - - /* 3. Initialize ul part */ - ueUl = &ueSchCmn->ul; - - rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, - cell->isCpUlExtend); - - ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \ - RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8); - - ue->ul.cfgdAmbr = (ueCfg->ueQosCfg.ueBr * RG_SCH_CMN_REFRESH_TIME)/100; - ue->ul.effAmbr = ue->ul.cfgdAmbr; - RGSCHCPYTIMEINFO(cell->crntTime, ue->ul.ulTransTime); - - /* Allocate UL BSR allocation tracking List */ - cmLListInit(&ueUl->ulAllocLst); - - for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++) - { - if((rgSCHUtlAllocSBuf(cell->instIdx, - (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED" - "for CRNTI:%d",ueCfg->crnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - allRcd->allocTime = cell->crntTime; - cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk); - allRcd->lnk.node = (PTR)allRcd; - } - /* Allocate common sch cntrl blocks for LCGs */ - for (cnt=0; cntinstIdx, - (Data**)&(ue->ul.lcgArr[cnt].sch), (sizeof(RgSchCmnLcg))); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "SCH struct alloc failed for CRNTI:%d",ueCfg->crnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - } - /* After initialising UL part, do power related init */ - ret = rgSCHPwrUeCfg(cell, ue, ueCfg); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not do " - "power config for UE CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } -#ifdef LTEMAC_SPS - ret = rgSCHCmnSpsUeCfg(cell, ue, ueCfg, err); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not do " - "SPS config for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } -#endif /* LTEMAC_SPS */ - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Spec Sched UL UE CFG FAILED" - "for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - } - else -#endif - { - if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Spec Sched UL UE CFG FAILED" - "for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - } - - /* DLFS UE Config */ - if (cellSchd->dl.isDlFreqSel) - { - if ((cellSchd->apisDlfs->rgSCHDlfsUeCfg(cell, ue, ueCfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "DLFS UE config FAILED" - "for CRNTI:%d",ueCfg->crnti); - RETVALUE(RFAILED); - } - } - - /* Fix: syed align multiple UEs to refresh at same time */ - rgSCHCmnGetRefreshPer(cell, ue, &waitPer); - /* Start UE Qos Refresh Timer */ - rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer); -#ifdef RG_5GTF - rgSCHCmn5gtfUeCfg(cell, ue, ueCfg); -#endif - - RETVALUE(ROK); -} /* rgSCHCmnRgrUeCfg */ - -/** - * @brief UE TX mode reconfiguration handler. - * - * @details - * - * Function : rgSCHCmnDlHdlTxModeRecfg - * - * This functions updates UE specific scheduler - * information upon UE reconfiguration. - * - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeRecfg *ueRecfg - * @return Void - **/ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -U8 numTxPorts -) -#else -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg, numTxPorts) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -U8 numTxPorts; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg -) -#else -PRIVATE Void rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlHdlTxModeRecfg); - - if (ueRecfg->txMode.pres != PRSNT_NODEF) - { - RETVOID; - } - /* ccpu00140894- Starting Timer for TxMode Transition Completion*/ - ue->txModeTransCmplt =FALSE; - rgSCHTmrStartTmr (ue->cell, ue, RG_SCH_TMR_TXMODE_TRNSTN, RG_SCH_TXMODE_TRANS_TIMER); - if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_CMPLT) - { - RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, - RG_SCH_CMN_TD_TXMODE_RECFG); - /* MS_WORKAROUND for ccpu00123186 MIMO Fix Start: need to set FORCE TD bitmap based on TX mode */ - ueDl->mimoInfo.ri = 1; - if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) || - (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6)) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); - } - if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } - /* MIMO Fix End: need to set FORCE TD bitmap based on TX mode */ - RETVOID; - } - if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_START) - { - /* start afresh forceTD masking */ - RG_SCH_CMN_INIT_FORCE_TD(ue, cell, 0); - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_TXMODE_RECFG); - /* Intialize MIMO related parameters of UE */ - -#ifdef TFU_UPGRADE - if(ueRecfg->txMode.pres) - { - if((ueRecfg->txMode.txModeEnum ==RGR_UE_TM_3) || - (ueRecfg->txMode.txModeEnum ==RGR_UE_TM_4)) - { - if(ueRecfg->ueCodeBookRstRecfg.pres) - { - ueDl->mimoInfo.ri = - rgSCHCmnComputeRank(ueRecfg->txMode.txModeEnum, - ueRecfg->ueCodeBookRstRecfg.pmiBitMap, numTxPorts); - } - else - { - ueDl->mimoInfo.ri = 1; - } - } - else - { - ueDl->mimoInfo.ri = 1; - } - } - else - { - ueDl->mimoInfo.ri = 1; - } -#else - ueDl->mimoInfo.ri = 1; -#endif /* TFU_UPGRADE */ - if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) || - (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6)) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); - } - if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3) - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } - RETVOID; - } -} -/*********************************************************** - * - * Func : rgSCHCmnUpdUeMimoInfo - * - * Desc : Updates UL and DL Ue Information - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdUeMimoInfo -( -RgrUeCfg *ueCfg, -RgSchCmnDlUe *ueDl, -RgSchCellCb *cell, -RgSchCmnCell *cellSchd -) -#else -PRIVATE Void rgSCHCmnUpdUeMimoInfo(ueCfg, ueDl, cell, cellSchd) -RgrUeCfg *ueCfg; -RgSchCmnDlUe *ueDl; -RgSchCellCb *cell; -RgSchCmnCell *cellSchd; -#endif -{ - TRC2(rgSCHCmnUpdUeMimoInfo) -#ifdef TFU_UPGRADE - if(ueCfg->txMode.pres) - { - if((ueCfg->txMode.txModeEnum ==RGR_UE_TM_3) || - (ueCfg->txMode.txModeEnum ==RGR_UE_TM_4)) - { - if(ueCfg->ueCodeBookRstCfg.pres) - { - ueDl->mimoInfo.ri = - rgSCHCmnComputeRank(ueCfg->txMode.txModeEnum, - ueCfg->ueCodeBookRstCfg.pmiBitMap, cell->numTxAntPorts); - } - else - { - ueDl->mimoInfo.ri = 1; - } - } - else - { - ueDl->mimoInfo.ri = 1; - } - } - else - { - ueDl->mimoInfo.ri = 1; - } - -#else - ueDl->mimoInfo.ri = 1; -#endif /*TFU_UPGRADE */ - ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi; - ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi; - - RETVOID; -} -/*********************************************************** - * - * Func : rgSCHCmnUpdUeUlCqiInfo - * - * Desc : Updates UL and DL Ue Information - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdUeUlCqiInfo -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchCmnUlUe *ueUl, -RgSchCmnUe *ueSchCmn, -RgSchCmnCell *cellSchd, -Bool isEcp -) -#else -PRIVATE Void rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, isEcp) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchCmnUlUe *ueUl; -RgSchCmnUe *ueSchCmn; -RgSchCmnCell *cellSchd; -Bool isEcp; -#endif -{ - - TRC2(rgSCHCmnUpdUeUlCqiInfo) - -#ifdef TFU_UPGRADE - if(ue->srsCb.srsCfg.type == RGR_SCH_SRS_SETUP) - { - if(ue->ul.ulTxAntSel.pres) - { - ueUl->crntUlCqi[ue->srsCb.selectedAnt] = cellSchd->ul.dfltUlCqi; - ueUl->validUlCqi = ueUl->crntUlCqi[ue->srsCb.selectedAnt]; - } - else - { - ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi; - ueUl->validUlCqi = ueUl->crntUlCqi[0]; - } - ue->validTxAnt = ue->srsCb.selectedAnt; - } - else - { - ueUl->validUlCqi = cellSchd->ul.dfltUlCqi; - ue->validTxAnt = 0; - } -#ifdef UL_LA - ueUl->ulLaCb.cqiBasediTbs = rgSchCmnUlCqiToTbsTbl[isEcp] - [ueUl->validUlCqi] * 100; - ueUl->ulLaCb.deltaiTbs = 0; -#endif - -#else - ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi; -#endif /*TFU_UPGRADE */ - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat); - if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE) - { - ueUl->maxUlCqi = cellSchd->ul.max16qamCqi; - } - else - { - ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1; - } - - RETVOID; -} -/*********************************************************** - * - * Func : rgSCHCmnUpdUeCatCfg - * - * Desc : Updates UL and DL Ue Information - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdUeCatCfg -( -RgSchUeCb *ue, -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnUpdUeCatCfg(ue, cell) -RgSchUeCb *ue; -RgSchCellCb *cell; -#endif -{ - RgSchDlHqEnt *hqE = NULLP; - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); - RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnUpdUeCatCfg) - - ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits; - - hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell); - /*CA dev-Start*/ - U8 ri = 0; - ri = RGSCH_MIN(ri, cell->numTxAntPorts); - if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat ) - ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat)) - && (RG_SCH_MAX_TX_LYRS_4 == ri)) - { - ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1]; - } - else - { - ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0]; - } - /*CA dev-End*/ - ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ - hqE->numHqPrcs); - if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE) - { - ueUl->maxUlCqi = cellSchd->ul.max16qamCqi; - } - else - { - ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1; - } - ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \ - RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8); - RETVOID; -} - -/** - * @brief UE reconfiguration for scheduler. - * - * @details - * - * Function : rgSChCmnRgrUeRecfg - * - * This functions updates UE specific scheduler - * information upon UE reconfiguration. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrUeRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrUeRecfg(cell, ue, ueRecfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell); - U32 waitPer; - - TRC2(rgSCHCmnRgrUeRecfg); - /* Basic validations */ - if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) - { -#ifdef TFU_UPGRADE - rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg, cell->numTxAntPorts); -#else - rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg); -#endif /* TFU_UPGRADE */ - } - if(ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG) - { - ue->csgMmbrSta = ueRecfg->csgMmbrSta; - } - /* Changes for UE Category reconfiguration feature */ - if(ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG) - { - rgSCHCmnUpdUeCatCfg(ue, cell); - } - if (ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG) - { - RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); - pCellInfo->acqiCb.aCqiCfg = ueRecfg->aprdDlCqiRecfg; - } -#ifndef TFU_UPGRADE - if (ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) - { - if ((ueRecfg->prdDlCqiRecfg.pres == TRUE) - && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD10) - && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD20)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Unsupported periodic CQI " - "reporting mode %d for old CRNIT:%d", - (int)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->oldCrnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ue->dl.ueDlCqiCfg.prdCqiCfg = ueRecfg->prdDlCqiRecfg; - } -#endif - - if (ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG) - { - if (rgSCHPwrUeRecfg(cell, ue, ueRecfg) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Power Reconfiguration Failed for OLD CRNTI:%d",ueRecfg->oldCrnti); - RETVALUE(RFAILED); - } - } - - if (ueRecfg->ueRecfgTypes & RGR_UE_QOS_RECFG) - { - /* Uplink Sched related Initialization */ - if ((ueRecfg->ueQosRecfg.dlAmbr == 0) && (ueRecfg->ueQosRecfg.ueBr == 0)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Ul Ambr and DL Ambr " - "configured as 0 for OLD CRNTI:%d",ueRecfg->oldCrnti); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ue->ul.cfgdAmbr = (ueRecfg->ueQosRecfg.ueBr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - /* Downlink Sched related Initialization */ - ue->dl.ambrCfgd = (ueRecfg->ueQosRecfg.dlAmbr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - /* Fix: syed Update the effAmbr and effUeBR fields w.r.t the - * new QOS configuration */ - rgSCHCmnDelUeFrmRefreshQ(cell, ue); - /* Fix: syed align multiple UEs to refresh at same time */ - rgSCHCmnGetRefreshPer(cell, ue, &waitPer); - rgSCHCmnApplyUeRefresh(cell, ue); - rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer); - } -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - if ((cellSchCmn->apisEmtcUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - if ((cellSchCmn->apisEmtcDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - else -#endif - { - if ((cellSchCmn->apisUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - if ((cellSchCmn->apisDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - /* DLFS UE Config */ - if (cellSchCmn->dl.isDlFreqSel) - { - if ((cellSchCmn->apisDlfs->rgSCHDlfsUeRecfg(cell, ue, \ - ueRecfg, err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "DLFS UE re-config FAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - -#ifdef LTEMAC_SPS - /* Invoke re-configuration on SPS module */ - if (rgSCHCmnSpsUeRecfg(cell, ue, ueRecfg, err) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "DL SPS ReCFG FAILED for UE CRNTI:%d", ue->ueId); - RETVALUE(RFAILED); - } -#endif - - RETVALUE(ROK); -} /* rgSCHCmnRgrUeRecfg*/ - -/*********************************************************** - * - * Func : rgSCHCmnUlUeDelAllocs - * - * Desc : Deletion of all UE allocations. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlUeDelAllocs -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnUlUeDelAllocs(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - U8 i; -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); -#endif - TRC2(rgSCHCmnUlUeDelAllocs); - - for (i = 0; i < ueUl->hqEnt.numHqPrcs; ++i) - { - RgSchUlHqProcCb *proc = rgSCHUhmGetUlHqProc(cell, ue, i); - -#ifdef ERRCLS_KW - /* proc can't be NULL here */ - if (proc) -#endif - { - /* R8 Upgrade */ - proc->ndi = 0; - if (proc->alloc) - { - /* Added Insure Fixes Of reading Dangling memory.NULLed crntAlloc */ -#ifdef LTEMAC_SPS - if(proc->alloc == ulSpsUe->ulSpsSchdInfo.crntAlloc) - { - ulSpsUe->ulSpsSchdInfo.crntAlloc = NULLP; - ulSpsUe->ulSpsSchdInfo.crntAllocSf = NULLP; - } -#endif -#ifdef EMTC_ENABLE - rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx], - proc->alloc,ue->isEmtcUe); -#else - rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx], - proc->alloc); -#endif - /* PHY probably needn't be intimated since - * whatever intimation it needs happens at the last minute - */ - } - /* Fix: syed Adaptive Msg3 Retx crash. Remove the harqProc - * from adaptive retx List. */ - if (proc->reTxLnk.node) - { - { - //TODO_SID: Need to take care - cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); - proc->reTxLnk.node = (PTR)NULLP; - } - } - } - } - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnDelUeFrmRefreshQ - * - * Desc : Adds a UE to refresh queue, so that the UE is - * periodically triggered to refresh it's GBR and - * AMBR values. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDelUeFrmRefreshQ -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnDelUeFrmRefreshQ(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); - CmTmrArg arg; - RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue); - - TRC2(rgSCHCmnDelUeFrmRefreshQ); - -#ifdef RGL_SPECIFIC_CHANGES - if(ue->refreshOffset < RGSCH_MAX_REFRESH_GRPSZ) - { - if(cell->refreshUeCnt[ue->refreshOffset]) - { - cell->refreshUeCnt[ue->refreshOffset]--; - } - } -#endif - - - cmMemset((U8 *)&arg, 0, sizeof(arg)); - arg.tqCp = &sched->tmrTqCp; - arg.tq = sched->tmrTq; - arg.timers = &ueSchd->tmr; - arg.cb = (PTR)ue; - arg.tNum = 0; - arg.max = 1; - arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH; - - cmRmvCbTq(&arg); - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnUeCcchSduDel - * - * Desc : Clear CCCH SDU scheduling context. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUeCcchSduDel -( -RgSchCellCb *cell, -RgSchUeCb *ueCb -) -#else -PRIVATE Void rgSCHCmnUeCcchSduDel(cell, ueCb) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -#endif -{ - RgSchDlHqEnt *hqE = NULLP; - RgSchDlHqProcCb *ccchSduHqP = NULLP; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnUeCcchSduDel); - - hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell); - if (hqE == NULLP) - { - RETVOID; - } - ccchSduHqP = hqE->ccchSduProc; - if(ueCb->ccchSduLnk.node != NULLP) - { - /* Remove the ccchSduProc if it is in the Tx list */ - cmLListDelFrm(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk)); - ueCb->ccchSduLnk.node = NULLP; - } - else if(ccchSduHqP != NULLP) - { - /* Fix for crash due to stale pdcch. Release ccch pdcch*/ - if(ccchSduHqP->pdcch) - { - cmLListDelFrm(&ccchSduHqP->subFrm->pdcchInfo.pdcchs, - &ccchSduHqP->pdcch->lnk); - cmLListAdd2Tail(&cell->pdcchLst, &ccchSduHqP->pdcch->lnk); - ccchSduHqP->pdcch = NULLP; - } - if(ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node != NULLP) - { - /* Remove the ccchSduProc if it is in the retx list */ - cmLListDelFrm(&cellSch->dl.ccchSduRetxLst, - &ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk); - /* ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node = NULLP; */ - rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE); - } - else if ((ccchSduHqP->subFrm != NULLP) && - (ccchSduHqP->hqPSfLnk.node != NULLP)) - { - rgSCHUtlDlHqPTbRmvFrmTx(ccchSduHqP->subFrm, - ccchSduHqP, 0, FALSE); - rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE); - } - } - RETVOID; -} - - - - -/** - * @brief UE deletion for scheduler. - * - * @details - * - * Function : rgSCHCmnUeDel - * - * This functions deletes all scheduler information - * pertaining to an UE. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUeDel -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUeDel(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchDlHqEnt *hqE = NULLP; - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - CmLList *node; - RgSchCmnAllocRecord *allRcd; - U8 cnt; - RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell); - U32 idx = 0; - TRC2(rgSCHCmnUeDel); - - if (RG_SCH_CMN_GET_UE(ue,cell) == NULLP) - { - /* Common scheduler config has not happened yet */ - RETVOID; - } - hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell); - if(hqE) - { - /* UE Free can be triggered before MSG4 done when dlHqE is not updated */ -#ifdef EMTC_ENABLE - if(ue->isEmtcUe) - { - rgSCHEmtcCmnUeCcchSduDel(cell, ue); - } - else -#endif - { - rgSCHCmnUeCcchSduDel(cell, ue); - } - } - rgSCHCmnDelUeFrmRefreshQ(cell, ue); - - rgSCHCmnUlUeDelAllocs(cell, ue); - - rgSCHCmnDelRachInfo(cell, ue); - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - cellSchCmn->apisEmtcUl->rgSCHFreeUlUe(cell, ue); - } - else -#endif - { - cellSchCmn->apisUl->rgSCHFreeUlUe(cell, ue); - } -#ifdef LTE_ADV - if (ue->numSCells) - { - for(idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++) - { - if(ue->cellInfo[idx] != NULLP) - { - rgSCHSCellDelUeSCell(cell,ue,idx); - } - } - - } -#endif -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - cellSchCmn->apisEmtcDl->rgSCHFreeDlUe(cell, ue); - } - else -#endif - { - cellSchCmn->apisDl->rgSCHFreeDlUe(cell, ue); - } - rgSCHPwrUeDel(cell, ue); - -#ifdef LTEMAC_SPS - rgSCHCmnSpsUeDel(cell, ue); -#endif /* LTEMAC_SPS*/ - - /* CA Dev Start*/ - rgSchCmnDlSfHqDel(ue, cell); - /* CA Dev End*/ - /* DLFS UE delete */ - if (cellSchCmn->dl.isDlFreqSel) - { - cellSchCmn->apisDlfs->rgSCHDlfsUeDel(cell, ue); - } - node = ueUl->ulAllocLst.first; - -/* ccpu00117052 - MOD - Passing double pointer in all the places of - rgSCHUtlFreeSBuf function call for proper NULLP assignment*/ - while(node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - node = node->next; - cmLListDelFrm(&ueUl->ulAllocLst, &allRcd->lnk); - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&allRcd), (sizeof(RgSchCmnAllocRecord))); - } - - for(cnt = 0; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) - { - if (ue->ul.lcgArr[cnt].sch != NULLP) - { - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(ue->ul.lcgArr[cnt].sch)), (sizeof(RgSchCmnLcg))); - } - } - - /* Fix : syed Moved hqEnt deinit to rgSCHCmnDlDeInitHqEnt */ - idx = (U8)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId) & (CM_LTE_MAX_CELLS - 1)); - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch))), (sizeof(RgSchCmnUe))); - RETVOID; -} /* rgSCHCmnUeDel */ - - -/** - * @brief This function handles the common code rate configurations - * done as part of RgrCellCfg/RgrCellRecfg. - * - * @details - * - * Function: rgSCHCmnDlCnsdrCmnRt - * Purpose: This function handles the common code rate configurations - * done as part of RgrCellCfg/RgrCellRecfg. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrDlCmnCodeRateCfg *dlCmnCodeRate - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlCnsdrCmnRt -( -RgSchCellCb *cell, -RgrDlCmnCodeRateCfg *dlCmnCodeRate -) -#else -PRIVATE S16 rgSCHCmnDlCnsdrCmnRt(cell, dlCmnCodeRate) -RgSchCellCb *cell; -RgrDlCmnCodeRateCfg *dlCmnCodeRate; -#endif -{ - RgSchCmnCell *cellDl = RG_SCH_CMN_GET_CELL(cell); - U32 bitsPerRb; - U32 bitsPer2Rb; - U32 bitsPer3Rb; - U8 i, rbNum; - U32 pdcchBits; - - TRC2(rgSCHCmnDlCnsdrCmnRt); - - /* code rate is bits per 1024 phy bits, since modl'n scheme is 2. it is - * bits per 1024/2 REs */ - if (dlCmnCodeRate->bcchPchRaCodeRate != 0) - { - bitsPerRb = ((dlCmnCodeRate->bcchPchRaCodeRate * 2) * - cellDl->dl.noResPerRb[3])/1024; - } - else - { - bitsPerRb = ((RG_SCH_CMN_DEF_BCCHPCCH_CODERATE * 2) * - cellDl->dl.noResPerRb[3])/1024; - } - /* Store bitsPerRb in cellDl->dl to use later to determine - * Number of RBs for UEs with SI-RNTI, P-RNTI and RA-RNTI */ - cellDl->dl.bitsPerRb = bitsPerRb; - /* ccpu00115595 end*/ - /* calculate the ITbs for 2 RBs. Initialize ITbs to MAX value */ - i = 0; - rbNum = 2; - bitsPer2Rb = bitsPerRb * rbNum; - while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer2Rb)) - i++; - - (i <= 1)? (cellDl->dl.cmnChITbs.iTbs2Rbs = 0) : - (cellDl->dl.cmnChITbs.iTbs2Rbs = i-1); - - /* calculate the ITbs for 3 RBs. Initialize ITbs to MAX value */ - i = 0; - rbNum = 3; - bitsPer3Rb = bitsPerRb * rbNum; - while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer3Rb)) - i++; - - (i <= 1)? (cellDl->dl.cmnChITbs.iTbs3Rbs = 0) : - (cellDl->dl.cmnChITbs.iTbs3Rbs = i-1); - - - pdcchBits = 1 + /* Flag for format0/format1a differentiation */ - 1 + /* Localized/distributed VRB assignment flag */ - 5 + /* For mcs */ -#ifndef LTE_TDD - 3 + /* Harq process Id */ -#else - 4 + /* Harq process Id */ - 2 + /* UL Index or DAI */ -#endif - 1 + /* New Data Indicator */ - 2 + /* For RV */ - 2 + /* For tpc */ - 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ - (cell->bwCfg.dlTotalBw + 1))/2); - /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \ - Since VRB is local */ - /* For TDD consider DAI */ - - /* Convert the pdcchBits to actual pdcchBits required for transmission */ - if (dlCmnCodeRate->pdcchCodeRate != 0) - { - pdcchBits = (pdcchBits * 1024)/dlCmnCodeRate->pdcchCodeRate; - if (pdcchBits <= 288) /* 288 : Num of pdcch bits for aggrLvl=4 */ - { - cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4; - } - else /* 576 : Num of pdcch bits for aggrLvl=8 */ - { - cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL8; - } - } - else - { - cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4; - } - if (dlCmnCodeRate->ccchCqi == 0) - { - RETVALUE(RFAILED); - } - else - { - cellDl->dl.ccchCqi = dlCmnCodeRate->ccchCqi; - } - RETVALUE(ROK); -} - -#ifdef LTE_TDD -/** - * @brief This function handles the configuration of cell for the first - * time by the scheduler. - * - * @details - * - * Function: rgSCHCmnDlRgrCellCfg - * Purpose: Configuration received is stored into the data structures - * Also, update the scheduler with the number of frames of - * RACH preamble transmission. - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgrCellCfg* cfg - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlRgrCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cfg, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHCmnDlRgrCellCfg(cell, cfg, err) -RgSchCellCb *cell; -RgrCellCfg *cfg; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSch; - U8 cp; - U8 sfCount; - U8 numPdcchSym; - U8 noSymPerSlot; - U8 maxDlSubfrms = cell->numDlSubfrms; - U8 splSubfrmIdx = cfg->spclSfCfgIdx; - U8 swPtCnt = 0; - Bool isSplfrm; - RgSchTddSubfrmInfo subfrmInfo = rgSchTddMaxUlSubfrmTbl[cell->ulDlCfgIdx]; - S16 ret; - U8 splSfIdx; - U8 antPortIdx; - U8 numCrs; - U8 cfi; - U8 cfiIdx; - RgSchDlSf *sf; - U8 splSfCfi; - U8 mPhich; - - TRC2(rgSCHCmnDlRgrCellCfg); - - - cellSch = RG_SCH_CMN_GET_CELL(cell); - cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->\ - rachCfg.preambleFormat]; - /*[ccpu00138532]-ADD-fill the Msg4 Harq data */ - cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx; - - /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + - 3 TTI (MAX L1+L2 processing delay at the UE) */ - cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) * - rgSchCmnHarqRtt[cell->ulDlCfgIdx] + 3; - cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; - cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; - if (cfg->maxUePerDlSf == 0) - { - cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; - } - if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti) - { - RETVALUE(RFAILED); - } - - - if (cell->bwCfg.dlTotalBw <= 10) - { - cfiIdx = 1; - numPdcchSym = 2; - } - else - { - cfiIdx = 0; - numPdcchSym = 1; - } - /* DwPTS Scheduling Changes Start */ - cellSch->dl.splSfCfg = splSubfrmIdx; - - if (cfg->isCpDlExtend == TRUE) - { - if((0 == splSubfrmIdx) || (4 == splSubfrmIdx) || - (7 == splSubfrmIdx) || (8 == splSubfrmIdx) - ) - { - cell->splSubfrmCfg.isDlDataAllowed = FALSE; - } - else - { - cell->splSubfrmCfg.isDlDataAllowed = TRUE; - } - } - else - { - /* Refer to 36.213 Section 7.1.7 */ - if((0 == splSubfrmIdx) || (5 == splSubfrmIdx)) - { - cell->splSubfrmCfg.isDlDataAllowed = FALSE; - } - else - { - cell->splSubfrmCfg.isDlDataAllowed = TRUE; - } - } - /* DwPTS Scheduling Changes End */ - - splSfCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi); - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi); - - for (sfCount = 0; sfCount < maxDlSubfrms; sfCount++) - { - sf = cell->subFrms[sfCount]; - /* Sfcount matches the first special subframe occurs at Index 0 - * or subsequent special subframes */ - if(subfrmInfo.switchPoints == 1) - { - isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount, - RG_SCH_CMN_10_MS_PRD, &subfrmInfo); - } - else - { - isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount, - RG_SCH_CMN_5_MS_PRD, &subfrmInfo); - } - if(isSplfrm == TRUE) - { - swPtCnt++; - /* DwPTS Scheduling Changes Start */ - if (cell->splSubfrmCfg.isDlDataAllowed == TRUE) - { - sf->sfType = RG_SCH_SPL_SF_DATA; - } - else - { - sf->sfType = RG_SCH_SPL_SF_NO_DATA; - } - /* DwPTS Scheduling Changes End */ - } - else - { - /* DwPTS Scheduling Changes Start */ - if (sf->sfNum != 0) - { - sf->sfType = RG_SCH_DL_SF; - } - else - { - sf->sfType = RG_SCH_DL_SF_0; - } - /* DwPTS Scheduling Changes End */ - } - - /* Calculate the number of CCEs per subframe in the cell */ - mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][sf->sfNum]; - if(cell->dynCfiCb.isDynCfiEnb == TRUE) - { - /* In case if Dynamic CFI feature is enabled, default CFI - * value 1 is used */ - sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][1]; - } - else - { - if (sf->sfType == RG_SCH_SPL_SF_DATA) - { - sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi]; - } - else - { - sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi)]; - } - } - } - - /* Intialize the RACH response scheduling related infromation */ - if(rgSCHCmnDlRachInfoInit(cell) != ROK) - { - RETVALUE(RFAILED); - } - - /* Allocate PRACH preamble list */ - rgSCHCmnDlCreateRachPrmLst(cell); - - /* Initialize PHICH offset information */ - rgSCHCmnDlPhichOffsetInit(cell); - - /* Update the size of HARQ ACK/NACK feedback table */ - /* The array size is increased by 2 to have enough free indices, where other - * indices are busy waiting for HARQ feedback */ - cell->ackNackFdbkArrSize = rgSchTddANFdbkMapTbl[cell->ulDlCfgIdx] + 2; - - /* Initialize expected HARQ ACK/NACK feedback time */ - rgSCHCmnDlANFdbkInit(cell); - - /* Initialize UL association set index */ - if(cell->ulDlCfgIdx != 0) - { - rgSCHCmnDlKdashUlAscInit(cell); - } - - if (cfg->isCpDlExtend == TRUE) - { - cp = RG_SCH_CMN_EXT_CP; - noSymPerSlot = 6; - cell->splSubfrmCfg.dwPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlDwPts; - - if ( cell->splSubfrmCfg.dwPts == 0 ) - { - cell->isDwPtsCnted = FALSE; - } - else - { - cell->isDwPtsCnted = TRUE; - } - - if(cfg->isCpUlExtend == TRUE) - { - cell->splSubfrmCfg.upPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlExtUpPts; - } - else - { - cell->splSubfrmCfg.upPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlNorUpPts; - } - } - else - { - cp = RG_SCH_CMN_NOR_CP; - noSymPerSlot = 7; - cell->splSubfrmCfg.dwPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlDwPts; - cell->isDwPtsCnted = TRUE; - - if(cfg->isCpUlExtend == TRUE) - { - cell->splSubfrmCfg.upPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlExtUpPts; - } - else - { - cell->splSubfrmCfg.upPts = - rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlNorUpPts; - } - } - - /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */ - for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++,cfiIdx++) - { - cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx]; - cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\ - [cell->numTxAntPorts]][cfiIdx]; - cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx]; - cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\ - [cell->numTxAntPorts]][cfiIdx]; - } - - /* Initializing the values of CFI parameters */ - if(cell->dynCfiCb.isDynCfiEnb) - { - /* If DCFI is enabled, current CFI value will start from 1 */ - cellSch->dl.currCfi = cellSch->dl.newCfi = 1; - } - else - { - /* If DCFI is disabled, current CFI value is set as default max allowed CFI value */ - cellSch->dl.currCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi); - cellSch->dl.newCfi = cellSch->dl.currCfi; - } - - /* Include CRS REs while calculating Efficiency - * The number of Resource Elements occupied by CRS depends on Number of - * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0. - * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic - * details of the same. Please note that PDCCH overlap symbols would not - * considered in CRS REs deduction */ - for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++) - { - cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF) - - numPdcchSym) *RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts]; - } - - /* DwPTS Scheduling Changes Start */ - antPortIdx = (cell->numTxAntPorts == 1)? 0: - ((cell->numTxAntPorts == 2)? 1: 2); - - if (cp == RG_SCH_CMN_NOR_CP) - { - splSfIdx = (splSubfrmIdx == 4)? 1: 0; - } - else - { - splSfIdx = (splSubfrmIdx == 3)? 1: 0; - } - - numCrs = rgSchCmnDwptsCrs[splSfIdx][antPortIdx]; - - for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI-1; cfi++) - { - /* If CFI is 2 and Ant Port is 4, don't consider the sym 1 CRS REs */ - if (antPortIdx == 2 && cfi == 2) - { - numCrs -= 4; - } - cellSch->dl.numReDwPts[cfi] = ((cell->splSubfrmCfg.dwPts - cfi)* - RB_SCH_CMN_NUM_SCS_PER_RB) - numCrs; - } - /* DwPTS Scheduling Changes End */ - - if (cfg->maxDlBwPerUe == 0) - { - cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE; - } - else - { - cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe; - } - if (cfg->maxDlRetxBw == 0) - { - cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW; - } - else - { - cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw; - } - /* Fix: MUE_PERTTI_DL*/ - cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; - cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; - if (cfg->maxUePerDlSf == 0) - { - cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; - } - RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl); - /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */ - if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid configuration !: " - "maxCcchPerDlSf %u > maxUePerDlSf %u", - cfg->maxCcchPerDlSf, cfg->maxUePerDlSf ); - - RETVALUE(RFAILED); - } - else if (!cfg->maxCcchPerDlSf) - { - /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application - * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler - * does't consider CCCH allocation in MaxUePerTti cap. Hence more than - * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes - * FLE crash in PHY as PHY has limit of 16 max*/ - cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf; - } - else - { - cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf; - } - if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK) - { - RETVALUE(RFAILED); - } - - /*ccpu00118273 - ADD - start */ - cmLListInit(&cellSch->dl.msg4RetxLst); -#ifdef RGR_V1 - cmLListInit(&cellSch->dl.ccchSduRetxLst); -#endif - -#ifdef RG_PHASE2_SCHED - if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */ - { - cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType]; - } - if (cfg->dlfsCfg.isDlFreqSel) - { - ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel; -#endif - - /* Power related configuration */ - ret = rgSCHPwrCellCfg(cell, cfg); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - - cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset; - cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset; - cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset; - cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset; - cellSch->dl.msg4pAVal = cfg->msg4pAVal; - RETVALUE(ROK); -} -#else /* LTE_TDD */ -/** - * @brief This function handles the configuration of cell for the first - * time by the scheduler. - * - * @details - * - * Function: rgSCHCmnDlRgrCellCfg - * Purpose: Configuration received is stored into the data structures - * Also, update the scheduler with the number of frames of - * RACH preamble transmission. - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgrCellCfg* cfg - * @param[in] RgSchErrInfo* err - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlRgrCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cfg, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHCmnDlRgrCellCfg(cell, cfg, err) -RgSchCellCb *cell; -RgrCellCfg *cfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch; - U8 cp; - U8 numPdcchSym; - U8 noSymPerSlot; - U8 cfi; - U8 cfiIdx; - - TRC2(rgSCHCmnDlRgrCellCfg); - - cellSch = RG_SCH_CMN_GET_CELL(cell); - - /* Initialize the parameters with the ones received in the */ - /* configuration. */ - - /* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA - * sub-frames from preamble format */ - cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->rachCfg.preambleFormat]; - - /*[ccpu00138532]-ADD-fill the Msg4 Harq data */ - cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx; - - /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + - 3 TTI (MAX L1+L2 processing delay at the UE) */ - cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) * - rgSchCmnHarqRtt[7] + 3; - - if (cell->bwCfg.dlTotalBw <= 10) - { - cfiIdx = 1; - numPdcchSym = 2; - } - else - { - cfiIdx = 0; - numPdcchSym = 1; - } - - if (cell->isCpDlExtend == TRUE) - { - cp = RG_SCH_CMN_EXT_CP; - noSymPerSlot = 6; - } - else - { - cp = RG_SCH_CMN_NOR_CP; - noSymPerSlot = 7; - } - - /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */ - for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, cfiIdx++) - { - cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx]; -#ifdef EMTC_ENABLE - cellSch->dl.emtcCqiToTbsTbl[0][cfi] = rgSchEmtcCmnCqiToTbs[0][cp][cfiIdx]; -#endif - cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\ - [cell->numTxAntPorts]][cfiIdx]; - cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx]; -#ifdef EMTC_ENABLE - cellSch->dl.emtcCqiToTbsTbl[1][cfi] = rgSchEmtcCmnCqiToTbs[1][cp][cfiIdx]; -#endif - cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\ - [cell->numTxAntPorts]][cfiIdx]; - } - - /* Initializing the values of CFI parameters */ - if(cell->dynCfiCb.isDynCfiEnb) - { - /* If DCFI is enabled, current CFI value will start from 1 */ - cellSch->dl.currCfi = cellSch->dl.newCfi = 1; - } - else - { - /* If DCFI is disabled, current CFI value is set as default CFI value */ - cellSch->dl.currCfi = cellSch->cfiCfg.cfi; - cellSch->dl.newCfi = cellSch->dl.currCfi; - } - - /* Include CRS REs while calculating Efficiency - * The number of Resource Elements occupied by CRS depends on Number of - * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0. - * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic - * details of the same. Please note that PDCCH overlap symbols would not - * considered in CRS REs deduction */ - for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++) - { - cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF) - - numPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts]; - } - - if (cfg->maxDlBwPerUe == 0) - { - cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE; - } - else - { - cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe; - } - if (cfg->maxDlRetxBw == 0) - { - cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW; - } - else - { - cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw; - } - - /* Fix: MUE_PERTTI_DL*/ - cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; - cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; - if (cfg->maxUePerDlSf == 0) - { - cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; - } - /* Fix: MUE_PERTTI_DL syed validating Cell Configuration */ - if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "FAILED MaxUePerDlSf(%u) < MaxDlUeNewTxPerTti(%u)", - cellSch->dl.maxUePerDlSf, - cellSch->dl.maxUeNewTxPerTti); - RETVALUE(RFAILED); - } - /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */ - if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid configuration !: " - "maxCcchPerDlSf %u > maxUePerDlSf %u", - cfg->maxCcchPerDlSf, cfg->maxUePerDlSf ); - - RETVALUE(RFAILED); - } - else if (!cfg->maxCcchPerDlSf) - { - /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application - * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler - * does't consider CCCH allocation in MaxUePerTti cap. Hence more than - * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes - * FLE crash in PHY as PHY has limit of 16 max*/ - cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf; - } - else - { - cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf; - } - - - if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK) - { - RETVALUE(RFAILED); - } - cmLListInit(&cellSch->dl.msg4RetxLst); -#ifdef RGR_V1 - cmLListInit(&cellSch->dl.ccchSduRetxLst); -#endif - -#ifdef RG_PHASE2_SCHED - if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */ - { - cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType]; - } - if (cfg->dlfsCfg.isDlFreqSel) - { - ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel; -#endif - - /* Power related configuration */ - ret = rgSCHPwrCellCfg(cell, cfg); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - - cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset; - cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset; - cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset; - cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset; - RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl); - RETVALUE(ROK); -} -#endif /* LTE_TDD */ - -/*********************************************************** - * - * Func : rgSCHCmnUlCalcReqRbCeil - * - * Desc : Calculate RB required to satisfy 'bytes' for - * a given CQI. - * Returns number of RBs such that requirement - * is necessarily satisfied (does a 'ceiling' - * computation). - * - * Ret : Required RBs (U8) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUlCalcReqRbCeil -( -U32 bytes, -U8 cqi, -RgSchCmnUlCell *cellUl -) -#else -PUBLIC U8 rgSCHCmnUlCalcReqRbCeil(bytes, cqi, cellUl) -U32 bytes; -U8 cqi; -RgSchCmnUlCell *cellUl; -#endif -{ - U32 numRe = RGSCH_CEIL((bytes * 8) * 1024, rgSchCmnUlCqiTbl[cqi].eff); - TRC2(rgSCHCmnUlCalcReqRbCeil); - RETVALUE((U8)RGSCH_CEIL(numRe, RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl))); -} - -/*********************************************************** - * - * Func : rgSCHCmnPrecompMsg3Vars - * - * Desc : Precomputes the following for msg3 allocation: - * 1. numSb and Imcs for msg size A - * 2. numSb and Imcs otherwise - * - * Ret : - * - * Notes: The corresponding vars in cellUl struct is filled - * up - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnPrecompMsg3Vars -( -RgSchCmnUlCell *cellUl, -U8 ccchCqi, -U16 msgSzA, -U8 sbSize, -Bool isEcp -) -#else -PRIVATE S16 rgSCHCmnPrecompMsg3Vars(cellUl, ccchCqi, msgSzA, sbSize, isEcp) -RgSchCmnUlCell *cellUl; -U8 ccchCqi; -U16 msgSzA; -U8 sbSize; -Bool isEcp; -#endif -{ - U8 numSb; - U8 ccchTbs; - U8 ccchMcs; - U8 numRb = 0; - U8 iTbs = 0; - U16 msg3GrntSz = 0; - - TRC2(rgSCHCmnPrecompMsg3Vars); - - if (ccchCqi > cellUl->max16qamCqi) - { - ccchCqi = cellUl->max16qamCqi; - } -/* #ifndef RG_SCH_CMN_EXP_CP_SUP For ECP Pick the index 1 */ - /* Fix */ - ccchTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi]; - ccchMcs = rgSCHCmnUlGetIMcsFrmITbs(ccchTbs, CM_LTE_UE_CAT_1); - - /* MCS should fit in 4 bits in RAR */ - if (ccchMcs >= 15) - { - ccchMcs = 15; - } - - /* Limit the ccchMcs to 15 as it - * can be inferred from 36.213, section 6.2 that msg3 imcs - * field is 4 bits. - * Since, UE doesn't exist right now, we use CAT_1 for ue - * category*/ - while((ccchMcs = (rgSCHCmnUlGetIMcsFrmITbs( - rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi],CM_LTE_UE_CAT_1)) - ) > - RG_SCH_CMN_MAX_MSG3_IMCS) - { - ccchCqi--; - } - - iTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi]; - - if (msgSzA < RGSCH_MIN_MSG3_GRNT_SZ) - { - RETVALUE(RFAILED); - } - numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(msgSzA, ccchCqi, cellUl), sbSize); - - numRb = numSb * sbSize; - msg3GrntSz = 8 * msgSzA; - - while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz) - { - ++numSb; - numRb = numSb * sbSize; - } - while (rgSchCmnMult235Tbl[numSb].match != numSb) - { - ++numSb; - } - /* Reversed(Corrected) the assignment for preamble-GrpA - * Refer- TG36.321- section- 5.1.2*/ - cellUl->ra.prmblBNumSb = numSb; - cellUl->ra.prmblBIMcs = ccchMcs; - numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(RGSCH_MIN_MSG3_GRNT_SZ, \ - ccchCqi, cellUl), - sbSize); - - numRb = numSb * sbSize; - msg3GrntSz = 8 * RGSCH_MIN_MSG3_GRNT_SZ; - while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz) - { - ++numSb; - numRb = numSb * sbSize; - } - while (rgSchCmnMult235Tbl[numSb].match != numSb) - { - ++numSb; - } - /* Reversed(Corrected) the assignment for preamble-GrpA - * Refer- TG36.321- section- 5.1.2*/ - cellUl->ra.prmblANumSb = numSb; - cellUl->ra.prmblAIMcs = ccchMcs; - RETVALUE(ROK); -} - -PUBLIC U32 gPrntPucchDet=0; - -#ifdef LTE_TDD -/*********************************************************** - * - * Func : rgSCHCmnUlCalcAvailBw - * - * Desc : Calculates bandwidth available for PUSCH scheduling. - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlCalcAvailBw -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -U8 cfi, -U8 *rbStartRef, -U8 *bwAvailRef -) -#else -PRIVATE S16 rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, rbStartRef, bwAvailRef) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -U8 cfi; -U8 *rbStartRef; -U8 *bwAvailRef; -#endif -{ - U8 c = 3; - U8 ulBw = cell->bwCfg.ulTotalBw; - U8 n2Rb = cell->pucchCfg.resourceSize; - U8 pucchDeltaShft = cell->pucchCfg.deltaShift; - U16 n1Pucch = cell->pucchCfg.n1PucchAn; - U8 n1Cs = cell->pucchCfg.cyclicShift; - - U8 n1PerRb; - U8 totalCce; - U16 n1Max; - U8 n1Rb; - U32 mixedRb; - U8 exclRb; /* RBs to exclude */ - U8 n1RbPart; - U8 puschRbStart; - /* To avoid PUCCH and PUSCH collision issue */ - U8 P; - U8 n1PlusOne; - U8 mi; - /* Maximum value of M as per Table 10.1-1 */ - U8 M[RGSCH_MAX_TDD_UL_DL_CFG] = {1, 2, 4, 3, 4, 9, 1}; - - TRC2(rgSCHCmnUlCalcAvailBw); - - if (cell->isCpUlExtend) - { - c = 2; - } - - n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */ - - /* Considering the max no. of CCEs for PUSCH BW calculation - * based on min mi value */ - if (cell->ulDlCfgIdx == 0 || cell->ulDlCfgIdx == 6) - { - mi = 1; - } - else - { - mi = 0; - } - - totalCce = cell->dynCfiCb.cfi2NCceTbl[mi][cfi]; - - P = rgSCHCmnGetPValFrmCCE(cell, totalCce-1); - n1PlusOne = cell->rgSchTddNpValTbl[P + 1]; - n1Max = (M[cell->ulDlCfgIdx] - 1)*n1PlusOne + (totalCce-1) + n1Pucch; - - /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in - * TS 36.211 */ - n1RbPart = (c*n1Cs)/pucchDeltaShft; - n1Rb = (n1Max - n1RbPart)/ n1PerRb; - mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */ - - /* get the total Number of RB's to be excluded for PUSCH */ - /* ccpu00137339 */ - if(n1Pucch < n1RbPart) - { - exclRb = n2Rb; - } - else - { - exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */ - } - puschRbStart = exclRb/2 + 1; - - /* Num of PUCCH RBs = puschRbStart*2 */ - if (puschRbStart * 2 >= ulBw) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"No bw available for PUSCH"); - RETVALUE(RFAILED); - } - - *rbStartRef = puschRbStart; - *bwAvailRef = ulBw - puschRbStart * 2; - - if(cell->pucchCfg.maxPucchRb !=0 && - (puschRbStart * 2 > cell->pucchCfg.maxPucchRb)) - { - cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi); - } - - RETVALUE(ROK); -} -#else - -/*********************************************************** - * - * Func : rgSCHCmnUlCalcAvailBw - * - * Desc : Calculates bandwidth available for PUSCH scheduling. - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlCalcAvailBw -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -U8 cfi, -U8 *rbStartRef, -U8 *bwAvailRef -) -#else -PRIVATE S16 rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, rbStartRef, bwAvailRef) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -U8 cfi; -U8 *rbStartRef; -U8 *bwAvailRef; -#endif -{ - U8 c = 3; - U8 ulBw = cell->bwCfg.ulTotalBw; - U8 n2Rb = cell->pucchCfg.resourceSize; - U8 pucchDeltaShft = cell->pucchCfg.deltaShift; - U16 n1Pucch = cell->pucchCfg.n1PucchAn; - U8 n1Cs = cell->pucchCfg.cyclicShift; - U8 n1PerRb; - U8 totalCce; - U16 n1Max; - U8 n1Rb; - U32 mixedRb; - U8 exclRb; /* RBs to exclude */ - U8 n1RbPart; - U8 puschRbStart; -#ifdef LTE_ADV - U16 numOfN3PucchRb; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); -#endif - - TRC2(rgSCHCmnUlCalcAvailBw); - - if (cell->isCpUlExtend) - { - c = 2; - } - - n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */ - - totalCce = cell->dynCfiCb.cfi2NCceTbl[0][cfi]; - - n1Max = n1Pucch + totalCce-1; - - /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in - * TS 36.211 */ - n1RbPart = (c*n1Cs)/pucchDeltaShft; - n1Rb = (U8)((n1Max - n1RbPart) / n1PerRb); - mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */ - - /* get the total Number of RB's to be excluded for PUSCH */ - /* ccpu00137339 */ - if(n1Pucch < n1RbPart) - { - exclRb = n2Rb; - } - else - { - exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */ - } - /*Support for PUCCH Format 3*/ -#ifdef LTE_ADV - if (cell->isPucchFormat3Sptd) - { - numOfN3PucchRb = RGSCH_CEIL(cellSch->dl.maxUePerDlSf,5); - exclRb = exclRb + numOfN3PucchRb; - } -#endif - puschRbStart = exclRb/2 + 1; - - if(gPrntPucchDet) - { -#ifndef ALIGN_64BIT - printf("CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%ld:%d:%d:%d:%d:%d]\n", - cell->crntTime.sfn, cell->crntTime.subframe, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb); -#else - printf("CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%d:%d:%d:%d:%d:%d]\n", - cell->crntTime.sfn, cell->crntTime.subframe, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb); -#endif - } - - if (puschRbStart*2 >= ulBw) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"No bw available for PUSCH"); - RETVALUE(RFAILED); - } - - *rbStartRef = puschRbStart; - *bwAvailRef = ulBw - puschRbStart * 2; - - if(cell->pucchCfg.maxPucchRb !=0 && - (puschRbStart * 2 > cell->pucchCfg.maxPucchRb)) - { - cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi); - } - - RETVALUE(ROK); -} -#endif - - - -/*********************************************************** - * - * Func : rgSCHCmnUlCellInit - * - * Desc : Uplink scheduler initialisation for cell. - * - * Ret : S16 - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlCellInit -( - RgSchCellCb *cell, - RgrCellCfg *cellCfg - ) -#else -PRIVATE S16 rgSCHCmnUlCellInit(cell, cellCfg) - RgSchCellCb *cell; - RgrCellCfg *cellCfg; -#endif -{ - S16 ret; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - U8 maxUePerUlSf = cellCfg->maxUePerUlSf; -#ifdef RGR_V1 - /* Added configuration for maximum number of MSG3s */ - U8 maxMsg3PerUlSf = cellCfg->maxMsg3PerUlSf; -#endif - U8 maxUlBwPerUe = cellCfg->maxUlBwPerUe; - U8 sbSize = cellCfg->puschSubBand.size; - U8 i; - U8 rbStart; - U8 bwAvail; - U8 cfi; - U8 maxSbPerUe; - U8 numSb; -#ifdef LTE_TDD - U16 ulDlCfgIdx = cell->ulDlCfgIdx; - /* [ccpu00127294]-MOD-Change the max Ul subfrms size in TDD */ - U8 maxSubfrms = 2 * rgSchTddNumUlSf[ulDlCfgIdx]; - U8 ulToDlMap[12] = {0}; /* maximum 6 Subframes in UL * 2 */ - U8 maxUlsubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ - [RGSCH_NUM_SUB_FRAMES-1]; - U16 subfrm; - S8 dlIdx; -#else - U8 maxSubfrms = RG_SCH_CMN_UL_NUM_SF; -#endif -#ifdef LTE_L2_MEAS - U8 idx; -#endif - U8 iTbs; -#if (defined(LTE_L2_MEAS) ) - Inst inst = cell->instIdx; -#endif /* #if (defined(LTE_L2_MEAS) || defined(DEBUGP) */ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - - TRC2(rgSCHCmnUlCellInit); - - cellUl->maxUeNewTxPerTti = cellCfg->maxUlUeNewTxPerTti; - if (maxUePerUlSf == 0) - { - maxUePerUlSf = RG_SCH_CMN_MAX_UE_PER_UL_SF; - } -#ifdef RGR_V1 - if (maxMsg3PerUlSf == 0) - { - maxMsg3PerUlSf = RG_SCH_CMN_MAX_MSG3_PER_UL_SF; - } - /* fixed the problem while sending raRsp - * if maxMsg3PerUlSf is greater than - * RGSCH_MAX_RNTI_PER_RARNTI - * */ - if(maxMsg3PerUlSf > RGSCH_MAX_RNTI_PER_RARNTI) - { - maxMsg3PerUlSf = RGSCH_MAX_RNTI_PER_RARNTI; - } - - if(maxMsg3PerUlSf > maxUePerUlSf) - { - maxMsg3PerUlSf = maxUePerUlSf; - } - - /*cellUl->maxAllocPerUlSf = maxUePerUlSf + maxMsg3PerUlSf;*/ - /*Max MSG3 should be a subset of Max UEs*/ - cellUl->maxAllocPerUlSf = maxUePerUlSf; - cellUl->maxMsg3PerUlSf = maxMsg3PerUlSf; -#else - cellUl->maxAllocPerUlSf = maxUePerUlSf; -#endif - /* Fix: MUE_PERTTI_UL syed validating Cell Configuration */ - if (cellUl->maxAllocPerUlSf < cellUl->maxUeNewTxPerTti) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "FAILED: MaxUePerUlSf(%u) < MaxUlUeNewTxPerTti(%u)", - cellUl->maxAllocPerUlSf, - cellUl->maxUeNewTxPerTti); - RETVALUE(RFAILED); - } - -#ifdef LTE_L2_MEAS -#ifdef LTE_TDD - for(idx = 0; idx < RGSCH_SF_ALLOC_SIZE; idx++) -#else - for(idx = 0; idx < RGSCH_NUM_SUB_FRAMES; idx++) -#endif - { - - ret = rgSCHUtlAllocSBuf(inst, (Data **)&(cell->sfAllocArr[idx]. - ulUeInfo.ulAllocInfo), (cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc))); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation failed "); - RETVALUE(ret); - } - } -#endif - if (maxUlBwPerUe == 0) - { - /* ccpu00139362- Setting to configured UL BW instead of MAX BW(100)*/ - maxUlBwPerUe = cell->bwCfg.ulTotalBw; - } - cellUl->maxUlBwPerUe = maxUlBwPerUe; - - /* FOR RG_SCH_CMN_EXT_CP_SUP */ - if (!cellCfg->isCpUlExtend) - { - cellUl->ulNumRePerRb = 12 * (14 - RGSCH_UL_SYM_DMRS_SRS); - } - else - { - cellUl->ulNumRePerRb = 12 * (12 - RGSCH_UL_SYM_DMRS_SRS); - } - - if (sbSize != rgSchCmnMult235Tbl[sbSize].match) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid subband size %d", sbSize); - RETVALUE(RFAILED); - } - //Setting the subband size to 4 which is size of VRBG in 5GTF -#ifdef RG_5GTF - sbSize = MAX_5GTF_VRBG_SIZE; -#endif - - maxSbPerUe = maxUlBwPerUe / sbSize; - if (maxSbPerUe == 0) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnUlCellInit(): " - "maxUlBwPerUe/sbSize is zero"); - RETVALUE(RFAILED); - } - cellUl->maxSbPerUe = rgSchCmnMult235Tbl[maxSbPerUe].prvMatch; - - /* CQI related updations */ - if ((!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->ulCmnCodeRate.ccchCqi)) - || (!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->trgUlCqi.trgCqi))) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnUlCellInit(): " - "Invalid cqi"); - RETVALUE(RFAILED); - } - cellUl->dfltUlCqi = cellCfg->ulCmnCodeRate.ccchCqi; - - /* Changed the logic to determine maxUlCqi. - * For a 16qam UE, maxUlCqi is the CQI Index at which - * efficiency is as close as possible to RG_SCH_MAX_CODE_RATE_16QAM - * Refer to 36.213-8.6.1 */ - for (i = RG_SCH_CMN_UL_NUM_CQI - 1;i > 0; --i) - { - RLOG_ARG2(L_INFO,DBG_CELLID,cell->cellId, - "CQI %u:iTbs %u", - i, - rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]); -#ifdef MAC_SCH_STATS - /* ccpu00128489 ADD Update mcs in hqFailStats here instead of at CRC - * since CQI to MCS mapping does not change. The only exception is for - * ITBS = 19 where the MCS can be 20 or 21 based on the UE cat. We - * choose 20, instead of 21, ie UE_CAT_3 */ - iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]; - RG_SCH_CMN_UL_TBS_TO_MCS(iTbs, hqFailStats.ulCqiStat[i - 1].mcs); -#endif - } - for (i = RG_SCH_CMN_UL_NUM_CQI - 1; i != 0; --i) - { - /* Fix for ccpu00123912*/ - iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]; - if (iTbs <= RGSCH_UL_16QAM_MAX_ITBS) /* corresponds to 16QAM */ - { - RLOG_ARG1(L_INFO,DBG_CELLID,cell->cellId, - "16 QAM CQI %u", i); - cellUl->max16qamCqi = i; - break; - } - } - -#ifdef EMTC_ENABLE - /* Precompute useful values for RA msg3 */ - ret = rgSCHCmnPrecompEmtcMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi, - cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend); - if (ret != ROK) - { - RETVALUE(ret); - } -#endif - - /* Precompute useful values for RA msg3 */ - ret = rgSCHCmnPrecompMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi, - cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend); - if (ret != ROK) - { - RETVALUE(ret); - } - - cellUl->sbSize = sbSize; - -#ifdef LTE_TDD - cellUl->numUlSubfrms = maxSubfrms; - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->ulSfArr, - cellUl->numUlSubfrms * sizeof(RgSchUlSf)); - - if (ret != ROK) - { - cellUl->numUlSubfrms = 0; - RETVALUE(ret); - } - - /* store the DL subframe corresponding to the PUSCH offset - * in their respective UL subframe */ - for(i=0; i < RGSCH_NUM_SUB_FRAMES; i++) - { - if(rgSchTddPuschTxKTbl[ulDlCfgIdx][i] != 0) - { - subfrm = (i + rgSchTddPuschTxKTbl[ulDlCfgIdx][i]) % \ - RGSCH_NUM_SUB_FRAMES; - subfrm = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subfrm]-1; - dlIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][i]-1; - RGSCH_ARRAY_BOUND_CHECK( cell->instIdx, ulToDlMap, subfrm); - ulToDlMap[subfrm] = dlIdx; - } - } - /* Copy the information in the remaining UL subframes based - * on number of HARQ processes */ - for(i=maxUlsubfrms; i < maxSubfrms; i++) - { - subfrm = i-maxUlsubfrms; - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, i); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, subfrm) - ulToDlMap[i] = ulToDlMap[subfrm]; - } -#endif - - for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) - { -#ifdef LTE_TDD - ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail); -#else - ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail); -#endif - if (ret != ROK) - { - RETVALUE(ret); - } - - if (cfi == 1) - { - cell->ulAvailBw = bwAvail; - } - - numSb = bwAvail/sbSize; - - cell->dynCfiCb.bwInfo[cfi].startRb = rbStart; - cell->dynCfiCb.bwInfo[cfi].numSb = numSb; - } - - if(0 == cell->dynCfiCb.maxCfi) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, - "Incorrect Default CFI(%u), maxCfi(%u), maxPucchRb(%d)", - cellSch->cfiCfg.cfi, cell->dynCfiCb.maxCfi, - cell->pucchCfg.maxPucchRb); - - RETVALUE(RFAILED); - } - - /* DMRS values */ - cellUl->dmrsArrSize = cell->dynCfiCb.bwInfo[1].numSb; - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->dmrsArr, - cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); - if (ret != ROK) - { - RETVALUE(ret); - } - for (i = 0; i < cellUl->dmrsArrSize; ++i) - { - cellUl->dmrsArr[i] = cellCfg->puschSubBand.dmrs[i]; - } - - /* Init subframes */ - for (i = 0; i < maxSubfrms; ++i) - { - ret = rgSCHUtlUlSfInit(cell, &cellUl->ulSfArr[i], i, - cellUl->maxAllocPerUlSf); - if (ret != ROK) - { - for (; i != 0; --i) - { - rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[i-1]); - } - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(cellUl->dmrsArr)), - cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); -#ifdef LTE_TDD - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf)); -#endif - RETVALUE(ret); - } - } - RG_SCH_RESET_HCSG_UL_PRB_CNTR(cellUl); - RETVALUE(ROK); -} - -/** - * @brief Scheduler processing on cell configuration. - * - * @details - * - * Function : rgSCHCmnRgrCellCfg - * - * This function does requisite initialisation - * and setup for scheduler1 when a cell is - * configured. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellCfg *cellCfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrCellCfg(cell, cellCfg, err) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch; - TRC2(rgSCHCmnRgrCellCfg); - - /* As part of RGR cell configuration, validate the CRGCellCfg - * There is no trigger for crgCellCfg from SC1 */ - /* Removed failure check for Extended CP */ - - if (((ret = rgSCHUtlAllocSBuf(cell->instIdx, - (Data**)&(cell->sc.sch), (sizeof(RgSchCmnCell)))) != ROK)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "Memory allocation FAILED"); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - cellSch = (RgSchCmnCell *)(cell->sc.sch); - cellSch->cfiCfg = cellCfg->cfiCfg; - cellSch->trgUlCqi.trgCqi = cellCfg->trgUlCqi.trgCqi; - /* Initialize the scheduler refresh timer queues */ - cellSch->tmrTqCp.nxtEnt = 0; - cellSch->tmrTqCp.tmrLen = RG_SCH_CMN_NUM_REFRESH_Q; - - /* RACHO Intialize the RACH ded Preamble Information */ - rgSCHCmnCfgRachDedPrm(cell); -#ifdef LTE_TDD - /* Initialize 'Np' value for each 'p' used for - * HARQ ACK/NACK reception */ - rgSCHCmnDlNpValInit(cell); -#endif - - /* Initialize 'Np' value for each 'p' used for - * HARQ ACK/NACK reception */ -#ifdef LTE_TDD - rgSCHCmnDlNpValInit(cell); -#endif - - /* Now perform uplink related initializations */ - ret = rgSCHCmnUlCellInit(cell, cellCfg); - if (ret != ROK) - { - /* There is no downlink deinit to be performed */ - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - ret = rgSCHCmnDlRgrCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - /* DL scheduler has no initializations to make */ - /* As of now DL scheduler always returns ROK */ - - rgSCHCmnGetDciFrmtSizes(cell); - rgSCHCmnGetCqiDciFrmt2AggrLvl(cell); -#ifdef EMTC_ENABLE - rgSCHCmnGetEmtcDciFrmtSizes(cell); - rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl(cell); -#endif /* EMTC_ENABLE */ - -#ifdef EMTC_ENABLE - if(TRUE == cellCfg->emtcEnable) - { - cellSch->apisEmtcUl = &rgSchEmtcUlSchdTbl[0]; - ret = cellSch->apisEmtcUl->rgSCHRgrUlCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - RETVALUE(ret); - } - } -#endif - cellSch->apisUl = &rgSchUlSchdTbl[RG_SCH_CMN_GET_UL_SCHED_TYPE(cell)]; - ret = cellSch->apisUl->rgSCHRgrUlCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - RETVALUE(ret); - } -#ifdef EMTC_ENABLE - if(TRUE == cellCfg->emtcEnable) - { - cellSch->apisEmtcDl = &rgSchEmtcDlSchdTbl[0]; - ret = cellSch->apisEmtcDl->rgSCHRgrDlCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - RETVALUE(ret); - } - } -#endif - cellSch->apisDl = &rgSchDlSchdTbl[RG_SCH_CMN_GET_DL_SCHED_TYPE(cell)]; -#ifdef LTEMAC_SPS - /* Perform SPS specific initialization for the cell */ - ret = rgSCHCmnSpsCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - RETVALUE(ret); - } -#endif - ret = cellSch->apisDl->rgSCHRgrDlCellCfg(cell, cellCfg, err); - if (ret != ROK) - { - RETVALUE(ret); - } - rgSCHCmnInitVars(cell); - - RETVALUE(ROK); -} /* rgSCHCmnRgrCellCfg*/ - - -/** - * @brief This function handles the reconfiguration of cell. - * - * @details - * - * Function: rgSCHCmnRgrCellRecfg - * Purpose: Update the reconfiguration parameters. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrCellRecfg -( -RgSchCellCb *cell, -RgrCellRecfg *recfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrCellRecfg(cell, recfg, err) -RgSchCellCb *cell; -RgrCellRecfg *recfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - - TRC2(rgSCHCmnRgrCellRecfg); - - if (recfg->recfgTypes & RGR_CELL_UL_CMNRATE_RECFG) - { - U8 oldCqi = cellUl->dfltUlCqi; - if (!RG_SCH_CMN_UL_IS_CQI_VALID(recfg->ulCmnCodeRate.ccchCqi)) - { - err->errCause = RGSCHERR_SCH_CFG; - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnRgrCellRecfg(): " - "Invalid cqi"); - RETVALUE(RFAILED); - } - cellUl->dfltUlCqi = recfg->ulCmnCodeRate.ccchCqi; - ret = rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi, - cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend); - if (ret != ROK) - { - cellUl->dfltUlCqi = oldCqi; - rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi, - cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend); - RETVALUE(ret); - } - } - - if (recfg->recfgTypes & RGR_CELL_DL_CMNRATE_RECFG) - { - if (rgSCHCmnDlCnsdrCmnRt(cell, &recfg->dlCmnCodeRate) != ROK) - { - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - } - -#ifdef EMTC_ENABLE - if(TRUE == cell->emtcEnable) - { - /* Invoke UL sched for cell Recfg */ - ret = cellSch->apisEmtcUl->rgSCHRgrUlCellRecfg(cell, recfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - - /* Invoke DL sched for cell Recfg */ - ret = cellSch->apisEmtcDl->rgSCHRgrDlCellRecfg(cell, recfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - /* Invoke UL sched for cell Recfg */ - ret = cellSch->apisUl->rgSCHRgrUlCellRecfg(cell, recfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - - /* Invoke DL sched for cell Recfg */ - ret = cellSch->apisDl->rgSCHRgrDlCellRecfg(cell, recfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - - if (recfg->recfgTypes & RGR_CELL_DLFS_RECFG) - { - ret = cellSch->apisDlfs->rgSCHDlfsCellRecfg(cell, recfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - cellSch->dl.isDlFreqSel = recfg->dlfsRecfg.isDlFreqSel; - } - - if (recfg->recfgTypes & RGR_CELL_PWR_RECFG) - { - ret = rgSCHPwrCellRecfg(cell, recfg); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlCellDeinit - * - * Desc : Uplink scheduler de-initialisation for cell. - * - * Ret : S16 - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlCellDeinit -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnUlCellDeinit(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - U8 ulSfIdx; -#ifdef LTE_TDD - U8 maxSubfrms = cellUl->numUlSubfrms; -#endif -#ifdef LTE_L2_MEAS - CmLList *lnk = NULLP; - RgSchL2MeasCb *measCb; -#endif - TRC2(rgSCHCmnUlCellDeinit); -#ifdef LTE_L2_MEAS -#ifdef LTE_TDD - for(ulSfIdx = 0; ulSfIdx < RGSCH_SF_ALLOC_SIZE; ulSfIdx++) -#else - for(ulSfIdx = 0; ulSfIdx < RGSCH_NUM_SUB_FRAMES; ulSfIdx++) -#endif - { - if(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo != NULLP) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo)), - cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc)); - - /* ccpu00117052 - DEL - removed explicit NULLP assignment - as it is done in above utility function */ - } - } - /* Free the memory allocated to measCb */ - lnk = cell->l2mList.first; - while(lnk != NULLP) - { - measCb = (RgSchL2MeasCb *)lnk->node; - cmLListDelFrm(&cell->l2mList, lnk); - lnk = lnk->next; - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\ - sizeof(RgSchL2MeasCb)); - } -#endif - if (cellUl->dmrsArr != NULLP) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx,(Data **)(&(cellUl->dmrsArr)), - cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); - } - /* De-init subframes */ -#ifdef LTE_TDD - for (ulSfIdx = 0; ulSfIdx < maxSubfrms; ++ulSfIdx) -#else - for (ulSfIdx = 0; ulSfIdx < RG_SCH_CMN_UL_NUM_SF; ++ulSfIdx) -#endif - { - rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[ulSfIdx]); - } - -#ifdef LTE_TDD - if (cellUl->ulSfArr != NULLP) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf)); - } -#endif - - RETVOID; -} - -/** - * @brief Scheduler processing for cell delete. - * - * @details - * - * Function : rgSCHCmnCellDel - * - * This functions de-initialises and frees memory - * taken up by scheduler1 for the entire cell. - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnCellDel -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnCellDel(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnCellDel); - -#ifdef LTE_L2_MEAS - glblTtiCnt = 0; -#endif - if (cellSch == NULLP) - { - RETVOID; - } - /* Perform the deinit for the UL scheduler */ - rgSCHCmnUlCellDeinit(cell); -#ifdef EMTC_ENABLE - if(TRUE == cell->emtcEnable) - { - if (cellSch->apisEmtcUl) - { - cellSch->apisEmtcUl->rgSCHFreeUlCell(cell); - } - } -#endif - if (cellSch->apisUl) - { - /* api pointer checks added (here and below in - * this function). pl check. - antriksh */ - cellSch->apisUl->rgSCHFreeUlCell(cell); - } - - /* Perform the deinit for the DL scheduler */ - cmLListInit(&cellSch->dl.taLst); - if (cellSch->apisDl) - { - cellSch->apisDl->rgSCHFreeDlCell(cell); - } -#ifdef EMTC_ENABLE - if (cellSch->apisEmtcDl) - { - rgSCHEmtcInitTaLst(&cellSch->dl); - - cellSch->apisEmtcDl->rgSCHFreeDlCell(cell); - } -#endif - - /* DLFS de-initialization */ - if (cellSch->dl.isDlFreqSel && cellSch->apisDlfs) - { - cellSch->apisDlfs->rgSCHDlfsCellDel(cell); - } - - rgSCHPwrCellDel(cell); -#ifdef LTEMAC_SPS - rgSCHCmnSpsCellDel(cell); -#endif - - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(cell->sc.sch)), (sizeof(RgSchCmnCell))); - RETVOID; -} /* rgSCHCmnCellDel */ - - -/** - * @brief This function validates QOS parameters for DL. - * - * @details - * - * Function: rgSCHCmnValidateDlQos - * Purpose: This function validates QOS parameters for DL. - * - * Invoked by: Scheduler - * - * @param[in] CrgLchQosCfg *dlQos - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnValidateDlQos -( -RgrLchQosCfg *dlQos -) -#else -PRIVATE S16 rgSCHCmnValidateDlQos(dlQos) -RgrLchQosCfg *dlQos; -#endif -{ - U8 qci = dlQos->qci; - - TRC2(rgSCHCmnValidateDlQos); - - if ( qci < RG_SCH_CMN_MIN_QCI || qci > RG_SCH_CMN_MAX_QCI ) - { - RETVALUE(RFAILED); - } - - if ((qci >= RG_SCH_CMN_GBR_QCI_START) && - (qci <= RG_SCH_CMN_GBR_QCI_END)) - { - if ((dlQos->mbr == 0) || (dlQos->mbr < dlQos->gbr)) - { - RETVALUE(RFAILED); - } - } - RETVALUE(ROK); -} - -/** - * @brief Scheduler invocation on logical channel addition. - * - * @details - * - * Function : rgSCHCmnRgrLchCfg - * - * This functions does required processing when a new - * (dedicated) logical channel is added. Assumes lcg - * pointer in ulLc is set. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlLcCb *dlLc - * @param[int] RgrLchCfg *lcCfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrLchCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc, -RgrLchCfg *lcCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrLchCfg(cell, ue, dlLc, lcCfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -RgrLchCfg *lcCfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnRgrLchCfg); - - ret = rgSCHUtlAllocSBuf(cell->instIdx, - (Data**)&((dlLc)->sch), (sizeof(RgSchCmnDlSvc))); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnRgrLchCfg(): " - "SCH struct alloc failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - if(lcCfg->lcType != CM_LTE_LCH_DCCH) - { - ret = rgSCHCmnValidateDlQos(&lcCfg->dlInfo.dlQos); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSchCmnCrgLcCfg(): " - "DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - /* Perform DL service activation in the scheduler */ - ((RgSchCmnDlSvc *)(dlLc->sch))->qci = lcCfg->dlInfo.dlQos.qci; - ((RgSchCmnDlSvc *)(dlLc->sch))->prio = rgSchCmnDlQciPrio[lcCfg->dlInfo.dlQos.qci - 1]; - ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcCfg->dlInfo.dlQos.gbr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcCfg->dlInfo.dlQos.mbr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - } - else - { - /*assigning highest priority to DCCH */ - ((RgSchCmnDlSvc *)(dlLc->sch))->prio=RG_SCH_CMN_DCCH_PRIO; - } - dlLc->ue = ue; - dlLc->lcType=lcCfg->lcType; - -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - ret = cellSch->apisEmtcDl->rgSCHRgrDlLcCfg(cell, ue,dlLc ,lcCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - ret = cellSch->apisDl->rgSCHRgrDlLcCfg(cell, ue, dlLc, lcCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - ret = cellSch->apisEmtcUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - ret = cellSch->apisUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - -#ifdef LTE_ADV - if (ue->numSCells) - { - rgSCHSCellDlLcCfg(cell, ue, dlLc); - } -#endif - - -#ifdef LTEMAC_SPS - if(lcCfg->dlInfo.dlSpsCfg.isSpsEnabled) - { - /* Invoke SPS module if SPS is enabled for the service */ - ret = rgSCHCmnSpsDlLcCfg(cell, ue, dlLc, lcCfg, err); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "rgSchCmnRgrLchCfg(): " - "SPS configuration failed for DL LC for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief Scheduler invocation on logical channel addition. - * - * @details - * - * Function : rgSCHCmnRgrLchRecfg - * - * This functions does required processing when an existing - * (dedicated) logical channel is reconfigured. Assumes lcg - * pointer in ulLc is set to the old value. - * Independent of whether new LCG is meant to be configured, - * the new LCG scheduler information is accessed and possibly modified. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlLcCb *dlLc - * @param[int] RgrLchRecfg *lcRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrLchRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc, -RgrLchRecfg *lcRecfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrLchRecfg(cell, ue, dlLc, lcRecfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -RgrLchRecfg *lcRecfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnRgrLchRecfg) - - if(dlLc->lcType != CM_LTE_LCH_DCCH) - { - ret = rgSCHCmnValidateDlQos(&lcRecfg->dlRecfg.dlQos); - - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - if (((RgSchCmnDlSvc *)(dlLc->sch))->qci != lcRecfg->dlRecfg.dlQos.qci) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Qci, hence lc Priority change " - "not supported for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(ret); - } - ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcRecfg->dlRecfg.dlQos.gbr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcRecfg->dlRecfg.dlQos.mbr * \ - RG_SCH_CMN_REFRESH_TIME)/100; - } - else - { - /*assigning highest priority to DCCH */ - ((RgSchCmnDlSvc *)(dlLc->sch))->prio = RG_SCH_CMN_DCCH_PRIO; - } - -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - ret = cellSch->apisEmtcDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - ret = cellSch->apisEmtcUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - ret = cellSch->apisDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - ret = cellSch->apisUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - -#ifdef LTEMAC_SPS - if (lcRecfg->recfgTypes & RGR_DL_LC_SPS_RECFG) - { - /* Invoke SPS module if SPS is enabled for the service */ - if(lcRecfg->dlRecfg.dlSpsRecfg.isSpsEnabled) - { - ret = rgSCHCmnSpsDlLcRecfg(cell, ue, dlLc, lcRecfg, err); - if (ret != ROK) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"SPS re-configuration not " - "supported for dlLC Ignore this CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); - } - } - RETVALUE(ROK); - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief Scheduler invocation on logical channel addition. - * - * @details - * - * Function : rgSCHCmnRgrLcgCfg - * - * This functions does required processing when a new - * (dedicated) logical channel is added. Assumes lcg - * pointer in ulLc is set. - * - * @param[in] RgSchCellCb *cell, - * @param[in] RgSchUeCb *ue, - * @param[in] RgSchLcgCb *lcg, - * @param[in] RgrLcgCfg *lcgCfg, - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrLcgCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchLcgCb *lcg, -RgrLcgCfg *lcgCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrLcgCfg(cell, ue, lcg, lcgCfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchLcgCb *lcg; -RgrLcgCfg *lcgCfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].sch)); - - TRC2(rgSCHCmnRgrLcgCfg); - - ulLcg->cfgdGbr = (lcgCfg->ulInfo.gbr * RG_SCH_CMN_REFRESH_TIME)/100; - ulLcg->effGbr = ulLcg->cfgdGbr; - ulLcg->deltaMbr = ((lcgCfg->ulInfo.mbr - lcgCfg->ulInfo.gbr) * RG_SCH_CMN_REFRESH_TIME)/100; - ulLcg->effDeltaMbr = ulLcg->deltaMbr; - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - ret = cellSch->apisUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr)) - { - /* Indicate MAC that this LCG is GBR LCG */ - rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcgCfg->ulInfo.lcgId, TRUE); - } - RETVALUE(ROK); -} - -/** - * @brief Scheduler invocation on logical channel addition. - * - * @details - * - * Function : rgSCHCmnRgrLcgRecfg - * - * This functions does required processing when a new - * (dedicated) logical channel is added. Assumes lcg - * pointer in ulLc is set. - * - * @param[in] RgSchCellCb *cell, - * @param[in] RgSchUeCb *ue, - * @param[in] RgSchLcgCb *lcg, - * @param[in] RgrLcgRecfg *reCfg, - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrLcgRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchLcgCb *lcg, -RgrLcgRecfg *reCfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnRgrLcgRecfg(cell, ue, lcg, reCfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchLcgCb *lcg; -RgrLcgRecfg *reCfg; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[reCfg->ulRecfg.lcgId].sch)); - - TRC2(rgSCHCmnRgrLcgRecfg); - - ulLcg->cfgdGbr = (reCfg->ulRecfg.gbr * RG_SCH_CMN_REFRESH_TIME)/100; - ulLcg->effGbr = ulLcg->cfgdGbr; - ulLcg->deltaMbr = ((reCfg->ulRecfg.mbr - reCfg->ulRecfg.gbr) * RG_SCH_CMN_REFRESH_TIME)/100; - ulLcg->effDeltaMbr = ulLcg->deltaMbr; - -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - else -#endif - { - ret = cellSch->apisUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err); - if (ret != ROK) - { - RETVALUE(RFAILED); - } - } - if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr)) - { - /* Indicate MAC that this LCG is GBR LCG */ - rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, TRUE); - } - else - { - /* In case of RAB modification */ - rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, FALSE); - } - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnRgrLchDel - * - * Desc : Scheduler handling for a (dedicated) - * uplink logical channel being deleted. - * - * Ret : - * - * Notes: - * - * File : - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnRgrLchDel -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteLcId lcId, -U8 lcgId -) -#else -PUBLIC S16 rgSCHCmnRgrLchDel(cell, ue, lcId, lcgId) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteLcId lcId; -U8 lcgId; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnRgrLchDel); -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId); - } - else -#endif - { - cellSch->apisUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId); - } - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnLcgDel - * - * Desc : Scheduler handling for a (dedicated) - * uplink logical channel being deleted. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnLcgDel -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchLcgCb *lcg -) -#else -PUBLIC Void rgSCHCmnLcgDel(cell, ue, lcg) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchLcgCb *lcg; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnLcg *lcgCmn = RG_SCH_CMN_GET_UL_LCG(lcg); - TRC2(rgSCHCmnLcgDel); - - if (lcgCmn == NULLP) - { - RETVOID; - } - - if (RGSCH_IS_GBR_BEARER(lcgCmn->cfgdGbr)) - { - /* Indicate MAC that this LCG is GBR LCG */ - rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcg->lcgId, FALSE); - } - -#ifdef LTEMAC_SPS - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlLcgDel(cell, ue, lcg); - } -#endif /* LTEMAC_SPS */ - - lcgCmn->effGbr = 0; - lcgCmn->reportedBs = 0; - lcgCmn->cfgdGbr = 0; - /* set lcg bs to 0. Deletion of control block happens - * at the time of UE deletion. */ - lcgCmn->bs = 0; -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHFreeUlLcg(cell, ue, lcg); - } - else -#endif - { - cellSch->apisUl->rgSCHFreeUlLcg(cell, ue, lcg); - } - RETVOID; -} - - -/** - * @brief This function deletes a service from scheduler. - * - * @details - * - * Function: rgSCHCmnFreeDlLc - * Purpose: This function is made available through a FP for - * making scheduler aware of a service being deleted from UE. - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @param[in] RgSchDlLcCb* svc - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnFreeDlLc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *svc -) -#else -PUBLIC Void rgSCHCmnFreeDlLc(cell, ue, svc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *svc; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnFreeDlLc); - if (svc->sch == NULLP) - { - RETVOID; - } -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - cellSch->apisEmtcDl->rgSCHFreeDlLc(cell, ue, svc); - } - else -#endif - { - cellSch->apisDl->rgSCHFreeDlLc(cell, ue, svc); - } - -#ifdef LTE_ADV - if (ue->numSCells) - { - rgSCHSCellDlLcDel(cell, ue, svc); - } -#endif - -#ifdef LTEMAC_SPS - /* If SPS service, invoke SPS module */ - if (svc->dlLcSpsCfg.isSpsEnabled) - { - rgSCHCmnSpsDlLcDel(cell, ue, svc); - } -#endif - - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data**)(&(svc->sch)), (sizeof(RgSchCmnDlSvc))); - -#ifdef LTE_ADV - rgSCHLaaDeInitDlLchCb(cell, svc); -#endif - - RETVOID; -} - -#ifdef RGR_V1 - -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH SDURetx Allocations. - * - * @details - * - * Function: rgSCHCmnDlCcchSduRetxFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH Retx Allocations. - * Scans through the scheduled list of ccchSdu retrans - * fills the corresponding pdcch, adds the hqProc to - * the corresponding SubFrm and removes the hqP from - * cells retx List. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchSduRetxFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchSduRetxFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchDlRbAlloc *rbAllocInfo; - RgSchDlHqProcCb *hqP; - RgSchUeCb *ue; - TRC2(rgSCHCmnDlCcchSduRetxFnlz); - - /* Traverse through the Scheduled Retx List */ - node = allocInfo->ccchSduAlloc.schdCcchSduRetxLst.first; - while (node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - ue = hqP->hqE->ue; - rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell); - node = node->next; - rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); - - /* Remove the HqP from cell's ccchSduRetxLst */ - cmLListDelFrm(&cmnCellDl->ccchSduRetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; - - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - rgSCHCmnDlUeResetTemp(ue, hqP); - } - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - node = allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst.first; - while(node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - ue = hqP->hqE->ue; - node = node->next; - /* reset the UE allocation Information */ - rgSCHCmnDlUeResetTemp(ue, hqP); - } - RETVOID; -} -#endif -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH Retx Allocations. - * - * @details - * - * Function: rgSCHCmnDlCcchRetxFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH Retx Allocations. - * Scans through the scheduled list of msg4 retrans - * fills the corresponding pdcch, adds the hqProc to - * the corresponding SubFrm and removes the hqP from - * cells retx List. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchRetxFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchRetxFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchDlRbAlloc *rbAllocInfo; - RgSchDlHqProcCb *hqP; - RgSchRaCb *raCb; - TRC2(rgSCHCmnDlCcchRetxFnlz); - - /* Traverse through the Scheduled Retx List */ - node = allocInfo->msg4Alloc.schdMsg4RetxLst.first; - while (node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - raCb = hqP->hqE->raCb; - rbAllocInfo = &raCb->rbAllocInfo; - node = node->next; - rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); - - /* Remove the HqP from cell's msg4RetxLst */ - cmLListDelFrm(&cmnCellDl->msg4RetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - cmMemset((U8 *)rbAllocInfo, (U8)0, sizeof(*rbAllocInfo)); - rgSCHCmnDlHqPResetTemp(hqP); - } - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - node = allocInfo->msg4Alloc.nonSchdMsg4RetxLst.first; - while(node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - raCb = hqP->hqE->raCb; - node = node->next; - cmMemset((U8 *)&raCb->rbAllocInfo, (U8)0, sizeof(raCb->rbAllocInfo)); - rgSCHCmnDlHqPResetTemp(hqP); - } - RETVOID; -} - -#ifdef RGR_V1 -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH SDU tx Allocations. - * - * @details - * - * Function: rgSCHCmnDlCcchSduTxFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH tx Allocations. - * Scans through the scheduled list of CCCH SDU trans - * fills the corresponding pdcch, adds the hqProc to - * the corresponding SubFrm and removes the hqP from - * cells tx List. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchSduTxFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchSduTxFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchUeCb *ueCb; - RgSchDlRbAlloc *rbAllocInfo; - RgSchDlHqProcCb *hqP; - RgSchLchAllocInfo lchSchdData; - TRC2(rgSCHCmnDlCcchSduTxFnlz); - - /* Traverse through the Scheduled Retx List */ - node = allocInfo->ccchSduAlloc.schdCcchSduTxLst.first; - while (node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - ueCb = hqP->hqE->ue; - node = node->next; - rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); - - /* fill the pdcch and HqProc */ - rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); - - /* Remove the raCb from cell's toBeSchdLst */ - cmLListDelFrm(&cell->ccchSduUeLst, &ueCb->ccchSduLnk); - ueCb->ccchSduLnk.node = (PTR)NULLP; - - /* Fix : Resetting this required to avoid complication - * in reestablishment case */ - ueCb->dlCcchInfo.bo = 0; - - /* Indicate DHM of the CCCH LC scheduling */ - hqP->tbInfo[0].contResCe = NOTPRSNT; - lchSchdData.lcId = 0; - lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes - - (RGSCH_MSG4_HDRSIZE); - rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]); - - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - rgSCHCmnDlUeResetTemp(ueCb, hqP); - } - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - node = allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst.first; - while(node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - ueCb = hqP->hqE->ue; - node = node->next; - /* Release HqProc */ - rgSCHDhmRlsHqpTb(hqP, 0, FALSE); - /*Fix: Removing releasing of TB1 as it will not exist for CCCH SDU and hence caused a crash*/ - /*rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/ - /* reset the UE allocation Information */ - rgSCHCmnDlUeResetTemp(ueCb, hqP); - } - RETVOID; -} - -#endif -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH tx Allocations. - * - * @details - * - * Function: rgSCHCmnDlCcchTxFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested - * CCCH tx Allocations. - * Scans through the scheduled list of msg4 trans - * fills the corresponding pdcch, adds the hqProc to - * the corresponding SubFrm and removes the hqP from - * cells tx List. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCcchTxFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlCcchTxFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - RgSchRaCb *raCb; - RgSchDlRbAlloc *rbAllocInfo; - RgSchDlHqProcCb *hqP; - RgSchLchAllocInfo lchSchdData; - TRC2(rgSCHCmnDlCcchTxFnlz); - - /* Traverse through the Scheduled Retx List */ - node = allocInfo->msg4Alloc.schdMsg4TxLst.first; - while (node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - raCb = hqP->hqE->raCb; - node = node->next; - rbAllocInfo = &raCb->rbAllocInfo; - - /* fill the pdcch and HqProc */ - rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); - /* MSG4 Fix Start */ - - rgSCHRamRmvFrmRaInfoSchdLst(cell, raCb); - /* MSG4 Fix End */ - - /* Indicate DHM of the CCCH LC scheduling */ - lchSchdData.lcId = 0; - lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes - - (RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE); - /* TRansmitting presence of cont Res CE across MAC-SCH interface to - * identify CCCH SDU transmissions which need to be done - * without the - * contention resolution CE*/ - hqP->tbInfo[0].contResCe = PRSNT_NODEF; - /*Dont add lc if only cont res CE is being transmitted*/ - if(raCb->dlCcchInfo.bo) - { - rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]); - } - else - { - } - /* Fix: syed dlAllocCb reset should be performed. - * zombie info in dlAllocCb leading to crash rbNum wraparound */ - cmMemset((U8 *)&raCb->rbAllocInfo, (U8)0, sizeof(raCb->rbAllocInfo)); - rgSCHCmnDlHqPResetTemp(hqP); - } - node = allocInfo->msg4Alloc.nonSchdMsg4TxLst.first; - while(node) - { - hqP = (RgSchDlHqProcCb *)(node->node); - raCb = hqP->hqE->raCb; - node = node->next; - rbAllocInfo = &raCb->rbAllocInfo; - /* Release HqProc */ - rgSCHDhmRlsHqpTb(hqP, 0, FALSE); - /*Fix: Removing releasing of TB1 as it will not exist for MSG4 and hence caused a crash*/ - /* rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/ - /* reset the UE allocation Information */ - cmMemset((U8 *)rbAllocInfo, (U8)0, sizeof(*rbAllocInfo)); - rgSCHCmnDlHqPResetTemp(hqP); - } - - RETVOID; -} -/* R8 Upgrade */ -/** - * @brief This function calculates the BI Index to be sent in the Bi header - * field. - * - * @details - * Function: rgSCHCmnGetBiIndex - * Purpose: This function Processes utilizes the previous BI time value - * calculated and the difference last BI sent time and current time. To - * calculate the latest BI Index. It also considers the how many UE's - * Unserved in this subframe. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] U32 ueCount - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnGetBiIndex -( -RgSchCellCb *cell, -U32 ueCount -) -#else -PUBLIC U8 rgSCHCmnGetBiIndex(cell, ueCount) -RgSchCellCb *cell; -U32 ueCount; -#endif -{ - S16 prevVal = 0; /* To Store Intermediate Value */ - U16 newBiVal = 0; /* To store Bi Value in millisecond */ - U8 idx = 0; - U16 timeDiff = 0; - - TRC2(rgSCHCmnGetBiIndex) - - if (cell->biInfo.prevBiTime != 0) - { -#ifdef EMTC_ENABLE - if(cell->emtcEnable == TRUE) - { - timeDiff =(RGSCH_CALC_SF_DIFF_EMTC(cell->crntTime, cell->biInfo.biTime)); - } - else -#endif - { - timeDiff =(RGSCH_CALC_SF_DIFF(cell->crntTime, cell->biInfo.biTime)); - } - - prevVal = cell->biInfo.prevBiTime - timeDiff; - } - if (prevVal < 0) - { - prevVal = 0; - } - newBiVal = RG_SCH_CMN_GET_BI_VAL(prevVal,ueCount); - /* To be used next time when BI is calculated */ -#ifdef EMTC_ENABLE - if(cell->emtcEnable == TRUE) - { - RGSCHCPYTIMEINFO_EMTC(cell->crntTime, cell->biInfo.biTime) - } - else -#endif - { - RGSCHCPYTIMEINFO(cell->crntTime, cell->biInfo.biTime) - } - - /* Search the actual BI Index from table Backoff Parameters Value and - * return that Index */ - do - { - if (rgSchCmnBiTbl[idx] > newBiVal) - { - break; - } - idx++; - }while(idx < RG_SCH_CMN_NUM_BI_VAL-1); - cell->biInfo.prevBiTime = rgSchCmnBiTbl[idx]; - /* For 16 Entries in Table 7.2.1 36.321.880 - 3 reserved so total 13 Entries */ - RETVALUE(idx); /* Returning reserved value from table UE treats it has 960 ms */ -} /* rgSCHCmnGetBiIndex */ - - -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * RAR allocations. Assumption: The reuqested - * allocations are always satisfied completely. - * Hence no roll back. - * - * @details - * - * Function: rgSCHCmnDlRaRspFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * Takes care of PDCCH filling. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRaRspFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlRaRspFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - U32 rarCnt = 0; - RgSchDlRbAlloc *raRspAlloc; - RgSchDlSf *subFrm = NULLP; - RgSchRaCb *raCb; - RgSchErrInfo err; - CmLListCp *reqLst; - RgSchRaReqInfo *raReq; - Bool preamGrpA; - RgSchUlAlloc *ulAllocRef=NULLP; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 allocRapidCnt = 0; -#ifdef LTE_TDD - U32 msg3SchdIdx = 0; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 msg3Subfrm; -#endif - - TRC2(rgSCHCmnDlRaRspFnlz); - - for (rarCnt=0; rarCntraRspAlloc[rarCnt]; - /* Having likely condition first for optimization */ - if (!raRspAlloc->pdcch) - { - continue; - } - else - { - subFrm = raRspAlloc->dlSf; - reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex]; - /* Corrected RACH handling for multiple RAPIDs per RARNTI */ - allocRapidCnt = raRspAlloc->numRapids; - while (allocRapidCnt) - { - raReq = (RgSchRaReqInfo *)(reqLst->first->node); - /* RACHO: If dedicated preamble, then allocate UL Grant - * (consequence of handover/pdcchOrder) and continue */ - if (RGSCH_IS_DEDPRM(cell, raReq->raReq.rapId)) - { - rgSCHCmnHdlHoPo(cell, &subFrm->raRsp[rarCnt].contFreeUeLst, - raReq); - cmLListDelFrm(reqLst, reqLst->first); - allocRapidCnt--; - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, - sizeof(RgSchRaReqInfo)); - continue; - } - /* ccpu00139815 */ - if(cell->overLoadBackOffEnab) - {/* rach Overlaod conrol is triggerd, Skipping this rach */ - cmLListDelFrm(reqLst, reqLst->first); - allocRapidCnt--; - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, - sizeof(RgSchRaReqInfo)); - continue; - } - /* Attempt to include each RA request into the RSP */ - /* Any failure in the procedure is considered to */ - /* affect futher allocations in the same TTI. When */ - /* a failure happens, we break out and complete */ - /* the processing for random access */ - if (rgSCHRamCreateRaCb(cell, &raCb, &err) != ROK) - { - break; - } - /* Msg3 allocation request to USM */ - if (raReq->raReq.rapId < cell->rachCfg.sizeRaPreambleGrpA) - preamGrpA = TRUE; - else - preamGrpA = FALSE; - /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/ - rgSCHCmnMsg3GrntReq(cell, raCb->tmpCrnti, preamGrpA, \ - &(raCb->msg3HqProc), &ulAllocRef, &raCb->msg3HqProcId); - if (ulAllocRef == NULLP) - { - rgSCHRamDelRaCb(cell, raCb, TRUE); - break; - } - if (raReq->raReq.cqiPres) - { - raCb->ccchCqi = raReq->raReq.cqiIdx; - } - else - { - raCb->ccchCqi = cellDl->ccchCqi; - } - raCb->rapId = raReq->raReq.rapId; - raCb->ta.pres = TRUE; - raCb->ta.val = raReq->raReq.ta; - raCb->msg3Grnt = ulAllocRef->grnt; - /* Populating the tpc value received */ - raCb->msg3Grnt.tpc = raReq->raReq.tpc; - /* PHR handling for MSG3 */ - ulAllocRef->raCb = raCb; -#ifndef LTE_TDD - /* To the crntTime, add the MIN time at which UE will - * actually send MSG3 i.e DL_DELTA+6 */ - raCb->msg3AllocTime = cell->crntTime; - RGSCH_INCR_SUB_FRAME(raCb->msg3AllocTime, RG_SCH_CMN_MIN_MSG3_RECP_INTRVL); -#else - msg3SchdIdx = (cell->crntTime.subframe+RG_SCH_CMN_DL_DELTA) % - RGSCH_NUM_SUB_FRAMES; - /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in - special subframe */ - if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][msg3SchdIdx] != - RG_SCH_TDD_UL_SUBFRAME) - { - RGSCHCMNADDTOCRNTTIME(cell->crntTime,raCb->msg3AllocTime, - RG_SCH_CMN_DL_DELTA) - msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][ - raCb->msg3AllocTime.subframe]; - RGSCHCMNADDTOCRNTTIME(raCb->msg3AllocTime, raCb->msg3AllocTime, - msg3Subfrm); - } -#endif - cmLListAdd2Tail(&subFrm->raRsp[rarCnt].raRspLst, &raCb->rspLnk); - raCb->rspLnk.node = (PTR)raCb; - cmLListDelFrm(reqLst, reqLst->first); - allocRapidCnt--; - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, - sizeof(RgSchRaReqInfo)); - - /* SR_RACH_STATS : RAR scheduled */ - rgNumRarSched++; - - } - /* R8 Upgrade */ - /* Fill subframe data members */ - subFrm->raRsp[rarCnt].raRnti = raRspAlloc->rnti; - subFrm->raRsp[rarCnt].pdcch = raRspAlloc->pdcch; - subFrm->raRsp[rarCnt].tbSz = raRspAlloc->tbInfo[0].bytesAlloc; - /* Fill PDCCH data members */ - rgSCHCmnFillPdcch(cell, subFrm->raRsp[rarCnt].pdcch, raRspAlloc); - - /* ccpu00139815 */ - if(cell->overLoadBackOffEnab) - {/* rach Overlaod conrol is triggerd, Skipping this rach */ - subFrm->raRsp[rarCnt].backOffInd.pres = PRSNT_NODEF; - subFrm->raRsp[rarCnt].backOffInd.val = cell->overLoadBackOffval; - continue; - } - else - { - subFrm->raRsp[rarCnt].backOffInd.pres = NOTPRSNT; - } - - /*[ccpu00125212] Avoiding sending of empty RAR in case of RAR window - is short and UE is sending unauthorised preamble.*/ - reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex]; - if ((raRspAlloc->biEstmt) && (reqLst->count)) - { - subFrm->raRsp[0].backOffInd.pres = PRSNT_NODEF; - /* Added as part of Upgrade */ - subFrm->raRsp[0].backOffInd.val = - rgSCHCmnGetBiIndex(cell, reqLst->count); - - /* SR_RACH_STATS : Back Off Inds */ - rgNumBI++; - - } - else if ((subFrm->raRsp[rarCnt].raRspLst.first == NULLP) && - (subFrm->raRsp[rarCnt].contFreeUeLst.first == NULLP)) - { - /* Return the grabbed PDCCH */ - rgSCHUtlPdcchPut(cell, &subFrm->pdcchInfo, raRspAlloc->pdcch); - subFrm->raRsp[rarCnt].pdcch = NULLP; - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnRaRspAlloc(): " - "Not even one RaReq."); - RETVOID; - } - } - RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId, - "RNTI:%d Scheduled RAR @ (%u,%u) ", - raRspAlloc->rnti, - cell->crntTime.sfn, - cell->crntTime.subframe); - } - RETVOID; -} - -/** - * @brief This function computes rv. - * - * @details - * - * Function: rgSCHCmnDlCalcRvForBcch - * Purpose: This function computes rv. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] Bool si - * @param[in] U16 i - * @return U8 - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnDlCalcRvForBcch -( -RgSchCellCb *cell, -Bool si, -U16 i -) -#else -PRIVATE U8 rgSCHCmnDlCalcRvForBcch(cell, si, i) -RgSchCellCb *cell; -Bool si; -U16 i; -#endif -{ - U8 k, rv; - CmLteTimingInfo frm; - TRC2(rgSCHCmnDlCalcRvForBcch); - - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - - if(si) - { - k = i % 4; - } - else - { - k = (frm.sfn/2) % 4; - } - rv = RGSCH_CEIL(3*k, 2) % 4; - RETVALUE(rv); -} - -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested - * BCCH/PCCH allocations. Assumption: The reuqested - * allocations are always satisfied completely. - * Hence no roll back. - * - * @details - * - * Function: rgSCHCmnDlBcchPcchFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * Takes care of PDCCH filling. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlBcchPcchFnlz -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlBcchPcchFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchDlRbAlloc *rbAllocInfo; - RgSchDlSf *subFrm; - -#ifdef LTE_TDD - U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE; -#else -#ifdef LTEMAC_HDFDD - U8 nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; -#else - U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; -#endif -#endif - - /* Moving variables to available scope for optimization */ - RgSchClcDlLcCb *pcch; - RgSchClcBoRpt *bo; -#ifndef RGR_SI_SCH - RgSchClcDlLcCb *bcch; - Bool sendInd=TRUE; -#endif - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - - TRC2(rgSCHCmnDlBcchPcchFnlz); - - /* handle PCCH */ - rbAllocInfo = &allocInfo->pcchAlloc; - if (rbAllocInfo->pdcch) - { - RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]); - - /* Added sfIdx calculation for TDD as well */ -#ifndef LTE_TDD -#ifdef LTEMAC_HDFDD - nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; -#else - nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; -#endif -#endif - subFrm = rbAllocInfo->dlSf; - pcch = rgSCHDbmGetPcch(cell); - if(pcch == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnDlBcchPcchFnlz( ): " - "No Pcch Present"); - RETVOID; - } - - /* Added Dl TB count for paging message transmission*/ -#ifdef LTE_L2_MEAS - cell->dlUlTbCnt.tbTransDlTotalCnt++; -#endif - bo = (RgSchClcBoRpt *)pcch->boLst.first->node; - cmLListDelFrm(&pcch->boLst, &bo->boLstEnt); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); - /* Fill subframe data members */ - subFrm->pcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc; - subFrm->pcch.pdcch = rbAllocInfo->pdcch; - /* Fill PDCCH data members */ - rgSCHCmnFillPdcch(cell, subFrm->pcch.pdcch, rbAllocInfo); - rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, pcch->lcId, TRUE); - /* ccpu00132314-ADD-Update the tx power allocation info - TODO-Need to add a check for max tx power per symbol */ - subfrmAlloc->cmnLcInfo.pcchInfo.txPwrOffset = cellDl->pcchTxPwrOffset; - } - - /* handle BCCH */ - rbAllocInfo = &allocInfo->bcchAlloc; - if (rbAllocInfo->pdcch) - { - RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]); -#ifndef LTE_TDD -#ifdef LTEMAC_HDFDD - nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; -#else - nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; -#endif -#endif - subFrm = rbAllocInfo->dlSf; - - /* Fill subframe data members */ - subFrm->bcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc; - subFrm->bcch.pdcch = rbAllocInfo->pdcch; - /* Fill PDCCH data members */ - rgSCHCmnFillPdcch(cell, subFrm->bcch.pdcch, rbAllocInfo); - - if(rbAllocInfo->schdFirst) - { -#ifndef RGR_SI_SCH - bcch = rgSCHDbmGetFirstBcchOnDlsch(cell); - bo = (RgSchClcBoRpt *)bcch->boLst.first->node; -#else - /*Copy the SIB1 msg buff into interface buffer */ - SCpyMsgMsg(cell->siCb.crntSiInfo.sib1Info.sib1, - rgSchCb[cell->instIdx].rgSchInit.region, - rgSchCb[cell->instIdx].rgSchInit.pool, - &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); -#endif/*RGR_SI_SCH*/ - subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = - rgSCHCmnDlCalcRvForBcch(cell, FALSE, 0); - } - else - { - U16 i; -#ifdef RGR_SI_SCH - Buffer *pdu; - - i = cell->siCb.siCtx.i; - /*Decrement the retransmission count */ - cell->siCb.siCtx.retxCntRem--; - - /*Copy the SI msg buff into interface buffer */ - if(cell->siCb.siCtx.warningSiFlag == FALSE) - { - SCpyMsgMsg(cell->siCb.siArray[cell->siCb.siCtx.siId-1].si, - rgSchCb[cell->instIdx].rgSchInit.region, - rgSchCb[cell->instIdx].rgSchInit.pool, - &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); - } - else - { - pdu = rgSCHUtlGetWarningSiPdu(cell); - RGSCH_NULL_CHECK(cell->instIdx, pdu); - SCpyMsgMsg(pdu, - rgSchCb[cell->instIdx].rgSchInit.region, - rgSchCb[cell->instIdx].rgSchInit.pool, - &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); - if(cell->siCb.siCtx.retxCntRem == 0) - { - rgSCHUtlFreeWarningSiPdu(cell); - cell->siCb.siCtx.warningSiFlag = FALSE; - - } - } -#else - bcch = rgSCHDbmGetSecondBcchOnDlsch(cell); - bo = (RgSchClcBoRpt *)bcch->boLst.first->node; - bo->retxCnt--; - if(bo->retxCnt != cell->siCfg.retxCnt-1) - { - sendInd=FALSE; - } - i = bo->i; -#endif/*RGR_SI_SCH*/ - subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = - rgSCHCmnDlCalcRvForBcch(cell, TRUE, i); - } - - /* Added Dl TB count for SIB1 and SI messages transmission. - * This counter will be incremented only for the first transmission - * (with RV 0) of these messages*/ -#ifdef LTE_L2_MEAS - if(subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv == 0) - { - cell->dlUlTbCnt.tbTransDlTotalCnt++; - } -#endif -#ifndef RGR_SI_SCH - if(bo->retxCnt == 0) - { - cmLListDelFrm(&bcch->boLst, &bo->boLstEnt); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); - } - rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, bcch->lcId, sendInd); -#else - /*Fill the interface info */ - rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, NULLD, NULLD); - - /* ccpu00132314-ADD-Update the tx power allocation info - TODO-Need to add a check for max tx power per symbol */ - subfrmAlloc->cmnLcInfo.bcchInfo.txPwrOffset = cellDl->bcchTxPwrOffset; - - /*mBuf has been already copied above */ -#endif/*RGR_SI_SCH*/ - } - - RETVOID; -} - - -#if RG_UNUSED -/** - * @brief - * - * @details - * - * Function: rgSCHCmnUlSetAllUnSched - * Purpose: - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnUlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlSetAllUnSched -( -RgSchCmnUlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnUlSetAllUnSched(allocInfo) -RgSchCmnUlRbAllocInfo *allocInfo; -#endif -{ - CmLList *node; - - TRC2(rgSCHCmnUlSetAllUnSched); - - node = allocInfo->contResLst.first; - while (node) - { - rgSCHCmnUlMov2NonSchdCntResLst(allocInfo, (RgSchUeCb *)node->node); - node = allocInfo->contResLst.first; - } - - node = allocInfo->retxUeLst.first; - while (node) - { - rgSCHCmnUlMov2NonSchdRetxUeLst(allocInfo, (RgSchUeCb *)node->node); - node = allocInfo->retxUeLst.first; - } - - node = allocInfo->ueLst.first; - while (node) - { - rgSCHCmnUlMov2NonSchdUeLst(allocInfo, (RgSchUeCb *)node->node); - node = allocInfo->ueLst.first; - } - - RETVOID; -} -#endif - -/** - * @brief - * - * @details - * - * Function: rgSCHCmnUlAdd2CntResLst - * Purpose: - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnUlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAdd2CntResLst -( -RgSchCmnUlRbAllocInfo *allocInfo, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlAdd2CntResLst(allocInfo, ue) -RgSchCmnUlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,ue->cell))->alloc); - TRC2(rgSCHCmnUlAdd2CntResLst); - cmLListAdd2Tail(&allocInfo->contResLst, &ulAllocInfo->reqLnk); - ulAllocInfo->reqLnk.node = (PTR)ue; - RETVOID; -} - -/** - * @brief - * - * @details - * - * Function: rgSCHCmnUlAdd2UeLst - * Purpose: - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnUlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlAdd2UeLst -( -RgSchCellCb *cell, -RgSchCmnUlRbAllocInfo *allocInfo, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlAdd2UeLst(cell, allocInfo, ue) -RgSchCellCb *cell; -RgSchCmnUlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,cell))->alloc); - TRC2(rgSCHCmnUlAdd2UeLst); - if (ulAllocInfo->reqLnk.node == NULLP) - { - cmLListAdd2Tail(&allocInfo->ueLst, &ulAllocInfo->reqLnk); - ulAllocInfo->reqLnk.node = (PTR)ue; - } - RETVOID; -} - -/** - * @brief - * - * @details - * - * Function: rgSCHCmnAllocUlRb - * Purpose: To do RB allocations for uplink - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnUlRbAllocInfo *allocInfo - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnAllocUlRb -( -RgSchCellCb *cell, -RgSchCmnUlRbAllocInfo *allocInfo -) -#else -PUBLIC Void rgSCHCmnAllocUlRb(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnUlRbAllocInfo *allocInfo; -#endif -{ - RgSchUlSf *sf = allocInfo->sf; - TRC2(rgSCHCmnAllocUlRb); - - /* Schedule for new transmissions */ - rgSCHCmnUlRbAllocForLst(cell, sf, allocInfo->ueLst.count, - &allocInfo->ueLst, &allocInfo->schdUeLst, - &allocInfo->nonSchdUeLst, (Bool)TRUE); - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnUlRbAllocForLst - * - * Desc : Allocate for a list in cmn rb alloc information passed - * in a subframe. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlRbAllocForLst -( -RgSchCellCb *cell, -RgSchUlSf *sf, -U32 count, -CmLListCp *reqLst, -CmLListCp *schdLst, -CmLListCp *nonSchdLst, -Bool isNewTx -) -#else -PRIVATE Void rgSCHCmnUlRbAllocForLst(cell, sf, count, reqLst, schdLst, - nonSchdLst, isNewTx) -RgSchCellCb *cell; -RgSchUlSf *sf; -U32 count; -CmLListCp *reqLst; -CmLListCp *schdLst; -CmLListCp *nonSchdLst; -Bool isNewTx; -#endif -{ - CmLList *lnk; - RgSchUlHole *hole; -#ifdef LTE_L2_MEAS -#ifdef LTE_TDD - U8 k; - CmLteTimingInfo timeInfo; -#endif -#endif - TRC2(rgSCHCmnUlRbAllocForLst); - - if(schdLst->count == 0) - { - cmLListInit(schdLst); - } - - cmLListInit(nonSchdLst); -#ifdef LTE_L2_MEAS - if(isNewTx == TRUE) - { - cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.numUes = (U8) count; -#ifdef LTE_TDD - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timeInfo, TFU_ULCNTRL_DLDELTA); - k = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][timeInfo.subframe]; - RG_SCH_ADD_TO_CRNT_TIME(timeInfo, - cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo, k); -#else - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime,cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo, - (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); -#endif - } -#endif - - for (lnk = reqLst->first; count; lnk = lnk->next, --count) - { - RgSchUeCb *ue = (RgSchUeCb *)lnk->node; - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - S16 ret; - U8 maxRb; - - - if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) - { - break; - } - - ueUl->subbandShare = ueUl->subbandRequired; - if(isNewTx == TRUE) - { - maxRb = RGSCH_MIN((ueUl->subbandRequired * MAX_5GTF_VRBG_SIZE), ue->ue5gtfCb.maxPrb); - } - ret = rgSCHCmnUlRbAllocForUe(cell, sf, ue, maxRb, hole); - if (ret == ROK) - { - rgSCHCmnUlRbAllocAddUeToLst(cell, ue, schdLst); - rgSCHCmnUlUeFillAllocInfo(cell, ue); - } - else - { - gUl5gtfRbAllocFail++; -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.ul5gtfRbAllocFail++; -#endif - rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst); - ue->isMsg4PdcchWithCrnti = FALSE; - ue->isSrGrant = FALSE; - } -#ifdef LTE_L2_MEAS - if(isNewTx == TRUE) - { - cell->sfAllocArr[cell->crntSfIdx].ulUeInfo. - ulAllocInfo[count - 1].rnti = ue->ueId; - cell->sfAllocArr[cell->crntSfIdx].ulUeInfo. - ulAllocInfo[count - 1].numPrb = ue->ul.nPrb; - } -#endif - ueUl->subbandShare = 0; /* This reset will take care of - * all scheduler types */ - } - for (; count; lnk = lnk->next, --count) - { - RgSchUeCb *ue = (RgSchUeCb *)lnk->node; - rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst); - ue->isMsg4PdcchWithCrnti = FALSE; - } - RETVOID; -} - -#ifdef TFU_UPGRADE -/*********************************************************** - * - * Func : rgSCHCmnUlMdfyGrntForCqi - * - * Desc : Modify UL Grant to consider presence of - * CQI along with PUSCH Data. - * - * Ret : - * - * Notes: - * - Scale down iTbs based on betaOffset and - * size of Acqi Size. - * - Optionally attempt to increase numSb by 1 - * if input payload size does not fit in due - * to reduced tbSz as a result of iTbsNew. - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 maxRb, -U32 *numSb, -U8 *iTbs, -U32 hqSz, -U32 stepDownItbs, -U32 effTgt -) -#else -PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi(cell, ue, maxRb, numSb, iTbs, hqSz, stepDownItbs, effTgt) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 maxRb; -U32 *numSb; -U8 *iTbs; -U32 hqSz; -U32 stepDownItbs; -U32 effTgt; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(ue->cell); - U32 nPrb; - U32 totREs; - U32 cqiRiREs; - U32 hqREs; - U32 remREsForPusch; - U32 bitsPerRe; - U32 tbSz; - U32 betaOffVal = ue->ul.betaOffstVal; - U32 cqiRiRptSz = ue->ul.cqiRiSz; - U32 betaOffHqVal = rgSchCmnBetaHqOffstTbl[ue->ul.betaHqOffst]; - U32 resNumSb = *numSb; - U32 puschEff = 1000; - U8 modOdr; - U8 iMcs; - Bool mdfyiTbsFlg = FALSE; - U8 resiTbs = *iTbs; - - TRC2(rgSCHCmnUlMdfyGrntForCqi) - - - do - { - iMcs = rgSCHCmnUlGetIMcsFrmITbs(resiTbs, RG_SCH_CMN_GET_UE_CTGY(ue)); - RG_SCH_UL_MCS_TO_MODODR(iMcs, modOdr); - if (RG_SCH_CMN_GET_UE_CTGY(ue) != CM_LTE_UE_CAT_5) - { - modOdr = RGSCH_MIN(RGSCH_QM_QPSK, modOdr); - } - else - { - modOdr = RGSCH_MIN(RGSCH_QM_64QAM, modOdr); - } - nPrb = resNumSb * cellUl->sbSize; - /* Restricting the minumum iTbs requried to modify to 10 */ - if ((nPrb >= maxRb) && (resiTbs <= 10)) - { - /* Could not accomodate ACQI */ - RETVALUE(RFAILED); - } - totREs = nPrb * RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl); - tbSz = rgTbSzTbl[0][resiTbs][nPrb-1]; - /* totalREs/tbSz = num of bits perRE. */ - cqiRiREs = (totREs * betaOffVal * cqiRiRptSz)/(1000 * tbSz); /* betaOffVal is represented - as parts per 1000 */ - hqREs = (totREs * betaOffHqVal * hqSz)/(1000 * tbSz); - if ((cqiRiREs + hqREs) < totREs) - { - remREsForPusch = totREs - cqiRiREs - hqREs; - bitsPerRe = (tbSz * 1000)/remREsForPusch; /* Multiplying by 1000 for Interger Oper */ - puschEff = bitsPerRe/modOdr; - } - if (puschEff < effTgt) - { - /* ensure resultant efficiency for PUSCH Data is within 0.93*/ - break; - } - else - { - /* Alternate between increasing SB or decreasing iTbs until eff is met */ - if (mdfyiTbsFlg == FALSE) - { - if (nPrb < maxRb) - { - resNumSb = resNumSb + 1; - } - mdfyiTbsFlg = TRUE; - } - else - { - if (resiTbs > 10) - { - resiTbs-= stepDownItbs; - } - mdfyiTbsFlg = FALSE; - } - } - }while (1); /* Loop breaks if efficency is met - or returns RFAILED if not able to meet the efficiency */ - - *numSb = resNumSb; - *iTbs = resiTbs; - - RETVALUE(ROK); -} -#endif -/*********************************************************** - * - * Func : rgSCHCmnUlRbAllocForUe - * - * Desc : Do uplink RB allocation for an UE. - * - * Ret : - * - * Notes: Note that as of now, for retx, maxRb - * is not considered. Alternatives, such - * as dropping retx if it crosses maxRb - * could be considered. - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlRbAllocForUe -( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUeCb *ue, -U8 maxRb, -RgSchUlHole *hole -) -#else -PRIVATE S16 rgSCHCmnUlRbAllocForUe(cell, sf, ue, maxRb, hole) -RgSchCellCb *cell; -RgSchUlSf *sf; -RgSchUeCb *ue; -U8 maxRb; -RgSchUlHole *hole; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - RgSchUlAlloc *alloc = NULLP; - U32 nPrb = 0; - U8 numVrbg; - U8 iMcs; - U8 iMcsCrnt; -#ifndef RG_5GTF - RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->schdHqProcIdx]; -#else - RgSchUlHqProcCb *proc = NULLP; -#endif - RgSchPdcch *pdcch; - U32 reqVrbg; - U8 numVrbgTemp; -#ifdef RG_5GTF - TfuDciFormat dciFrmt; - U8 numLyr; -#endif - - TRC2(rgSCHCmnUlRbAllocForUe); -#ifdef RG_5GTF - rgSCHUhmGetAvlHqProc(cell, ue, &proc); - if (proc == NULLP) - { - //printf("UE [%d] HQ Proc unavailable\n", ue->ueId); - RETVALUE(RFAILED); - } -#endif - - if (ue->ue5gtfCb.rank == 2) - { - dciFrmt = TFU_DCI_FORMAT_A2; - numLyr = 2; - } - else - { - dciFrmt = TFU_DCI_FORMAT_A1; - numLyr = 1; - } - /* 5gtf TODO : To pass dci frmt to this function */ - pdcch = rgSCHCmnPdcchAllocCrntSf(cell, ue); - if(pdcch == NULLP) - { - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "rgSCHCmnUlRbAllocForUe(): Could not get PDCCH for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - gUl5gtfPdcchSchd++; -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.ul5gtfPdcchSchd++; -#endif - - //TODO_SID using configured prb as of now - nPrb = ue->ue5gtfCb.maxPrb; - reqVrbg = nPrb/MAX_5GTF_VRBG_SIZE; - iMcs = ue->ue5gtfCb.mcs; //gSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg); - iMcsCrnt = iMcs; - numVrbg = reqVrbg; - - if((sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart > MAX_5GTF_VRBG) - || (sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated > MAX_5GTF_VRBG)) - { - printf("5GTF_ERROR vrbg > 25 valstart = %d valalloc %d\n", sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart - , sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated); - int *p=NULLP; - *p = 10; - } - - /*TODO_SID: Workaround for alloc. Currently alloc is ulsf based. To handle multiple beams, we need a different - design. Now alloc are formed based on MAX_5GTF_UE_SCH macro. */ - numVrbgTemp = MAX_5GTF_VRBG/MAX_5GTF_UE_SCH; - if(numVrbg) - { - alloc = rgSCHCmnUlSbAlloc(sf, numVrbgTemp,\ - hole); - } - if (alloc == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnUlRbAllocForUe(): Could not get UlAlloc %d CRNTI:%d",numVrbg,ue->ueId); - rgSCHCmnPdcchRlsCrntSf(cell, pdcch); - RETVALUE(RFAILED); - } - gUl5gtfAllocAllocated++; -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.ul5gtfAllocAllocated++; -#endif - alloc->grnt.vrbgStart = sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart; - alloc->grnt.numVrbg = numVrbg; - alloc->grnt.numLyr = numLyr; - alloc->grnt.dciFrmt = dciFrmt; - - sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart += numVrbg; - sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated += numVrbg; - - //rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); -#ifdef LTE_L2_MEAS - sf->totPrb += alloc->grnt.numRb; - ue->ul.nPrb = alloc->grnt.numRb; -#endif - if (ue->csgMmbrSta != TRUE) - { - cellUl->ncsgPrbCnt += alloc->grnt.numRb; - } - cellUl->totPrbCnt += (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); - alloc->pdcch = pdcch; - alloc->grnt.iMcs = iMcs; - alloc->grnt.iMcsCrnt = iMcsCrnt; - alloc->grnt.hop = 0; - /* Initial Num RBs support for UCI on PUSCH */ -#ifdef TFU_UPGRADE - ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); -#endif - alloc->forMsg3 = FALSE; - //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTb5gtfSzTbl[0], (iTbs)); - - //ueUl->alloc.allocdBytes = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; - /* TODO_SID Allocating based on configured MCS as of now. - Currently for format A2. When doing multi grp per tti, need to update this. */ - ueUl->alloc.allocdBytes = (rgSch5gtfTbSzTbl[iMcs]/8) * ue->ue5gtfCb.rank; - - alloc->grnt.datSz = ueUl->alloc.allocdBytes; - //TODO_SID Need to check mod order. - RG_SCH_CMN_TBS_TO_MODODR(iMcs, alloc->grnt.modOdr); - //alloc->grnt.modOdr = 6; - alloc->grnt.isRtx = FALSE; - - alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg); - alloc->grnt.SCID = 0; - alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE; - alloc->grnt.PMI = 0; - alloc->grnt.uciOnxPUSCH = 0; - alloc->grnt.hqProcId = proc->procId; - - alloc->hqProc = proc; - alloc->hqProc->ulSfIdx = cellUl->schdIdx; - alloc->ue = ue; - /*commenting to retain the rnti used for transmission SPS/c-rnti */ - alloc->rnti = ue->ueId; - ueUl->alloc.alloc = alloc; - /*rntiwari-Adding the debug for generating the graph.*/ - /* No grant attr recorded now */ - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlRbAllocAddUeToLst - * - * Desc : Add UE to list (scheduled/non-scheduled list) - * for UL RB allocation information. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlRbAllocAddUeToLst -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLListCp *lst -) -#else -PUBLIC Void rgSCHCmnUlRbAllocAddUeToLst(cell, ue, lst) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLListCp *lst; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - TRC2(rgSCHCmnUlRbAllocAddUeToLst); - UNUSED(cell); - - gUl5gtfUeRbAllocDone++; -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.ul5gtfUeRbAllocDone++; -#endif - cmLListAdd2Tail(lst, &ueUl->alloc.schdLstLnk); - ueUl->alloc.schdLstLnk.node = (PTR)ue; -} - - -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * - * @details - * - * Function: rgSCHCmnUlAllocFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnUlRbAllocInfo *allocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlAllocFnlz -( -RgSchCellCb *cell, -RgSchCmnUlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnUlAllocFnlz(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnUlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnUlAllocFnlz); - - /* call scheduler specific Finalization */ - cellSch->apisUl->rgSCHUlAllocFnlz(cell, allocInfo); - - RETVOID; -} - -/** - * @brief This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * - * @details - * - * Function: rgSCHCmnDlAllocFnlz - * Purpose: This function Processes the Final Allocations - * made by the RB Allocator against the requested. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlAllocFnlz -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnDlAllocFnlz(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo; - - TRC2(rgSCHCmnDlAllocFnlz); - - rgSCHCmnDlCcchRetxFnlz(cell, allocInfo); - rgSCHCmnDlCcchTxFnlz(cell, allocInfo); -#ifdef RGR_V1 - /* Added below functions for handling CCCH SDU transmission received - * after - * * guard timer expiry*/ - rgSCHCmnDlCcchSduRetxFnlz(cell, allocInfo); - rgSCHCmnDlCcchSduTxFnlz(cell, allocInfo); -#endif - rgSCHCmnDlRaRspFnlz(cell, allocInfo); - /* call scheduler specific Finalization */ - cellSch->apisDl->rgSCHDlAllocFnlz(cell, allocInfo); - - /* Stack Crash problem for TRACE5 Changes. Added the return below */ - RETVOID; - -} - -#ifdef RG_UNUSED -/** - * @brief Update an uplink subframe. - * - * @details - * - * Function : rgSCHCmnUlUpdSf - * - * For each allocation - * - if no more tx needed - * - Release allocation - * - else - * - Perform retransmission - * - * @param[in] RgSchUlSf *sf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlUpdSf -( -RgSchCellCb *cell, -RgSchCmnUlRbAllocInfo *allocInfo, -RgSchUlSf *sf -) -#else -PRIVATE Void rgSCHCmnUlUpdSf(cell, allocInfo, sf) -RgSchCellCb *cell; -RgSchCmnUlRbAllocInfo *allocInfo; -RgSchUlSf *sf; -#endif -{ - CmLList *lnk; - TRC2(rgSCHCmnUlUpdSf); - - while ((lnk = sf->allocs.first)) - { - RgSchUlAlloc *alloc = (RgSchUlAlloc *)lnk->node; - lnk = lnk->next; - - if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0)) - { - } - else - { - /* If need to handle all retx together, run another loop separately */ - rgSCHCmnUlHndlAllocRetx(cell, allocInfo, sf, alloc); - } - rgSCHCmnUlRlsUlAlloc(cell, sf, alloc); - } - - /* By this time, all allocs would have been cleared and - * SF is reset to be made ready for new allocations. */ - rgSCHCmnUlSfReset(cell, sf); - /* In case there are timing problems due to msg3 - * allocations being done in advance, (which will - * probably happen with the current FDD code that - * handles 8 subframes) one solution - * could be to hold the (recent) msg3 allocs in a separate - * list, and then possibly add that to the actual - * list later. So at this time while allocations are - * traversed, the recent msg3 ones are not seen. Anytime after - * this (a good time is when the usual allocations - * are made), msg3 allocations could be transferred to the - * normal list. Not doing this now as it is assumed - * that incorporation of TDD shall take care of this. - */ - - - RETVOID; -} - -/** - * @brief Handle uplink allocation for retransmission. - * - * @details - * - * Function : rgSCHCmnUlHndlAllocRetx - * - * Processing Steps: - * - Add to queue for retx. - * - Do not release here, release happends as part - * of the loop that calls this function. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnUlRbAllocInfo *allocInfo - * @param[in] RgSchUlSf *sf - * @param[in] RgSchUlAlloc *alloc - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlHndlAllocRetx -( -RgSchCellCb *cell, -RgSchCmnUlRbAllocInfo *allocInfo, -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PRIVATE Void rgSCHCmnUlHndlAllocRetx(cell, allocInfo, sf, alloc) -RgSchCellCb *cell; -RgSchCmnUlRbAllocInfo *allocInfo; -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - U32 bytes; - RgSchCmnUlUe *ueUl; - TRC2(rgSCHCmnUlHndlAllocRetx); - bytes = \ - rgTbSzTbl[0][rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs)]\ - [alloc->grnt.numRb-1]/8; - if (!alloc->forMsg3) - { - ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue); - ueUl->alloc.reqBytes = bytes; - rgSCHUhmRetx(alloc->hqProc); - rgSCHCmnUlAdd2RetxUeLst(allocInfo, alloc->ue); - } - else - { - /* RACHO msg3 retx handling. Part of RACH procedure changes. */ - retxAlloc = rgSCHCmnUlGetUlAlloc(cell, sf, alloc->numSb); - if (retxAlloc == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnUlRbAllocForUe():Could not get UlAlloc for msg3Retx RNTI:%d", - alloc->rnti); - RETVOID; - } - retxAlloc->grnt.iMcs = alloc->grnt.iMcs; - retxAlloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl\ - [alloc->hqProc->rvIdx]; - retxAlloc->grnt.nDmrs = 0; - retxAlloc->grnt.hop = 0; - retxAlloc->grnt.delayBit = 0; - retxAlloc->rnti = alloc->rnti; - retxAlloc->ue = NULLP; - retxAlloc->pdcch = FALSE; - retxAlloc->forMsg3 = TRUE; - retxAlloc->raCb = alloc->raCb; - retxAlloc->hqProc = alloc->hqProc; - rgSCHUhmRetx(retxAlloc->hqProc); - } - RETVOID; -} -#endif - -/** - * @brief Uplink Scheduling Handler. - * - * @details - * - * Function: rgSCHCmnUlAlloc - * Purpose: This function Handles Uplink Scheduling. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -/* ccpu00132653- The definition of this function made common for TDD and FDD*/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlAlloc -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnUlAlloc(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnUlRbAllocInfo allocInfo; - RgSchCmnUlRbAllocInfo *allocInfoRef = &allocInfo; -#ifdef RG_5GTF - U8 idx; - -#endif - - TRC2(rgSCHCmnUlAlloc); - - /* Initializing RgSchCmnUlRbAllocInfo structure */ - rgSCHCmnInitUlRbAllocInfo(allocInfoRef); - - /* Get Uplink Subframe */ - allocInfoRef->sf = &cellUl->ulSfArr[cellUl->schdIdx]; -#ifdef LTE_L2_MEAS - /* initializing the UL PRB count */ - allocInfoRef->sf->totPrb = 0; -#endif - -#ifdef LTEMAC_SPS - rgSCHCmnSpsUlTti(cell, allocInfoRef); -#endif - - if(*allocInfoRef->sf->allocCountRef == 0) - { - RgSchUlHole *hole; - - if ((hole = rgSCHUtlUlHoleFirst(allocInfoRef->sf)) != NULLP) - { - /* Sanity check of holeDb */ - if (allocInfoRef->sf->holeDb->count == 1 && hole->start == 0) - { - hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; - /* Re-Initialize available subbands because of CFI change*/ - allocInfoRef->sf->availSubbands = cell->dynCfiCb.\ - bwInfo[cellDl->currCfi].numSb; - /*Currently initializing 5gtf ulsf specific initialization here. - need to do at proper place */ -#ifdef RG_5GTF - allocInfoRef->sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; - allocInfoRef->sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; - for(idx = 0; idx < MAX_5GTF_BEAMS; idx++) - { - allocInfoRef->sf->sfBeamInfo[idx].totVrbgAllocated = 0; - allocInfoRef->sf->sfBeamInfo[idx].totVrbgRequired = 0; - allocInfoRef->sf->sfBeamInfo[idx].vrbgStart = 0; - } -#endif - } - else - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "Error! holeDb sanity check failed"); - } - } - } - - /* Fix: Adaptive re-transmissions prioritised over other transmissions */ - /* perform adaptive retransmissions */ - rgSCHCmnUlSfReTxAllocs(cell, allocInfoRef->sf); - - g5gtfTtiCnt++; - - /* Fix: syed Adaptive Msg3 Retx crash. Release all - Harq processes for which adap Retx failed, to avoid - blocking. This step should be done before New TX - scheduling to make hqProc available. Right now we - dont check if proc is in adap Retx list for considering - it to be available. But now with this release that - functionality would be correct. */ -#ifndef RG_5GTF - rgSCHCmnUlSfRlsRetxProcs(cell, allocInfoRef->sf); -#endif - - /* Specific UL scheduler to perform UE scheduling */ - cellSch->apisUl->rgSCHUlSched(cell, allocInfoRef); - - /* Call UL RB allocator module */ - rgSCHCmnAllocUlRb(cell, allocInfoRef); - - /* Do group power control for PUSCH */ - rgSCHCmnGrpPwrCntrlPusch(cell, allocInfoRef->sf); - - cell->sc.apis->rgSCHDrxStrtInActvTmrInUl(cell); - - rgSCHCmnUlAllocFnlz(cell, allocInfoRef); - if(5000 == g5gtfTtiCnt) - { - ul5gtfsidDlAlreadyMarkUl = 0; - ul5gtfsidDlSchdPass = 0; - ul5gtfsidUlMarkUl = 0; - ul5gtfTotSchdCnt = 0; - g5gtfTtiCnt = 0; - } - - RETVOID; -} - -/** - * @brief send Subframe Allocations. - * - * @details - * - * Function: rgSCHCmnSndCnsldtInfo - * Purpose: Send the scheduled - * allocations to MAC for StaInd generation to Higher layers and - * for MUXing. PST's RgInfSfAlloc to MAC instance. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnSndCnsldtInfo -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnSndCnsldtInfo(cell) -RgSchCellCb *cell; -#endif -{ - RgInfSfAlloc *subfrmAlloc; - Pst pst; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnSndCnsldtInfo); - - subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); - - /* Send the allocations to MAC for MUXing */ - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); - subfrmAlloc->cellId = cell->cellId; - /* Populate the List of UEs needing PDB-based Flow control */ - cellSch->apisDl->rgSCHDlFillFlwCtrlInfo(cell, subfrmAlloc); -#ifdef LTE_L2_MEAS - if((subfrmAlloc->rarInfo.numRaRntis) || -#ifdef EMTC_ENABLE - (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) || - (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) || - (subfrmAlloc->emtcInfo.ueInfo.numUes) || -#endif - (subfrmAlloc->ueInfo.numUes) || - (subfrmAlloc->cmnLcInfo.bitMask) || - (subfrmAlloc->ulUeInfo.numUes) || - (subfrmAlloc->flowCntrlInfo.numUes)) -#else - if((subfrmAlloc->rarInfo.numRaRntis) || -#ifdef EMTC_ENABLE - (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) || - (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) || - (subfrmAlloc->emtcInfo.ueInfo.numUes) || -#endif - (subfrmAlloc->ueInfo.numUes) || - (subfrmAlloc->cmnLcInfo.bitMask) || - (subfrmAlloc->flowCntrlInfo.numUes)) -#endif - { - RgSchMacSfAlloc(&pst, subfrmAlloc); - } -#ifndef LTE_TDD - cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_NUM_SUB_FRAMES; -#else - cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_SF_ALLOC_SIZE; -#endif - - RETVOID; -} -/** - * @brief Consolidate Subframe Allocations. - * - * @details - * - * Function: rgSCHCmnCnsldtSfAlloc - * Purpose: Consolidate Subframe Allocations. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnCnsldtSfAlloc -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnCnsldtSfAlloc(cell) -RgSchCellCb *cell; -#endif -{ - RgInfSfAlloc *subfrmAlloc; - CmLteTimingInfo frm; - RgSchDlSf *dlSf; - CmLListCp dlDrxInactvTmrLst; - CmLListCp dlInActvLst; - CmLListCp ulInActvLst; - RgSchCmnCell *cellSch = NULLP; - - TRC2(rgSCHCmnCnsldtSfAlloc); - - cmLListInit(&dlDrxInactvTmrLst); - cmLListInit(&dlInActvLst); - cmLListInit(&ulInActvLst); - - subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); - - /* Get Downlink Subframe */ - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - dlSf = rgSCHUtlSubFrmGet(cell, frm); - - /* Fill the allocation Info */ - rgSCHUtlFillRgInfRarInfo(dlSf, subfrmAlloc, cell); - - /* CA dev Start */ - rgSCHUtlFillRgInfUeInfo(dlSf, cell, &dlDrxInactvTmrLst, - &dlInActvLst, &ulInActvLst); -#ifdef RG_PFS_STATS - cell->totalPrb += dlSf->bwAssigned; -#endif - /* Mark the following Ues inactive for UL*/ - cellSch = RG_SCH_CMN_GET_CELL(cell); - - /* Calling Scheduler specific function with DRX inactive UE list*/ - cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInActvLst); - cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInActvLst); - - /* CA dev End */ - /*re/start DRX inactivity timer for the UEs*/ - (Void)rgSCHDrxStrtInActvTmr(cell,&dlDrxInactvTmrLst,RG_SCH_DRX_DL); - - RETVOID; -} - -/** - * @brief Initialize the DL Allocation Information Structure. - * - * @details - * - * Function: rgSCHCmnInitDlRbAllocInfo - * Purpose: Initialize the DL Allocation Information Structure. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnInitDlRbAllocInfo -( -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnInitDlRbAllocInfo(allocInfo) -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - TRC2(rgSCHCmnInitDlRbAllocInfo); - cmMemset((U8 *)&allocInfo->pcchAlloc, (U8)0, sizeof(RgSchDlRbAlloc)); - cmMemset((U8 *)&allocInfo->bcchAlloc, (U8)0, sizeof(RgSchDlRbAlloc)); - cmMemset((U8 *)allocInfo->raRspAlloc, (U8)0, - RG_SCH_CMN_MAX_CMN_PDCCH*sizeof(RgSchDlRbAlloc)); - - allocInfo->msg4Alloc.msg4DlSf = NULLP; - cmLListInit(&allocInfo->msg4Alloc.msg4TxLst); - cmLListInit(&allocInfo->msg4Alloc.msg4RetxLst); - cmLListInit(&allocInfo->msg4Alloc.schdMsg4TxLst); - cmLListInit(&allocInfo->msg4Alloc.schdMsg4RetxLst); - cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4TxLst); - cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4RetxLst); -#ifdef RGR_V1 - allocInfo->ccchSduAlloc.ccchSduDlSf = NULLP; - cmLListInit(&allocInfo->ccchSduAlloc.ccchSduTxLst); - cmLListInit(&allocInfo->ccchSduAlloc.ccchSduRetxLst); - cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduTxLst); - cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduRetxLst); - cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst); - cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst); -#endif - - allocInfo->dedAlloc.dedDlSf = NULLP; - cmLListInit(&allocInfo->dedAlloc.txHqPLst); - cmLListInit(&allocInfo->dedAlloc.retxHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdTxHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdRetxHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdTxHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdRetxHqPLst); - - cmLListInit(&allocInfo->dedAlloc.txRetxHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdTxRetxHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdTxRetxHqPLst); -#ifdef LTEMAC_SPS - cmLListInit(&allocInfo->dedAlloc.txSpsHqPLst); - cmLListInit(&allocInfo->dedAlloc.retxSpsHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdTxSpsHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdRetxSpsHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdTxSpsHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdRetxSpsHqPLst); -#endif - -#ifdef LTE_ADV - rgSCHLaaCmnInitDlRbAllocInfo (allocInfo); -#endif - - cmLListInit(&allocInfo->dedAlloc.errIndTxHqPLst); - cmLListInit(&allocInfo->dedAlloc.schdErrIndTxHqPLst); - cmLListInit(&allocInfo->dedAlloc.nonSchdErrIndTxHqPLst); - RETVOID; -} - -/** - * @brief Initialize the UL Allocation Information Structure. - * - * @details - * - * Function: rgSCHCmnInitUlRbAllocInfo - * Purpose: Initialize the UL Allocation Information Structure. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnUlRbAllocInfo *allocInfo - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnInitUlRbAllocInfo -( -RgSchCmnUlRbAllocInfo *allocInfo -) -#else -PUBLIC Void rgSCHCmnInitUlRbAllocInfo(allocInfo) -RgSchCmnUlRbAllocInfo *allocInfo; -#endif -{ - TRC2(rgSCHCmnInitUlRbAllocInfo); - allocInfo->sf = NULLP; - cmLListInit(&allocInfo->contResLst); - cmLListInit(&allocInfo->schdContResLst); - cmLListInit(&allocInfo->nonSchdContResLst); - cmLListInit(&allocInfo->ueLst); - cmLListInit(&allocInfo->schdUeLst); - cmLListInit(&allocInfo->nonSchdUeLst); - - RETVOID; -} - -/** - * @brief Scheduling for PUCCH group power control. - * - * @details - * - * Function: rgSCHCmnGrpPwrCntrlPucch - * Purpose: This function does group power control for PUCCH - * corresponding to the subframe for which DL UE allocations - * have happended. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGrpPwrCntrlPucch -( -RgSchCellCb *cell, -RgSchDlSf *dlSf -) -#else -PRIVATE Void rgSCHCmnGrpPwrCntrlPucch(cell, dlSf) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -#endif -{ - TRC2(rgSCHCmnGrpPwrCntrlPucch); - - rgSCHPwrGrpCntrlPucch(cell, dlSf); - - RETVOID; -} - -/** - * @brief Scheduling for PUSCH group power control. - * - * @details - * - * Function: rgSCHCmnGrpPwrCntrlPusch - * Purpose: This function does group power control, for - * the subframe for which UL allocation has (just) happened. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *ulSf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGrpPwrCntrlPusch -( -RgSchCellCb *cell, -RgSchUlSf *ulSf -) -#else -PRIVATE Void rgSCHCmnGrpPwrCntrlPusch(cell, ulSf) -RgSchCellCb *cell; -RgSchUlSf *ulSf; -#endif -{ - /*removed unused variable *cellSch*/ - CmLteTimingInfo frm; - RgSchDlSf *dlSf; - - TRC2(rgSCHCmnGrpPwrCntrlPusch); - - /* Got to pass DL SF corresponding to UL SF, so get that first. - * There is no easy way of getting dlSf by having the RgSchUlSf*, - * so use the UL delta from current time to get the DL SF. */ - frm = cell->crntTime; - -#ifdef EMTC_ENABLE - if(cell->emtcEnable == TRUE) - { - RGSCH_INCR_SUB_FRAME_EMTC(frm, TFU_DLCNTRL_DLDELTA); - } - else -#endif - { - RGSCH_INCR_SUB_FRAME(frm, TFU_DLCNTRL_DLDELTA); - } - /* Del filling of dl.time */ - dlSf = rgSCHUtlSubFrmGet(cell, frm); - - rgSCHPwrGrpCntrlPusch(cell, dlSf, ulSf); - - RETVOID; -} - -/* Fix: syed align multiple UEs to refresh at same time */ -/*********************************************************** - * - * Func : rgSCHCmnApplyUeRefresh - * - * Desc : Apply UE refresh in CMN and Specific - * schedulers. Data rates and corresponding - * scratchpad variables are updated. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnApplyUeRefresh -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE S16 rgSCHCmnApplyUeRefresh(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U32 effGbrBsr = 0; - U32 effNonGbrBsr = 0; - U32 lcgId; - - TRC2(rgSCHCmnApplyUeRefresh); - - /* Reset the refresh cycle variableCAP */ - ue->ul.effAmbr = ue->ul.cfgdAmbr; - - for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) - { - if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) - { - RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); - - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - cmnLcg->effGbr = cmnLcg->cfgdGbr; - cmnLcg->effDeltaMbr = cmnLcg->deltaMbr; - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); - /* Considering GBR LCG will be prioritised by UE */ - effGbrBsr += cmnLcg->bs; - }/* Else no remaing BS so nonLcg0 will be updated when BSR will be received */ - else - { - effNonGbrBsr += cmnLcg->reportedBs; - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); - } - } - } - effNonGbrBsr = RGSCH_MIN(effNonGbrBsr,ue->ul.effAmbr); - ue->ul.nonGbrLcgBs = effNonGbrBsr; - - ue->ul.nonLcg0Bs = effGbrBsr + effNonGbrBsr; - ue->ul.effBsr = ue->ul.nonLcg0Bs +\ - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; - - - /* call scheduler specific event handlers - * for refresh timer expiry */ - cellSch->apisUl->rgSCHUlUeRefresh(cell, ue); - cellSch->apisDl->rgSCHDlUeRefresh(cell, ue); - - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnTmrExpiry - * - * Desc : Adds an UE to refresh queue, so that the UE is - * periodically triggered to refresh it's GBR and - * AMBR values. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnTmrExpiry -( -PTR cb, /* Pointer to timer control block */ -S16 tmrEvnt /* Timer Event */ -) -#else -PRIVATE S16 rgSCHCmnTmrExpiry(cb, tmrEvnt) -PTR cb; /* Pointer to timer control block */ -S16 tmrEvnt; /* Timer Event */ -#endif -{ - RgSchUeCb *ue = (RgSchUeCb *)cb; - RgSchCellCb *cell = ue->cell; -#if (ERRCLASS & ERRCLS_DEBUG) -#endif - - TRC2(rgSCHCmnTmrExpiry); - -#if (ERRCLASS & ERRCLS_DEBUG) - if (tmrEvnt != RG_SCH_CMN_EVNT_UE_REFRESH) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnTmrExpiry(): Invalid " - "timer event CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } -#else - UNUSED(tmrEvnt); -#endif - - rgSCHCmnApplyUeRefresh(cell, ue); - - rgSCHCmnAddUeToRefreshQ(cell, ue, RG_SCH_CMN_REFRESH_TIME); - - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHCmnTmrProc - * - * Desc : Timer entry point per cell. Timer - * processing is triggered at every frame boundary - * (every 10 ms). - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnTmrProc -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnTmrProc(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); - /* Moving the assignment of scheduler pointer - to available scope for optimization */ - TRC2(rgSCHCmnTmrProc); - - if ((cell->crntTime.subframe % RGSCH_NUM_SUB_FRAMES_5G) == 0) - { - /* Reset the counters periodically */ - if ((cell->crntTime.sfn % RG_SCH_CMN_CSG_REFRESH_TIME) == 0) - { - RG_SCH_RESET_HCSG_DL_PRB_CNTR(cmnDlCell); - RG_SCH_RESET_HCSG_UL_PRB_CNTR(cmnUlCell); - } - if ((cell->crntTime.sfn % RG_SCH_CMN_OVRLDCTRL_REFRESH_TIME) == 0) - { - - cell->measurements.ulTpt = ((cell->measurements.ulTpt * 95) + ( cell->measurements.ulBytesCnt * 5))/100; - cell->measurements.dlTpt = ((cell->measurements.dlTpt * 95) + ( cell->measurements.dlBytesCnt * 5))/100; - - rgSCHUtlCpuOvrLdAdjItbsCap(cell); - /* reset cell level tpt measurements for next cycle */ - cell->measurements.ulBytesCnt = 0; - cell->measurements.dlBytesCnt = 0; - } - /* Comparing with Zero instead of % is being done for efficiency. - * If Timer resolution changes then accordingly update the - * macro RG_SCH_CMN_REFRESH_TIMERES */ - RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); - cmPrcTmr(&sched->tmrTqCp, sched->tmrTq, (PFV)rgSCHCmnTmrExpiry); - } - - RETVALUE(ROK); -} - - -/*********************************************************** - * - * Func : rgSchCmnUpdCfiVal - * - * Desc : Update the CFI value if CFI switch was done - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSchCmnUpdCfiVal -( -RgSchCellCb *cell, -U8 delta -) -#else -PRIVATE Void rgSchCmnUpdCfiVal(cell, delta) -RgSchCellCb *cell; -U8 delta; -#endif -{ - RgSchDlSf *dlSf; - CmLteTimingInfo pdsch; - RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 dlIdx; -#ifdef LTE_TDD - U8 mPhich; - RgSchDlSf *tddSf; - U8 idx; - U8 splSfCfi = 0; -#endif - - TRC2(rgSchCmnUpdCfiVal); - - pdsch = cell->crntTime; - RGSCH_INCR_SUB_FRAME(pdsch, delta); - dlSf = rgSCHUtlSubFrmGet(cell, pdsch); - /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI - *change happens in that SF then UL PDCCH allocation happens with old CFI - *but CFI in control Req goes updated one since it was stored in the CELL - */ - dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi; - if(cell->dynCfiCb.pdcchSfIdx != 0xFF) - { -#ifdef LTE_TDD - dlIdx = rgSCHUtlGetDlSfIdx(cell, &pdsch); -#else - dlIdx = (((pdsch.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (pdsch.subframe % RGSCH_NUM_SUB_FRAMES)); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); -#endif - /* If current downlink subframe index is same as pdcch SF index, - * perform the switching of CFI in this subframe */ - if(cell->dynCfiCb.pdcchSfIdx == dlIdx) - { - cellCmnDl->currCfi = cellCmnDl->newCfi; - cell->dynCfiCb.pdcchSfIdx = 0xFF; - - /* Updating the nCce value based on the new CFI */ -#ifdef LTE_TDD - splSfCfi = cellCmnDl->newCfi; - for(idx = 0; idx < cell->numDlSubfrms; idx++) - { - tddSf = cell->subFrms[idx]; - - mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][tddSf->sfNum]; - - if(tddSf->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi); - - tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi]; - } - else - { - tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][cellCmnDl->currCfi]; - } - } - /* Setting the switch over window length based on config index. - * During switch over period all the UL trnsmissions are Acked - * to UEs */ - cell->dynCfiCb.switchOvrWinLen = - rgSchCfiSwitchOvrWinLen[cell->ulDlCfgIdx]; -#else - cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCmnDl->currCfi]; - /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI - *change happens in that SF then UL PDCCH allocation happens with old CFI - *but CFI in control Req goes updated one since it was stored in the CELL - */ - dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi; - cell->dynCfiCb.switchOvrWinLen = rgSchCfiSwitchOvrWinLen[7]; -#endif - } - } - - RETVOID; -} - -/*********************************************************** - * - * Func : rgSchCmnUpdtPdcchSfIdx - * - * Desc : Update the switch over window length - * - * Ret : void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef LTE_TDD -#ifdef ANSI -PRIVATE Void rgSchCmnUpdtPdcchSfIdx -( -RgSchCellCb *cell, -U8 dlIdx, -U8 sfNum -) -#else -PRIVATE Void rgSchCmnUpdtPdcchSfIdx(cell, dlIdx, sfNum) -RgSchCellCb *cell; -U8 dlIdx; -U8 sfNum; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSchCmnUpdtPdcchSfIdx -( -RgSchCellCb *cell, -U8 dlIdx -) -#else -PRIVATE Void rgSchCmnUpdtPdcchSfIdx(cell, dlIdx) -RgSchCellCb *cell; -U8 dlIdx; -#endif -#endif -{ - U8 idx; - - TRC2(rgSchCmnUpdtPdcchSfIdx); - - /* Resetting the parameters on CFI switching */ - cell->dynCfiCb.cceUsed = 0; - cell->dynCfiCb.lowCceCnt = 0; - - cell->dynCfiCb.cceFailSum = 0; - cell->dynCfiCb.cceFailCnt = 0; - cell->dynCfiCb.prevCceFailIdx = 0; - - cell->dynCfiCb.switchOvrInProgress = TRUE; - - for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++) - { - cell->dynCfiCb.cceFailSamples[idx] = 0; - } - - cell->dynCfiCb.ttiCnt = 0; - - cell->dynCfiCb.cfiSwitches++; - cfiSwitchCnt = cell->dynCfiCb.cfiSwitches; - -#ifdef LTE_TDD - cell->dynCfiCb.pdcchSfIdx = (dlIdx + - rgSchTddPdcchSfIncTbl[cell->ulDlCfgIdx][sfNum]) % cell->numDlSubfrms; -#else - cell->dynCfiCb.pdcchSfIdx = (dlIdx + RG_SCH_CFI_APPLY_DELTA) % \ - RGSCH_NUM_DL_SUBFRAMES; -#endif -} - -/*********************************************************** - * - * Func : rgSchCmnUpdCfiDb - * - * Desc : Update the counters related to dynamic - * CFI feature in cellCb. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSchCmnUpdCfiDb -( -RgSchCellCb *cell, -U8 delta -) -#else -PUBLIC Void rgSchCmnUpdCfiDb(cell, delta) -RgSchCellCb *cell; -U8 delta; -#endif -{ - CmLteTimingInfo frm; - RgSchDlSf *dlSf; -#ifdef LTE_TDD - U8 mPhich; - Bool isHiDci0; -#endif - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 nCceLowerCfi = 0; - U8 currCfi; - U8 cceFailIdx; - U32 totalCce; - U8 dlIdx; - U16 ttiMod; - - TRC2(rgSchCmnUpdCfiDb); - - /* Get Downlink Subframe */ - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, delta); - -#ifdef LTE_TDD - dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm); - dlSf = cell->subFrms[dlIdx]; - isHiDci0 = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][dlSf->sfNum]; -#else - /* Changing the idexing - so that proper subframe is selected */ - dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.subframe % RGSCH_NUM_SUB_FRAMES)); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); - dlSf = cell->subFrms[dlIdx]; -#endif - - currCfi = cellSch->dl.currCfi; - - if(!cell->dynCfiCb.switchOvrInProgress) - { - do{ - if(!cell->dynCfiCb.isDynCfiEnb) - { - if(currCfi != cellSch->cfiCfg.cfi) - { - if(currCfi < cellSch->cfiCfg.cfi) - { - RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi) - cfiIncr = cell->dynCfiCb.cfiIncr; - } - else - { - RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi) - cfiDecr = cell->dynCfiCb.cfiDecr; - } - } - break; - } - -#ifdef LTE_TDD - /* Setting ttiMod to 0 for ttiCnt > 1000 in case if this - * function was not called in UL subframe*/ - if(cell->dynCfiCb.ttiCnt > RGSCH_CFI_TTI_MON_INTRVL) - { - ttiMod = 0; - } - else -#endif - { - ttiMod = cell->dynCfiCb.ttiCnt % RGSCH_CFI_TTI_MON_INTRVL; - } - - dlSf->dlUlBothCmplt++; -#ifdef LTE_TDD - if((dlSf->dlUlBothCmplt == 2) || (!isHiDci0)) -#else - if(dlSf->dlUlBothCmplt == 2) -#endif - { - /********************STEP UP CRITERIA********************/ - /* Updating the CCE failure count parameter */ - cell->dynCfiCb.cceFailCnt += dlSf->isCceFailure; - cell->dynCfiCb.cceFailSum += dlSf->isCceFailure; - - /* Check if cfi step up can be performed */ - if(currCfi < cell->dynCfiCb.maxCfi) - { - if(cell->dynCfiCb.cceFailSum >= cell->dynCfiCb.cfiStepUpTtiCnt) - { - RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi) - cfiIncr = cell->dynCfiCb.cfiIncr; - break; - } - } - - /********************STEP DOWN CRITERIA********************/ - - /* Updating the no. of CCE used in this dl subframe */ - cell->dynCfiCb.cceUsed += dlSf->cceCnt; - - if(currCfi > RGSCH_MIN_CFI_VAL) - { - /* calculating the number of CCE for next lower CFI */ -#ifdef LTE_TDD - mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][dlSf->sfNum]; - nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[mPhich][currCfi-1]; -#else - nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[0][currCfi-1]; -#endif - if(dlSf->cceCnt < nCceLowerCfi) - { - /* Updating the count of TTIs in which no. of CCEs - * used were less than the CCEs of next lower CFI */ - cell->dynCfiCb.lowCceCnt++; - } - - if(ttiMod == 0) - { - totalCce = (nCceLowerCfi * cell->dynCfiCb.cfiStepDownTtiCnt * - RGSCH_CFI_CCE_PERCNTG)/100; - - if((!cell->dynCfiCb.cceFailSum) && - (cell->dynCfiCb.lowCceCnt >= - cell->dynCfiCb.cfiStepDownTtiCnt) && - (cell->dynCfiCb.cceUsed < totalCce)) - { - RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi) - cfiDecr = cell->dynCfiCb.cfiDecr; - break; - } - } - } - - cceFailIdx = ttiMod/cell->dynCfiCb.failSamplePrd; - - if(cceFailIdx != cell->dynCfiCb.prevCceFailIdx) - { - /* New sample period has started. Subtract the old count - * from the new sample period */ - cell->dynCfiCb.cceFailSum -= cell->dynCfiCb.cceFailSamples[cceFailIdx]; - - /* Store the previous sample period data */ - cell->dynCfiCb.cceFailSamples[cell->dynCfiCb.prevCceFailIdx] - = cell->dynCfiCb.cceFailCnt; - - cell->dynCfiCb.prevCceFailIdx = cceFailIdx; - - /* Resetting the CCE failure count as zero for next sample period */ - cell->dynCfiCb.cceFailCnt = 0; - } - - if(ttiMod == 0) - { - /* Restting the parametrs after Monitoring Interval expired */ - cell->dynCfiCb.cceUsed = 0; - cell->dynCfiCb.lowCceCnt = 0; - cell->dynCfiCb.ttiCnt = 0; - } - - cell->dynCfiCb.ttiCnt++; - } - }while(0); - - if(cellSch->dl.newCfi != cellSch->dl.currCfi) - { -#ifdef LTE_TDD - rgSchCmnUpdtPdcchSfIdx(cell, dlIdx, dlSf->sfNum); -#else - rgSchCmnUpdtPdcchSfIdx(cell, dlIdx); -#endif - } - } -} - -/** - * @brief Dl Scheduler for Broadcast and Common channel scheduling. - * - * @details - * - * Function: rgSCHCmnDlCommonChSch - * Purpose: This function schedules DL Common channels for LTE. - * Invoked by TTI processing in TOM. Scheduling is done for - * BCCH, PCCH, Msg4, CCCH SDU, RAR in that order - * - * Invoked by: TOM (TTI processing) - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlCommonChSch -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnDlCommonChSch(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnDlCommonChSch); - - cellSch->apisDl->rgSCHDlTickForPdbTrkng(cell); - rgSchCmnUpdCfiVal(cell, RG_SCH_CMN_DL_DELTA); - - /* handle Inactive UEs for DL */ - rgSCHCmnHdlDlInactUes(cell); - - /* Send a Tick to Refresh Timer */ - rgSCHCmnTmrProc(cell); - - if (cell->isDlDataAllwd && (cell->stopSiSch == FALSE)) - { - rgSCHCmnInitRbAlloc(cell); - /* Perform DL scheduling of BCCH, PCCH */ - rgSCHCmnDlBcchPcchAlloc(cell); - } - else - { - if(cell->siCb.inWindow != 0) - { - cell->siCb.inWindow--; - } - } - if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE)) - { - rgSCHCmnDlCcchRarAlloc(cell); - } - RETVOID; -} - -/** - * @brief Scheduler invocation per TTI. - * - * @details - * - * Function: rgSCHCmnUlSch - * Purpose: This function implements UL scheduler alone. This is to - * be able to perform scheduling with more flexibility. - * - * Invoked by: TOM (TTI processing) - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlSch -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnUlSch(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnUlSch); - -#ifdef LTE_ADV - /* LAA_SCELL: */ - if(TRUE == rgSCHLaaSCellEnabled(cell)) - { - RETVOID; - } -#endif - - if(cellSch->ul.schdIdx != RGSCH_INVALID_INFO) - { - rgSchCmnUpdCfiVal(cell, TFU_ULCNTRL_DLDELTA); - - /* Handle Inactive UEs for UL */ - rgSCHCmnHdlUlInactUes(cell); - /* Perform UL Scheduling EVERY TTI */ - rgSCHCmnUlAlloc(cell); - - /* Calling function to update CFI parameters*/ - rgSchCmnUpdCfiDb(cell, TFU_ULCNTRL_DLDELTA); - - if(cell->dynCfiCb.switchOvrWinLen > 0) - { - /* Decrementing the switchover window length */ - cell->dynCfiCb.switchOvrWinLen--; - - if(!cell->dynCfiCb.switchOvrWinLen) - { - if(cell->dynCfiCb.dynCfiRecfgPend) - { - /* Toggling the Dynamic CFI enabling */ - cell->dynCfiCb.isDynCfiEnb ^= 1; - rgSCHDynCfiReCfg(cell, cell->dynCfiCb.isDynCfiEnb); - cell->dynCfiCb.dynCfiRecfgPend = FALSE; - } - cell->dynCfiCb.switchOvrInProgress = FALSE; - } - } - } -#ifdef LTE_TDD -#ifdef LTEMAC_SPS - else - { - rgSCHCmnSpsUlTti(cell, NULLP); - } -#endif -#endif - - RETVOID; -} - - -/** - * @brief This function updates the scheduler with service for an UE. - * - * @details - * - * Function: rgSCHCmnDlDedBoUpd - * Purpose: This function should be called whenever there is a - * change BO for a service. - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @param[in] RgSchDlLcCb* svc - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlDedBoUpd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *svc -) -#else -PUBLIC Void rgSCHCmnDlDedBoUpd(cell, ue, svc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *svc; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnDlDedBoUpd); - - /* RACHO : if UEs idle time exceeded and a BO update - * is received, then add UE to the pdcch Order Q */ - if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) - { - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue, cell); - /* If PDCCH order is already triggered and we are waiting for - * RACH from UE then do not add to PdcchOdrQ. */ - if (ueDl->rachInfo.rapIdLnk.node == NULLP) - { - rgSCHCmnDlAdd2PdcchOdrQ(cell, ue); - } - } - -#ifdef LTEMAC_SPS - - /* If SPS service, invoke SPS module */ - if (svc->dlLcSpsCfg.isSpsEnabled) - { - rgSCHCmnSpsDlDedBoUpd(cell, ue, svc); - /* Note: Retrun from here, no update needed in other schedulers */ - RETVOID; - } -#endif -#ifdef EMTC_ENABLE - if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) - { - cellSch->apisEmtcDl->rgSCHDlDedBoUpd(cell, ue, svc); - //printf("rgSCHEMTCDlDedBoUpd\n"); - } - else -#endif - { - cellSch->apisDl->rgSCHDlDedBoUpd(cell, ue, svc); - } -#ifdef LTE_ADV - if (ue->numSCells) - { - rgSCHSCellDlDedBoUpd(cell, ue, svc); - } -#endif - RETVOID; -} - - -/** - * @brief Removes an UE from Cell's TA List. - * - * @details - * - * Function: rgSCHCmnRmvFrmTaLst - * Purpose: Removes an UE from Cell's TA List. - * - * Invoked by: Specific Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnRmvFrmTaLst -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnRmvFrmTaLst(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); - TRC2(rgSCHCmnRmvFrmTaLst); - -#ifdef EMTC_ENABLE - if(cell->emtcEnable && ue->isEmtcUe) - { - rgSCHEmtcRmvFrmTaLst(cellCmnDl,ue); - } - else -#endif - { - cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk); - ue->dlTaLnk.node = (PTR)NULLP; - } - RETVOID; -} - -/* Fix: syed Remove the msg4Proc from cell - * msg4Retx Queue. I have used CMN scheduler function - * directly. Please define a new API and call this - * function through that. */ - -/** - * @brief This function removes MSG4 HARQ process from cell RETX Queues. - * - * @details - * - * Function: rgSCHCmnDlMsg4ProcRmvFrmRetx - * Purpose: This function removes MSG4 HARQ process from cell RETX Queues. - * - * Invoked by: UE/RACB deletion. - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlHqProc* hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlMsg4ProcRmvFrmRetx -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnDlMsg4ProcRmvFrmRetx(cell, hqP) -RgSchCellCb *cell; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnDlMsg4ProcRmvFrmRetx); - - if (hqP->tbInfo[0].ccchSchdInfo.retxLnk.node) - { - if (hqP->hqE->msg4Proc == hqP) - { - cmLListDelFrm(&cellSch->dl.msg4RetxLst, \ - &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; - } -#ifdef RGR_V1 - else if(hqP->hqE->ccchSduProc == hqP) - { - cmLListDelFrm(&cellSch->dl.ccchSduRetxLst, - &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; - } -#endif - } - RETVOID; -} - - -/** - * @brief This function adds a HARQ process for retx. - * - * @details - * - * Function: rgSCHCmnDlProcAddToRetx - * Purpose: This function adds a HARQ process to retransmission - * queue. This may be performed when a HARQ ack is - * unsuccessful. - * - * Invoked by: HARQ feedback processing - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlHqProc* hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlProcAddToRetx -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnDlProcAddToRetx(cell, hqP) -RgSchCellCb *cell; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnDlProcAddToRetx); - - if (hqP->hqE->msg4Proc == hqP) /* indicating msg4 transmission */ - { - cmLListAdd2Tail(&cellSch->dl.msg4RetxLst, \ - &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP; - } -#ifdef RGR_V1 - else if(hqP->hqE->ccchSduProc == hqP) - { - /*If CCCH SDU being transmitted without cont res CE*/ - cmLListAdd2Tail(&cellSch->dl.ccchSduRetxLst, - &hqP->tbInfo[0].ccchSchdInfo.retxLnk); - hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP; - } -#endif - else - { -#ifdef LTEMAC_SPS - if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) - { - /* Invoke SPS module for SPS HARQ proc re-transmission handling */ - rgSCHCmnSpsDlProcAddToRetx(cell, hqP); - RETVOID; - } -#endif /* LTEMAC_SPS */ -#ifdef EMTC_ENABLE - if((TRUE == cell->emtcEnable) - && (TRUE == hqP->hqE->ue->isEmtcUe)) - { - cellSch->apisEmtcDl->rgSCHDlProcAddToRetx(cell, hqP); - } - else -#endif - { - cellSch->apisDl->rgSCHDlProcAddToRetx(cell, hqP); - } - } - RETVOID; -} - - -/** - * @brief This function performs RI validation and - * updates it to the ueCb. - * - * @details - * - * Function: rgSCHCmnDlSetUeRi - * Purpose: This function performs RI validation and - * updates it to the ueCb. - * - * Invoked by: rgSCHCmnDlCqiInd - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 ri - * @param[in] Bool isPeriodic - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlSetUeRi -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 ri, -Bool isPer -) -#else -PRIVATE Void rgSCHCmnDlSetUeRi(cell, ue, ri, isPer) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 ri; -Bool isPer; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgSchCmnUeInfo *ueSchCmn = RG_SCH_CMN_GET_CMN_UE(ue); - TRC2(rgSCHCmnDlSetUeRi); - -#ifdef TFU_UPGRADE - RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell); - UNUSED(isPer); -#endif - - - /* FIX for RRC Reconfiguration issue */ - /* ccpu00140894- During Tx Mode transition RI report will not entertained for - * specific during which SCH expecting UE can complete TX mode transition*/ - if (ue->txModeTransCmplt == FALSE) - { - RETVOID; - } - - /* Restrict the Number of TX layers to cell->numTxAntPorts. - * Protection from invalid RI values. */ - ri = RGSCH_MIN(ri, cell->numTxAntPorts); - - /* Special case of converting PMI to sane value when - * there is a switch in RI from 1 to 2 and PMI reported - * for RI=1 is invalid for RI=2 */ - if ((cell->numTxAntPorts == 2) && (ue->mimoInfo.txMode == RGR_UE_TM_4)) - { - if ((ri == 2) && ( ueDl->mimoInfo.ri == 1)) - { - ueDl->mimoInfo.pmi = (ueDl->mimoInfo.pmi < 2)? 1:2; - } - } - - /* Restrict the Number of TX layers according to the UE Category */ - ueDl->mimoInfo.ri = RGSCH_MIN(ri, rgUeCatTbl[ueSchCmn->ueCat].maxTxLyrs); -#ifdef TENB_STATS - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].riCnt[ueDl->mimoInfo.ri-1]++; - cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++; -#endif - -#ifdef TENB_STATS - ue->tenbStats->stats.nonPersistent.sch[0].riCnt[ueDl->mimoInfo.ri-1]++; - cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++; -#endif - -#ifdef TFU_UPGRADE - if (isPer) - { - /* If RI is from Periodic CQI report */ - cqiCb->perRiVal = ueDl->mimoInfo.ri; - /* Reset at every Periodic RI Reception */ - cqiCb->invalidateCqi = FALSE; - } - else - { - /* If RI is from Aperiodic CQI report */ - if (cqiCb->perRiVal != ueDl->mimoInfo.ri) - { - /* if this aperRI is different from last reported - * perRI then invalidate all CQI reports till next - * perRI */ - cqiCb->invalidateCqi = TRUE; - } - else - { - cqiCb->invalidateCqi = FALSE; - } - } -#endif - - if (ueDl->mimoInfo.ri > 1) - { - RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } - else if (ue->mimoInfo.txMode == RGR_UE_TM_3) /* ri == 1 */ - { - RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); - } - - RETVOID; -} - - -/** - * @brief This function performs PMI validation and - * updates it to the ueCb. - * - * @details - * - * Function: rgSCHCmnDlSetUePmi - * Purpose: This function performs PMI validation and - * updates it to the ueCb. - * - * Invoked by: rgSCHCmnDlCqiInd - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 pmi - * @return Void - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlSetUePmi -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 pmi -) -#else -PRIVATE S16 rgSCHCmnDlSetUePmi(cell, ue, pmi) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 pmi; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlSetUePmi); - - if (ue->txModeTransCmplt == FALSE) - { - RETVALUE(RFAILED); - } - - if (cell->numTxAntPorts == 2) - { - if (pmi > 3) - { - RETVALUE(RFAILED); - } - if (ueDl->mimoInfo.ri == 2) - { - /*ccpu00118150 - MOD - changed pmi value validation from 0 to 2*/ - /* PMI 2 and 3 are invalid incase of 2 TxAnt and 2 Layered SM */ - if (pmi == 2 || pmi == 3) - { - RETVALUE(RFAILED); - } - ueDl->mimoInfo.pmi = pmi+1; - } - else - { - ueDl->mimoInfo.pmi = pmi; - } - } - else if (cell->numTxAntPorts == 4) - { - if (pmi > 15) - { - RETVALUE(RFAILED); - } - ueDl->mimoInfo.pmi = pmi; - } - /* Reset the No PMI Flag in forceTD */ - RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); - RETVALUE(ROK); -} - -/** - * @brief This function Updates the DL CQI on PUCCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlProcCqiMode10 - * - * This function updates the DL CQI on PUCCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiOnPucchInd - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - Bool *isCqiAvail - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi, isCqiAvail) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; - Bool *isCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlProcCqiMode10); - - if (pucchCqi->u.mode10Info.type == TFU_RPT_CQI) - { - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - /* Checking whether the decoded CQI is a value between 1 and 15*/ - if((pucchCqi->u.mode10Info.u.cqi) && (pucchCqi->u.mode10Info.u.cqi - < RG_SCH_CMN_MAX_CQI)) - { - ueDl->cqiFlag = TRUE; - ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode10Info.u.cqi; - ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - } - else if (pucchCqi->u.mode10Info.type == TFU_RPT_RI) - { - if ( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode10Info.u.ri) ) - { - rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode10Info.u.ri, - TRUE); - } - else - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", - pucchCqi->u.mode10Info.u.ri,ue->ueId); - RETVOID; - } - } -} - -/** - * @brief This function Updates the DL CQI on PUCCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlProcCqiMode11 - * - * This function updates the DL CQI on PUCCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiOnPucchInd - * - * Processing Steps: - * Process CQI MODE 11 - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi, isCqiAvail, is2ndCwCqiAvail) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; - Bool *isCqiAvail; - Bool *is2ndCwCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlProcCqiMode11); - - if (pucchCqi->u.mode11Info.type == TFU_RPT_CQI) - { - ue->mimoInfo.puschFdbkVld = FALSE; - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((pucchCqi->u.mode11Info.u.cqi.cqi) && - (pucchCqi->u.mode11Info.u.cqi.cqi < RG_SCH_CMN_MAX_CQI)) - { - ueDl->cqiFlag = TRUE; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode11Info.u.cqi.cqi; - if (pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.pres) - { - RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \ - ueDl->mimoInfo.cwInfo[1].cqi, \ - pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.val); -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = TRUE; -#endif - } - } - else - { - RETVOID; - } - rgSCHCmnDlSetUePmi(cell, ue, \ - pucchCqi->u.mode11Info.u.cqi.pmi); - } - else if (pucchCqi->u.mode11Info.type == TFU_RPT_RI) - { - if( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode11Info.u.ri)) - { - rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode11Info.u.ri, - TRUE); - } - else - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Invalid RI value(%x) CRNTI:%d", - pucchCqi->u.mode11Info.u.ri,ue->ueId); - RETVOID; - } - } -} - -/** - * @brief This function Updates the DL CQI on PUCCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlProcCqiMode20 - * - * This function updates the DL CQI on PUCCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiOnPucchInd - * - * Processing Steps: - * Process CQI MODE 20 - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - Bool *isCqiAvail - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi, isCqiAvail ) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; - Bool *isCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlProcCqiMode20); - - if (pucchCqi->u.mode20Info.type == TFU_RPT_CQI) - { - if (pucchCqi->u.mode20Info.u.cqi.isWideband) - { - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((pucchCqi->u.mode20Info.u.cqi.u.wideCqi) && - (pucchCqi->u.mode20Info.u.cqi.u.wideCqi < RG_SCH_CMN_MAX_CQI)) - { - ueDl->cqiFlag = TRUE; - ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode20Info.u.cqi.\ - u.wideCqi; - ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - } - } - else if (pucchCqi->u.mode20Info.type == TFU_RPT_RI) - { - if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode20Info.u.ri)) - { - rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode20Info.u.ri, - TRUE); - } - else - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", - pucchCqi->u.mode20Info.u.ri,ue->ueId); - RETVOID; - } - } -} - - -/** - * @brief This function Updates the DL CQI on PUCCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlProcCqiMode21 - * - * This function updates the DL CQI on PUCCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiOnPucchInd - * - * Processing Steps: - * Process CQI MODE 21 - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi, isCqiAvail, is2ndCwCqiAvail) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; - TfuDlCqiRpt *dlCqiRpt; - Bool *isCqiAvail; - Bool *is2ndCwCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21 -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - ) -#else -PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlProcCqiMode21); - - if (pucchCqi->u.mode21Info.type == TFU_RPT_CQI) - { - ue->mimoInfo.puschFdbkVld = FALSE; - if (pucchCqi->u.mode21Info.u.cqi.isWideband) - { - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi) && - (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi < RG_SCH_CMN_MAX_CQI)) - { - ueDl->cqiFlag = TRUE; - ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode21Info.u.cqi.\ - u.wideCqi.cqi; - if (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.pres) - { - RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \ - ueDl->mimoInfo.cwInfo[1].cqi, \ - pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.val); -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = TRUE; -#endif - } - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - rgSCHCmnDlSetUePmi(cell, ue, \ - pucchCqi->u.mode21Info.u.cqi.u.wideCqi.pmi); - } - } - else if (pucchCqi->u.mode21Info.type == TFU_RPT_RI) - { - if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode21Info.u.ri)) - { - rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode21Info.u.ri, - TRUE); - } - else - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Invalid RI value(%x) CRNTI:%d", - pucchCqi->u.mode21Info.u.ri,ue->ueId); - RETVOID; - } - } -} - - -/** - * @brief This function Updates the DL CQI on PUCCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlCqiOnPucchInd - * - * This function updates the DL CQI on PUCCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiInd - * - * Processing Steps: - * - Depending on the reporting mode of the PUCCH, the CQI/PMI/RI values - * are updated and stored for each UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCqiOnPucchInd -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi, - RgrUeCqiRept *ueCqiRept, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - ) -#else -PRIVATE Void rgSCHCmnDlCqiOnPucchInd(cell, ue, pucchCqi, ueCqiRept, isCqiAvail, is2ndCwCqiAvail) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; - RgrUeCqiRept *ueCqiRept; - Bool *isCqiAvail; - Bool *is2ndCwCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCqiOnPucchInd -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPucch *pucchCqi - ) -#else -PRIVATE Void rgSCHCmnDlCqiOnPucchInd(cell, ue, pucchCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPucch *pucchCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - TRC2(rgSCHCmnDlCqiOnPucchInd); - - /* ccpu00117452 - MOD - Changed - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* Save CQI mode information in the report */ - ueCqiRept->cqiMode = pucchCqi->mode; -#endif - - switch(pucchCqi->mode) - { - case TFU_PUCCH_CQI_MODE10: -#ifdef RGR_CQI_REPT - rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi, isCqiAvail); -#else - rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi); -#endif - ueDl->cqiFlag = TRUE; - break; - case TFU_PUCCH_CQI_MODE11: -#ifdef RGR_CQI_REPT - rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi, isCqiAvail, - is2ndCwCqiAvail); -#else - rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi); -#endif - ueDl->cqiFlag = TRUE; - break; - case TFU_PUCCH_CQI_MODE20: -#ifdef RGR_CQI_REPT - rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi, isCqiAvail); -#else - rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi); -#endif - ueDl->cqiFlag = TRUE; - break; - case TFU_PUCCH_CQI_MODE21: -#ifdef RGR_CQI_REPT - rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi, isCqiAvail, - is2ndCwCqiAvail); -#else - rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi); -#endif - ueDl->cqiFlag = TRUE; - break; - default: - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Unknown CQI Mode %d", - pucchCqi->mode,ue->ueId); - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = FALSE; -#endif - } - break; - } - - RETVOID; -} /* rgSCHCmnDlCqiOnPucchInd */ - - -/** - * @brief This function Updates the DL CQI on PUSCH for the UE. - * - * @details - * - * Function: rgSCHCmnDlCqiOnPuschInd - * - * This function updates the DL CQI on PUSCH for the UE. - * - * Invoked by: rgSCHCmnDlCqiInd - * - * Processing Steps: - * - Depending on the reporting mode of the PUSCH, the CQI/PMI/RI values - * are updated and stored for each UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef RGR_CQI_REPT -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCqiOnPuschInd -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPusch *puschCqi, - RgrUeCqiRept *ueCqiRept, - Bool *isCqiAvail, - Bool *is2ndCwCqiAvail - ) -#else -PRIVATE Void rgSCHCmnDlCqiOnPuschInd(cell, ue, puschCqi, ueCqiRept, isCqiAvail, is2ndCwCqiAvail) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPusch *puschCqi; - RgrUeCqiRept *ueCqiRept; - Bool *isCqiAvail; - Bool *is2ndCwCqiAvail; -#endif -#else -#ifdef ANSI -PRIVATE Void rgSCHCmnDlCqiOnPuschInd -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuDlCqiPusch *puschCqi - ) -#else -PRIVATE Void rgSCHCmnDlCqiOnPuschInd(cell, ue, puschCqi) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuDlCqiPusch *puschCqi; -#endif -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U32 prevRiVal = 0; - TRC2(rgSCHCmnDlCqiOnPuschInd); - if (puschCqi->ri.pres == PRSNT_NODEF) - { - if (RG_SCH_CMN_IS_RI_VALID(puschCqi->ri.val)) - { - /* Saving the previous ri value to revert back - in case PMI update failed */ - if (RGR_UE_TM_4 == ue->mimoInfo.txMode ) /* Cheking for TM4. TM8 check later */ - { - prevRiVal = ueDl->mimoInfo.ri; - } - rgSCHCmnDlSetUeRi(cell, ue, puschCqi->ri.val, FALSE); - } - else - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", - puschCqi->ri.val,ue->ueId); - RETVOID; - } - } - ue->mimoInfo.puschFdbkVld = FALSE; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* Save CQI mode information in the report */ - ueCqiRept->cqiMode = puschCqi->mode; - /* ccpu00117259 - DEL - removed default setting of isCqiAvail to TRUE */ -#endif - - switch(puschCqi->mode) - { - case TFU_PUSCH_CQI_MODE_20: - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - /* Checking whether the decoded CQI is a value between 1 and 15*/ - if((puschCqi->u.mode20Info.wideBandCqi) && - (puschCqi->u.mode20Info.wideBandCqi < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode20Info.wideBandCqi; - ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - break; - case TFU_PUSCH_CQI_MODE_30: - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((puschCqi->u.mode30Info.wideBandCqi) && - (puschCqi->u.mode30Info.wideBandCqi < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode30Info.wideBandCqi; - ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif -#ifdef CA_DBG - { - extern U32 gACqiRcvdCount; - gACqiRcvdCount++; - - } -#endif - } - else - { - RETVOID; - } - break; - case TFU_PUSCH_CQI_MODE_12: - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((puschCqi->u.mode12Info.cqiIdx[0]) && - (puschCqi->u.mode12Info.cqiIdx[0] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode12Info.cqiIdx[0]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - if((puschCqi->u.mode12Info.cqiIdx[1]) && - (puschCqi->u.mode12Info.cqiIdx[1] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode12Info.cqiIdx[1]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - ue->mimoInfo.puschFdbkVld = TRUE; - ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_12; - ue->mimoInfo.puschPmiInfo.u.mode12Info = puschCqi->u.mode12Info; - /* : resetting this is time based. Make use of CQI reporting - * periodicity, DELTA's in determining the exact time at which this - * need to be reset. */ - break; - case TFU_PUSCH_CQI_MODE_22: - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((puschCqi->u.mode22Info.wideBandCqi[0]) && - (puschCqi->u.mode22Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode22Info.wideBandCqi[0]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - if((puschCqi->u.mode22Info.wideBandCqi[1]) && - (puschCqi->u.mode22Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode22Info.wideBandCqi[1]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = TRUE; -#endif - } - else - { - RETVOID; - } - rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode22Info.wideBandPmi); - ue->mimoInfo.puschFdbkVld = TRUE; - ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_22; - ue->mimoInfo.puschPmiInfo.u.mode22Info = puschCqi->u.mode22Info; - break; - case TFU_PUSCH_CQI_MODE_31: - /*ccpu00109787 - ADD - Check for non-zero CQI*/ - if((puschCqi->u.mode31Info.wideBandCqi[0]) && - (puschCqi->u.mode31Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode31Info.wideBandCqi[0]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = TRUE; -#endif - } - if (ueDl->mimoInfo.ri > 1) - { - if((puschCqi->u.mode31Info.wideBandCqi[1]) && - (puschCqi->u.mode31Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI)) - { - ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode31Info.wideBandCqi[1]; - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = TRUE; -#endif - } - } - if (rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode31Info.pmi) != ROK) - { - /* To avoid Rank and PMI inconsistency */ - if ((puschCqi->ri.pres == PRSNT_NODEF) && - (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */ - { - ueDl->mimoInfo.ri = prevRiVal; - } - } - ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_31; - ue->mimoInfo.puschPmiInfo.u.mode31Info = puschCqi->u.mode31Info; - break; - default: - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Unknown CQI Mode %d CRNTI:%d", - puschCqi->mode,ue->ueId); - /* CQI decoding failed revert the RI to previous value */ - if ((puschCqi->ri.pres == PRSNT_NODEF) && - (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */ - { - ueDl->mimoInfo.ri = prevRiVal; - } - /* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - *isCqiAvail = FALSE; - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - *is2ndCwCqiAvail = FALSE; -#endif - } - break; - } - - RETVOID; -} /* rgSCHCmnDlCqiOnPuschInd */ - - -/** - * @brief This function Updates the DL CQI for the UE. - * - * @details - * - * Function: rgSCHCmnDlCqiInd - * Purpose: Updates the DL CQI for the UE - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqi - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlCqiInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isPucchInfo, -Void *dlCqi, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHCmnDlCqiInd(cell, ue, isPucchInfo, dlCqi, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -Bool isPucchInfo; -Void *dlCqi; -CmLteTimingInfo timingInfo; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgrUeCqiRept ueCqiRept = {{0}}; - Bool isCqiAvail = FALSE; - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting */ - Bool is2ndCwCqiAvail = FALSE; -#endif - - TRC2(rgSCHCmnDlCqiInd); - -#ifdef RGR_CQI_REPT - if (isPucchInfo) - { - rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail); - } - else - { - rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail); - } -#else - if (isPucchInfo) - { - rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi); - } - else - { - rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi); - } -#endif - -#ifdef CQI_CONFBITMASK_DROP - if(!ue->cqiConfBitMask) - { - if (ueDl->mimoInfo.cwInfo[0].cqi >15) - { - ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi; - ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi; - } - else if ( ueDl->mimoInfo.cwInfo[0].cqi >= ue->prevCqi) - { - ue->prevCqi = ueDl->mimoInfo.cwInfo[0].cqi; - } - else - { - U8 dlCqiDeltaPrev = 0; - dlCqiDeltaPrev = ue->prevCqi - ueDl->mimoInfo.cwInfo[0].cqi; - if (dlCqiDeltaPrev > 3) - dlCqiDeltaPrev = 3; - if ((ue->prevCqi - dlCqiDeltaPrev) < 6) - { - ue->prevCqi = 6; - } - else - { - ue->prevCqi = ue->prevCqi - dlCqiDeltaPrev; - } - ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi; - ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi; - - } - } -#endif - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting - added is2ndCwCqiAvail\ - in 'if' condition*/ - if (RG_SCH_CQIR_IS_PUSHNCQI_ENBLE(ue) && (isCqiAvail || is2ndCwCqiAvail)) - { - ueCqiRept.cqi[0] = ueDl->mimoInfo.cwInfo[0].cqi; - - /* ccpu00117259 - ADD - Considering second codeword CQI info - incase of MIMO for CQI Reporting - added is2ndCwCqiAvail - in 'if' condition*/ - ueCqiRept.cqi[1] = 0; - if(is2ndCwCqiAvail) - { - ueCqiRept.cqi[1] = ueDl->mimoInfo.cwInfo[1].cqi; - } - rgSCHCmnUeDlPwrCtColltCqiRept(cell, ue, &ueCqiRept); - - } -#endif -#ifdef DL_LA - rgSCHCmnDlSetUeAllocLmtLa(cell, ue); - rgSCHCheckAndSetTxScheme(cell, ue); -#else -#ifdef EMTC_ENABLE - rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), ue->isEmtcUe); -#else - rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), FALSE); -#endif -#endif - - if (cellSch->dl.isDlFreqSel) - { - cellSch->apisDlfs->rgSCHDlfsDlCqiInd(cell, ue, isPucchInfo, dlCqi, timingInfo); - } -#ifdef LTEMAC_SPS - /* Call SPS module to update CQI indication */ - rgSCHCmnSpsDlCqiIndHndlr(cell, ue, timingInfo); -#endif - /* Call Specific scheduler to process on dlCqiInd */ -#ifdef EMTC_ENABLE - if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe)) - { - cellSch->apisEmtcDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi); - } - else -#endif - { - cellSch->apisDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi); - } - -#ifdef RG_PFS_STATS - ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].avgCqi += - ueDl->mimoInfo.cwInfo[0].cqi; - ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].totalCqiOcc++; -#endif - -#ifdef SCH_STATS - ueDl->avgCqi += ueDl->mimoInfo.cwInfo[0].cqi; - ueDl->numCqiOccns++; - if (ueDl->mimoInfo.ri == 1) - { - ueDl->numRi1++; - } - else - { - ueDl->numRi2++; - } -#endif - -#ifdef TENB_STATS - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw0Cqi ++; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw1Cqi ++; - cell->tenbStats->sch.dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi; - cell->tenbStats->sch.dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi; - cell->tenbStats->sch.dlNumCw0Cqi ++; - cell->tenbStats->sch.dlNumCw1Cqi ++; -#endif - RETVOID; -} - -#ifdef TFU_UPGRADE -/** - * @brief This function calculates the wideband CQI from SNR - * reported for each RB. - * - * @details - * - * Function: rgSCHCmnCalcWcqiFrmSnr - * Purpose: Wideband CQI calculation from SNR - * - * Invoked by: RG SCH - * - * @param[in] RgSchCellCb *cell - * @param[in] TfuSrsRpt *srsRpt, - * @return Wideband CQI - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr -( - RgSchCellCb *cell, - TfuSrsRpt *srsRpt - ) -#else -PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr(cell,srsRpt) - RgSchCellCb *cell; - TfuSrsRpt *srsRpt; -#endif -{ - U8 wideCqi=1; /*Calculated value from SNR*/ - TRC2(rgSCHCmnCalcWcqiFrmSnr); - /*Need to map a certain SNR with a WideCQI value. - * The CQI calculation is still primitive. Further, need to - * use a improvized method for calculating WideCQI from SNR*/ - if (srsRpt->snr[0] <=50) - { - wideCqi=3; - } - else if (srsRpt->snr[0]>=51 && srsRpt->snr[0] <=100) - { - wideCqi=6; - } - else if (srsRpt->snr[0]>=101 && srsRpt->snr[0] <=150) - { - wideCqi=9; - } - else if (srsRpt->snr[0]>=151 && srsRpt->snr[0] <=200) - { - wideCqi=12; - } - else if (srsRpt->snr[0]>=201 && srsRpt->snr[0] <=250) - { - wideCqi=14; - } - else - { - wideCqi=15; - } - RETVALUE(wideCqi); -}/*rgSCHCmnCalcWcqiFrmSnr*/ - - -/** - * @brief This function Updates the SRS for the UE. - * - * @details - * - * Function: rgSCHCmnSrsInd - * Purpose: Updates the UL SRS for the UE - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuSrsRpt *srsRpt, - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnSrsInd -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuSrsRpt *srsRpt, - CmLteTimingInfo timingInfo - ) -#else -PUBLIC Void rgSCHCmnSrsInd(cell, ue, srsRpt, timingInfo) - RgSchCellCb *cell; - RgSchUeCb *ue; - TfuSrsRpt *srsRpt; - CmLteTimingInfo timingInfo; -#endif -{ - U8 wideCqi; /*Calculated value from SNR*/ - U32 recReqTime; /*Received Time in TTI*/ - TRC2(rgSCHCmnSrsInd); - - recReqTime = (timingInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) + timingInfo.subframe; - ue->srsCb.selectedAnt = (recReqTime/ue->srsCb.peri)%2; - if(srsRpt->wideCqiPres) - { - wideCqi = srsRpt->wideCqi; - } - else - { - wideCqi = rgSCHCmnCalcWcqiFrmSnr(cell, srsRpt); - } - rgSCHCmnFindUlCqiUlTxAnt(cell, ue, wideCqi); - RETVOID; -}/*rgSCHCmnSrsInd*/ -#endif - - -/** - * @brief This function is a handler for TA report for an UE. - * - * @details - * - * Function: rgSCHCmnDlTARpt - * Purpose: Determine based on UE_IDLE_TIME threshold, - * whether UE needs to be Linked to the scheduler's TA list OR - * if it needs a PDCCH Order. - * - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlTARpt -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnDlTARpt(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - CmLListCp poInactvLst; - - TRC2(rgSCHCmnDlTARpt); - - /* RACHO: If UE idle time is more than threshold, then - * set its poInactv pdcch order inactivity */ - /* Fix : syed Ignore if TaTmr is not configured */ - if ((ue->dl.taCb.cfgTaTmr) && (rgSCHCmnUeIdleExdThrsld(cell, ue) == ROK)) - { - U32 prevDlMsk = ue->dl.dlInactvMask; - U32 prevUlMsk = ue->ul.ulInactvMask; - ue->dl.dlInactvMask |= RG_PDCCHODR_INACTIVE; - ue->ul.ulInactvMask |= RG_PDCCHODR_INACTIVE; - /* Indicate Specific scheduler for this UEs inactivity */ - cmLListInit(&poInactvLst); - cmLListAdd2Tail(&poInactvLst, &ueDl->rachInfo.inActUeLnk); - ueDl->rachInfo.inActUeLnk.node = (PTR)ue; - /* Send inactivate ind only if not already sent */ - if (prevDlMsk == 0) - { - cellSch->apisDl->rgSCHDlInactvtUes(cell, &poInactvLst); - } - if (prevUlMsk == 0) - { - cellSch->apisUl->rgSCHUlInactvtUes(cell, &poInactvLst); - } - } - else - { - /* Fix: ccpu00124009 Fix for loop in the linked list "cellDl->taLst" */ - if (!ue->dlTaLnk.node) - { -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - rgSCHEmtcAddToTaLst(cellDl,ue); - } - } - else -#endif - { - - cmLListAdd2Tail(&cellDl->taLst, &ue->dlTaLnk); - ue->dlTaLnk.node = (PTR)ue; - } - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "TA duplicate entry attempt failed: UEID:%u", - ue->ueId); - } - } - RETVOID; -} - -#ifdef TFU_UPGRADE -/** - * @brief Indication of UL CQI. - * - * @details - * - * Function : rgSCHCmnFindUlCqiUlTxAnt - * - * - Finds the Best Tx Antenna amongst the CQIs received - * from Two Tx Antennas. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 wideCqi - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 wideCqi -) -#else -PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt(cell, ue, wideCqi) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 wideCqi; -#endif -{ - ue->validTxAnt = 1; - RETVOID; -} /* rgSCHCmnFindUlCqiUlTxAnt */ -#endif - -/** - * @brief Indication of UL CQI. - * - * @details - * - * Function : rgSCHCmnUlCqiInd - * - * - Updates uplink CQI information for the UE. Computes and - * stores the lowest CQI of CQIs reported in all subbands. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuUlCqiRpt *ulCqiInfo - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlCqiInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuUlCqiRpt *ulCqiInfo -) -#else -PUBLIC Void rgSCHCmnUlCqiInd(cell, ue, ulCqiInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuUlCqiRpt *ulCqiInfo; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); -#ifdef UL_LA - U8 iTbsNew; - S32 previTbs; -#endif -#if (defined(SCH_STATS) || defined(TENB_STATS)) - CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); -#endif - - TRC2(rgSCHCmnUlCqiInd); - /* consider inputs from SRS handlers about SRS occassions - * in determining the UL TX Antenna selection */ - ueUl->crntUlCqi[0] = ulCqiInfo->wideCqi; -#ifdef TFU_UPGRADE - ueUl->validUlCqi = ueUl->crntUlCqi[0]; - ue->validTxAnt = 0; -#ifdef UL_LA - iTbsNew = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][ueUl->validUlCqi]; - previTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; - - if (RG_ITBS_DIFF(iTbsNew, previTbs) > 5) - { - /* Ignore this iTBS report and mark that last iTBS report was */ - /* ignored so that subsequently we reset the LA algorithm */ - ueUl->ulLaCb.lastiTbsIgnored = TRUE; - } - else - { - if (ueUl->ulLaCb.lastiTbsIgnored != TRUE) - { - ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) + - (80 * ueUl->ulLaCb.cqiBasediTbs))/100; - } - else - { - /* Reset the LA as iTbs in use caught up with the value */ - /* reported by UE. */ - ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) + - (80 * previTbs * 100))/100; - ueUl->ulLaCb.deltaiTbs = 0; - ueUl->ulLaCb.lastiTbsIgnored = FALSE; - } - } -#endif -#endif - rgSCHPwrUlCqiInd(cell, ue); -#ifdef LTEMAC_SPS - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlCqiInd(cell, ue); - } -#endif - /* Applicable to only some schedulers */ -#ifdef EMTC_ENABLE - if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe)) - { - cellSch->apisEmtcUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo); - } - else -#endif - { - cellSch->apisUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo); - } - -#ifdef SCH_STATS - ueUl->numCqiOccns++; - ueUl->avgCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); -#endif - -#ifdef TENB_STATS - { - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNumCqi ++; - cell->tenbStats->sch.ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); - cell->tenbStats->sch.ulNumCqi ++; - } -#endif - - RETVOID; -} /* rgSCHCmnUlCqiInd */ - -/** - * @brief Returns HARQ proc for which data expected now. - * - * @details - * - * Function: rgSCHCmnUlHqProcForUe - * Purpose: This function returns the harq process for - * which data is expected in the current subframe. - * It does not validate that the HARQ process - * has an allocation. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteTimingInfo frm - * @param[in] RgSchUeCb *ue - * @param[out] RgSchUlHqProcCb **procRef - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlHqProcForUe -( -RgSchCellCb *cell, -CmLteTimingInfo frm, -RgSchUeCb *ue, -RgSchUlHqProcCb **procRef -) -#else -PUBLIC Void rgSCHCmnUlHqProcForUe(cell, frm, ue, procRef) -RgSchCellCb *cell; -CmLteTimingInfo frm; -RgSchUeCb *ue; -RgSchUlHqProcCb **procRef; -#endif -{ -#ifndef RG_5GTF - U8 procId = rgSCHCmnGetUlHqProcIdx(&frm, cell); -#endif - TRC2(rgSCHCmnUlHqProcForUe); -#ifndef RG_5GTF - *procRef = rgSCHUhmGetUlHqProc(cell, ue, procId); -#else - *procRef = rgSCHUhmGetUlProcByTime(cell, ue, frm); -#endif - RETVOID; -} - -#ifdef RG_UNUSED -/** - * @brief Update harq process for allocation. - * - * @details - * - * Function : rgSCHCmnUpdUlHqProc - * - * This function is invoked when harq process - * control block is now in a new memory location - * thus requiring a pointer/reference update. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlHqProcCb *curProc - * @param[in] RgSchUlHqProcCb *oldProc - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdUlHqProc -( -RgSchCellCb *cell, -RgSchUlHqProcCb *curProc, -RgSchUlHqProcCb *oldProc -) -#else -PUBLIC S16 rgSCHCmnUpdUlHqProc(cell, curProc, oldProc) -RgSchCellCb *cell; -RgSchUlHqProcCb *curProc; -RgSchUlHqProcCb *oldProc; -#endif -{ - TRC2(rgSCHCmnUpdUlHqProc); - - UNUSED(cell); - UNUSED(oldProc); -#if (ERRCLASS & ERRCLS_DEBUG) - if (curProc->alloc == NULLP) - { - RETVALUE(RFAILED); - } -#endif - curProc->alloc->hqProc = curProc; - RETVALUE(ROK); -} /* rgSCHCmnUpdUlHqProc */ -#endif - -/*MS_WORKAROUND for CR FIXME */ -/** - * @brief Hsndles BSR timer expiry - * - * @details - * - * Function : rgSCHCmnBsrTmrExpry - * - * This function is invoked when periodic BSR timer expires for a UE. - * - * @param[in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnBsrTmrExpry -( -RgSchUeCb *ueCb -) -#else -PUBLIC S16 rgSCHCmnBsrTmrExpry(ueCb) -RgSchUeCb *ueCb; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ueCb->cell); - - TRC2(rgSCHCmnBsrTmrExpry) - - ueCb->isSrGrant = TRUE; - -#ifdef EMTC_ENABLE - emtcStatsUlBsrTmrTxp++; -#endif - -#ifdef EMTC_ENABLE - if(ueCb->cell->emtcEnable) - { - if(ueCb->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHSrRcvd(ueCb->cell, ueCb); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHSrRcvd(ueCb->cell, ueCb); - } - - RETVALUE (ROK); -} - -/** - * @brief Short BSR update. - * - * @details - * - * Function : rgSCHCmnUpdBsrShort - * - * This functions does requisite updates to handle short BSR reporting. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchLcgCb *ulLcg - * @param[in] U8 bsr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdBsrShort -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchLcgCb *ulLcg, -U8 bsr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnUpdBsrShort(cell, ue, ulLcg, bsr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchLcgCb *ulLcg; -U8 bsr; -RgSchErrInfo *err; -#endif -{ - U8 lcgCnt; -#ifdef LTE_L2_MEAS - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); -#endif - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnLcg *cmnLcg = NULLP; - -#ifdef LTE_L2_MEAS - U8 idx; -#endif - TRC2(rgSCHCmnUpdBsrShort); - - if (!RGSCH_LCG_ISCFGD(ulLcg)) - { - err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD; - RETVALUE(RFAILED); - } - for (lcgCnt=0; lcgCnt<4; lcgCnt++) - { -#ifdef LTE_L2_MEAS - /* Set BS of all other LCGs to Zero. - If Zero BSR is reported in Short BSR include this LCG too */ - if ((lcgCnt != ulLcg->lcgId) || - (!bsr && !ueUl->hqEnt.numBusyHqProcs)) - { - /* If old BO is zero do nothing */ - if(((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs != 0) - { - for(idx = 0; idx < ue->ul.lcgArr[lcgCnt].numLch; idx++) - { - if((ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount) && - (ue->ulActiveLCs & (1 << - (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1)))) - { - /* L2_COUNTER */ - ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount--; - ue->ulActiveLCs &= ~(1 << - (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1)); - } - } - } - } -#endif - if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgCnt])) - { - ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs = 0; - ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->reportedBs = 0; - } - } - -#ifdef LTE_L2_MEAS - if(ulLcg->lcgId && bsr && (((RgSchCmnLcg *)(ulLcg->sch))->bs == 0)) - { - for(idx = 0; idx < ulLcg->numLch; idx++) - { - /* L2_COUNTER */ - if (!(ue->ulActiveLCs & (1 << (ulLcg->lcArray[idx]->qciCb->qci -1)))) - { - ulLcg->lcArray[idx]->qciCb->ulUeCount++; - ue->ulActiveLCs |= (1 << (ulLcg->lcArray[idx]->qciCb->qci -1)); - } - } - } -#endif - /* Resetting the nonGbrLcgBs info here */ - ue->ul.nonGbrLcgBs = 0; - ue->ul.nonLcg0Bs = 0; - - cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch)); - - if (TRUE == ue->ul.useExtBSRSizes) - { - cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr]; - } - else - { - cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr]; - } - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - /* TBD check for effGbr != 0 */ - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); - } - else if (0 == ulLcg->lcgId) - { - /* This is added for handling LCG0 */ - cmnLcg->bs = cmnLcg->reportedBs; - } - else - { - /* Update non GBR LCG's BS*/ - ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr); - cmnLcg->bs = ue->ul.nonGbrLcgBs; - } - ue->ul.totalBsr = cmnLcg->bs; - -#ifdef RGR_V1 - if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (bsr == 0)) - { - rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); - } -#endif -#ifdef LTEMAC_SPS - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsBsrRpt(cell, ue, ulLcg); - } -#endif - rgSCHCmnUpdUlCompEffBsr(ue); - -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr); - } - -#ifdef LTE_ADV - if (ue->ul.isUlCaEnabled && ue->numSCells) - { - for(U8 sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++) - { -#ifndef PAL_ENABLE_UL_CA - if((ue->cellInfo[sCellIdx] != NULLP) && - (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)) -#else - if(ue->cellInfo[sCellIdx] != NULLP) -#endif - { - cellSch->apisUl->rgSCHUpdBsrShort(ue->cellInfo[sCellIdx]->cell, - ue, ulLcg, bsr); - } - } - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief Truncated BSR update. - * - * @details - * - * Function : rgSCHCmnUpdBsrTrunc - * - * This functions does required updates to handle truncated BSR report. - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchLcgCb *ulLcg - * @param[in] U8 bsr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdBsrTrunc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchLcgCb *ulLcg, -U8 bsr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnUpdBsrTrunc(cell, ue, ulLcg, bsr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchLcgCb *ulLcg; -U8 bsr; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnLcg *cmnLcg = NULLP; - S32 cnt; -#ifdef LTE_L2_MEAS - U8 idx; -#endif - - TRC2(rgSCHCmnUpdBsrTrunc); - - if (!RGSCH_LCG_ISCFGD(ulLcg)) - { - err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD; - RETVALUE(RFAILED); - } - /* set all higher prio lcgs bs to 0 and update this lcgs bs and - total bsr= sumofall lcgs bs */ - if (ulLcg->lcgId) - { - for (cnt = ulLcg->lcgId-1; cnt >= 0; cnt--) - { -#ifdef LTE_L2_MEAS - /* If Existing BO is zero the don't do anything */ - if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs != 0) - { - for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++) - { - /* L2_COUNTERS */ - if((ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount) && - (ue->ulActiveLCs & (1 << - (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)))) - { - ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount--; - ue->ulActiveLCs &= ~(1 << - (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)); - } - } - } -#endif - ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs = 0; - ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->reportedBs = 0; - } - } - -#ifdef LTE_L2_MEAS - for (cnt = ulLcg->lcgId; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) - { - if (ulLcg->lcgId == 0) - { - continue; - } - /* If Existing BO is zero the don't do anything */ - if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs == 0) - { - for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++) - { - /* L2_COUNTERS */ - if (!(ue->ulActiveLCs & (1 << - (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)))) - { - ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount++; - ue->ulActiveLCs |= (1 << - (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)); - } - } - } - } -#endif - ue->ul.nonGbrLcgBs = 0; - ue->ul.nonLcg0Bs = 0; - cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch)); - if (TRUE == ue->ul.useExtBSRSizes) - { - cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr]; - } - else - { - cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr]; - } - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); - } - else if(ulLcg->lcgId == 0) - { - /* This is for handeling LCG0 */ - cmnLcg->bs = cmnLcg->reportedBs; - } - else - { - ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); - cmnLcg->bs = ue->ul.nonGbrLcgBs; - } - ue->ul.totalBsr = cmnLcg->bs; - - for (cnt = ulLcg->lcgId+1; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) - { - /* TODO: The bs for the other LCGs may be stale because some or all of - * the part of bs may have been already scheduled/data received. Please - * consider this when truncated BSR is tested/implemented */ - ue->ul.totalBsr += ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs; - } - - rgSCHCmnUpdUlCompEffBsr(ue); - -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr); - } - -#ifdef LTE_ADV - if (ue->ul.isUlCaEnabled && ue->numSCells) - { - for(U8 sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++) - { -#ifndef PAL_ENABLE_UL_CA - if((ue->cellInfo[sCellIdx] != NULLP) && - (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)) -#else - if(ue->cellInfo[sCellIdx] != NULLP) -#endif - { - cellSch->apisUl->rgSCHUpdBsrTrunc(ue->cellInfo[sCellIdx]->cell, ue, ulLcg, bsr); - } - } - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief Long BSR update. - * - * @details - * - * Function : rgSCHCmnUpdBsrLong - * - * - Update BSRs for all configured LCGs. - * - Update priority of LCGs if needed. - * - Update UE's position within/across uplink scheduling queues. - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 bsArr[] - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdBsrLong -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 *bsArr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnUpdBsrLong(cell, ue, bsArr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 *bsArr; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U32 tmpBsArr[4] = {0, 0, 0, 0}; - U32 nonGbrBs = 0; -#ifdef LTE_L2_MEAS - U8 idx1; - U8 idx2; -#endif - U32 lcgId; - - TRC2(rgSCHCmnUpdBsrLong); - -#ifdef LTE_L2_MEAS - for(idx1 = 1; idx1 < RGSCH_MAX_LCG_PER_UE; idx1++) - { - /* If Old BO is non zero then do nothing */ - if ((((RgSchCmnLcg *)(ue->ul.lcgArr[idx1].sch))->bs == 0) - && bsArr[idx1] ) - { - for(idx2 = 0; idx2 < ue->ul.lcgArr[idx1].numLch; idx2++) - { - /* L2_COUNTERS */ - if (!(ue->ulActiveLCs & (1 << - (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1)))) - { - ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->ulUeCount++; - ue->ulActiveLCs |= (1 << - (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1)); - } - } - } - } -#endif - ue->ul.nonGbrLcgBs = 0; - ue->ul.nonLcg0Bs = 0; - - if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[0])) - { - if (TRUE == ue->ul.useExtBSRSizes) - { - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnExtBsrTbl[bsArr[0]]; - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnExtBsrTbl[bsArr[0]]; - tmpBsArr[0] = rgSchCmnExtBsrTbl[bsArr[0]]; - } - else - { - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnBsrTbl[bsArr[0]]; - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnBsrTbl[bsArr[0]]; - tmpBsArr[0] = rgSchCmnBsrTbl[bsArr[0]]; - } - } - for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) - { - if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) - { - RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); - - if (TRUE == ue->ul.useExtBSRSizes) - { - cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsArr[lcgId]]; - } - else - { - cmnLcg->reportedBs = rgSchCmnBsrTbl[bsArr[lcgId]]; - } - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); - tmpBsArr[lcgId] = cmnLcg->bs; - } - else - { - nonGbrBs += cmnLcg->reportedBs; - tmpBsArr[lcgId] = cmnLcg->reportedBs; - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr); - } - } - } - ue->ul.nonGbrLcgBs = RGSCH_MIN(nonGbrBs,ue->ul.effAmbr); - - ue->ul.totalBsr = tmpBsArr[0] + tmpBsArr[1] + tmpBsArr[2] + tmpBsArr[3]; -#ifdef RGR_V1 - if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (ue->ul.totalBsr == 0)) - { - rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); - } -#endif - -#ifdef LTEMAC_SPS - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) /* SPS_FIX */ - { - if(ue->ul.totalBsr - tmpBsArr[1] == 0) - {/* Updaing the BSR to SPS only if LCG1 BS is present in sps active state */ - rgSCHCmnSpsBsrRpt(cell, ue, &ue->ul.lcgArr[1]); - } - } -#endif - rgSCHCmnUpdUlCompEffBsr(ue); - -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHUpdBsrLong(cell, ue, bsArr); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHUpdBsrLong(cell, ue, bsArr); - } - -#ifdef LTE_ADV - if (ue->ul.isUlCaEnabled && ue->numSCells) - { - for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++) - { -#ifndef PAL_ENABLE_UL_CA - if((ue->cellInfo[idx] != NULLP) && - (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE)) -#else - if(ue->cellInfo[idx] != NULLP) -#endif - { - cellSch->apisUl->rgSCHUpdBsrLong(ue->cellInfo[idx]->cell, ue, bsArr); - } - } - } -#endif - - RETVALUE(ROK); -} - -/** - * @brief PHR update. - * - * @details - * - * Function : rgSCHCmnUpdExtPhr - * - * Updates extended power headroom information for an UE. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 phr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdExtPhr -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgInfExtPhrCEInfo *extPhr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnUpdExtPhr(cell, ue, extPhr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgInfExtPhrCEInfo *extPhr; -RgSchErrInfo *err; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - RgSchCmnAllocRecord *allRcd; - CmLList *node = ueUl->ulAllocLst.last; - -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); -#endif - TRC2(rgSCHCmnUpdExtPhr); - - UNUSED(err); - - while (node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - node = node->prev; - if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) - { - rgSCHPwrUpdExtPhr(cell, ue, extPhr, allRcd); - break; - } - } -#ifdef LTEMAC_SPS - if(ulSpsUe->isUlSpsActv) - { - rgSCHCmnSpsPhrInd(cell,ue); - } -#endif - - RETVALUE(ROK); -} /* rgSCHCmnUpdExtPhr */ - - - - -/** - * @brief PHR update. - * - * @details - * - * Function : rgSCHCmnUpdPhr - * - * Updates power headroom information for an UE. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 phr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnUpdPhr -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 phr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnUpdPhr(cell, ue, phr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 phr; -RgSchErrInfo *err; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - RgSchCmnAllocRecord *allRcd; - CmLList *node = ueUl->ulAllocLst.last; - -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); -#endif - TRC2(rgSCHCmnUpdPhr); - - UNUSED(err); - - while (node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - node = node->prev; - if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) - { - rgSCHPwrUpdPhr(cell, ue, phr, allRcd, RG_SCH_CMN_PWR_USE_CFG_MAX_PWR); - break; - } - } -#ifdef LTEMAC_SPS - if(ulSpsUe->isUlSpsActv) - { - rgSCHCmnSpsPhrInd(cell,ue); - } -#endif - - RETVALUE(ROK); -} /* rgSCHCmnUpdPhr */ - -/** - * @brief UL grant for contention resolution. - * - * @details - * - * Function : rgSCHCmnContResUlGrant - * - * Add UE to another queue specifically for CRNTI based contention - * resolution. - * - * - * @param[in] RgSchUeCb *ue - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnContResUlGrant -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnContResUlGrant(cell, ue, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnContResUlGrant); - - #ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHContResUlGrant(cell, ue); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHContResUlGrant(cell, ue); - } - RETVALUE(ROK); -} - -/** - * @brief SR reception handling. - * - * @details - * - * Function : rgSCHCmnSrRcvd - * - * - Update UE's position within/across uplink scheduling queues - * - Update priority of LCGs if needed. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo frm - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnSrRcvd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHCmnSrRcvd(cell, ue, frm, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -RgSchErrInfo *err; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - CmLList *node = ueUl->ulAllocLst.last; - - TRC2(rgSCHCmnSrRcvd); - -#ifdef EMTC_ENABLE - emtcStatsUlTomSrInd++; -#endif - - RGSCH_INCR_SUB_FRAME(frm, 1); /* 1 TTI after the time SR was sent */ - while (node) - { - RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)node->node; - if (RGSCH_TIMEINFO_SAME(frm, allRcd->allocTime)) - { - break; - } - node = node->prev; - } - //TODO_SID Need to check when it is getting triggered - ue->isSrGrant = TRUE; -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - if(ue->isEmtcUe) - { - cellSch->apisEmtcUl->rgSCHSrRcvd(cell, ue); - RETVALUE(ROK); - } - } - else -#endif - { - cellSch->apisUl->rgSCHSrRcvd(cell, ue); - } - RETVALUE(ROK); -} - -/** - * @brief Returns first uplink allocation to send reception - * request to PHY. - * - * @details - * - * Function: rgSCHCmnFirstRcptnReq(cell) - * Purpose: This function returns the first uplink allocation - * (or NULLP if there is none) in the subframe - * in which is expected to prepare and send reception - * request to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHCmnFirstRcptnReq -( -RgSchCellCb *cell -) -#else -PUBLIC RgSchUlAlloc *rgSCHCmnFirstRcptnReq(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); -/* ACC_TDD */ - RgSchUlAlloc* alloc = NULLP; - - TRC2(rgSCHCmnFirstRcptnReq); - - if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO) - { - RgSchUlSf* sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; - alloc = rgSCHUtlUlAllocFirst(sf); - - if (alloc && alloc->hqProc == NULLP) - { - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - } - } - - RETVALUE(alloc); -} - -/** - * @brief Returns first uplink allocation to send reception - * request to PHY. - * - * @details - * - * Function: rgSCHCmnNextRcptnReq(cell) - * Purpose: This function returns the next uplink allocation - * (or NULLP if there is none) in the subframe - * in which is expected to prepare and send reception - * request to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHCmnNextRcptnReq -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc -) -#else -PUBLIC RgSchUlAlloc *rgSCHCmnNextRcptnReq(cell, alloc) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); -/* ACC-TDD */ - //RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; - - TRC2(rgSCHCmnNextRcptnReq); -/* ACC-TDD */ - if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO) - { - RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; - - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - if (alloc && alloc->hqProc == NULLP) - { - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - } - } - else - { - alloc = NULLP; - } - - RETVALUE(alloc); -} -/** - * @brief Collates DRX enabled UE's scheduled in this SF - * - * @details - * - * Function: rgSCHCmnDrxStrtInActvTmrInUl(cell) - * Purpose: This function collates the link - * of UE's scheduled in this SF who - * have drx enabled. It then calls - * DRX specific function to start/restart - * inactivity timer in Ul - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDrxStrtInActvTmrInUl -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnDrxStrtInActvTmrInUl(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchUlSf *sf = &(cellUl->ulSfArr[cellUl->schdIdx]); - RgSchUlAlloc *alloc = rgSCHUtlUlAllocFirst(sf); - CmLListCp ulUeLst; - RgSchUeCb *ueCb; - - - TRC2(rgSCHCmnDrxStrtInActvTmrInUl); - - cmLListInit(&ulUeLst); - - while(alloc) - { - ueCb = alloc->ue; - - if (ueCb) - { - if (!(alloc->grnt.isRtx) && ueCb->isDrxEnabled && !(ueCb->isSrGrant) -#ifdef LTEMAC_SPS - /* ccpu00139513- DRX inactivity timer should not be started for - * UL SPS occasions */ - && (alloc->hqProc->isSpsOccnHqP == FALSE) -#endif - ) - { - cmLListAdd2Tail(&ulUeLst,&(ueCb->ulDrxInactvTmrLnk)); - ueCb->ulDrxInactvTmrLnk.node = (PTR)ueCb; - } - } - - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - }/*while(alloc)*/ - - (Void)rgSCHDrxStrtInActvTmr(cell,&ulUeLst,RG_SCH_DRX_UL); - - RETVOID; -} - - -/** - * @brief Returns first uplink allocation to send HARQ feedback - * request to PHY. - * - * @details - * - * Function: rgSCHCmnFirstHqFdbkAlloc - * Purpose: This function returns the first uplink allocation - * (or NULLP if there is none) in the subframe - * for which it is expected to prepare and send HARQ - * feedback to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] U8 idx - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc -( -RgSchCellCb *cell, -U8 idx -) -#else -PUBLIC RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc(cell, idx) -RgSchCellCb *cell; -U8 idx; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); -/* ACC-TDD */ - RgSchUlAlloc *alloc = NULLP; - - TRC2(rgSCHCmnFirstHqFdbkAlloc); - - if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) - { - RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; - alloc = rgSCHUtlUlAllocFirst(sf); - - while (alloc && (alloc->hqProc == NULLP)) - { - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - } - } - - RETVALUE(alloc); -} - -/** - * @brief Returns next allocation to send HARQ feedback for. - * - * @details - * - * Function: rgSCHCmnNextHqFdbkAlloc(cell) - * Purpose: This function returns the next uplink allocation - * (or NULLP if there is none) in the subframe - * for which HARQ feedback needs to be sent. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc, -U8 idx -) -#else -PUBLIC RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc(cell, alloc, idx) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -U8 idx; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - TRC2(rgSCHCmnNextHqFdbkAlloc); - - if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) - { - RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; - - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - while (alloc && (alloc->hqProc == NULLP)) - { - alloc = rgSCHUtlUlAllocNxt(sf, alloc); - } - } - else - { - alloc = NULLP; - } - RETVALUE(alloc); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlGetITbsFrmIMcs - * - * Desc : Returns the Itbs that is mapped to an Imcs - * for the case of uplink. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUlGetITbsFrmIMcs -( -U8 iMcs -) -#else -PUBLIC U8 rgSCHCmnUlGetITbsFrmIMcs(iMcs) -U8 iMcs; -#endif -{ - TRC2(rgSCHCmnUlGetITbsFrmIMcs); - - RETVALUE(rgUlIMcsTbl[iMcs].iTbs); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlGetIMcsFrmITbs - * - * Desc : Returns the Imcs that is mapped to an Itbs - * for the case of uplink. - * - * Ret : - * - * Notes: For iTbs 19, iMcs is dependant on modulation order. - * Refer to 36.213, Table 8.6.1-1 and 36.306 Table 4.1-2 - * for UE capability information - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUlGetIMcsFrmITbs -( -U8 iTbs, -CmLteUeCategory ueCtg -) -#else -PUBLIC U8 rgSCHCmnUlGetIMcsFrmITbs(iTbs, ueCtg) -U8 iTbs; -CmLteUeCategory ueCtg; -#endif -{ - U8 iMcs; - TRC2(rgSCHCmnUlGetIMcsFrmITbs); - - if (iTbs <= 10) - { - iMcs = iTbs; - } - /*a higher layer can force a 64QAM UE to transmit at 16QAM. - * We currently do not support this. Once the support for such - * is added, ueCtg should be replaced by current transmit - * modulation configuration.Refer to 36.213 -8.6.1 - */ - else if ( iTbs < 19 ) - { - iMcs = iTbs + 1; - } - else if ((iTbs == 19) && (ueCtg != CM_LTE_UE_CAT_5)) - { - iMcs = iTbs + 1; - } - else - { - iMcs = iTbs + 2; - } - -#ifdef LTE_TDD - /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption - was seen when IMCS exceeds 20 on T2k TDD*/ - if (iMcs > 20) - { - iMcs = 20; - } -#endif - - RETVALUE(iMcs); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlMinTbBitsForITbs - * - * Desc : Returns the minimum number of bits that can - * be given as grant for a specific CQI. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC U32 rgSCHCmnUlMinTbBitsForITbs -( -RgSchCmnUlCell *cellUl, -U8 iTbs -) -#else -PUBLIC U32 rgSCHCmnUlMinTbBitsForITbs(cellUl, iTbs) -RgSchCmnUlCell *cellUl; -U8 iTbs; -#endif -{ - TRC2(rgSCHCmnUlMinTbBitsForITbs); - - RGSCH_ARRAY_BOUND_CHECK(0, rgTbSzTbl[0], iTbs); - - RETVALUE(rgTbSzTbl[0][iTbs][cellUl->sbSize-1]); -} - -/*********************************************************** - * - * Func : rgSCHCmnUlSbAlloc - * - * Desc : Given a required 'number of subbands' and a hole, - * returns a suitable alloc such that the subband - * allocation size is valid - * - * Ret : - * - * Notes: Does not assume either passed numSb or hole size - * to be valid for allocation, and hence arrives at - * an acceptable value. - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHCmnUlSbAlloc -( -RgSchUlSf *sf, -U8 numSb, -RgSchUlHole *hole -) -#else -PUBLIC RgSchUlAlloc *rgSCHCmnUlSbAlloc(sf, numSb, hole) -RgSchUlSf *sf; -U8 numSb; -RgSchUlHole *hole; -#endif -{ - U8 holeSz; /* valid hole size */ - RgSchUlAlloc *alloc; - TRC2(rgSCHCmnUlSbAlloc); - - if ((holeSz = rgSchCmnMult235Tbl[hole->num].prvMatch) == hole->num) - { - numSb = rgSchCmnMult235Tbl[numSb].match; - if (numSb >= holeSz) - { - alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); - } - else - { - alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); - } - } - else - { - if (numSb < holeSz) - { - numSb = rgSchCmnMult235Tbl[numSb].match; - } - else - { - numSb = rgSchCmnMult235Tbl[numSb].prvMatch; - } - - if ( numSb >= holeSz ) - { - numSb = holeSz; - } - alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); - } - RETVALUE(alloc); -} - -/** - * @brief To fill the RgSchCmnUeUlAlloc structure of UeCb. - * - * @details - * - * Function: rgSCHCmnUlUeFillAllocInfo - * Purpose: Specific scheduler to call this API to fill the alloc - * information. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlUeFillAllocInfo -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlUeFillAllocInfo(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUeUlAlloc *ulAllocInfo; - RgSchCmnUlUe *ueUl; - - TRC2(rgSCHCmnUlUeFillAllocInfo); - - ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - ulAllocInfo = &ueUl->alloc; - - /* Fill alloc structure */ - rgSCHCmnUlAllocFillTpc(cell, ue, ulAllocInfo->alloc); - rgSCHCmnUlAllocFillNdmrs(cellUl, ulAllocInfo->alloc); - rgSCHCmnUlAllocLnkHqProc(ue, ulAllocInfo->alloc, ulAllocInfo->alloc->hqProc, - ulAllocInfo->alloc->hqProc->isRetx); - /* Fill PDCCH */ - rgSCHCmnUlFillPdcchWithAlloc(ulAllocInfo->alloc->pdcch, - ulAllocInfo->alloc, ue); - /* Recording information about this allocation */ - rgSCHCmnUlRecordUeAlloc(cell, ue); - - /* Update the UE's outstanding allocation */ - if (!ulAllocInfo->alloc->hqProc->isRetx) - { - rgSCHCmnUlUpdOutStndAlloc(cell, ue, ulAllocInfo->allocdBytes); - } - - RETVOID; -} - -/** - * @brief Update the UEs outstanding alloc based on the BSR report's timing. - * - * - * @details - * - * Function: rgSCHCmnUpdUlCompEffBsr - * Purpose: Clear off all the allocations from outstanding allocation that - * are later than or equal to BSR timing information (stored in UEs datIndTime). - * - * Invoked by: Scheduler - * - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdUlCompEffBsr -( -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnUpdUlCompEffBsr(ue) -RgSchUeCb *ue; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,ue->cell); - CmLList *node = ueUl->ulAllocLst.last; - RgSchCmnAllocRecord *allRcd; - U32 outStndAlloc=0; - U32 nonLcg0OutStndAllocBs=0; - U32 nonLcg0Bsr=0; - U8 lcgId; - RgSchCmnLcg *cmnLcg = NULLP; - TRC2(rgSCHCmnUpdUlCompEffBsr); - - while (node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) - { - node = node->next; - break; - } - node = node->prev; - } - while (node) - { - allRcd = (RgSchCmnAllocRecord *)node->node; - node = node->next; - outStndAlloc += allRcd->alloc; - } - - cmnLcg = (RgSchCmnLcg *)(ue->ul.lcgArr[0].sch); - /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/ - if (cmnLcg->bs > outStndAlloc) - { - cmnLcg->bs -= outStndAlloc; - ue->ul.minReqBytes = cmnLcg->bs; - outStndAlloc = 0; - } - else - { - nonLcg0OutStndAllocBs = outStndAlloc - cmnLcg->bs; - cmnLcg->bs = 0; - } - - for(lcgId = 1;lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) - { - if(RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) - { - cmnLcg = ((RgSchCmnLcg *) (ue->ul.lcgArr[lcgId].sch)); - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - nonLcg0Bsr += cmnLcg->bs; - } - } - } - nonLcg0Bsr += ue->ul.nonGbrLcgBs; - if (nonLcg0OutStndAllocBs > nonLcg0Bsr) - { - nonLcg0Bsr = 0; - } - else - { - nonLcg0Bsr -= nonLcg0OutStndAllocBs; - } - ue->ul.nonLcg0Bs = nonLcg0Bsr; - /* Cap effBsr with nonLcg0Bsr and append lcg0 bs. - * nonLcg0Bsr limit applies only to lcg1,2,3 */ - /* better be handled in individual scheduler */ - ue->ul.effBsr = nonLcg0Bsr +\ - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; - RETVOID; -} - -/** - * @brief Records information about the current allocation. - * - * @details - * - * Function: rgSCHCmnUlRecordUeAlloc - * Purpose: Records information about the curent allocation. - * This includes the allocated bytes, as well - * as some power information. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlRecordUeAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnUlRecordUeAlloc(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ -#ifdef LTE_TDD - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); -#endif - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - CmLListCp *lst = &ueUl->ulAllocLst; - CmLList *node = ueUl->ulAllocLst.first; - RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node); - RgSchCmnUeUlAlloc *ulAllocInfo = &ueUl->alloc; - CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); - TRC2(rgSCHCmnUlRecordUeAlloc); - - cmLListDelFrm(lst, &allRcd->lnk); -#ifndef LTE_TDD - /* To the crntTime, add the MIN time at which UE will - * actually send the BSR i.e DELTA+4 */ - allRcd->allocTime = cell->crntTime; - /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ -#ifdef EMTC_ENABLE - if(ue->isEmtcUe == TRUE) - { - RGSCH_INCR_SUB_FRAME_EMTC(allRcd->allocTime, - (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); - } - else -#endif - { - RGSCH_INCR_SUB_FRAME(allRcd->allocTime, - (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); - } -#else - allRcd->allocTime = cellUl->schdTime; -#endif - cmLListAdd2Tail(lst, &allRcd->lnk); - - /* Filling in the parameters to be recorded */ - allRcd->alloc = ulAllocInfo->allocdBytes; - //allRcd->numRb = ulAllocInfo->alloc->grnt.numRb; - allRcd->numRb = (ulAllocInfo->alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); - /*Recording the UL CQI derived from the maxUlCqi */ - allRcd->cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg); - allRcd->tpc = ulAllocInfo->alloc->grnt.tpc; - - rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb); - - cell->measurements.ulBytesCnt += ulAllocInfo->allocdBytes; - - RETVOID; -} - -/** PHR handling for MSG3 - * @brief Records allocation information of msg3 in the the UE. - * - * @details - * - * Function: rgSCHCmnUlRecMsg3Alloc - * Purpose: Records information about msg3 allocation. - * This includes the allocated bytes, as well - * as some power information. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchRaCb *raCb - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlRecMsg3Alloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchRaCb *raCb -) -#else -PUBLIC Void rgSCHCmnUlRecMsg3Alloc(cell, ue, raCb) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchRaCb *raCb; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - CmLListCp *lst = &ueUl->ulAllocLst; - CmLList *node = ueUl->ulAllocLst.first; - RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node); - - /* Stack Crash problem for TRACE5 changes */ - TRC2(rgSCHCmnUlRecMsg3Alloc); - - cmLListDelFrm(lst, node); - allRcd->allocTime = raCb->msg3AllocTime; - cmLListAdd2Tail(lst, node); - - /* Filling in the parameters to be recorded */ - allRcd->alloc = raCb->msg3Grnt.datSz; - allRcd->numRb = raCb->msg3Grnt.numRb; - allRcd->cqi = raCb->ccchCqi; - allRcd->tpc = raCb->msg3Grnt.tpc; - - rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb); - - RETVOID; -} -/** - * @brief Keeps track of the most recent RG_SCH_CMN_MAX_ALLOC_TRACK - * allocations to track. Adds this allocation to the ueUl's ulAllocLst. - * - * - * @details - * - * Function: rgSCHCmnUlUpdOutStndAlloc - * Purpose: Recent Allocation shall be at First Pos'n. - * Remove the last node, update the fields - * with the new allocation and add at front. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 alloc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlUpdOutStndAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 alloc -) -#else -PUBLIC Void rgSCHCmnUlUpdOutStndAlloc(cell, ue, alloc) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 alloc; -#endif -{ - U32 nonLcg0Alloc=0; - TRC2(rgSCHCmnUlUpdOutStndAlloc); - - /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/ - if (((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs > alloc) - { - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs -= alloc; - } - else - { - nonLcg0Alloc = alloc - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = 0; - } - - if (nonLcg0Alloc >= ue->ul.nonLcg0Bs) - { - ue->ul.nonLcg0Bs = 0; - } - else - { - ue->ul.nonLcg0Bs -= nonLcg0Alloc; - } - /* Cap effBsr with effAmbr and append lcg0 bs. - * effAmbr limit applies only to lcg1,2,3 non GBR LCG's*/ - /* better be handled in individual scheduler */ - ue->ul.effBsr = ue->ul.nonLcg0Bs +\ - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; -#ifdef RGR_V1 - if (ue->ul.effBsr == 0) - { - if (ue->bsrTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); - } - /* ccpu00133008 */ - if (FALSE == ue->isSrGrant) - { - if (ue->ul.bsrTmrCfg.isPrdBsrTmrPres) - { - /* - rgSCHTmrStartTmr(cell, ue, RG_SCH_TMR_BSR, - ue->ul.bsrTmrCfg.prdBsrTmr); - */ - } - } - } -#endif - /* Resetting UEs lower Cap */ - ue->ul.minReqBytes = 0; - - RETVOID; -} - - -/** - * @brief Returns the "Itbs" for a given UE. - * - * @details - * - * Function: rgSCHCmnUlGetITbs - * Purpose: This function returns the "Itbs" for a given UE. - * - * Invoked by: Scheduler - * - * @param[in] RgSchUeCb *ue - * @return U8 - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUlGetITbs -( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isEcp -) -#else -PUBLIC U8 rgSCHCmnUlGetITbs(cell, ue, isEcp) -RgSchCellCb *cell; -RgSchUeCb *ue; -Bool isEcp; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - /* CQI will be capped to maxUlCqi for 16qam UEs */ - CmLteUeCategory ueCtgy = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); - U8 cqi; -#ifdef UL_LA - S32 iTbs; - U8 maxiTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ueUl->maxUlCqi]; -#endif - - TRC2(rgSCHCmnUlGetITbs); - - /* #ifdef RG_SCH_CMN_EXT_CP_SUP For ECP pick index 1 */ -#ifdef TFU_UPGRADE - if ( (ueCtgy != CM_LTE_UE_CAT_5) && - (ueUl->validUlCqi > ueUl->maxUlCqi) - ) - { - cqi = ueUl->maxUlCqi; - } - else - { - cqi = ueUl->validUlCqi; - } - -#ifdef UL_LA - iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; - - RG_SCH_CHK_ITBS_RANGE(iTbs, maxiTbs); - - iTbs = RGSCH_MIN(iTbs, ue->cell->thresholds.maxUlItbs); - -#ifdef LTE_TDD - /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption - was seen when IMCS exceeds 20 on T2k TDD */ - if (iTbs > 19) - { - iTbs = 19; - } -#endif - RETVALUE(iTbs); -#endif -#else - if ( (ueCtgy != CM_LTE_UE_CAT_5) && (ueUl->crntUlCqi[0] > ueUl->maxUlCqi )) - { - cqi = ueUl->maxUlCqi; - } - else - { - cqi = ueUl->crntUlCqi[0]; - } -#endif - RETVALUE(rgSchCmnUlCqiToTbsTbl[(U8)isEcp][cqi]); -} - -/** - * @brief This function adds the UE to DLRbAllocInfo TX lst. - * - * @details - * - * Function: rgSCHCmnDlRbInfoAddUeTx - * Purpose: This function adds the UE to DLRbAllocInfo TX lst. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRbInfoAddUeTx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -) -#else -PRIVATE Void rgSCHCmnDlRbInfoAddUeTx(cell, allocInfo, ue, hqP) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnDlRbInfoAddUeTx); - - if (hqP->reqLnk.node == NULLP) - { - if (cellSch->dl.isDlFreqSel) - { - cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, - &allocInfo->dedAlloc.txHqPLst, hqP); - } - else - { - { - cmLListAdd2Tail(&allocInfo->dedAlloc.txHqPLst, &hqP->reqLnk); - } - hqP->reqLnk.node = (PTR)hqP; - } - } - RETVOID; -} - -/** - * @brief This function adds the UE to DLRbAllocInfo RETX lst. - * - * @details - * - * Function: rgSCHCmnDlRbInfoAddUeRetx - * Purpose: This function adds the UE to DLRbAllocInfo RETX lst. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -) -#else -PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx(cell, allocInfo, ue, hqP) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell); - - TRC2(rgSCHCmnDlRbInfoAddUeRetx); - - if (cellSch->dl.isDlFreqSel) - { - cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, - &allocInfo->dedAlloc.retxHqPLst, hqP); - } - else - { - /* checking UE's presence in this lst is unnecessary */ - cmLListAdd2Tail(&allocInfo->dedAlloc.retxHqPLst, &hqP->reqLnk); - hqP->reqLnk.node = (PTR)hqP; - } - RETVOID; -} - -/** - * @brief This function adds the UE to DLRbAllocInfo TX-RETX lst. - * - * @details - * - * Function: rgSCHCmnDlRbInfoAddUeRetxTx - * Purpose: This adds the UE to DLRbAllocInfo TX-RETX lst. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRbInfoAddUeRetxTx -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -) -#else -PRIVATE Void rgSCHCmnDlRbInfoAddUeRetxTx(allocInfo, ue, hqP) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -RgSchDlHqProcCb *hqP; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell); - - TRC2(rgSCHCmnDlRbInfoAddUeRetxTx); - - if (cellSch->dl.isDlFreqSel) - { - cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, - &allocInfo->dedAlloc.txRetxHqPLst, hqP); - } - else - { - cmLListAdd2Tail(&allocInfo->dedAlloc.txRetxHqPLst, &hqP->reqLnk); - hqP->reqLnk.node = (PTR)hqP; - } - RETVOID; -} - -/** - * @brief This function adds the UE to DLRbAllocInfo NonSchdRetxLst. - * - * @details - * - * Function: rgSCHCmnDlAdd2NonSchdRetxLst - * Purpose: During RB estimation for RETX, if allocation fails - * then appending it to NonSchdRetxLst, the further - * action is taken as part of Finalization in - * respective schedulers. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst -( -RgSchCmnDlRbAllocInfo *allocInfo, -RgSchUeCb *ue, -RgSchDlHqProcCb *hqP -) -#else -PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst(allocInfo, ue, hqP) -RgSchCmnDlRbAllocInfo *allocInfo; -RgSchUeCb *ue; -RgSchDlHqProcCb *hqP; -#endif -{ - CmLList *schdLnkNode; - - TRC2(rgSCHCmnDlAdd2NonSchdRetxLst); - -#ifdef LTEMAC_SPS - if ( (hqP->sch != (RgSchCmnDlHqProc *)NULLP) && - (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP))) - { - RETVOID; - } -#endif - - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - cmLListAdd2Tail(&allocInfo->dedAlloc.nonSchdRetxHqPLst, schdLnkNode); - - RETVOID; -} - - - -/** - * @brief This function adds the UE to DLRbAllocInfo NonSchdTxRetxLst. - * - * @details - * - * Function: rgSCHCmnDlAdd2NonSchdTxRetxLst - * Purpose: During RB estimation for TXRETX, if allocation fails - * then appending it to NonSchdTxRetxLst, the further - * action is taken as part of Finalization in - * respective schedulers. - * - * Invoked by: Common Scheduler - * - * @param[out] RgSchCmnDlRbAllocInfo *allocInfo - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef LTE_TDD -/** - * @brief This function handles the initialisation of DL HARQ/ACK feedback - * timing information for eaach DL subframe. - * - * @details - * - * Function: rgSCHCmnDlANFdbkInit - * Purpose: Each DL subframe stores the sfn and subframe - * information of UL subframe in which it expects - * HARQ ACK/NACK feedback for this subframe.It - * generates the information based on Downlink - * Association Set Index table. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlANFdbkInit -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlANFdbkInit(cell) -RgSchCellCb *cell; -#endif -{ - U8 sfCount; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 maxDlSubfrms = cell->numDlSubfrms; - U8 sfNum; - U8 idx; - U8 dlIdx; - U8 calcSfnOffset; - S8 calcSfNum; - U8 ulSfCnt =0; - RgSchTddSubfrmInfo ulSubfrmInfo; - U8 maxUlSubfrms; - - TRC2(rgSCHCmnDlANFdbkInit); - - ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; - maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - - /* Generate HARQ ACK/NACK feedback information for each DL sf in a radio frame - * Calculate this information based on DL Association set Index table */ - for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) - { - while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != - RG_SCH_TDD_UL_SUBFRAME) - { - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - ulSfCnt++; - - for(idx=0; idx < rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\ - numFdbkSubfrms; idx++) - { - calcSfNum = sfNum - rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\ - subfrmNum[idx]; - if(calcSfNum < 0) - { - calcSfnOffset = RGSCH_CEIL(-calcSfNum, RGSCH_NUM_SUB_FRAMES); - } - else - { - calcSfnOffset = 0; - } - - calcSfNum = ((RGSCH_NUM_SUB_FRAMES * calcSfnOffset) + calcSfNum)\ - % RGSCH_NUM_SUB_FRAMES; - - if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) - { - dlIdx = calcSfNum; - } - else if((ulSubfrmInfo.switchPoints == 2) && (calcSfNum <= \ - RG_SCH_CMN_SPL_SUBFRM_6)) - { - dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; - } - else - { - dlIdx = calcSfNum - maxUlSubfrms; - } - - cell->subFrms[dlIdx]->dlFdbkInfo.subframe = sfNum; - cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = calcSfnOffset; - cell->subFrms[dlIdx]->dlFdbkInfo.m = idx; - } - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - - /* DL subframes in the subsequent radio frames are initialized - * with the previous radio frames */ - for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms;\ - dlIdx++) - { - sfNum = dlIdx - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx]\ - [RGSCH_NUM_SUB_FRAMES-1]; - cell->subFrms[dlIdx]->dlFdbkInfo.subframe = \ - cell->subFrms[sfNum]->dlFdbkInfo.subframe; - cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = \ - cell->subFrms[sfNum]->dlFdbkInfo.sfnOffset; - cell->subFrms[dlIdx]->dlFdbkInfo.m = cell->subFrms[sfNum]->dlFdbkInfo.m; - } - RETVALUE(ROK); -} - -/** - * @brief This function handles the initialization of uplink association - * set information for each DL subframe. - * - * - * @details - * - * Function: rgSCHCmnDlKdashUlAscInit - * Purpose: Each DL sf stores the sfn and sf information of UL sf - * in which it expects HQ ACK/NACK trans. It generates the information - * based on k` in UL association set index table. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlKdashUlAscInit -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlKdashUlAscInit(cell) -RgSchCellCb *cell; -#endif -{ - U8 sfCount; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 maxDlSubfrms = cell->numDlSubfrms; - U8 sfNum; - U8 dlIdx; - S8 calcSfnOffset; - S8 calcSfNum; - U8 ulSfCnt =0; - RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; - U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ - [RGSCH_NUM_SUB_FRAMES-1]; - U8 dlPres = 0; - - TRC2(rgSCHCmnDlKdashUlAscInit); - - /* Generate ACK/NACK offset information for each DL subframe in a radio frame - * Calculate this information based on K` in UL Association Set table */ - for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) - { - while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != - RG_SCH_TDD_UL_SUBFRAME) - { - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - ulSfCnt++; - - calcSfNum = (sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum] + \ - RGSCH_NUM_SUB_FRAMES) % RGSCH_NUM_SUB_FRAMES; - calcSfnOffset = sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum]; - if(calcSfnOffset < 0) - { - calcSfnOffset = RGSCH_CEIL(-calcSfnOffset, RGSCH_NUM_SUB_FRAMES); - } - else - { - calcSfnOffset = 0; - } - - if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) - { - dlIdx = calcSfNum; - } - else if((ulSubfrmInfo.switchPoints == 2) && - (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6)) - { - dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; - } - else - { - dlIdx = calcSfNum - maxUlSubfrms; - } - - cell->subFrms[dlIdx]->ulAscInfo.subframe = sfNum; - cell->subFrms[dlIdx]->ulAscInfo.sfnOffset = calcSfnOffset; - - /* set dlIdx for which ulAscInfo is updated */ - dlPres = dlPres | (1 << dlIdx); - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - - /* Set Invalid information for which ulAscInfo is not present */ - for (sfCount = 0; - sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - sfCount++) - { - /* If dlPres is 0, ulAscInfo is not present in that DL index */ - if(! ((dlPres >> sfCount)&0x01)) - { - cell->subFrms[sfCount]->ulAscInfo.sfnOffset = - RGSCH_INVALID_INFO; - cell->subFrms[sfCount]->ulAscInfo.subframe = - RGSCH_INVALID_INFO; - } - } - - /* DL subframes in the subsequent radio frames are initialized - * with the previous radio frames */ - for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms; - dlIdx++) - { - sfNum = dlIdx - \ - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - cell->subFrms[dlIdx]->ulAscInfo.subframe = - cell->subFrms[sfNum]->ulAscInfo.subframe; - cell->subFrms[dlIdx]->ulAscInfo.sfnOffset = - cell->subFrms[sfNum]->ulAscInfo.sfnOffset; - } - RETVALUE(ROK); -} - - -/** - * @brief This function initialises the 'Np' value for 'p' - * - * @details - * - * Function: rgSCHCmnDlNpValInit - * Purpose: To initialise the 'Np' value for each 'p'. It is used - * to find the mapping between nCCE and 'p' and used in - * HARQ ACK/NACK reception. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlNpValInit -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlNpValInit(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx; - U16 np; - TRC2(rgSCHCmnDlNpValInit); - - /* Always Np is 0 for p=0 */ - cell->rgSchTddNpValTbl[0] = 0; - - for(idx=1; idx < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; idx++) - { - np = cell->bwCfg.dlTotalBw * (idx * RG_SCH_CMN_NUM_SUBCAR - 4); - cell->rgSchTddNpValTbl[idx] = (U8) (np/36); - } - - RETVALUE(ROK); -} - -/** - * @brief This function handles the creation of RACH preamble - * list to queue the preambles and process at the scheduled - * time. - * - * @details - * - * Function: rgSCHCmnDlCreateRachPrmLst - * Purpose: To create RACH preamble list based on RA window size. - * It is used to queue the preambles and process it at the - * scheduled time. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlCreateRachPrmLst -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlCreateRachPrmLst(cell) -RgSchCellCb *cell; -#endif -{ - U8 raArrSz; - S16 ret; - U8 lstSize; - - TRC2(rgSCHCmnDlCreateRachPrmLst); - - RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz); - - lstSize = raArrSz * RGSCH_MAX_RA_RNTI_PER_SUBFRM * RGSCH_NUM_SUB_FRAMES; - - cell->raInfo.maxRaSize = raArrSz; - ret = rgSCHUtlAllocSBuf(cell->instIdx, - (Data **)(&cell->raInfo.raReqLst), (Size)(lstSize * sizeof(CmLListCp))); - if (ret != ROK) - { - RETVALUE(ret); - } - - cell->raInfo.lstSize = lstSize; - - RETVALUE(ROK); -} - - -/** - * @brief This function handles the initialization of RACH Response - * information at each DL subframe. - * - * @details - * - * Function: rgSCHCmnDlRachInfoInit - * Purpose: Each DL subframe stores the sfn and subframe information of - * possible RACH response allowed for UL subframes. It generates - * the information based on PRACH configuration. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlRachInfoInit -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlRachInfoInit(cell) -RgSchCellCb *cell; -#endif -{ - U8 sfCount; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 sfNum; - U8 ulSfCnt =0; - U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ - [RGSCH_NUM_SUB_FRAMES-1]; - U8 raArrSz; - RgSchTddRachRspLst rachRspLst[3][RGSCH_NUM_SUB_FRAMES]; - U8 startWin; - U8 endWin; - U8 sfnIdx; - U8 subfrmIdx; - U8 endSubfrmIdx; - U8 startSubfrmIdx; - S16 ret; - RgSchTddRachDelInfo *delInfo; - S8 sfnOffset; - U8 numSubfrms; - - TRC2(rgSCHCmnDlRachInfoInit); - - cmMemset((U8 *)rachRspLst, 0, sizeof(rachRspLst)); - - RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz); - - /* Include Special subframes */ - maxUlSubfrms = maxUlSubfrms + \ - rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx].switchPoints; - for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) - { - while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] == - RG_SCH_TDD_DL_SUBFRAME) - { - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - ulSfCnt++; - - startWin = (sfNum + RG_SCH_CMN_RARSP_WAIT_PRD + \ - ((RgSchCmnCell *)cell->sc.sch)->dl.numRaSubFrms); - endWin = (startWin + cell->rachCfg.raWinSize - 1); - startSubfrmIdx = - rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][startWin%RGSCH_NUM_SUB_FRAMES]; - /* Find the next DL subframe starting from Subframe 0 */ - if((startSubfrmIdx % RGSCH_NUM_SUB_FRAMES) == 0) - { - startWin = RGSCH_CEIL(startWin, RGSCH_NUM_SUB_FRAMES); - startWin = startWin * RGSCH_NUM_SUB_FRAMES; - } - - endSubfrmIdx = - rgSchTddLowDlSubfrmIdxTbl[ulDlCfgIdx][endWin%RGSCH_NUM_SUB_FRAMES]; - endWin = (endWin/RGSCH_NUM_SUB_FRAMES) * RGSCH_NUM_SUB_FRAMES \ - + endSubfrmIdx; - if(startWin > endWin) - { - continue; - } - /* Find all the possible RACH Response transmission - * time within the RA window size */ - startSubfrmIdx = startWin%RGSCH_NUM_SUB_FRAMES; - for(sfnIdx = startWin/RGSCH_NUM_SUB_FRAMES; - sfnIdx <= endWin/RGSCH_NUM_SUB_FRAMES; sfnIdx++) - { - if(sfnIdx == endWin/RGSCH_NUM_SUB_FRAMES) - { - endSubfrmIdx = endWin%RGSCH_NUM_SUB_FRAMES; - } - else - { - endSubfrmIdx = RGSCH_NUM_SUB_FRAMES-1; - } - - /* Find all the possible RACH Response transmission - * time within radio frame */ - for(subfrmIdx = startSubfrmIdx; - subfrmIdx <= endSubfrmIdx; subfrmIdx++) - { - if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][subfrmIdx] == - RG_SCH_TDD_UL_SUBFRAME) - { - continue; - } - subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx]; - /* Find the next DL subframe starting from Subframe 0 */ - if(subfrmIdx == RGSCH_NUM_SUB_FRAMES) - { - break; - } - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx], subfrmIdx); - numSubfrms = - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset = sfnIdx; - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].subframe[numSubfrms] - = sfNum; - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms++; - } - startSubfrmIdx = RG_SCH_CMN_SUBFRM_0; - } - /* Update the subframes to be deleted at this subframe */ - /* Get the subframe after the end of RA window size */ - endWin++; - endSubfrmIdx++; - sfnOffset = endWin/RGSCH_NUM_SUB_FRAMES; - if(sfnOffset < 0) - { - sfnOffset += raArrSz; - } - sfnIdx = (endWin/RGSCH_NUM_SUB_FRAMES) % raArrSz; - - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx],endSubfrmIdx-1); - if((endSubfrmIdx == RGSCH_NUM_SUB_FRAMES) || - (rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx] == - RGSCH_NUM_SUB_FRAMES)) - { - subfrmIdx = - rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][RG_SCH_CMN_SUBFRM_0]; - } - else - { - subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx]; - } - - delInfo = &rachRspLst[sfnIdx][subfrmIdx].delInfo; - delInfo->sfnOffset = sfnOffset; - delInfo->subframe[delInfo->numSubfrms] = sfNum; - delInfo->numSubfrms++; - - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - - ret = rgSCHCmnDlCpyRachInfo(cell, rachRspLst, raArrSz); - if (ret != ROK) - { - RETVALUE(ret); - } - - RETVALUE(ROK); -} - -/** - * @brief This function handles the initialization of PHICH information - * for each DL subframe based on PHICH table. - * - * @details - * - * Function: rgSCHCmnDlPhichOffsetInit - * Purpose: Each DL subf stores the sfn and subf information of UL subframe - * for which it trnsmts PHICH in this subframe. It generates the information - * based on PHICH table. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlPhichOffsetInit -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHCmnDlPhichOffsetInit(cell) -RgSchCellCb *cell; -#endif -{ - U8 sfCount; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 maxDlSubfrms = cell->numDlSubfrms; - U8 sfNum; - U8 dlIdx; - U8 dlPres = 0; - U8 calcSfnOffset; - U8 calcSfNum; - U8 ulSfCnt =0; - RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; - U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ - [RGSCH_NUM_SUB_FRAMES-1]; - - TRC2(rgSCHCmnDlPhichOffsetInit); - - /* Generate PHICH offset information for each DL subframe in a radio frame - * Calculate this information based on K in PHICH table */ - for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) - { - while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != - RG_SCH_TDD_UL_SUBFRAME) - { - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - ulSfCnt++; - - calcSfNum = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) % \ - RGSCH_NUM_SUB_FRAMES; - calcSfnOffset = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) / \ - RGSCH_NUM_SUB_FRAMES; - - if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) - { - dlIdx = calcSfNum; - } - else if((ulSubfrmInfo.switchPoints == 2) && - (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6)) - { - dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; - } - else - { - dlIdx = calcSfNum - maxUlSubfrms; - } - - cell->subFrms[dlIdx]->phichOffInfo.subframe = sfNum; - cell->subFrms[dlIdx]->phichOffInfo.numSubfrms = 1; - - cell->subFrms[dlIdx]->phichOffInfo.sfnOffset = calcSfnOffset; - - /* set dlIdx for which phich offset is updated */ - dlPres = dlPres | (1 << dlIdx); - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - - /* Set Invalid information for which phich offset is not present */ - for (sfCount = 0; - sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - sfCount++) - { - /* If dlPres is 0, phich offset is not present in that DL index */ - if(! ((dlPres >> sfCount)&0x01)) - { - cell->subFrms[sfCount]->phichOffInfo.sfnOffset = - RGSCH_INVALID_INFO; - cell->subFrms[sfCount]->phichOffInfo.subframe = - RGSCH_INVALID_INFO; - cell->subFrms[sfCount]->phichOffInfo.numSubfrms = 0; - } - } - - /* DL subframes in the subsequent radio frames are - * initialized with the previous radio frames */ - for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; - dlIdx < maxDlSubfrms; dlIdx++) - { - sfNum = dlIdx - \ - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - - cell->subFrms[dlIdx]->phichOffInfo.subframe = - cell->subFrms[sfNum]->phichOffInfo.subframe; - - cell->subFrms[dlIdx]->phichOffInfo.sfnOffset = - cell->subFrms[sfNum]->phichOffInfo.sfnOffset; - } - RETVALUE(ROK); -} - - -/** - * @brief Updation of Sch vars per TTI. - * - * @details - * - * Function: rgSCHCmnUpdVars - * Purpose: Updation of Sch vars per TTI. - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUpdVars -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHCmnUpdVars(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - CmLteTimingInfo timeInfo; - U8 idx; - U8 ulSubframe; - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 msg3Subfrm; - U8 Mval; - TRC2(rgSCHCmnUpdVars); - - /* ccpu00132654-ADD- Initializing all the indices in every subframe*/ - rgSCHCmnInitVars(cell); - - idx = (cell->crntTime.subframe + TFU_ULCNTRL_DLDELTA) % RGSCH_NUM_SUB_FRAMES; - /* Calculate the UL scheduling subframe idx based on the - Pusch k table */ - if(rgSchTddPuschTxKTbl[ulDlCfgIdx][idx] != 0) - { - /* PUSCH transmission is based on offset from DL - * PDCCH scheduling */ - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA); - ulSubframe = rgSchTddPuschTxKTbl[ulDlCfgIdx][timeInfo.subframe]; - /* Add the DCI-0 to PUSCH time to get the time of UL subframe */ - RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, ulSubframe); -#ifdef LTEMAC_SPS - cellUl->schdTti = timeInfo.sfn * 10 + timeInfo.subframe; -#endif - /* Fetch the corresponding UL subframe Idx in UL sf array */ - cellUl->schdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); - /* Fetch the corresponding UL Harq Proc ID */ - cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); - cellUl->schdTime = timeInfo; - } - Mval = rgSchTddPhichMValTbl[ulDlCfgIdx][idx]; - if(Mval) - { - /* Fetch the tx time for DL HIDCI-0 */ - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA); - /* Fetch the corresponding n-k tx time of PUSCH */ - cellUl->hqFdbkIdx[0] = rgSCHCmnGetPhichUlSfIdx(&timeInfo, cell); - /* Retx will happen according to the Pusch k table */ - cellUl->reTxIdx[0] = cellUl->schdIdx; - - if(ulDlCfgIdx == 0) - { - /* Calculate the ReTxIdx corresponding to hqFdbkIdx[0] */ - cellUl->reTxIdx[0] = rgSchUtlCfg0ReTxIdx(cell,timeInfo, - cellUl->hqFdbkIdx[0]); - if(Mval == 2) - { - /* At Idx 1 store the UL SF adjacent(left) to the UL SF - given at idx 0 */ - cellUl->hqFdbkIdx[1] = (cellUl->hqFdbkIdx[0]-1 + - cellUl->numUlSubfrms) % cellUl->numUlSubfrms; - /* Calculate the ReTxIdx corresponding to hqFdbkIdx[1] */ - cellUl->reTxIdx[1] = rgSchUtlCfg0ReTxIdx(cell,timeInfo, - cellUl->hqFdbkIdx[1]); - } - } - } - - idx = (cell->crntTime.subframe + TFU_RECPREQ_DLDELTA) % RGSCH_NUM_SUB_FRAMES; - if (rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] == RG_SCH_TDD_UL_SUBFRAME) - { - RGSCHCMNADDTOCRNTTIME(cell->crntTime, timeInfo, TFU_RECPREQ_DLDELTA) - cellUl->rcpReqIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); - } - idx = (cell->crntTime.subframe+RG_SCH_CMN_DL_DELTA) % RGSCH_NUM_SUB_FRAMES; - - /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in - special subframe */ - if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] != RG_SCH_TDD_UL_SUBFRAME) - { - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA) - msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe]; - RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, msg3Subfrm); - cellUl->msg3SchdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); - cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); - } -#ifdef LTEMAC_SPS - if(!rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][idx]) - { - cellUl->spsUlRsrvIdx = RGSCH_INVALID_INFO; - } - else - { - /* introduce some reuse with above code? */ - U8 offst; - RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA) - //offst = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe]; - offst = rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][timeInfo.subframe]; - RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, offst); - cellUl->spsUlRsrvIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); - /* The harq proc continues to be accessed and used the same delta before - * actual data occurance, and hence use the same idx */ - cellUl->spsUlRsrvHqProcIdx = cellUl->schdHqProcIdx; - } -#endif - - /* RACHO: update cmn sched specific RACH variables, - * mainly the prachMaskIndex */ - rgSCHCmnUpdRachParam(cell); - - RETVOID; -} - -/** - * @brief To get 'p' value from nCCE. - * - * @details - * - * Function: rgSCHCmnGetPValFrmCCE - * Purpose: Gets 'p' value for HARQ ACK/NACK reception from CCE. - * - * @param[in] RgSchCellCb *cell - * @param[in] U8 cce - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnGetPValFrmCCE -( -RgSchCellCb *cell, -U8 cce -) -#else -PUBLIC U8 rgSCHCmnGetPValFrmCCE(cell, cce) -RgSchCellCb *cell; -U8 cce; -#endif -{ - U8 i; - TRC2(rgSCHCmnGetPValFrmCCE); - - for(i=1; i < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; i++) - { - if(cce < cell->rgSchTddNpValTbl[i]) - { - RETVALUE(i-1); - } - } - RETVALUE(0); -} -#endif - -/*********************************************************** - * - * Func : rgSCHCmnUlAdapRetx - * - * Desc : Adaptive retransmission for an allocation. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlAdapRetx -( -RgSchUlAlloc *alloc, -RgSchUlHqProcCb *proc -) -#else -PRIVATE Void rgSCHCmnUlAdapRetx(alloc, proc) -RgSchUlAlloc *alloc; -RgSchUlHqProcCb *proc; -#endif -{ - TRC2(rgSCHCmnUlAdapRetx); - - rgSCHUhmRetx(proc, alloc); -#ifndef RG_5GTF - if (proc->rvIdx != 0) - { - alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[proc->rvIdx]; - } - else -#endif - { - alloc->grnt.iMcsCrnt = alloc->grnt.iMcs; - } - RETVOID; -} - -/** - * @brief Scheduler invocation per TTI. - * - * @details - * - * Function: rgSCHCmnHdlUlInactUes - * Purpose: - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnHdlUlInactUes -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnHdlUlInactUes(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - CmLListCp ulInactvLst; - TRC2(rgSCHCmnHdlUlInactUes); - /* Get a List of Inactv UEs for UL*/ - cmLListInit(&ulInactvLst); - - /* Trigger Spfc Schedulers with Inactive UEs */ - rgSCHMeasGapANRepGetUlInactvUe (cell, &ulInactvLst); - /* take care of this in UL retransmission */ - cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst); - - RETVOID; -} - -/** - * @brief Scheduler invocation per TTI. - * - * @details - * - * Function: rgSCHCmnHdlDlInactUes - * Purpose: - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnHdlDlInactUes -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnHdlDlInactUes(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - CmLListCp dlInactvLst; - TRC2(rgSCHCmnHdlDlInactUes); - /* Get a List of Inactv UEs for DL */ - cmLListInit(&dlInactvLst); - - /* Trigger Spfc Schedulers with Inactive UEs */ - rgSCHMeasGapANRepGetDlInactvUe (cell, &dlInactvLst); - - cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst); - RETVOID; -} - -/* RACHO: Rach handover functions start here */ -/*********************************************************** - * - * Func : rgSCHCmnUeIdleExdThrsld - * - * Desc : RETURN ROK if UE has been idle more - * than threshold. - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUeIdleExdThrsld -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE S16 rgSCHCmnUeIdleExdThrsld(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - /* Time difference in subframes */ - U32 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, ue->ul.ulTransTime); - - TRC2(rgSCHCmnUeIdleExdThrsld); - - if (sfDiff > (U32)RG_SCH_CMN_UE_IDLE_THRSLD(ue)) - { - RETVALUE(ROK); - } - else - { - RETVALUE(RFAILED); - } -} - - -/** - * @brief Scheduler processing for Ded Preambles on cell configuration. - * - * @details - * - * Function : rgSCHCmnCfgRachDedPrm - * - * This function does requisite initialisation - * for RACH Ded Preambles. - * - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnCfgRachDedPrm -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnCfgRachDedPrm(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - U32 gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP; - U32 sfDiff; - U8 cnt; - TRC2(rgSCHCmnCfgRachDedPrm); - - if (cell->macPreambleSet.pres == NOTPRSNT) - { - RETVOID; - } - cellSch->rachCfg.numDedPrm = cell->macPreambleSet.size; - cellSch->rachCfg.dedPrmStart = cell->macPreambleSet.start; - /* Initialize handover List */ - cmLListInit(&cellSch->rachCfg.hoUeLst); - /* Initialize pdcch Order List */ - cmLListInit(&cellSch->rachCfg.pdcchOdrLst); - - /* Intialize the rapId to UE mapping structure */ - for (cnt = 0; cntrachCfg.numDedPrm; cnt++) - { - cellSch->rachCfg.rapIdMap[cnt].rapId = cellSch->rachCfg.dedPrmStart + \ - cnt; - cmLListInit(&cellSch->rachCfg.rapIdMap[cnt].assgndUes); - } - /* Perform Prach Mask Idx, remDedPrm, applFrm initializations */ - /* Set remDedPrm as numDedPrm */ - cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm; - /* Initialize applFrm */ - cellSch->rachCfg.prachMskIndx = 0; - if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_EVEN) - { - cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + \ - (cell->crntTime.sfn % 2)) % RGSCH_MAX_SFN; - } -#ifdef LTE_TDD - else if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ODD) - { - if((cell->crntTime.sfn%2) == 0) - { - cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + 1)\ - % RGSCH_MAX_SFN; - } - } -#endif - else /* ANY sfn */ - { - cellSch->rachCfg.applFrm.sfn = cell->crntTime.sfn; - } - /* Initialize cellSch->rachCfg.applFrm as >= crntTime. - * This is because of RGSCH_CALC_SF_DIFF logic */ - if (cellSch->rachCfg.applFrm.sfn == cell->crntTime.sfn) - { - while (cellSch->rachCfg.prachMskIndx < cell->rachCfg.raOccasion.size) - { - if (cell->crntTime.subframe <\ - cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]) - { - break; - } - cellSch->rachCfg.prachMskIndx++; - } - if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size) - { - if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY) - { - cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) %\ - RGSCH_MAX_SFN; - } - else - { - cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) %\ - RGSCH_MAX_SFN; - } - cellSch->rachCfg.prachMskIndx = 0; - } - cellSch->rachCfg.applFrm.subframe = \ - cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; - } - else - { - cellSch->rachCfg.applFrm.subframe = \ - cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; - } - - /* Note first param to this macro should always be the latest in time */ - sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime); - while (sfDiff <= gap) - { - rgSCHCmnUpdNxtPrchMskIdx(cell); - sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime); - } - - RETVOID; -} - -/** - * @brief Updates the PRACH MASK INDEX. - * - * @details - * - * Function: rgSCHCmnUpdNxtPrchMskIdx - * Purpose: Ensures the "applFrm" field of Cmn Sched RACH - * CFG is always >= "n"+"DELTA", where "n" is the crntTime - * of the cell. If not, applFrm is updated to the next avl - * PRACH oppurtunity as per the PRACH Cfg Index configuration. - * - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - TRC2(rgSCHCmnUpdNxtPrchMskIdx); - - /* Determine the next prach mask Index */ - if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size - 1) - { - /* PRACH within applFrm.sfn are done, go to next AVL sfn */ - cellSch->rachCfg.prachMskIndx = 0; - if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY) - { - cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) % \ - RGSCH_MAX_SFN; - } - else/* RGR_SFN_EVEN or RGR_SFN_ODD */ - { - cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) % \ - RGSCH_MAX_SFN; - } - cellSch->rachCfg.applFrm.subframe = cell->rachCfg.raOccasion.\ - subFrameNum[0]; - } - else /* applFrm.sfn is still valid */ - { - cellSch->rachCfg.prachMskIndx += 1; - if ( cellSch->rachCfg.prachMskIndx < RGR_MAX_SUBFRAME_NUM ) - { - cellSch->rachCfg.applFrm.subframe = \ - cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; - } - } - RETVOID; -} - -/** - * @brief Updates the Ded preamble RACH parameters - * every TTI. - * - * @details - * - * Function: rgSCHCmnUpdRachParam - * Purpose: Ensures the "applFrm" field of Cmn Sched RACH - * CFG is always >= "n"+"6"+"DELTA", where "n" is the crntTime - * of the cell. If not, applFrm is updated to the next avl - * PRACH oppurtunity as per the PRACH Cfg Index configuration, - * accordingly the "remDedPrm" is reset to "numDedPrm" and - * "prachMskIdx" field is updated as per "applFrm". - * - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUpdRachParam -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnUpdRachParam(cell) -RgSchCellCb *cell; -#endif -{ - - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - U32 gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP; - U32 sfDiff; - TRC2(rgSCHCmnUpdRachParam); - - if (cell->macPreambleSet.pres == NOTPRSNT) - { - RETVOID; - } - sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, \ - cell->crntTime); - if (sfDiff > gap) - { - /* applFrm is still a valid next Prach Oppurtunity */ - RETVOID; - } - rgSCHCmnUpdNxtPrchMskIdx(cell); - /* Reset remDedPrm as numDedPrm */ - cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm; - - RETVOID; -} - -/** - * @brief Dedicated Preamble allocation function. - * - * @details - * - * Function: rgSCHCmnAllocPOParam - * Purpose: Allocate pdcch, rapId and PrachMskIdx. - * Set mapping of UE with the allocated rapId. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchUeCb *ue - * @param[out] RgSchPdcch **pdcch - * @param[out] U8 *rapId - * @param[out] U8 *prachMskIdx - * @return Void - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnAllocPOParam -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchUeCb *ue, -RgSchPdcch **pdcch, -U8 *rapId, -U8 *prachMskIdx -) -#else -PRIVATE S16 rgSCHCmnAllocPOParam(cell, dlSf, ue, pdcch, rapId, prachMskIdx) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchUeCb *ue; -RgSchPdcch **pdcch; -U8 *rapId; -U8 *prachMskIdx; -#endif -{ - - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnAllocPOParam); - - if (cell->macPreambleSet.pres == PRSNT_NODEF) - { - if (cellSch->rachCfg.remDedPrm == 0) - { - RETVALUE(RFAILED); - } - /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ - if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP) - { - RETVALUE(RFAILED); - } - /* The stored prachMskIdx is the index of PRACH Oppurtunities in - * raOccasions.subframes[]. - * Converting the same to the actual PRACHMskIdx to be transmitted. */ - *prachMskIdx = cellSch->rachCfg.prachMskIndx + 1; - /* Distribution starts from dedPrmStart till dedPrmStart + numDedPrm */ - *rapId = cellSch->rachCfg.dedPrmStart + - cellSch->rachCfg.numDedPrm - cellSch->rachCfg.remDedPrm; - cellSch->rachCfg.remDedPrm--; - /* Map UE with the allocated RapId */ - ueDl->rachInfo.asgnOppr = cellSch->rachCfg.applFrm; - RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, cellSch->rachCfg.rapIdMap, (*rapId - cellSch->rachCfg.dedPrmStart)); - cmLListAdd2Tail(&cellSch->rachCfg.rapIdMap[*rapId - cellSch->rachCfg.dedPrmStart].assgndUes, - &ueDl->rachInfo.rapIdLnk); - ueDl->rachInfo.rapIdLnk.node = (PTR)ue; - ueDl->rachInfo.poRapId = *rapId; - } - else /* if dedicated preambles not configured */ - { - /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ - if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP) - { - RETVALUE(RFAILED); - } - *prachMskIdx = 0; - *rapId = 0; - } - - RETVALUE(ROK); -} - -/** - * @brief Dowlink Scheduling Handler. - * - * @details - * - * Function: rgSCHCmnGenPdcchOrder - * Purpose: For each UE in PO Q, grab a PDCCH, - * get an available ded RapId and fill PDCCH - * with PO information. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnGenPdcchOrder -( -RgSchCellCb *cell, -RgSchDlSf *dlSf -) -#else -PRIVATE Void rgSCHCmnGenPdcchOrder(cell, dlSf) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - CmLList *node = cellSch->rachCfg.pdcchOdrLst.first; - RgSchUeCb *ue; - U8 rapId; - U8 prachMskIdx; - RgSchPdcch *pdcch = NULLP; - - TRC2(rgSCHCmnGenPdcchOrder); - - while (node) - { - ue = (RgSchUeCb *)node->node; - node = node->next; - /* Skip sending for this subframe is Measuring or inActive in UL due - * to MeasGap or inactie due to DRX - */ - if ((ue->measGapCb.isMeasuring == TRUE) || - (ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE) || - (ue->isDrxEnabled && - ue->dl.dlInactvMask & RG_DRX_INACTIVE) - ) - { - continue; - } - if (rgSCHCmnAllocPOParam(cell, dlSf, ue, &pdcch, &rapId,\ - &prachMskIdx) != ROK) - { - /* No More rapIds left for the valid next avl Oppurtunity. - * Unsatisfied UEs here would be given a chance, when the - * prach Mask Index changes as per rachUpd every TTI */ - - /* PDDCH can also be ordered with rapId=0, prachMskIdx=0 - * so that UE triggers a RACH procedure with non-dedicated preamble. - * But the implementation here does not do this. Instead, the "break" - * here implies, that PDCCH Odr always given with valid rapId!=0, - * prachMskIdx!=0 if dedicated preambles are configured. - * If not configured, then trigger a PO with rapId=0,prchMskIdx=0*/ - break; - } - /* Fill pdcch with pdcch odr information */ - rgSCHCmnFillPdcchOdr2Sf(cell, ue, pdcch, rapId, prachMskIdx); - /* Remove this UE from the PDCCH ORDER QUEUE */ - rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); - /* Reset UE's power state */ - rgSCHPwrUeReset(cell, ue); - } - RETVOID; -} - - -/** - * @brief This function add UE to PdcchOdr Q if not already present. - * - * @details - * - * Function: rgSCHCmnDlAdd2PdcchOdrQ - * Purpose: - * - * Invoked by: CMN Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnDlAdd2PdcchOdrQ); - - if (ueDl->rachInfo.poLnk.node == NULLP) - { - cmLListAdd2Tail(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk); - ueDl->rachInfo.poLnk.node = (PTR)ue; - } - RETVOID; -} - - -/** - * @brief This function rmvs UE to PdcchOdr Q if not already present. - * - * @details - * - * Function: rgSCHCmnDlRmvFrmPdcchOdrQ - * Purpose: - * - * Invoked by: CMN Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnDlRmvFrmPdcchOdrQ); - - cmLListDelFrm(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk); - ueDl->rachInfo.poLnk.node = NULLP; - RETVOID; -} - -/** - * @brief Fill pdcch with PDCCH order information. - * - * @details - * - * Function: rgSCHCmnFillPdcchOdr2Sf - * Purpose: Fill PDCCH with PDCCH order information, - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchUeCb *ue - * @param[in] RgSchPdcch *pdcch - * @param[in] U8 rapId - * @param[in] U8 prachMskIdx - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFillPdcchOdr2Sf -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchPdcch *pdcch, -U8 rapId, -U8 prachMskIdx -) -#else -PRIVATE Void rgSCHCmnFillPdcchOdr2Sf(ue, pdcch, rapId, prachMskIdx) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchPdcch *pdcch; -U8 rapId; -U8 prachMskIdx; -#endif -{ - RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell); - - TRC2(rgSCHCmnFillPdcchOdr2Sf); - - pdcch->rnti = ue->ueId; - pdcch->dci.dciFormat = TFU_DCI_FORMAT_1A; - pdcch->dci.u.format1aInfo.isPdcchOrder = TRUE; - pdcch->dci.u.format1aInfo.t.pdcchOrder.preambleIdx = rapId; - pdcch->dci.u.format1aInfo.t.pdcchOrder.prachMaskIdx = prachMskIdx; - - /* Request for APer CQI immediately after PDCCH Order */ - /* CR ccpu00144525 */ -#ifdef TFU_UPGRADE - if(ue->dl.ueDlCqiCfg.aprdCqiCfg.pres) - { - ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; - acqiCb->aCqiTrigWt = 0; - } -#endif - - RETVOID; -} - - -/** - * @brief UE deletion for scheduler. - * - * @details - * - * Function : rgSCHCmnDelRachInfo - * - * This functions deletes all scheduler information - * pertaining to an UE. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDelRachInfo -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnDelRachInfo(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 rapIdIdx; - - TRC2(rgSCHCmnDelRachInfo); - - if (ueDl->rachInfo.poLnk.node) - { - rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); - } - if (ueDl->rachInfo.hoLnk.node) - { - cmLListDelFrm(&cellSch->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk); - ueDl->rachInfo.hoLnk.node = NULLP; - } - if (ueDl->rachInfo.rapIdLnk.node) - { - rapIdIdx = ueDl->rachInfo.poRapId - cellSch->rachCfg.dedPrmStart; - cmLListDelFrm(&cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes, - &ueDl->rachInfo.rapIdLnk); - ueDl->rachInfo.rapIdLnk.node = NULLP; - } - RETVOID; -} - -/** - * @brief This function retrieves the ue which has sent this raReq - * and it allocates grant for UEs undergoing (for which RAR - * is being generated) HandOver/PdcchOrder. - * - * - * @details - * - * Function: rgSCHCmnHdlHoPo - * Purpose: This function retrieves the ue which has sent this raReq - * and it allocates grant for UEs undergoing (for which RAR - * is being generated) HandOver/PdcchOrder. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] CmLListCp *raRspLst - * @param[in] RgSchRaReqInfo *raReq - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnHdlHoPo -( -RgSchCellCb *cell, -CmLListCp *raRspLst, -RgSchRaReqInfo *raReq -) -#else -PRIVATE Void rgSCHCmnHdlHoPo(cell, raRspLst, raReq) -RgSchCellCb *cell; -CmLListCp *raRspLst; -RgSchRaReqInfo *raReq; -#endif -{ - RgSchUeCb *ue = raReq->ue; - TRC2(rgSCHCmnHdlHoPo); - - if ( ue->isDrxEnabled ) - { - rgSCHDrxDedRa(cell,ue); - } - rgSCHCmnAllocPoHoGrnt(cell, raRspLst, ue, raReq); - RETVOID; -} - -/** - * @brief This function retrieves the UE which has sent this raReq - * for handover case. - * - * - * @details - * - * Function: rgSCHCmnGetHoUe - * Purpose: This function retrieves the UE which has sent this raReq - * for handover case. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchRaReqInfo *raReq - * @return RgSchUeCb* - * - **/ -#ifdef ANSI -PUBLIC RgSchUeCb* rgSCHCmnGetHoUe -( -RgSchCellCb *cell, -U16 rapId -) -#else -PUBLIC RgSchUeCb* rgSCHCmnGetHoUe(cell, rapId) -RgSchCellCb *cell; -U16 rapId -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - CmLList *node; - CmLListCp *ueLst; - RgSchUeCb *ue; - RgSchCmnDlUe *ueDl; - TRC2(rgSCHCmnGetHoUe); - - ueLst = &cellSch->rachCfg.hoUeLst; - node = ueLst->first; - while (node) - { - ue = (RgSchUeCb *)node->node; - node = node->next; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - if (ueDl->rachInfo.hoRapId == rapId) - { - RETVALUE(ue); - } - } - RETVALUE(NULLP); -} - -#ifdef ANSI -PRIVATE Void rgSCHCmnDelDedPreamble -( -RgSchCellCb *cell, -U8 preambleId -) -#else -PRIVATE rgSCHCmnDelDedPreamble(cell, preambleId) -RgSchCellCb *cell; -U8 preambleId; -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - CmLList *node; - CmLListCp *ueLst; - RgSchUeCb *ue; - RgSchCmnDlUe *ueDl; - TRC2(rgSCHCmnDelDedPreamble); - - ueLst = &cellSch->rachCfg.hoUeLst; - node = ueLst->first; - while (node) - { - ue = (RgSchUeCb *)node->node; - node = node->next; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - if (ueDl->rachInfo.hoRapId == preambleId) - { - cmLListDelFrm(ueLst, &ueDl->rachInfo.hoLnk); - ueDl->rachInfo.hoLnk.node = (PTR)NULLP; - } - } -} - -/** - * @brief This function retrieves the UE which has sent this raReq - * for PDCCh Order case. - * - * - * @details - * - * Function: rgSCHCmnGetPoUe - * Purpose: This function retrieves the UE which has sent this raReq - * for PDCCH Order case. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchRaReqInfo *raReq - * @return RgSchUeCb* - * - **/ -#ifdef ANSI -PUBLIC RgSchUeCb* rgSCHCmnGetPoUe -( -RgSchCellCb *cell, -U16 rapId, -CmLteTimingInfo timingInfo -) -#else -PUBLIC RgSchUeCb* rgSCHCmnGetPoUe(cell, rapId, timingInfo) -RgSchCellCb *cell; -U16 rapId; -CmLteTimingInfo timingInfo; -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - CmLList *node; - CmLListCp *ueLst; - RgSchUeCb *ue; - RgSchCmnDlUe *ueDl; - U8 rapIdIdx; - TRC2(rgSCHCmnGetPoUe); - - rapIdIdx = rapId -cellSch->rachCfg.dedPrmStart; - ueLst = &cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes; - node = ueLst->first; - while (node) - { - ue = (RgSchUeCb *)node->node; - node = node->next; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - /* Remove UEs irrespective. - * Old UE associations are removed.*/ - cmLListDelFrm(ueLst, &ueDl->rachInfo.rapIdLnk); - ueDl->rachInfo.rapIdLnk.node = (PTR)NULLP; - if (RGSCH_TIMEINFO_SAME(ueDl->rachInfo.asgnOppr, timingInfo)) - { - RETVALUE(ue); - } - } - - RETVALUE(NULLP); -} - - -/** - * @brief This function returns the valid UL cqi for a given UE. - * - * @details - * - * Function: rgSCHCmnUlGetCqi - * Purpose: This function returns the "valid UL cqi" for a given UE - * based on UE category - * - * Invoked by: Scheduler - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 ueCtgy - * @return U8 - **/ -#ifdef ANSI -PUBLIC U8 rgSCHCmnUlGetCqi -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteUeCategory ueCtgy -) -#else -PUBLIC U8 rgSCHCmnUlGetCqi(cell, ue, ueCtgy) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteUeCategory ueCtgy; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - U8 cqi; - - TRC2(rgSCHCmnUlGetCqi); - - cqi = ueUl->maxUlCqi; -#ifdef TFU_UPGRADE - if (!((ueCtgy != CM_LTE_UE_CAT_5) && - (ueUl->validUlCqi > ueUl->maxUlCqi))) - { - cqi = ueUl->validUlCqi; - } -#else - if (!((ueCtgy != CM_LTE_UE_CAT_5) && - (ueUl->crntUlCqi[0] > ueUl->maxUlCqi ))) - { - cqi = ueUl->crntUlCqi[0]; - } -#endif - RETVALUE(cqi); -}/* End of rgSCHCmnUlGetCqi */ - -/*********************************************************** - * - * Func : rgSCHCmnUlRbAllocForPoHoUe - * - * Desc : Do uplink RB allocation for a HO/PO UE. - * - * Ret : - * - * Notes: Note that as of now, for retx, maxRb - * is not considered. Alternatives, such - * as dropping retx if it crosses maxRb - * could be considered. - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe -( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUeCb *ue, -U8 maxRb -) -#else -PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe(cell, sf, ue, maxRb) -RgSchCellCb *cell; -RgSchUlSf *sf; -RgSchUeCb *ue; -U8 maxRb; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - U8 sbSize = cellUl->sbSize; - U32 maxBits = ue->ul.maxBytesPerUePerTti*8; - U32 bits; - RgSchUlAlloc *alloc; - U32 nPrb; - U8 iTbs; - U32 eff; - U32 numSb; - U8 iMcs; - U8 iMcsCrnt; - U8 cqi; - U8 modOdr; - RgSchUlHole *hole; - RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->msg3SchdHqProcIdx]; - CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); - - TRC2(rgSCHCmnUlRbAllocForPoHoUe); - if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) - { - RETVALUE(RFAILED); - } - /*MS_WORKAROUND for HO ccpu00121116*/ - cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend], cqi); - iTbs = rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend][cqi]; - iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg); - while(iMcs > RG_SCH_CMN_MAX_MSG3_IMCS) - { - cqi--; - iTbs = rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend][cqi]; - iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs, ueCtg); - } - /* Filling the modorder in the grant structure*/ - RG_SCH_UL_MCS_TO_MODODR(iMcs,modOdr); - if (!cell->isCpUlExtend) - { - eff = rgSchCmnNorUlEff[0][iTbs]; - } - else - { - eff = rgSchCmnExtUlEff[0][iTbs]; - } - - bits = ueUl->alloc.reqBytes * 8; - -#if (ERRCLASS & ERRCLS_DEBUG) - if (!bits) - { - RETVALUE(RFAILED); - } -#endif - - if (bits < rgSCHCmnUlMinTbBitsForITbs(cellUl, iTbs)) - { - numSb = 1; - nPrb = numSb * sbSize; - } - else - { - if (bits > maxBits) - { - bits = maxBits; - nPrb = bits * 1024 / eff / RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl); - if (nPrb > maxRb) - { - nPrb = maxRb; - } - numSb = nPrb / sbSize; - } - else - { - /*ccpu00128775:MOD-Change to get upper threshold nPrb*/ - nPrb = RGSCH_CEIL((RGSCH_CEIL(bits * 1024, eff)), - RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl)); - if (nPrb > maxRb) - { - nPrb = maxRb; - } - numSb = RGSCH_DIV_ROUND(nPrb, sbSize); - } - } - iMcsCrnt = iMcs; - - alloc = rgSCHCmnUlSbAlloc(sf, (U8)RGSCH_MIN(numSb, cellUl->maxSbPerUe),\ - hole); - if (alloc == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnUlRbAllocForPoHoUe(): Could not get UlAlloc"); - RETVALUE(RFAILED); - } - rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); - - /* Filling the modorder in the grant structure start*/ - alloc->grnt.modOdr = (TfuModScheme) modOdr; - alloc->grnt.iMcs = iMcs; - alloc->grnt.iMcsCrnt = iMcsCrnt; - alloc->grnt.hop = 0; - /* Fix for ccpu00123915*/ - alloc->forMsg3 = TRUE; - alloc->hqProc = proc; - alloc->hqProc->ulSfIdx = cellUl->msg3SchdIdx; - alloc->ue = ue; - alloc->rnti = ue->ueId; - /* updating initNumRbs in case of HO */ -#ifdef TFU_UPGRADE - ue->initNumRbs = alloc->grnt.numRb; -#endif - ueUl->alloc.alloc = alloc; - iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs); - alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; - /* MS_WORKAROUND for HO ccpu00121124*/ - /*[Adi temp change] Need to fil modOdr */ - RG_SCH_UL_MCS_TO_MODODR(alloc->grnt.iMcsCrnt,alloc->grnt.modOdr); - rgSCHUhmNewTx(proc, ueUl->hqEnt.maxHqRetx, alloc); - /* No grant attr recorded now */ - RETVALUE(ROK); -} - -/** - * @brief This function allocates grant for UEs undergoing (for which RAR - * is being generated) HandOver/PdcchOrder. - * - * - * @details - * - * Function: rgSCHCmnAllocPoHoGrnt - * Purpose: This function allocates grant for UEs undergoing (for which RAR - * is being generated) HandOver/PdcchOrder. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[out] CmLListCp *raRspLst, - * @param[in] RgSchUeCb *ue - * @param[in] RgSchRaReqInfo *raReq - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnAllocPoHoGrnt -( -RgSchCellCb *cell, -CmLListCp *raRspLst, -RgSchUeCb *ue, -RgSchRaReqInfo *raReq -) -#else -PRIVATE Void rgSCHCmnAllocPoHoGrnt(cell, raRspLst, ue, raReq) -RgSchCellCb *cell; -CmLListCp *raRspLst; -RgSchUeCb *ue; -RgSchRaReqInfo *raReq; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - RgSchUlGrnt *grnt; - RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx]; - - TRC2(rgSCHCmnAllocPoHoGrnt); - - /* Clearing previous allocs if any*/ - rgSCHCmnUlUeDelAllocs(cell, ue); - /* Fix : syed allocs are limited */ - if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf) - { - RETVOID; - } - ueUl->alloc.reqBytes = RG_SCH_MIN_GRNT_HOPO; - if (rgSCHCmnUlRbAllocForPoHoUe(cell, sf, ue, RGSCH_MAX_UL_RB) != ROK) - { - RETVOID; - } - - /* Fill grant information */ - grnt = &ueUl->alloc.alloc->grnt; - - /* KWork fix */ - if (grnt == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_INSTID,cell->instIdx, "Failed to get" - "the grant for HO/PDCCH Order. CRNTI:%d",ue->ueId); - RETVOID; - } - ue->ul.rarGrnt.rapId = raReq->raReq.rapId; - ue->ul.rarGrnt.hop = grnt->hop; - ue->ul.rarGrnt.rbStart = grnt->rbStart; - ue->ul.rarGrnt.numRb = grnt->numRb; - ue->ul.rarGrnt.tpc = grnt->tpc; - ue->ul.rarGrnt.iMcsCrnt = grnt->iMcsCrnt; - ue->ul.rarGrnt.ta.pres = TRUE; - ue->ul.rarGrnt.ta.val = raReq->raReq.ta; - ue->ul.rarGrnt.datSz = grnt->datSz; - if((sf->numACqiCount < RG_SCH_MAX_ACQI_PER_ULSF) && (RG_SCH_APCQI_NO != ue->dl.reqForCqi)) - { -#ifdef LTE_ADV - U8 idx = 0; - /* Send two bits cqireq field if more than one cells are configured else one*/ - for (idx = 1;idx < CM_LTE_MAX_CELLS;idx++) - { - if (ue->cellInfo[idx] != NULLP) - { - ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi; - break; - } - } - if (idx == CM_LTE_MAX_CELLS) -#endif - { - ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi; - } - ue->dl.reqForCqi = RG_SCH_APCQI_NO; - sf->numACqiCount++; - } - else - { - ue->ul.rarGrnt.cqiReqBit = 0; - } - /* Attach Ho/Po allocation to RAR Rsp cont free Lst */ - cmLListAdd2Tail(raRspLst, &ue->ul.rarGrnt.raRspLnk); - ue->ul.rarGrnt.raRspLnk.node = (PTR)ue; - - RETVOID; -} - -/** - * @brief This is a utility function to set the fields in - * an UL harq proc which is identified for non-adaptive retx - * - * @details - * - * Function: rgSCHCmnUlNonadapRetx - * Purpose: Sets the fields in UL Harq proc for non-adaptive retx - * - * @param[in] RgSchCmnUlCell *cellUl - * @param[out] RgSchUlAlloc *alloc - * @param[in] U8 idx - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlNonadapRetx -( -RgSchCmnUlCell *cellUl, -RgSchUlAlloc *alloc, -U8 idx -) -#else -PRIVATE Void rgSCHCmnUlNonadapRetx(cellUl, alloc, idx) -RgSchCmnUlCell *cellUl; -RgSchUlAlloc *alloc; -U8 idx; -#endif -{ - TRC2(rgSCHCmnUlNonadapRetx); - rgSCHUhmRetx(alloc->hqProc, alloc); - - /* Update alloc to retx */ - alloc->hqProc->isRetx = TRUE; - alloc->hqProc->ulSfIdx = cellUl->reTxIdx[idx]; - - if (alloc->hqProc->rvIdx != 0) - { - alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[alloc->hqProc->rvIdx]; - } - else - { - alloc->grnt.iMcsCrnt = alloc->grnt.iMcs; - } - alloc->grnt.isRtx = TRUE; - alloc->pdcch = NULLP; - RETVOID; -} - -/** - * @brief Check if 2 allocs overlap - * - * @details - * - * Function : rgSCHCmnUlAllocsOvrLap - * - * - Return TRUE if alloc1 and alloc2 overlap. - * - * @param[in] RgSchUlAlloc *alloc1 - * @param[in] RgSchUlAlloc *alloc2 - * @return Bool - **/ -#ifdef ANSI -PRIVATE Bool rgSCHCmnUlAllocsOvrLap -( -RgSchUlAlloc *alloc1, -RgSchUlAlloc *alloc2 -) -#else -PRIVATE Bool rgSCHCmnUlAllocsOvrLap(alloc1, alloc2) -RgSchUlAlloc *alloc1; -RgSchUlAlloc *alloc2; -#endif -{ - - TRC2(rgSCHCmnUlAllocsOvrLap); - - if (((alloc1->sbStart >= alloc2->sbStart) && - (alloc1->sbStart <= alloc2->sbStart + alloc2->numSb-1)) || - ((alloc2->sbStart >= alloc1->sbStart) && - (alloc2->sbStart <= alloc1->sbStart + alloc1->numSb-1))) - { - RETVALUE(TRUE); - } - RETVALUE(FALSE); -} - -/** - * @brief Copy allocation Info from src to dst. - * - * @details - * - * Function : rgSCHCmnUlCpyAllocInfo - * - * - Copy allocation Info from src to dst. - * - * @param[in] RgSchUlAlloc *srcAlloc - * @param[in] RgSchUlAlloc *dstAlloc - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlCpyAllocInfo -( -RgSchCellCb *cell, -RgSchUlAlloc *srcAlloc, -RgSchUlAlloc *dstAlloc -) -#else -PRIVATE Void rgSCHCmnUlCpyAllocInfo(cell, srcAlloc, dstAlloc) -RgSchCellCb *cell; -RgSchUlAlloc *srcAlloc; -RgSchUlAlloc *dstAlloc; -#endif -{ - RgSchCmnUlUe *ueUl; - TRC2(rgSCHCmnUlCpyAllocInfo); - - dstAlloc->grnt = srcAlloc->grnt; - dstAlloc->hqProc = srcAlloc->hqProc; - /* Fix : syed During UE context release, hqProc->alloc - * was pointing to srcAlloc instead of dstAlloc and - * freeing from incorrect sf->allocDb was - * corrupting the list. */ - /* In case of SPS Occasion Allocation is done in advance and - at a later time Hq Proc is linked. Hence HqProc - pointer in alloc shall be NULL */ -#ifdef LTEMAC_SPS - if (dstAlloc->hqProc) -#endif - { - dstAlloc->hqProc->alloc = dstAlloc; - } - dstAlloc->ue = srcAlloc->ue; - dstAlloc->rnti = srcAlloc->rnti; - dstAlloc->forMsg3 = srcAlloc->forMsg3; - dstAlloc->raCb = srcAlloc->raCb; - dstAlloc->pdcch = srcAlloc->pdcch; - /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ - if (dstAlloc->ue) - { - ueUl = RG_SCH_CMN_GET_UL_UE(dstAlloc->ue,cell); - ueUl->alloc.alloc = dstAlloc; -#ifdef LTEMAC_SPS - if (dstAlloc->ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - if((dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc != NULLP) - && (dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc == srcAlloc)) - { - dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc = dstAlloc; - } - } -#endif - } - - RETVOID; -} - - -/** - * @brief Update TX and RETX subframe's allocation - * markings. - * - * @details - * - * Function : rgSCHCmnUlInsAllocFrmNewSf2OldSf - * - * - Release all preassigned allocations of newSf and merge - * them to oldSf. - * - If alloc of newSf collide with one or more allocs of oldSf - * - mark all such allocs of oldSf for Adaptive Retx. - * - Swap the alloc and hole DB references of oldSf and newSf. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *newSf - * @param[in] RgSchUlSf *oldSf - * @param[in] RgSchUlAlloc *srcAlloc - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlInsAllocFrmNewSf2OldSf -( -RgSchCellCb *cell, -RgSchUlSf *newSf, -RgSchUlSf *oldSf, -RgSchUlAlloc *srcAlloc -) -#else -PRIVATE Void rgSCHCmnUlInsAllocFrmNewSf2OldSf(cell, newSf, oldSf, srcAlloc) -RgSchCellCb *cell; -RgSchUlSf *newSf; -RgSchUlSf *oldSf; -RgSchUlAlloc *srcAlloc; -#endif -{ - RgSchUlAlloc *alloc, *dstAlloc, *nxtAlloc; - - /* MS_WORKAROUND ccpu00120827 */ - RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); - U8 remAllocs; - TRC2(rgSCHCmnUlInsAllocFrmNewSf2OldSf); - - if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP) - { - do - { - nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc); - /* If there is an overlap between alloc and srcAlloc - * then alloc is marked for Adaptive retx and it is released - * from txSf */ - if (rgSCHCmnUlAllocsOvrLap(alloc, srcAlloc) == TRUE) - { - rgSCHCmnUlUpdAllocRetx(cell, alloc); - rgSCHUtlUlAllocRls(oldSf, alloc); - } - /* No further allocs spanning the srcAlloc subbands */ - if (srcAlloc->sbStart + srcAlloc->numSb - 1 <= alloc->sbStart) - { - break; - } - } while ((alloc = nxtAlloc) != NULLP); - } - - /* After freeing all the colliding allocs, request for an allocation - * specifying the start and numSb with in txSf. This function should - * always return positively with a nonNULL dstAlloc */ - /* MS_WORKAROUND ccpu00120827 */ - remAllocs = schCmnCell->ul.maxAllocPerUlSf - *oldSf->allocCountRef; - if (!remAllocs) - { - /* Fix : If oldSf already has max Allocs then release the - * old RETX alloc to make space for new alloc of newSf. - * newSf allocs(i.e new Msg3s) are given higher priority - * over retx allocs. */ - if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP) - { - do - { - nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc); - if (!alloc->mrgdNewTxAlloc) - { - /* If alloc is for RETX */ - /* TODO: Incase of this ad also in case of choosing - * and alloc for ADAP RETX, we need to send ACK for - * the corresponding alloc in PHICH */ -#ifndef EMTC_ENABLE - rgSCHCmnUlFreeAllocation(cell, oldSf, alloc); -#else - rgSCHCmnUlFreeAllocation(cell, oldSf, alloc,FALSE); -#endif - break; - } - }while((alloc = nxtAlloc) != NULLP); - } - } - dstAlloc = rgSCHUtlUlGetSpfcAlloc(oldSf, srcAlloc->sbStart, srcAlloc->numSb); -#ifdef ERRCLS_KW - /* This should never happen */ - if (dstAlloc == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d " - "rgSCHUtlUlGetSpfcAlloc failed in rgSCHCmnUlInsAllocFrmNewSf2OldSf", - srcAlloc->rnti); - RETVOID; - } -#endif - /* Copy the srcAlloc's state information in to dstAlloc */ - rgSCHCmnUlCpyAllocInfo(cell, srcAlloc, dstAlloc); - /* Set new Tx merged Alloc Flag to TRUE, indicating that this - * alloc shall not be processed for non-adaptive retransmission */ - dstAlloc->mrgdNewTxAlloc = TRUE; - RETVOID; -} - -/** - * @brief Merge all allocations of newSf to oldSf. - * - * @details - * - * Function : rgSCHCmnUlMergeSfAllocs - * - * - Merge all allocations of newSf to oldSf. - * - If newSf's alloc collides with oldSf's alloc - * then oldSf's alloc is marked for adaptive Retx - * and is released from oldSf to create space for - * newSf's alloc. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *oldSf - * @param[in] RgSchUlSf *newSf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlMergeSfAllocs -( -RgSchCellCb *cell, -RgSchUlSf *oldSf, -RgSchUlSf *newSf -) -#else -PRIVATE Void rgSCHCmnUlMergeSfAllocs(cell, oldSf, newSf) -RgSchCellCb *cell; -RgSchUlSf *oldSf; -RgSchUlSf *newSf; -#endif -{ - RgSchUlAlloc *alloc, *nxtAlloc; - TRC2(rgSCHCmnUlMergeSfAllocs); - UNUSED(cell); - - /* Merge each alloc of newSf in to oldSf - * and release it from newSf */ - if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP) - { - do - { - nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc); - rgSCHCmnUlInsAllocFrmNewSf2OldSf(cell, newSf, oldSf, alloc); - rgSCHUtlUlAllocRls(newSf, alloc); - } while((alloc = nxtAlloc) != NULLP); - } - RETVOID; -} - -/** - * @brief Swap Hole/Alloc DB context of newSf and oldSf. - * - * @details - * - * Function : rgSCHCmnUlSwapSfAllocs - * - * - Swap Hole/Alloc DB context of newSf and oldSf. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *oldSf - * @param[in] RgSchUlSf *newSf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlSwapSfAllocs -( -RgSchCellCb *cell, -RgSchUlSf *oldSf, -RgSchUlSf *newSf -) -#else -PRIVATE Void rgSCHCmnUlSwapSfAllocs(cell, oldSf, newSf) -RgSchCellCb *cell; -RgSchUlSf *oldSf; -RgSchUlSf *newSf; -#endif -{ - RgSchUlAllocDb *tempAllocDb = newSf->allocDb; - RgSchUlHoleDb *tempHoleDb = newSf->holeDb; - U8 tempAvailSbs = newSf->availSubbands; - - TRC2(rgSCHCmnUlSwapSfAllocs); - UNUSED(cell); - - newSf->allocDb = oldSf->allocDb; - newSf->holeDb = oldSf->holeDb; - newSf->availSubbands = oldSf->availSubbands; - - oldSf->allocDb = tempAllocDb; - oldSf->holeDb = tempHoleDb; - oldSf->availSubbands = tempAvailSbs; - - /* Fix ccpu00120610*/ - newSf->allocCountRef = &newSf->allocDb->count; - oldSf->allocCountRef = &oldSf->allocDb->count; - RETVOID; -} - -/** - * @brief Perform non-adaptive RETX for non-colliding allocs. - * - * @details - * - * Function : rgSCHCmnUlPrcNonAdptRetx - * - * - Perform non-adaptive RETX for non-colliding allocs. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *newSf - * @param[in] U8 idx - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlPrcNonAdptRetx -( -RgSchCellCb *cell, -RgSchUlSf *newSf, -U8 idx -) -#else -PRIVATE Void rgSCHCmnUlPrcNonAdptRetx(cell, newSf, idx) -RgSchCellCb *cell; -RgSchUlSf *newSf; -U8 idx; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchUlAlloc *alloc, *nxtAlloc; - TRC2(rgSCHCmnUlPrcNonAdptRetx); - - /* perform non-adaptive retx allocation(adjustment) */ - if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP) - { - do - { - nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc); - /* A merged new TX alloc, reset the state and skip */ - if (alloc->mrgdNewTxAlloc) - { - alloc->mrgdNewTxAlloc = FALSE; - continue; - } - - - rgSCHCmnUlNonadapRetx(cellUl, alloc, idx); - - } while((alloc = nxtAlloc) != NULLP); - } - RETVOID; -} - -/** - * @brief Update TX and RETX subframe's allocation - * markings. - * - * @details - * - * Function : rgSCHCmnUlPrfmSfMerge - * - * - Release all preassigned allocations of newSf and merge - * them to oldSf. - * - If alloc of newSf collide with one or more allocs of oldSf - * - mark all such allocs of oldSf for Adaptive Retx. - * - Swap the alloc and hole DB references of oldSf and newSf. - * - The allocs which did not collide with pre-assigned msg3 - * allocs are marked for non-adaptive RETX. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *oldSf - * @param[in] RgSchUlSf *newSf - * @param[in] U8 idx - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlPrfmSfMerge -( -RgSchCellCb *cell, -RgSchUlSf *oldSf, -RgSchUlSf *newSf, -U8 idx -) -#else -PRIVATE Void rgSCHCmnUlPrfmSfMerge(cell, oldSf, newSf, idx) -RgSchCellCb *cell; -RgSchUlSf *oldSf; -RgSchUlSf *newSf; -U8 idx; -#endif -{ - TRC2(rgSCHCmnUlPrfmSfMerge); - /* Preassigned resources for msg3 in newSf. - * Hence do adaptive retx for all NACKED TXs */ - rgSCHCmnUlMergeSfAllocs(cell, oldSf, newSf); - /* swap alloc and hole DBs of oldSf and newSf. */ - rgSCHCmnUlSwapSfAllocs(cell, oldSf, newSf); - /* Here newSf has the resultant merged allocs context */ - /* Perform non-adaptive RETX for non-colliding allocs */ - rgSCHCmnUlPrcNonAdptRetx(cell, newSf, idx); - - RETVOID; -} - -/** - * @brief Update TX and RETX subframe's allocation - * markings. - * - * @details - * - * Function : rgSCHCmnUlRmvCmpltdAllocs - * - * - Free all Transmission which are ACKED - * OR for which MAX retransmission have - * occurred. - * - * - * @param[in] RgSchCellCb *cell, - * @param[in] RgSchUlSf *sf - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlRmvCmpltdAllocs -( -RgSchCellCb *cell, -RgSchUlSf *sf -) -#else -PRIVATE Void rgSCHCmnUlRmvCmpltdAllocs(cell, sf) -RgSchCellCb *cell; -RgSchUlSf *sf; -#endif -{ - RgSchUlAlloc *alloc, *nxtAlloc; - TRC2(rgSCHCmnUlRmvCmpltdAllocs); - - if ((alloc = rgSCHUtlUlAllocFirst(sf)) == NULLP) - { - RETVOID; - } - do - { - nxtAlloc = rgSCHUtlUlAllocNxt(sf, alloc); -#ifdef UL_ADPT_DBG - printf("rgSCHCmnUlRmvCmpltdAllocs:time(%d %d) alloc->hqProc->remTx %d hqProcId(%d) \n",cell->crntTime.sfn,cell->crntTime.subframe,alloc->hqProc->remTx, alloc->grnt.hqProcId); -#endif - alloc->hqProc->rcvdCrcInd = TRUE; - if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0)) - { - - /* SR_RACH_STATS : MSG 3 MAX RETX FAIL*/ - if ((alloc->forMsg3 == TRUE) && (alloc->hqProc->remTx == 0)) - { - rgNumMsg3FailMaxRetx++; -#ifdef TENB_STATS - cell->tenbStats->sch.msg3Fail++; -#endif - } - -#ifdef MAC_SCH_STATS - if(alloc->ue != NULLP) - { - /* access from ulHarqProc*/ - RgSchUeCb *ueCb = alloc->ue; - RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch; - RgSchCmnUlUe *ulUe = &(cmnUe->ul); - U8 cqi = ulUe->crntUlCqi[0]; - U16 numUlRetx = ueCb->ul.hqEnt.maxHqRetx - alloc->hqProc->remTx; - - hqRetxStats.ulCqiStat[(cqi - 1)].mcs = alloc->grnt.iMcs; - - switch (numUlRetx) - { - case 1: - hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1++; - break; - case 2: - hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2++; - break; - case 3: - hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3++; - break; - case 4: - hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4++; - break; - } - hqRetxStats.ulCqiStat[(cqi - 1)].totalTx = \ - hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1 + \ - (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2 * 2) + \ - (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3 * 3) + \ - (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4 * 4); - } - -#endif /*MAC_SCH_STATS*/ - rgSCHCmnUlFreeAllocation(cell, sf, alloc); - } - /*ccpu00106104 MOD added check for AckNackRep */ - /*added check for acknack so that adaptive retx considers ue - inactivity due to ack nack repetition*/ - else if((alloc->ue != NULLP) && (TRUE != alloc->forMsg3)) - { - rgSCHCmnUlUpdAllocRetx(cell, alloc); - rgSCHUtlUlAllocRls(sf, alloc); - } - } while ((alloc = nxtAlloc) != NULLP); - - RETVOID; -} - -/** - * @brief Update an uplink subframe. - * - * @details - * - * Function : rgSCHCmnRlsUlSf - * - * For each allocation - * - if no more tx needed - * - Release allocation - * - else - * - Perform retransmission - * - * @param[in] RgSchUlSf *sf - * @param[in] U8 idx - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnRlsUlSf -( -RgSchCellCb *cell, -U8 idx -) -#else -PUBLIC Void rgSCHCmnRlsUlSf(cell, idx) -RgSchCellCb *cell; -U8 idx; -#endif -{ - TRC2(rgSCHCmnRlsUlSf); - - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - - if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) - { - RgSchUlSf *oldSf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; - - /* Initialize the reTxLst of UL HqProcs for RETX subframe */ - if (rgSCHUtlUlAllocFirst(oldSf) == NULLP) - { - RETVOID; - } - /* Release all completed TX allocs from sf */ - rgSCHCmnUlRmvCmpltdAllocs(cell, oldSf); - - oldSf->numACqiCount = 0; - } - RETVOID; -} - -/** - * @brief Handle uplink allocation for retransmission. - * - * @details - * - * Function : rgSCHCmnUlUpdAllocRetx - * - * - Perform adaptive retransmission - * - * @param[in] RgSchUlSf *sf - * @param[in] RgSchUlAlloc *alloc - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlUpdAllocRetx -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc -) -#else -PRIVATE Void rgSCHCmnUlUpdAllocRetx(cell, alloc) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -#endif -{ - RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); - - TRC2(rgSCHCmnUlUpdAllocRetx); - - alloc->hqProc->reTxAlloc.rnti = alloc->rnti; - alloc->hqProc->reTxAlloc.numSb = alloc->numSb; - alloc->hqProc->reTxAlloc.iMcs = alloc->grnt.iMcs; -#ifdef RG_5GTF - alloc->hqProc->reTxAlloc.dciFrmt = alloc->grnt.dciFrmt; - alloc->hqProc->reTxAlloc.numLyr = alloc->grnt.numLyr; - alloc->hqProc->reTxAlloc.vrbgStart = alloc->grnt.vrbgStart; - alloc->hqProc->reTxAlloc.numVrbg = alloc->grnt.numVrbg; - alloc->hqProc->reTxAlloc.modOdr = alloc->grnt.modOdr; -#endif - //iTbs = rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); - //iTbs = alloc->grnt.iMcs; - //RGSCH_ARRAY_BOUND_CHECK( 0, rgTbSzTbl[0], iTbs); - alloc->hqProc->reTxAlloc.tbSz = alloc->grnt.datSz; - //rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1]/8; - alloc->hqProc->reTxAlloc.ue = alloc->ue; - alloc->hqProc->reTxAlloc.forMsg3 = alloc->forMsg3; - alloc->hqProc->reTxAlloc.raCb = alloc->raCb; - - /* Set as retransmission is pending */ - alloc->hqProc->isRetx = TRUE; - alloc->hqProc->alloc = NULLP; - alloc->hqProc->ulSfIdx = RGSCH_INVALID_INFO; -#ifdef UL_ADPT_DBG - printf("Adding Harq Proc Id in the retx list hqProcId %d \n",alloc->grnt.hqProcId); -#endif - cmLListAdd2Tail(&cmnUlCell->reTxLst, &alloc->hqProc->reTxLnk); - alloc->hqProc->reTxLnk.node = (PTR)alloc->hqProc; - RETVOID; -} - -/** - * @brief Attempts allocation for msg3s for which ADAP retransmissions - * are required. - * - * @details - * - * Function : rgSCHCmnUlAdapRetxAlloc - * - * Attempts allocation for msg3s for which ADAP retransmissions - * are required. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *sf - * @param[in] RgSchUlHqProcCb *proc; - * @param[in] RgSchUlHole *hole; - * @return U8 - **/ -#ifdef ANSI -PRIVATE Bool rgSCHCmnUlAdapRetxAlloc -( -RgSchCellCb *cell, -RgSchUlSf *sf, -RgSchUlHqProcCb *proc, -RgSchUlHole *hole -) -#else -PRIVATE Bool rgSCHCmnUlAdapRetxAlloc(cell, sf, proc, hole) -RgSchCellCb *cell; -RgSchUlSf *sf; -RgSchUlHqProcCb *proc; -RgSchUlHole *hole; -#endif -{ - U8 numSb = proc->reTxAlloc.numSb; - U8 iMcs = proc->reTxAlloc.iMcs; - CmLteTimingInfo frm = cell->crntTime; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchDlSf *dlSf; - RgSchPdcch *pdcch; - RgSchUlAlloc *alloc; - TRC2(rgSCHCmnUlAdapRetxAlloc); - - /* Fetch PDCCH for msg3 */ - /* ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ - /* Introduced timing delta for UL control */ - RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); - dlSf = rgSCHUtlSubFrmGet(cell, frm); - pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); - if (pdcch == NULLP) - { - RETVALUE(FALSE); - } - - /* Fetch UL Alloc for msg3 */ - if (numSb <= hole->num) - { - alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole); - - /* KWork fix */ - if(alloc == NULLP) - { - rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch); - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "UL Alloc fail for msg3 retx for rnti: %d\n", - proc->reTxAlloc.rnti); - RETVALUE(FALSE); - } - - rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); - alloc->grnt.iMcs = iMcs; - alloc->grnt.datSz = proc->reTxAlloc.tbSz; -#ifdef RG_5GTF -#else - //RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr); -#endif - /* Fill UL Alloc for msg3 */ - /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/ - alloc->grnt.nDmrs = 0; - alloc->grnt.hop = 0; - alloc->grnt.delayBit = 0; - alloc->grnt.isRtx = TRUE; - proc->ulSfIdx = cellUl->schdIdx; -#ifdef RG_5GTF - proc->schdTime = cellUl->schdTime; - alloc->grnt.hqProcId = proc->procId; - alloc->grnt.dciFrmt = proc->reTxAlloc.dciFrmt; - alloc->grnt.numLyr = proc->reTxAlloc.numLyr; - alloc->grnt.vrbgStart = proc->reTxAlloc.vrbgStart; - alloc->grnt.numVrbg = proc->reTxAlloc.numVrbg; - alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg); - alloc->grnt.modOdr = proc->reTxAlloc.modOdr; - - /* TODO : Hardcoding these as of now */ - alloc->grnt.hop = 0; - alloc->grnt.SCID = 0; - alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE; - alloc->grnt.PMI = 0; - alloc->grnt.uciOnxPUSCH = 0; -#endif - alloc->rnti = proc->reTxAlloc.rnti; - /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ - alloc->ue = proc->reTxAlloc.ue; - alloc->pdcch = pdcch; - alloc->forMsg3 = proc->reTxAlloc.forMsg3; - alloc->raCb = proc->reTxAlloc.raCb; - alloc->hqProc = proc; - alloc->isAdaptive = TRUE; -#ifdef LTE_L2_MEAS - sf->totPrb += alloc->grnt.numRb; -#endif - /* FIX : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ - if (alloc->raCb) - { - alloc->raCb->msg3Grnt= alloc->grnt; -#ifndef LTE_TDD - /* To the crntTime, add the time at which UE will - * actually send MSG3 */ - alloc->raCb->msg3AllocTime = cell->crntTime; - RGSCH_INCR_SUB_FRAME(alloc->raCb->msg3AllocTime, RG_SCH_CMN_MIN_RETXMSG3_RECP_INTRVL); -#else - alloc->raCb->msg3AllocTime = cellUl->schdTime; -#endif - rgSCHCmnUlAdapRetx(alloc, proc); - /* Fill PDCCH with alloc info */ - pdcch->rnti = alloc->rnti; - pdcch->dci.dciFormat = TFU_DCI_FORMAT_0; - pdcch->dci.u.format0Info.hoppingEnbld = alloc->grnt.hop; - pdcch->dci.u.format0Info.rbStart = alloc->grnt.rbStart; - pdcch->dci.u.format0Info.numRb = alloc->grnt.numRb; - pdcch->dci.u.format0Info.mcs = alloc->grnt.iMcsCrnt; - pdcch->dci.u.format0Info.ndi = alloc->hqProc->ndi; - pdcch->dci.u.format0Info.nDmrs = alloc->grnt.nDmrs; - pdcch->dci.u.format0Info.tpcCmd = alloc->grnt.tpc; - -#ifdef LTE_TDD -#ifdef TFU_TDD - /* ulIdx setting for cfg 0 shall be appropriately fixed thru ccpu00109015 */ - pdcch->dci.u.format0Info.ulIdx = RG_SCH_ULIDX_MSB; - pdcch->dci.u.format0Info.dai = RG_SCH_MAX_DAI_IDX; -#endif -#endif - pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_0]; - } - else - { - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue,cell); -#ifdef TFU_UPGRADE - alloc->ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); -#endif -#ifdef LTE_L2_MEAS - ue->ul.nPrb = alloc->grnt.numRb; -#endif - ueUl->alloc.alloc = alloc; - /* FIx: Removed the call to rgSCHCmnUlAdapRetx */ - rgSCHCmnUlUeFillAllocInfo(cell, alloc->ue); - /* Setting csireq as false for Adaptive Retx*/ - ueUl->alloc.alloc->pdcch->dci.u.format0Info.cqiReq = RG_SCH_APCQI_NO; - pdcch->dciNumOfBits = alloc->ue->dciSize.cmnSize[TFU_DCI_FORMAT_0]; - } - /* Reset as retransmission is done */ - proc->isRetx = FALSE; - } - else /* Intg fix */ - { - rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch); - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, - "Num SB not suffiecient for adap retx for rnti: %d", - proc->reTxAlloc.rnti); - RETVALUE(FALSE); - } - RETVALUE(TRUE); -} - -/* Fix: syed Adaptive Msg3 Retx crash. */ -/** - * @brief Releases all Adaptive Retx HqProcs which failed for - * allocations in this scheduling occassion. - * - * @details - * - * Function : rgSCHCmnUlSfRlsRetxProcs - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *sf - * @return U8 - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlSfRlsRetxProcs -( -RgSchCellCb *cell, -RgSchUlSf *sf -) -#else -PRIVATE Void rgSCHCmnUlSfRlsRetxProcs(cell, sf) -RgSchCellCb *cell; -RgSchUlSf *sf; -#endif -{ - CmLListCp *cp; - CmLList *node; - RgSchUlHqProcCb *proc; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - - TRC2(rgSCHCmnUlSfRlsRetxProcs); - - cp = &(cellUl->reTxLst); - node = cp->first; - while (node) - { - proc = (RgSchUlHqProcCb *)node->node; - node = node->next; - /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */ - cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); - proc->reTxLnk.node = (PTR)NULLP; - } - RETVOID; -} - - -/** - * @brief Attempts allocation for UEs for which retransmissions - * are required. - * - * @details - * - * Function : rgSCHCmnUlSfReTxAllocs - * - * Attempts allocation for UEs for which retransmissions - * are required. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlSf *sf - * @return U8 - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnUlSfReTxAllocs -( -RgSchCellCb *cell, -RgSchUlSf *sf -) -#else -PRIVATE Void rgSCHCmnUlSfReTxAllocs(cell, sf) -RgSchCellCb *cell; -RgSchUlSf *sf; -#endif -{ - CmLListCp *cp; - CmLList *node; - RgSchUlHqProcCb *proc; - RgSchUlHole *hole; - RgSchUeCb *ue; - RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - TRC2(rgSCHCmnUlSfReTxAllocs); - - cp = &(cellUl->reTxLst); - node = cp->first; - while ((node)) - { - proc = (RgSchUlHqProcCb *)node->node; - ue = proc->reTxAlloc.ue; - node = node->next; - /*ccpu00106104 MOD added check for AckNackRep */ - /*added check for acknack so that adaptive retx considers ue - inactivity due to ack nack repetition*/ - if((ue != NULLP) && - ((ue->measGapCb.isMeasuring == TRUE)|| - (ue->ackNakRepCb.isAckNakRep == TRUE))) - { - continue; - } - /* Fix for ccpu00123917: Check if maximum allocs per UL sf have been exhausted */ - if (((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) - || (sf->allocDb->count == schCmnCell->ul.maxAllocPerUlSf)) - { - /* No more UL BW then return */ - break; - } - /* perform adaptive retx for UE's */ - if (rgSCHCmnUlAdapRetxAlloc(cell, sf, proc, hole) == FALSE) - { - continue; - } - /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */ - cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); - /* Fix: syed Adaptive Msg3 Retx crash. */ - proc->reTxLnk.node = (PTR)NULLP; - } - RETVOID; -} - -/** - * @brief Handles RB allocation for downlink. - * - * @details - * - * Function : rgSCHCmnDlRbAlloc - * - * Invoking Module Processing: - * - This function is invoked for DL RB allocation - * - * Processing Steps: - * - If cell is frequency selecive, - * - Call rgSCHDlfsAllocRb(). - * - else, - * - Call rgSCHCmnNonDlfsRbAlloc(). - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlRbAllocInfo *allocInfo - * @return Void - **/ - -#ifdef ANSI -PRIVATE Void rgSCHCmnDlRbAlloc -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnDlRbAlloc(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - TRC2(rgSCHCmnDlRbAlloc); - - if (cellSch->dl.isDlFreqSel) - { - printf("5GTF_ERROR DLFS SCH Enabled\n"); - cellSch->apisDlfs->rgSCHDlfsAllocRb(cell, allocInfo); - } - else - { - rgSCHCmnNonDlfsRbAlloc(cell, allocInfo); - } - RETVOID; -} - -#ifdef LTEMAC_SPS - -/** - * @brief Determines number of RBGs and RBG subset sizes for the given DL - * bandwidth and rbgSize - * - * @details - * Function : rgSCHCmnDlGetRbgInfo - * - * - * Processing Steps: - * - Fill-up rbgInfo data structure for given DL bandwidth and rbgSize - * - * @param[in] U8 dlTotalBw - * @param[in] U8 dlSubsetBw - * @param[in] U8 maxRaType1SubsetBw - * @param[in] U8 rbgSize - * @param[out] RgSchBwRbgInfo *rbgInfo - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlGetRbgInfo -( -U8 dlTotalBw, -U8 dlSubsetBw, -U8 maxRaType1SubsetBw, -U8 rbgSize, -RgSchBwRbgInfo *rbgInfo -) -#else -PUBLIC Void rgSCHCmnDlGetRbgInfo(dlTotalBw, dlSubsetBw, maxRaType1SubsetBw, - rbgSize, rbgInfo) -U8 dlTotalBw; -U8 dlSubsetBw; -U8 maxRaType1SubsetBw; -U8 rbgSize; -RgSchBwRbgInfo *rbgInfo; -#endif -{ -#ifdef RGSCH_SPS_UNUSED - U8 idx = 0; - U8 lastRbgIdx = ((dlTotalBw + rbgSize - 1)/rbgSize) - 1; - U8 currRbgSize = rbgSize; - U8 subsetSizeIdx = 0; - U8 subsetSize[RG_SCH_NUM_RATYPE1_SUBSETS] = {0}; - U8 lastRbgSize = rbgSize - (dlTotalBw - ((dlTotalBw/rbgSize) * rbgSize)); - U8 numRaType1Rbgs = (maxRaType1SubsetBw + rbgSize - 1)/rbgSize; -#endif - - /* Compute maximum number of SPS RBGs for the cell */ - rbgInfo->numRbgs = ((dlSubsetBw + rbgSize - 1)/rbgSize); - -#ifdef RGSCH_SPS_UNUSED - /* Distribute RBGs across subsets except last RBG */ - for (;idx < numRaType1Rbgs - 1; ++idx) - { - subsetSize[subsetSizeIdx] += currRbgSize; - subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize; - } - - /* Computation for last RBG */ - if (idx == lastRbgIdx) - { - currRbgSize = lastRbgSize; - } - subsetSize[subsetSizeIdx] += currRbgSize; - subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize; -#endif - - /* Update the computed sizes */ -#ifdef RGSCH_SPS_UNUSED - rbgInfo->lastRbgSize = currRbgSize; -#endif - rbgInfo->lastRbgSize = rbgSize - - (dlSubsetBw - ((dlSubsetBw/rbgSize) * rbgSize)); -#ifdef RGSCH_SPS_UNUSED - cmMemcpy((U8 *)rbgInfo->rbgSubsetSize, (U8 *) subsetSize, 4 * sizeof(U8)); -#endif - rbgInfo->numRbs = (rbgInfo->numRbgs * rbgSize > dlTotalBw) ? - dlTotalBw:(rbgInfo->numRbgs * rbgSize); - rbgInfo->rbgSize = rbgSize; -} - -/** - * @brief Handles RB allocation for Resource allocation type 0 - * - * @details - * - * Function : rgSCHCmnDlRaType0Alloc - * - * Invoking Module Processing: - * - This function is invoked for DL RB allocation for resource allocation - * type 0 - * - * Processing Steps: - * - Determine the available positions in the rbgMask. - * - Allocate RBGs in the available positions. - * - Update RA Type 0, RA Type 1 and RA type 2 masks. - * - * @param[in] RgSchDlSfAllocInfo *allocedInfo - * @param[in] U8 rbsReq - * @param[in] RgSchBwRbgInfo *rbgInfo - * @param[out] U8 *numAllocRbs - * @param[out] RgSchDlSfAllocInfo *resAllocInfo - * @param[in] Bool isPartialAlloc - * - * @return Void - **/ - -#ifdef ANSI -PUBLIC U8 rgSCHCmnDlRaType0Alloc -( -RgSchDlSfAllocInfo *allocedInfo, -U8 rbsReq, -RgSchBwRbgInfo *rbgInfo, -U8 *numAllocRbs, -RgSchDlSfAllocInfo *resAllocInfo, -Bool isPartialAlloc -) -#else -PUBLIC U8 rgSCHCmnDlRaType0Alloc(allocedInfo, rbsReq, rbgInfo, - numAllocRbs, resAllocInfo, isPartialAlloc) -RgSchDlSfAllocInfo *allocedInfo; -U8 rbsReq; -RgSchBwRbgInfo *rbgInfo; -U8 *numAllocRbs; -RgSchDlSfAllocInfo *resAllocInfo; -Bool isPartialAlloc; -#endif -{ - /* Note: This function atttempts allocation only full allocation */ - U32 remNumRbs, rbgPosInRbgMask, ueRaType2Mask; - U8 type2MaskIdx, cnt, rbIdx; - U8 maskSize, rbg; - U8 bestNumAvailRbs = 0; - U8 usedRbs = 0; - U8 numAllocRbgs = 0; - U8 rbgSize = rbgInfo->rbgSize; - U32 *rbgMask = &(resAllocInfo->raType0Mask); -#ifdef RGSCH_SPS_UNUSED - U8 rbgSubset; - U32 ueRaType1Mask; - U32 *raType1Mask = resAllocInfo->raType1Mask; - U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; -#endif - U32 *raType2Mask = resAllocInfo->raType2Mask; - - U32 allocedMask = allocedInfo->raType0Mask; - - maskSize = rbgInfo->numRbgs; - - *numAllocRbs = 0; - RG_SCH_CMN_DL_COUNT_ONES(allocedMask, maskSize, &usedRbs); - if (maskSize == usedRbs) - { - /* All RBGs are allocated, including the last one */ - remNumRbs = 0; - } - else - { - remNumRbs = (maskSize - usedRbs - 1) * rbgSize; /* vamsee: removed minus 1 */ - - /* If last RBG is available, add last RBG size */ - if (!(allocedMask & (1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(maskSize - 1)))) - { - remNumRbs += rbgInfo->lastRbgSize; - } - } - - /* If complete allocation is needed, check if total requested RBs are available else - * check the best available RBs */ - if (!isPartialAlloc) - { - if (remNumRbs >= rbsReq) - { - bestNumAvailRbs = rbsReq; - } - } - else - { - bestNumAvailRbs = remNumRbs > rbsReq ? rbsReq : remNumRbs; - } - - /* Allocate for bestNumAvailRbs */ - if (bestNumAvailRbs) - { - for (rbg = 0; rbg < maskSize - 1; ++rbg) - { - rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); - if (!(allocedMask & rbgPosInRbgMask)) - { - /* Update RBG mask */ - *rbgMask |= rbgPosInRbgMask; - - /* Compute RB index of the first RB of the RBG allocated */ - rbIdx = rbg * rbgSize; - - for (cnt = 0; cnt < rbgSize; ++cnt) - { -#ifdef RGSCH_SPS_UNUSED - ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); -#endif - ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); -#ifdef RGSCH_SPS_UNUSED - /* Update RBG mask for RA type 1 */ - raType1Mask[rbgSubset] |= ueRaType1Mask; - raType1UsedRbs[rbgSubset]++; -#endif - /* Update RA type 2 mask */ - raType2Mask[type2MaskIdx] |= ueRaType2Mask; - rbIdx++; - } - *numAllocRbs += rbgSize; - remNumRbs -= rbgSize; - ++numAllocRbgs; - if (*numAllocRbs >= bestNumAvailRbs) - { - break; - } - } - } - /* If last RBG available and allocation is not completed, allocate - * last RBG */ - if (*numAllocRbs < bestNumAvailRbs) - { - rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); - *rbgMask |= rbgPosInRbgMask; - *numAllocRbs += rbgInfo->lastRbgSize; - - /* Compute RB index of the first RB of the last RBG */ - rbIdx = ((rbgInfo->numRbgs - 1 ) * rbgSize ); /* removed minus 1 vamsee */ - - for (cnt = 0; cnt < rbgInfo->lastRbgSize; ++cnt) - { -#ifdef RGSCH_SPS_UNUSED - ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); -#endif - ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); -#ifdef RGSCH_SPS_UNUSED - /* Update RBG mask for RA type 1 */ - raType1Mask[rbgSubset] |= ueRaType1Mask; - raType1UsedRbs[rbgSubset]++; -#endif - /* Update RA type 2 mask */ - raType2Mask[type2MaskIdx] |= ueRaType2Mask; - rbIdx++; - } - remNumRbs -= rbgInfo->lastRbgSize; - ++numAllocRbgs; - } - /* Note: this should complete allocation, not checking for the - * same */ - } - - RETVALUE(numAllocRbgs); -} - -#ifdef RGSCH_SPS_UNUSED -/** - * @brief Handles RB allocation for Resource allocation type 1 - * - * @details - * - * Function : rgSCHCmnDlRaType1Alloc - * - * Invoking Module Processing: - * - This function is invoked for DL RB allocation for resource allocation - * type 1 - * - * Processing Steps: - * - Determine the available positions in the subsets. - * - Allocate RB in the available subset. - * - Update RA Type1, RA type 0 and RA type 2 masks. - * - * @param[in] RgSchDlSfAllocInfo *allocedInfo - * @param[in] U8 rbsReq - * @param[in] RgSchBwRbgInfo *rbgInfo - * @param[in] U8 startRbgSubset - * @param[in] U8 *allocRbgSubset - * @param[out] rgSchDlSfAllocInfo *resAllocInfo - * @param[in] Bool isPartialAlloc - * - * @return U8 - * Number of allocated RBs - **/ - -#ifdef ANSI -PUBLIC U8 rgSCHCmnDlRaType1Alloc -( -RgSchDlSfAllocInfo *allocedInfo, -U8 rbsReq, -RgSchBwRbgInfo *rbgInfo, -U8 startRbgSubset, -U8 *allocRbgSubset, -RgSchDlSfAllocInfo *resAllocInfo, -Bool isPartialAlloc -) -#else -PUBLIC U8 rgSCHCmnDlRaType1Alloc(allocedInfo, rbsReq,rbgInfo,startRbgSubset, - allocRbgSubset, resAllocInfo, isPartialAlloc) -RgSchDlSfAllocInfo *allocedInfo; -U8 rbsReq; -RgSchBwRbgInfo *rbgInfo; -U8 startRbgSubset; -U8 *allocRbgSubset; -RgSchDlSfAllocInfo *resAllocInfo; -Bool isPartialAlloc; -#endif -{ - /* Note: This function atttempts only full allocation */ - U8 *rbgSubsetSzArr; - U8 type2MaskIdx, subsetIdx, rbIdx, rbInSubset, rbgInSubset; - U8 offset, rbg, maskSize, bestSubsetIdx; - U8 startPos = 0; - U8 bestNumAvailRbs = 0; - U8 numAllocRbs = 0; - U32 ueRaType2Mask, ueRaType0Mask, rbPosInSubset; - U32 remNumRbs, allocedMask; - U8 usedRbs = 0; - U8 rbgSize = rbgInfo->rbgSize; - U8 rbgSubset = startRbgSubset; - U32 *rbgMask = &resAllocInfo->raType0Mask; - U32 *raType1Mask = resAllocInfo->raType1Mask; - U32 *raType2Mask = resAllocInfo->raType2Mask; - U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; - U32 *allocMask = allocedInfo->raType1Mask; - - /* Initialize the subset size Array */ - rbgSubsetSzArr = rbgInfo->rbgSubsetSize; - - /* Perform allocation for RA type 1 */ - for (subsetIdx = 0;subsetIdx < rbgSize; ++subsetIdx) - { - allocedMask = allocMask[rbgSubset]; - maskSize = rbgSubsetSzArr[rbgSubset]; - - /* Determine number of available RBs in the subset */ - usedRbs = allocedInfo->raType1UsedRbs[subsetIdx]; - remNumRbs = maskSize - usedRbs; - - if (remNumRbs >= rbsReq) - { - bestNumAvailRbs = rbsReq; - bestSubsetIdx = rbgSubset; - break; - } - else if (isPartialAlloc && (remNumRbs > bestNumAvailRbs)) - { - bestNumAvailRbs = remNumRbs; - bestSubsetIdx = rbgSubset; - } - - rbgSubset = (rbgSubset + 1) % rbgSize; - } /* End of for (each rbgsubset) */ - - if (bestNumAvailRbs) - { - /* Initialize alloced mask and subsetSize depending on the RBG - * subset of allocation */ - U8 startIdx = 0; - maskSize = rbgSubsetSzArr[bestSubsetIdx]; - allocedMask = allocMask[bestSubsetIdx]; - RG_SCH_CMN_DL_GET_START_POS(allocedMask, maskSize, - &startPos); - for (; startIdx < rbgSize; ++startIdx, ++startPos) - { - for (rbInSubset = startPos; rbInSubset < maskSize; - rbInSubset = rbInSubset + rbgSize) - { - rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset); - if (!(allocedMask & rbPosInSubset)) - { - raType1Mask[bestSubsetIdx] |= rbPosInSubset; - raType1UsedRbs[bestSubsetIdx]++; - - /* Compute RB index value for the RB being allocated */ - rbgInSubset = rbInSubset /rbgSize; - offset = rbInSubset % rbgSize; - rbg = (rbgInSubset * rbgSize) + bestSubsetIdx; - rbIdx = (rbg * rbgSize) + offset; - - /* Update RBG mask for RA type 0 allocation */ - ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize); - *rbgMask |= ueRaType0Mask; - - /* Update RA type 2 mask */ - ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); - raType2Mask[type2MaskIdx] |= ueRaType2Mask; - - /* Update the counters */ - numAllocRbs++; - remNumRbs--; - if (numAllocRbs == bestNumAvailRbs) - { - break; - } - } - } /* End of for (each position in the subset mask) */ - if (numAllocRbs == bestNumAvailRbs) - { - break; - } - } /* End of for startIdx = 0 to rbgSize */ - - *allocRbgSubset = bestSubsetIdx; - } /* End of if (bestNumAvailRbs) */ - - RETVALUE(numAllocRbs); -} -#endif -/** - * @brief Handles RB allocation for Resource allocation type 2 - * - * @details - * - * Function : rgSCHCmnDlRaType2Alloc - * - * Invoking Module Processing: - * - This function is invoked for DL RB allocation for resource allocation - * type 2 - * - * Processing Steps: - * - Determine the available positions in the mask - * - Allocate best fit cosecutive RBs. - * - Update RA Type2, RA type 1 and RA type 0 masks. - * - * @param[in] RgSchDlSfAllocInfo *allocedInfo - * @param[in] U8 rbsReq - * @param[in] RgSchBwRbgInfo *rbgInfo - * @param[out] U8 *rbStart - * @param[out] rgSchDlSfAllocInfo *resAllocInfo - * @param[in] Bool isPartialAlloc - * - * @return U8 - * Number of allocated RBs - **/ - -#ifdef ANSI -PUBLIC U8 rgSCHCmnDlRaType2Alloc -( -RgSchDlSfAllocInfo *allocedInfo, -U8 rbsReq, -RgSchBwRbgInfo *rbgInfo, -U8 *rbStart, -RgSchDlSfAllocInfo *resAllocInfo, -Bool isPartialAlloc -) -#else -PUBLIC U8 rgSCHCmnDlRaType2Alloc(allocedInfo, rbsReq, rbgInfo, rbStart, - resAllocInfo, isPartialAlloc) -RgSchDlSfAllocInfo *allocedInfo; -U8 rbsReq; -RgSchBwRbgInfo *rbgInfo; -U8 *rbStart; -RgSchDlSfAllocInfo *resAllocInfo; -Bool isPartialAlloc; -#endif -{ - U8 numAllocRbs = 0; - U8 rbIdx; - U8 rbgSize = rbgInfo->rbgSize; - U32 *rbgMask = &resAllocInfo->raType0Mask; -#ifdef RGSCH_SPS_UNUSED - U32 *raType1Mask = resAllocInfo->raType1Mask; -#endif - U32 *raType2Mask = resAllocInfo->raType2Mask; -#ifdef RGSCH_SPS_UNUSED - U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; -#endif - U32 *allocedMask = allocedInfo->raType2Mask; - - /* Note: This function atttempts only full allocation */ - rgSCHCmnDlGetBestFitHole(allocedMask, rbgInfo->numRbs, - raType2Mask, rbsReq, rbStart, &numAllocRbs, isPartialAlloc); - if (numAllocRbs) - { - /* Update the allocation in RA type 0 and RA type 1 masks */ - U8 rbCnt = numAllocRbs; -#ifdef RGSCH_SPS_UNUSED - U8 rbgSubset; - U32 ueRaType1Mask; -#endif - U32 ueRaType0Mask; - rbIdx = *rbStart; - - while(rbCnt) - { - /* Update RBG mask for RA type 0 allocation */ - ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize); - *rbgMask |= ueRaType0Mask; - -#ifdef RGSCH_SPS_UNUSED - /* Update RBG mask for RA type 1 */ - ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); - raType1Mask[rbgSubset] |= ueRaType1Mask; - raType1UsedRbs[rbgSubset]++; -#endif - /* Update the counters */ - --rbCnt; - rbIdx++; - } - } - - RETVALUE(numAllocRbs); -} - -/** - * @brief Determines RA type 0 mask from given RB index. - * - * @details - * - * Function : rgSCHCmnGetRaType0Mask - * - * - * Processing Steps: - * - Determine RA Type 0 mask for given rbIdex and rbg size. - * - * @param[in] U8 rbIdx - * @param[in] U8 rbgSize - * @return U32 RA type 0 mask - **/ -#ifdef ANSI -PRIVATE U32 rgSCHCmnGetRaType0Mask -( -U8 rbIdx, -U8 rbgSize -) -#else -PRIVATE U32 rgSCHCmnGetRaType0Mask(rbIdx, rbgSize) -U8 rbIdx; -U8 rbgSize; -#endif -{ - U8 rbg; - U32 rbgPosInRbgMask = 0; - - rbg = rbIdx/rbgSize; - rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); - - RETVALUE(rbgPosInRbgMask); -} - -#ifdef RGSCH_SPS_UNUSED -/** - * @brief Determines RA type 1 mask from given RB index. - * - * @details - * - * Function : rgSCHCmnGetRaType1Mask - * - * - * Processing Steps: - * - Determine RA Type 1 mask for given rbIdex and rbg size. - * - * @param[in] U8 rbIdx - * @param[in] U8 rbgSize - * @param[out] U8 *type1Subset - * @return U32 RA type 1 mask - **/ -#ifdef ANSI -PRIVATE U32 rgSCHCmnGetRaType1Mask -( -U8 rbIdx, -U8 rbgSize, -U8 *type1Subset -) -#else -PRIVATE U32 rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, type1Subset) -U8 rbIdx; -U8 rbgSize; -U8 *type1Subset; -#endif -{ - U8 rbg, rbgSubset, rbgInSubset, offset, rbInSubset; - U32 rbPosInSubset; - - rbg = rbIdx/rbgSize; - rbgSubset = rbg % rbgSize; - rbgInSubset = rbg/rbgSize; - offset = rbIdx % rbgSize; - rbInSubset = rbgInSubset * rbgSize + offset; - rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset); - - *type1Subset = rbgSubset; - RETVALUE(rbPosInSubset); -} -#endif /* RGSCH_SPS_UNUSED */ -/** - * @brief Determines RA type 2 mask from given RB index. - * - * @details - * - * Function : rgSCHCmnGetRaType2Mask - * - * - * Processing Steps: - * - Determine RA Type 2 mask for given rbIdx and rbg size. - * - * @param[in] U8 rbIdx - * @param[out] U8 *maskIdx - * @return U32 RA type 2 mask - **/ -#ifdef ANSI -PRIVATE U32 rgSCHCmnGetRaType2Mask -( -U8 rbIdx, -U8 *maskIdx -) -#else -PRIVATE U32 rgSCHCmnGetRaType2Mask(rbIdx, maskIdx) -U8 rbIdx; -U8 *maskIdx; -#endif -{ - U32 rbPosInType2; - - *maskIdx = rbIdx / 32; - rbPosInType2 = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbIdx % 32); - - RETVALUE(rbPosInType2); -} - -/** - * @brief Performs resource allocation for a non-SPS UE in SPS bandwidth - * - * @details - * - * Function : rgSCHCmnAllocUeInSpsBw - * - * - * Processing Steps: - * - Determine allocation for the UE. - * - Use resource allocation type 0, 1 and 2 for allocation - * within maximum SPS bandwidth. - * - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlRbAlloc *rbAllocInfo - * @param[in] Bool isPartialAlloc - * @return Bool - * ROK success - * RFAILED failed - **/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnAllocUeInSpsBw -( -RgSchDlSf *dlSf, -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlRbAlloc *rbAllocInfo, -Bool isPartialAlloc -) -#else -PUBLIC Bool rgSCHCmnAllocUeInSpsBw(dlSf, cell, ue, rbAllocInfo, isPartialAlloc) -RgSchDlSf *dlSf; -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlRbAlloc *rbAllocInfo; -Bool isPartialAlloc; -#endif -{ - U8 rbgSize = cell->rbgSize; - U8 numAllocRbs = 0; - U8 numAllocRbgs = 0; - U8 rbStart = 0; - U8 idx, noLyr, iTbs; - RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); - RgSchDlSfAllocInfo *dlSfAlloc = &rbAllocInfo->dlSf->dlSfAllocInfo; - RgSchBwRbgInfo *spsRbgInfo = &cell->spsBwRbgInfo; - - /* SPS_FIX : Check if this Hq proc is scheduled */ - if ((0 == rbAllocInfo->tbInfo[0].schdlngForTb) && - (0 == rbAllocInfo->tbInfo[1].schdlngForTb)) - { - RETVALUE(TRUE); - } - - /* Check if the requirement can be accomodated in SPS BW */ - if (dlSf->spsAllocdBw == spsRbgInfo->numRbs) - { - /* SPS Bandwidth has been exhausted: no further allocations possible */ - RETVALUE(FALSE); - } - if (!isPartialAlloc) - { - if((dlSf->spsAllocdBw + rbAllocInfo->rbsReq) > spsRbgInfo->numRbs) - { - RETVALUE(TRUE); - } - } - - /* Perform allocation for RA type 0 if rbsReq is multiple of RBG size (also - * if RBG size = 1) */ - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - rbAllocInfo->rbsReq += (rbgSize - rbAllocInfo->rbsReq % rbgSize); - numAllocRbgs = rgSCHCmnDlRaType0Alloc(dlSfAlloc, - rbAllocInfo->rbsReq, spsRbgInfo, &numAllocRbs, - &rbAllocInfo->resAllocInfo, isPartialAlloc); - } -#ifdef RGSCH_SPS_UNUSED - else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1) - { - /* If no RBS could be allocated, attempt RA TYPE 1 */ - - numAllocRbs = rgSCHCmnDlRaType1Alloc(dlSfAlloc, - rbAllocInfo->rbsReq, spsRbgInfo, (U8)dlSfAlloc->nxtRbgSubset, - &rbAllocInfo->allocInfo.raType1.rbgSubset, - &rbAllocInfo->resAllocInfo, isPartialAlloc); - - if(numAllocRbs) - { - dlSfAlloc->nxtRbgSubset = - (rbAllocInfo->allocInfo.raType1.rbgSubset + 1 ) % rbgSize; - } - } -#endif - else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - numAllocRbs = rgSCHCmnDlRaType2Alloc(dlSfAlloc, - rbAllocInfo->rbsReq, spsRbgInfo, - &rbStart, &rbAllocInfo->resAllocInfo, isPartialAlloc); - } - if (!numAllocRbs) - { - RETVALUE(TRUE); - } - - if (!(rbAllocInfo->pdcch = - rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi,\ - rbAllocInfo->dciFormat, FALSE))) - { - /* Note: Returning TRUE since PDCCH might be available for another UE */ - RETVALUE(TRUE); - } - - /* Update Tb info for each scheduled TB */ - iTbs = rbAllocInfo->tbInfo[0].iTbs; - noLyr = rbAllocInfo->tbInfo[0].noLyr; - rbAllocInfo->tbInfo[0].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8; - - if (rbAllocInfo->tbInfo[1].schdlngForTb) - { - iTbs = rbAllocInfo->tbInfo[1].iTbs; - noLyr = rbAllocInfo->tbInfo[1].noLyr; - rbAllocInfo->tbInfo[1].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8;; - } - - /* Update rbAllocInfo with the allocation information */ - if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - rbAllocInfo->allocInfo.raType0.dlAllocBitMask = - rbAllocInfo->resAllocInfo.raType0Mask; - rbAllocInfo->allocInfo.raType0.numDlAlloc = numAllocRbgs; - } -#ifdef RGSCH_SPS_UNUSED - else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1) - { - rbAllocInfo->allocInfo.raType1.dlAllocBitMask = - rbAllocInfo->resAllocInfo.raType1Mask[rbAllocInfo->allocInfo.raType1.rbgSubset]; - rbAllocInfo->allocInfo.raType1.numDlAlloc = numAllocRbs; - rbAllocInfo->allocInfo.raType1.shift = 0; - } -#endif - else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - rbAllocInfo->allocInfo.raType2.isLocal = TRUE; - rbAllocInfo->allocInfo.raType2.rbStart = rbStart; - rbAllocInfo->allocInfo.raType2.numRb = numAllocRbs; - } - - rbAllocInfo->rbsAlloc = numAllocRbs; - rbAllocInfo->tbInfo[0].schdlngForTb = TRUE; - - /* Update allocation masks for RA types 0, 1 and 2 in DL SF */ - - /* Update type 0 allocation mask */ - dlSfAlloc->raType0Mask |= rbAllocInfo->resAllocInfo.raType0Mask; -#ifdef RGSCH_SPS_UNUSED - /* Update type 1 allocation masks */ - for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx) - { - dlSfAlloc->raType1Mask[idx] |= rbAllocInfo->resAllocInfo.raType1Mask[idx]; - dlSfAlloc->raType1UsedRbs[idx] += - rbAllocInfo->resAllocInfo.raType1UsedRbs[idx]; - } -#endif - /* Update type 2 allocation masks */ - for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx) - { - dlSfAlloc->raType2Mask[idx] |= rbAllocInfo->resAllocInfo.raType2Mask[idx]; - } - - dlSf->spsAllocdBw += numAllocRbs; - RETVALUE(TRUE); -} - -/*********************************************************** - * - * Func : rgSCHCmnDlGetBestFitHole - * - * - * Desc : Converts the best fit hole into allocation and returns the - * allocation information. - * - * - * Ret : Void - * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlGetBestFitHole -( -U32 *allocMask, -U8 numMaskRbs, -U32 *crntAllocMask, -U8 rbsReq, -U8 *allocStart, -U8 *allocNumRbs, -Bool isPartialAlloc -) -#else -PRIVATE Void rgSCHCmnDlGetBestFitHole (allocMask, numMaskRbs, - crntAllocMask, rbsReq, allocStart, allocNumRbs, isPartialAlloc) -U32 *allocMask; -U8 numMaskRbs; -U32 *crntAllocMask; -U8 rbsReq; -U8 *allocStart; -U8 *allocNumRbs; -Bool isPartialAlloc; -#endif -{ - U8 maskSz = (numMaskRbs + 31)/32; - U8 maxMaskPos = (numMaskRbs % 32); - U8 maskIdx, maskPos; - U8 numAvailRbs = 0; - U8 bestAvailNumRbs = 0; - S8 bestStartPos = -1; - S8 startPos = -1; - U32 tmpMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0}; - U32 bestMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0}; - - *allocNumRbs = numAvailRbs; - *allocStart = 0; - - for (maskIdx = 0; maskIdx < maskSz; ++maskIdx) - { - maxMaskPos = 31; - if (maskIdx == (maskSz - 1)) - { - if (numMaskRbs % 32) - { - maxMaskPos = numMaskRbs % 32; - } - } - for (maskPos = 0; maskPos < maxMaskPos; ++maskPos) - { - if (!(allocMask[maskIdx] & (1 << (31 - maskPos)))) - { - tmpMask[maskIdx] |= (1 << (31 - maskPos)); - if (startPos == -1) - { - startPos = maskIdx * 32 + maskPos; - } - ++numAvailRbs; - if (numAvailRbs == rbsReq) - { - *allocStart = (U8)startPos; - *allocNumRbs = rbsReq; - break; - } - } - else - { - if (numAvailRbs > bestAvailNumRbs) - { - bestAvailNumRbs = numAvailRbs; - bestStartPos = startPos; - cmMemcpy((U8 *)bestMask, (U8 *) tmpMask, 4 * sizeof(U32)); - } - numAvailRbs = 0; - startPos = -1; - cmMemset((U8 *)tmpMask, 0, 4 * sizeof(U32)); - } - } - if (*allocNumRbs == rbsReq) - { - break; - } - } - - if (*allocNumRbs == rbsReq) - { - /* Convert the hole into allocation */ - cmMemcpy((U8 *)crntAllocMask, (U8 *) tmpMask, 4 * sizeof(U32)); - RETVOID; - } - else - { - if (bestAvailNumRbs && isPartialAlloc) - { - /* Partial allocation could have been done */ - *allocStart = (U8)bestStartPos; - *allocNumRbs = bestAvailNumRbs; - /* Convert the hole into allocation */ - cmMemcpy((U8 *)crntAllocMask, (U8 *) bestMask, 4 * sizeof(U32)); - } - } - - RETVOID; -} -#endif /* LTEMAC_SPS */ - -/*************************************************************************** - * - * NON-DLFS Allocation functions - * - * *************************************************************************/ -#ifndef LTE_TDD -#ifdef DEBUGP -/** - * @brief Function to find out code rate - * - * @details - * - * Function : rgSCHCmnFindCodeRate - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @return void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFindCodeRate -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -U8 idx -) -#else -PRIVATE Void rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,idx) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -U8 idx; -#endif -{ - RETVOID; - -} -#endif - -/* Adjust the Imcs and bytes allocated also with respect to the adjusted - RBs - Here we will find out the Imcs by identifying first Highest - number of bits compared to the original bytes allocated. */ -/** - * @brief Adjust IMCS according to tbSize and ITBS - * - * @details - * - * Function : rgSCHCmnNonDlfsPbchTbImcsAdj - * - * Processing Steps: - * - Adjust Imcs according to tbSize and ITBS. - * - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @param[in] U8 *idx - * @return void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsPbchTbImcsAdj -( -RgSchCellCb *cell, -RgSchDlRbAlloc *allocInfo, -U8 idx, -U8 rbsReq -) -#else -PRIVATE Void rgSCHCmnNonDlfsPbchTbImcsAdj(cell,allocInfo, idx, rbsReq) -RgSchCellCb *cell; -RgSchDlRbAlloc *allocInfo; -U8 idx; -U8 rbsReq; -#endif -{ - U8 noLyrs = 0; - U8 tbs = 0; - U32 origBytesReq; - U8 noRbgs = 0; - U8 noRbs = 0; - RgSchDlSf *dlSf = allocInfo->dlSf; - - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs); - noLyrs = allocInfo->tbInfo[idx].noLyr; - - if((allocInfo->raType == RG_SCH_CMN_RA_TYPE0)) - { - noRbgs = RGSCH_CEIL((allocInfo->rbsReq + dlSf->lstRbgDfct), cell->rbgSize); - noRbs = (noRbgs * cell->rbgSize) - dlSf->lstRbgDfct; - } - else - { - noRbs = allocInfo->rbsReq; - } - - /* This line will help in case if tbs is zero and reduction in MCS is not possible */ - if (allocInfo->rbsReq == 0 ) - { - RETVOID; - } - origBytesReq = rgTbSzTbl[noLyrs - 1][tbs][rbsReq - 1]/8; - - /* Find out the ITbs & Imcs by identifying first Highest - number of bits compared to the original bytes allocated.*/ - if(tbs > 0) - { - if(((rgTbSzTbl[noLyrs - 1][0][noRbs - 1])/8) < origBytesReq) - { - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyrs - 1], tbs); - while(((rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1])/8) > origBytesReq) - { - tbs--; - } - } - else - { - tbs = 0; - } - allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1]/8; - allocInfo->tbInfo[idx].iTbs = tbs; - RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs); - } - - RETVOID; -} -/* Added funcion to adjust TBSize*/ -/** - * @brief Function to adjust the tbsize in case of subframe 0 & 5 when - * we were not able to do RB alloc adjustment by adding extra required Rbs - * - * @details - * - * Function : rgSCHCmnNonDlfsPbchTbSizeAdj - * - * Processing Steps: - * - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @param[in] U8 numOvrlapgPbchRb - * @param[in] U8 idx - * @param[in] U8 pbchSsRsSym - * @return void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj -( -RgSchDlRbAlloc *allocInfo, -U8 numOvrlapgPbchRb, -U8 pbchSsRsSym, -U8 idx, -U32 bytesReq -) -#else -PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,idx,bytesReq) -RgSchDlRbAlloc *allocInfo; -U8 numOvrlapgPbchRb; -U8 pbchSsRsSym; -U8 idx; -U32 bytesReq; -#endif -{ - U32 reducedTbs = 0; - U8 noLyrs = 0; - U8 tbs = 0; - - noLyrs = allocInfo->tbInfo[idx].noLyr; - - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs); - - reducedTbs = bytesReq - (((U32)numOvrlapgPbchRb * (U32)pbchSsRsSym * 6)/8); - - /* find out the ITbs & Imcs by identifying first Highest - number of bits compared with reduced bits considering the bits that are - reserved for PBCH/PSS/SSS */ - if(((rgTbSzTbl[noLyrs - 1][0][allocInfo->rbsReq - 1])/8) < reducedTbs) - { - while(((rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1])/8) > reducedTbs) - { - tbs--; - } - } - else - { - tbs = 0; - } - allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1]/8; - allocInfo->tbInfo[idx].iTbs = tbs; - RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs); - - RETVOID; -} - -/* Added this function to find num of ovrlapping PBCH rb*/ -/** - * @brief Function to find out how many additional rbs are available - * in the entire bw which can be allocated to a UE - * @details - * - * Function : rgSCHCmnFindNumAddtlRbsAvl - * - * Processing Steps: - * - Calculates number of additinal rbs available - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @param[out] U8 addtlRbsAvl - * @return void - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo -) -#else -PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl(cell,dlSf,allocInfo) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -#endif -{ - U8 addtlRbsAvl = 0; - - TRC2(rgSCHCmnFindNumAddtlRbsAvl) - - if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - addtlRbsAvl = (((dlSf->type0End - dlSf->type2End + 1)*\ - cell->rbgSize) - dlSf->lstRbgDfct) - allocInfo->rbsReq; - } - else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - addtlRbsAvl = (dlSf->bw - dlSf->bwAlloced) - allocInfo->rbsReq; - } - - RETVALUE(addtlRbsAvl); - -} -/* Added this function to find num of ovrlapping PBCH rb*/ -/** - * @brief Function to find out how many of the requested RBs are - * falling in the center 6 RBs of the downlink bandwidth. - * @details - * - * Function : rgSCHCmnFindNumPbchOvrlapRbs - * - * Processing Steps: - * - Calculates number of overlapping rbs - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @param[out] U8* numOvrlapgPbchRb - * @return void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -U8 *numOvrlapgPbchRb -) -#else -PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,numOvrlapgPbchRb) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -U8 *numOvrlapgPbchRb; -#endif -{ - *numOvrlapgPbchRb = 0; - TRC2(rgSCHCmnFindNumPbchOvrlapRbs) - /*Find if we have already crossed the start boundary for PBCH 6 RBs, - * if yes then lets find the number of RBs which are getting overlapped - * with this allocation.*/ - if(dlSf->bwAlloced <= (cell->pbchRbStart)) - { - /*We have not crossed the start boundary of PBCH RBs. Now we need - * to know that if take this allocation then how much PBCH RBs - * are overlapping with this allocation.*/ - /* Find out the overlapping RBs in the centre 6 RBs */ - if((dlSf->bwAlloced + allocInfo->rbsReq) > cell->pbchRbStart) - { - *numOvrlapgPbchRb = (dlSf->bwAlloced + allocInfo->rbsReq) - (cell->pbchRbStart); - if(*numOvrlapgPbchRb > 6) - *numOvrlapgPbchRb = 6; - } - } - else if ((dlSf->bwAlloced > (cell->pbchRbStart)) && - (dlSf->bwAlloced < (cell->pbchRbEnd))) - { - /*We have already crossed the start boundary of PBCH RBs.We need to - * find that if we take this allocation then how much of the RBs for - * this allocation will overlap with PBCH RBs.*/ - /* Find out the overlapping RBs in the centre 6 RBs */ - if(dlSf->bwAlloced + allocInfo->rbsReq < (cell->pbchRbEnd)) - { - /*If we take this allocation then also we are not crossing the - * end boundary of PBCH 6 RBs.*/ - *numOvrlapgPbchRb = allocInfo->rbsReq; - } - else - { - /*If we take this allocation then we are crossing the - * end boundary of PBCH 6 RBs.*/ - *numOvrlapgPbchRb = (cell->pbchRbEnd) - dlSf->bwAlloced; - } - } - RETVOID; - -} -/** - * @brief Performs RB allocation adjustment if the requested RBs are - * falling in the center 6 RBs of the downlink bandwidth. - * @details - * - * Function : rgSCHCmnNonDlfsPbchRbAllocAdj - * - * Processing Steps: - * - Allocate consecutively available RBs. - * - * @param[in] RgSchCellCb *cell - * @param[in,out] RgSchDlRbAlloc *allocInfo - * @param[in] U8 pbchSsRsSym - * @return void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj -( -RgSchCellCb *cell, -RgSchDlRbAlloc *allocInfo, -U8 pbchSsRsSym, -Bool isBcchPcch -) -#else -PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj(cell, allocInfo,pbchSsRsSym) -RgSchCellCb *cell; -RgSchDlRbAlloc *allocInfo; -U8 pbchSsRsSym; -Bool isBcchPcch; -#endif -{ - RgSchDlSf *dlSf = allocInfo->dlSf; - U8 numOvrlapgPbchRb = 0; - U8 numOvrlapgAdtlPbchRb = 0; - U8 totSym; - U8 addtlRbsReq = 0; - U8 moreAddtlRbsReq = 0; - U8 addtlRbsAdd = 0; - U8 moreAddtlRbsAdd = 0; - U8 tbs; - U8 origRbsReq = 0; - U32 bytesReq; - U8 noLyr; - U8 divResult; - - - TRC2(rgSCHCmnNonDlfsPbchRbAllocAdj); - - - origRbsReq = allocInfo->rbsReq; - rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); - - totSym = (cell->isCpDlExtend) ? RGSCH_TOT_NUM_SYM_EXTCP : RGSCH_TOT_NUM_SYM_NORCP; - - /* Additional RBs are allocated by considering the loss due to - the reserved symbols for CFICH, PBCH, PSS, SSS and cell specific RS */ - - divResult = (numOvrlapgPbchRb * pbchSsRsSym)/totSym; - if((numOvrlapgPbchRb * pbchSsRsSym) % totSym) - { - divResult++; - } - addtlRbsReq = divResult; - - RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, addtlRbsReq, addtlRbsAdd) - - /*Now RBs requires is original requested RBs + these additional RBs to make - * up for PSS/SSS/BCCH.*/ - allocInfo->rbsReq = allocInfo->rbsReq + addtlRbsAdd; - - /*Check if with these additional RBs we have taken up, these are also falling - * under PBCH RBs range, if yes then we would need to account for - * PSS/BSS/BCCH for these additional RBs too.*/ - if(addtlRbsAdd && ((dlSf->bwAlloced + allocInfo->rbsReq - addtlRbsAdd) < (cell->pbchRbEnd))) - { - if((dlSf->bwAlloced + allocInfo->rbsReq) <= (cell->pbchRbEnd)) - { - /*With additional RBs taken into account, we are not crossing the - * PBCH RB end boundary.Thus here we need to account just for - * overlapping PBCH RBs for these additonal RBs.*/ - divResult = (addtlRbsAdd * pbchSsRsSym)/totSym; - if((addtlRbsAdd * pbchSsRsSym) % totSym) - { - divResult++; - } - - moreAddtlRbsReq = divResult; - - RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd) - - allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd; - } - else - { - - /*Here we have crossed the PBCH RB end boundary, thus we need to take - * into account the overlapping RBs for additional RBs which will be - * subset of addtlRbs.*/ - numOvrlapgAdtlPbchRb = (cell->pbchRbEnd) - ((dlSf->bwAlloced + allocInfo->rbsReq) - addtlRbsAdd); - - divResult = (numOvrlapgAdtlPbchRb * pbchSsRsSym)/totSym; - if((numOvrlapgAdtlPbchRb * pbchSsRsSym) % totSym) - { - divResult++; - } - - moreAddtlRbsReq = divResult; - - RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd) - - allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd; - } - } - if (isBcchPcch == TRUE) - { - RETVOID; - } - - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - if(tbs == 6) - { - /* This case might be for Imcs value 6 and NPrb = 1 case - Not - Adjusting either RBs or Imcs or Bytes Allocated */ - allocInfo->rbsReq = allocInfo->rbsReq - addtlRbsAdd - moreAddtlRbsAdd; - } - else if(tbs && ((0 == addtlRbsAdd) && (moreAddtlRbsAdd == 0))) - { - /*In case of a situation where we the entire bandwidth is already occupied - * and we dont have room to add additional Rbs then in order to decrease the - * code rate we reduce the tbsize such that we reduce the present calculated - * tbsize by number of bytes that would be occupied by PBCH/PSS/SSS in overlapping - * rbs and find the nearest tbsize which would be less than this deduced value*/ - - rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); - - noLyr = allocInfo->tbInfo[0].noLyr; - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyr - 1], tbs); - bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8; - - rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,bytesReq); - - if(allocInfo->tbInfo[1].schdlngForTb == TRUE) - { - noLyr = allocInfo->tbInfo[1].noLyr; - bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8; - rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,bytesReq); - } - - } - else if(tbs && ((addtlRbsAdd != addtlRbsReq) || - (addtlRbsAdd && (moreAddtlRbsReq != moreAddtlRbsAdd)))) - { - /*In case of a situation where we were not able to add required number of - * additional RBs then we adjust the Imcs based on original RBs requested. - * Doing this would comensate for the few extra Rbs we have added but inorder - * to comensate for number of RBS we couldnt add we again do the TBSize adjustment*/ - - rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq); - - if(allocInfo->tbInfo[1].schdlngForTb == TRUE) - { - rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq); - } - - rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); - numOvrlapgPbchRb = numOvrlapgPbchRb - (addtlRbsAdd + moreAddtlRbsAdd); - - rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,allocInfo->tbInfo[0].bytesReq); - - if(allocInfo->tbInfo[1].schdlngForTb == TRUE) - { - rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,allocInfo->tbInfo[1].bytesReq); - } - - } - else - { - /*We hit this code when we were able to add the required additional RBS - * hence we should adjust the IMcs based on orignals RBs requested*/ - - rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq); - - if(allocInfo->tbInfo[1].schdlngForTb == TRUE) - { - rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq); - } - } - - RETVOID; -} /* end of rgSCHCmnNonDlfsPbchRbAllocAdj */ -#endif - -/** - * @brief Performs RB allocation for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsCmnRbAlloc - * - * Processing Steps: - * - Allocate consecutively available RBs for BCCH/PCCH/RAR. - * - * @param[in] RgSchCellCb *cell - * @param[in, out] RgSchDlRbAlloc *allocInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc -( -RgSchCellCb *cell, -RgSchDlRbAlloc *allocInfo -) -#else -PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc(cell, allocInfo) -RgSchCellCb *cell; -RgSchDlRbAlloc *allocInfo; -#endif -{ -#ifndef LTE_TDD -#ifdef LTEMAC_SPS -#endif - U8 pbchSsRsSym = 0; - U8 pbchFrame = 0; - U8 tbs = 0; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); -#endif - RgSchDlSf *dlSf = allocInfo->dlSf; -#ifdef LTEMAC_SPS - U8 rbStart = 0; - U8 spsRbsAlloc = 0; - RgSchDlSfAllocInfo *dlSfAlloc = &allocInfo->dlSf->dlSfAllocInfo; -#endif - TRC2(rgSCHCmnNonDlfsCmnRbAlloc); - - allocInfo->tbInfo[0].noLyr = 1; - -#ifdef LTEMAC_SPS - /* Note: Initialize the masks to 0, this might not be needed since alloInfo - * is initialized to 0 at the beginning of allcoation */ - allocInfo->resAllocInfo.raType0Mask = 0; - cmMemset((U8*)allocInfo->resAllocInfo.raType1Mask, 0, - RG_SCH_NUM_RATYPE1_32BIT_MASK * sizeof (U32)); - cmMemset((U8*)allocInfo->resAllocInfo.raType2Mask, 0, - RG_SCH_NUM_RATYPE2_32BIT_MASK * sizeof (U32)); - - if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && - (dlSf->bwAlloced == dlSf->bw)) -#else - if(dlSf->bwAlloced == dlSf->bw) -#endif - { - RETVALUE(RFAILED); - } -#ifndef LTE_TDD - if (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced)) - { -#ifdef LTEMAC_SPS - if ((allocInfo->tbInfo[0].imcs < 29) && (dlSf->bwAlloced < dlSf->bw)) -#else - if(allocInfo->tbInfo[0].imcs < 29) -#endif - { - /* set the remaining RBs for the requested UE */ - allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced; - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[0][tbs][allocInfo->rbsReq - 1]/8; - } - else - { -#ifdef LTEMAC_SPS - /* Attempt RA Type 2 allocation in SPS Bandwidth */ - if (dlSf->spsAllocdBw < cell->spsBwRbgInfo.numRbs) - { - spsRbsAlloc = - rgSCHCmnDlRaType2Alloc(dlSfAlloc, - allocInfo->rbsReq, &cell->spsBwRbgInfo, &rbStart, - &allocInfo->resAllocInfo, FALSE); - /* rbsAlloc assignment moved from line 16671 to here to avoid - * compilation error. Recheck */ - dlSf->spsAllocdBw += spsRbsAlloc; - } - if (!spsRbsAlloc) -#endif /* LTEMAC_SPS */ - { - RETVALUE(RFAILED); - } - } - } -#endif - - /* Update allocation information */ - allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); - if (allocInfo->pdcch == NULLP) - { - RETVALUE(RFAILED); - } - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A]; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - allocInfo->allocInfo.raType2.isLocal = TRUE; -#ifdef LTEMAC_SPS - if (spsRbsAlloc) - { - allocInfo->allocInfo.raType2.rbStart = rbStart; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - allocInfo->rbsAlloc = allocInfo->rbsReq; - } -#endif - -#ifdef LTEMAC_SPS - if (!spsRbsAlloc) - { -#endif -#ifndef LTE_TDD - if(dlSf->sfNum) - { - if(!(dlSf->sfNum == 5)) - { - /* case for subframes 1 to 9 except 5 */ -#ifdef LTEMAC_SPS - allocInfo->allocInfo.raType2.rbStart = rbStart; -#else - /*Fix for ccpu00123918*/ - allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; -#endif - } - else - { - pbchFrame = 1; /* case for subframe 5 */ - /* In subframe 5, symbols are reserved for PSS and SSS and CFICH - and Cell Specific Reference Signals */ - pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PSS_SSS_SYM) * - RGSCH_NUM_SC_IN_RB + cell->numCellRSPerSf); - } - } - else - { - pbchFrame = 1; - /* In subframe 0, symbols are reserved for PSS, SSS, PBCH, CFICH and - and Cell Specific Reference signals */ - pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PBCH_SYM + - RGSCH_NUM_PSS_SSS_SYM) * RGSCH_NUM_SC_IN_RB + - cell->numCellRSPerSf); - } /* end of outer else */ - - if((pbchFrame) && - (((dlSf->bwAlloced + allocInfo->rbsReq) - cell->pbchRbStart) > 0)&& - (dlSf->bwAlloced < cell->pbchRbEnd)) - { - if(allocInfo->tbInfo[0].imcs < 29) - { - rgSCHCmnNonDlfsPbchRbAllocAdj(cell, allocInfo, pbchSsRsSym, TRUE); - } - } -#endif -#ifdef LTEMAC_SPS - } -#endif - -#ifdef LTEMAC_SPS - if (!spsRbsAlloc) - { -#endif - /*Fix for ccpu00123918*/ - allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - allocInfo->rbsAlloc = allocInfo->rbsReq; - - /* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD - if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) - { - rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \ - allocInfo->allocInfo.raType2.rbStart, \ - allocInfo->allocInfo.raType2.numRb); - } - else -#endif - { - rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \ - allocInfo->allocInfo.raType2.rbStart, \ - allocInfo->allocInfo.raType2.numRb); - } - -#ifdef LTEMAC_SPS - } -#endif - /* LTE_ADV_FLAG_REMOVED_END */ - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - - -#ifdef LTEMAC_SPS - if (spsRbsAlloc) - { - U8 idx; - /* Update type 0, 1 and 2 masks */ - dlSfAlloc->raType0Mask |= allocInfo->resAllocInfo.raType0Mask; -#ifdef RGSCH_SPS_UNUSED - for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx) - { - dlSfAlloc->raType1Mask[idx] |= - allocInfo->resAllocInfo.raType1Mask[idx]; - dlSfAlloc->raType1UsedRbs[idx] += - allocInfo->resAllocInfo.raType1UsedRbs[idx]; - } -#endif - for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx) - { - dlSfAlloc->raType2Mask[idx] |= - allocInfo->resAllocInfo.raType2Mask[idx]; - } - } -#endif - - RETVALUE(ROK); -} - - -/** - * @brief Performs RB allocation for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsCmnRbAllocRar - * - * Processing Steps: - * - Allocate consecutively available RBs for BCCH/PCCH/RAR. - * - * @param[in] RgSchCellCb *cell - * @param[in, out] RgSchDlRbAlloc *allocInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsCmnRbAllocRar -( - RgSchCellCb *cell, - RgSchDlRbAlloc *allocInfo - ) -#else -PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc(cell, allocInfo) - RgSchCellCb *cell; - RgSchDlRbAlloc *allocInfo; -#endif -{ - U8 tbs = 0; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchDlSf *dlSf = allocInfo->dlSf; - TRC2(rgSCHCmnNonDlfsCmnRbAllocRar); - - - if(dlSf->bwAlloced == dlSf->bw) - { - RETVALUE(RFAILED); - } - - allocInfo->tbInfo[0].noLyr = 1; -#ifndef RG_5GTF - /* Update allocation information */ - allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); - if (allocInfo->pdcch == NULLP) - { - RETVALUE(RFAILED); - } - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A]; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - allocInfo->allocInfo.raType2.isLocal = TRUE; - - /*Fix for ccpu00123918*/ - allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - allocInfo->rbsAlloc = allocInfo->rbsReq; - - /* LTE_ADV_FLAG_REMOVED_END */ - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - -#else - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, NULLP, dlSf, 13, TFU_DCI_FORMAT_B1, FALSE); - if (allocInfo->pdcch == NULLP) - { - RETVALUE(RFAILED); - } - RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]); - if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) - { - printf("5GTF_ERROR vrbg allocated > 25\n"); - RETVALUE(RFAILED); - } - - allocInfo->tbInfo[0].cmnGrnt.vrbgStart = beamInfo->vrbgStart; - allocInfo->tbInfo[0].cmnGrnt.numVrbg = allocInfo->vrbgReq; - - /* Update allocation information */ - allocInfo->dciFormat = TFU_DCI_FORMAT_B1; - - allocInfo->tbInfo[0].cmnGrnt.xPDSCHRange = 1; - allocInfo->tbInfo[0].cmnGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, - allocInfo->tbInfo[0].cmnGrnt.vrbgStart, allocInfo->tbInfo[0].cmnGrnt.numVrbg); - - allocInfo->tbInfo[0].cmnGrnt.rbStrt = (allocInfo->tbInfo[0].cmnGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); - allocInfo->tbInfo[0].cmnGrnt.numRb = (allocInfo->tbInfo[0].cmnGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); - - beamInfo->vrbgStart += allocInfo->tbInfo[0].cmnGrnt.numVrbg; - beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].cmnGrnt.numVrbg; - allocInfo->tbInfo[0].cmnGrnt.rv = 0; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - -#endif - printf("\n[%s],allocInfo->tbInfo[0].bytesAlloc:%u,vrbgReq:%u\n", - __func__,allocInfo->tbInfo[0].bytesAlloc,allocInfo->vrbgReq); - - RETVALUE(ROK); -} - - -/* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD -/** - * @brief To check if DL BW available for non-DLFS allocation. - * - * @details - * - * Function : rgSCHCmnNonDlfsBwAvlbl - * - * Processing Steps: - * - Determine availability based on RA Type. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchDlRbAlloc *allocInfo - * - * @return Bool - * -# TRUE - * -# FALSE - **/ -#ifdef ANSI -PRIVATE Bool rgSCHCmnNonDlfsSFRBwAvlbl -( -RgSchCellCb *cell, -RgSchSFRPoolInfo **sfrpoolInfo, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -Bool isUeCellEdge -) -#else -PRIVATE Bool rgSCHCmnNonDlfsSFRBwAvlbl(cell, sfrpoolInfo, dlSf, allocInfo, isUeCellEdge) -RgSchCellCb *cell; -RgSchSFRPoolInfo **sfrpoolInfo; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -Bool isUeCellEdge; -#endif -{ - CmLListCp *l; - CmLListCp *l1; - CmLList *n; - CmLList *n1; - RgSchSFRPoolInfo *sfrPool; - RgSchSFRPoolInfo *sfrCEPool; - - U8 tbs; - U8 noLyrs; - RgSchSFRPoolInfo *poolWithMaxAvlblBw = NULLP; - U32 bwAvlbl = 0; - U32 addtnlPRBs = 0; - - if (dlSf->bw <= dlSf->bwAlloced) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "BW is fully allocated for subframe (%d) CRNTI:%d", dlSf->sfNum,allocInfo->rnti); - return FALSE; - } - - if (dlSf->sfrTotalPoolInfo.ccBwFull == TRUE) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "BW is fully allocated for CC Pool CRNTI:%d",allocInfo->rnti); - return FALSE; - } - - if ((dlSf->sfrTotalPoolInfo.ceBwFull == TRUE) && (isUeCellEdge)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "BW is fully allocated for CE Pool CRNTI:%d",allocInfo->rnti); - return FALSE; - } - - /* We first check if the ue scheduled is a cell edge or cell centre and accordingly check the avaialble - memory in their pool. If the cell centre UE doesnt have Bw available in its pool, then it will check - Bw availability in cell edge pool but the other way around is NOT possible. */ - if(isUeCellEdge) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - } - else - { - l = &dlSf->sfrTotalPoolInfo.ccPool; - } - - n = cmLListFirst(l); - - while(n) - { - if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - sfrPool = (RgSchSFRPoolInfo*)(n->node); - - /* MS_FIX for ccpu00123919 : Number of RBs in case of RETX should be same as that of initial transmission. */ - if(allocInfo->tbInfo[0].tbCb->txCntr) - { - /* If RB assignment is being done for RETX. Then if reqRbs are a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is - * not a multiple of rbgSize then check if lsgRbgDfct exists */ - if (allocInfo->rbsReq % cell->rbgSize == 0) - { - if ((sfrPool->type2End == dlSf->type2End) && dlSf->lstRbgDfct) - { - /* In this scenario we are wasting the last RBG for this dlSf */ - sfrPool->type0End--; - sfrPool->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); - - dlSf->lstRbgDfct = 0; - - /*ABHINAV To check if these variables need to be taken care of*/ - dlSf->type0End--; - dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); - } - } - else - { - if (dlSf->lstRbgDfct) - { - /* Check if type0 allocation can cater to this RETX requirement */ - if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct)) - { - RETVALUE(FALSE); - } - else - { - if (sfrPool->type2End != dlSf->type2End) /*Search again for some pool which has the END RBG of the BandWidth*/ - { - continue; - } - } - } - else - { - /* cannot allocate same number of required RBs */ - RETVALUE(FALSE); - } - } - } - - /*rg002.301 ccpu00120391 MOD condition is modified approprialtely to find if rbsReq is less than available RBS*/ - if(allocInfo->rbsReq <= (((sfrPool->type0End - sfrPool->type2End + 1)*\ - cell->rbgSize) - dlSf->lstRbgDfct)) - { - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - else - { - if (sfrPool->bw <= sfrPool->bwAlloced + cell->rbgSize) - { - n = cmLListNext(l); - /* If the ue is cell centre then it will simply check the memory available in next pool. - But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */ - - if((!isUeCellEdge) && (!n->node)) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - n = cmLListFirst(l); - } - - continue; - } - - /* MS_FIX: Number of RBs in case of RETX should be same as that of initial transmission */ - if(allocInfo->tbInfo[0].tbCb->txCntr == 0) - { - /*rg002.301 ccpu00120391 MOD setting the remaining RBs for the requested UE*/ - allocInfo->rbsReq = (((sfrPool->type0End - sfrPool->type2End + 1)*\ - cell->rbgSize) - dlSf->lstRbgDfct); - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - noLyrs = allocInfo->tbInfo[0].noLyr; - allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - else - { - n = cmLListNext(l); - - /* If the ue is cell centre then it will simply check the memory available in next pool. - But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */ - if((!isUeCellEdge) && (!n->node)) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - n = cmLListFirst(l); - } - - continue; - } - - // RETVALUE(FALSE); - } - } - else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - sfrPool = (RgSchSFRPoolInfo*)(n->node); - /* This is a Case where a UE was CC and had more RBs allocated than present in CE pool. - In case this UE whn become CE with retx going on, then BW is not sufficient for Retx */ - if ((isUeCellEdge) && - (allocInfo->tbInfo[0].tbCb->txCntr != 0)) - { - if(allocInfo->rbsReq > (sfrPool->bw - sfrPool->bwAlloced)) - { - /* Adjust CE BW such that Retx alloc is successful */ - /* Check if merging CE with adjacent CC pool will be sufficient to process Retx */ - - /* If no Type 0 allocations are made from this pool */ - if (sfrPool->type0End == (((sfrPool->poolendRB + 1) / cell->rbgSize) - 1)) - { - if (sfrPool->adjCCPool && - (sfrPool->adjCCPool->type2Start == sfrPool->poolendRB + 1) && - (allocInfo->rbsReq <= ((sfrPool->bw - sfrPool->bwAlloced) + - ((sfrPool->adjCCPool->bw - sfrPool->adjCCPool->bwAlloced))))) - { - addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced); - - /* Adjusting CE Pool Info */ - sfrPool->bw += addtnlPRBs; - sfrPool->type0End = ((sfrPool->poolendRB + addtnlPRBs + 1) / - cell->rbgSize) - 1; - - /* Adjusting CC Pool Info */ - sfrPool->adjCCPool->type2Start += addtnlPRBs; - sfrPool->adjCCPool->type2End = RGSCH_CEIL(sfrPool->adjCCPool->type2Start, - cell->rbgSize); - sfrPool->adjCCPool->bw -= addtnlPRBs; - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - } - } - } - - /* Check if CC pool is one of the following: - * 1. |CE| + |CC "CCPool2Exists" = TRUE| - * 2. |CC "CCPool2Exists" = FALSE| + |CE| + |CC "CCPool2Exists" = TRUE| - */ - if(TRUE == sfrPool->CCPool2Exists) - { - l1 = &dlSf->sfrTotalPoolInfo.cePool; - n1 = cmLListFirst(l1); - sfrCEPool = (RgSchSFRPoolInfo*)(n1->node); - if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced)) - { - *sfrpoolInfo = sfrCEPool; - RETVALUE(TRUE); - } - else if(allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced)) - { - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - /* Check if CE and CC boundary has unallocated prbs */ - else if ((sfrPool->poolstartRB == sfrPool->type2Start) && - (sfrCEPool->type0End == ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1)) - { - if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced) + - (sfrPool->bw - sfrPool->bwAlloced)) - { - /* Checking if BW can be allocated partly from CE pool and partly - * from CC pool - */ - addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced); - /* Updating CE and CC type2 parametrs based on the RBs allocated - * from these pools*/ - sfrPool->type2Start -= addtnlPRBs; - sfrPool->type2End = RGSCH_CEIL(sfrPool->type2Start, cell->rbgSize); - sfrPool->bw += addtnlPRBs; - if (addtnlPRBs == (sfrCEPool->bw - sfrCEPool->bwAlloced)) - { - sfrCEPool->bwAlloced = sfrCEPool->bw; - dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; - } - else - { - sfrCEPool->bw -= addtnlPRBs; - sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1 - addtnlPRBs) / cell->rbgSize) - 1; - } - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - else if ( bwAvlbl < - ((sfrCEPool->bw - sfrCEPool->bwAlloced) + - (sfrPool->bw - sfrPool->bwAlloced))) - { - /* All the Prbs from CE BW shall be allocated */ - if(allocInfo->tbInfo[0].tbCb->txCntr == 0) - { - sfrPool->type2Start = sfrCEPool->type2Start; - sfrPool->bw += sfrCEPool->bw - sfrCEPool->bwAlloced; - sfrCEPool->type2Start = sfrCEPool->poolendRB + 1; - sfrCEPool->bwAlloced = sfrCEPool->bw; - dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; - - /* set the remaining RBs for the requested UE */ - allocInfo->rbsReq = (sfrPool->bw - sfrPool->bwAlloced); - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - noLyrs = allocInfo->tbInfo[0].noLyr; - allocInfo->tbInfo[0].bytesReq = - rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - else - { - RETVALUE(FALSE); - } - } - } - } - - /* Checking if no. of RBs required can be allocated from - * SFR pool. - * 1. If available return the SFR pool. - * 2. Else update the RBs required parameter based on the - * BW available in the pool - * 3. Return FALSE if no B/W is available. - */ - if (allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced)) - { - *sfrpoolInfo = sfrPool; - RETVALUE(TRUE); - } - else - { - if(allocInfo->tbInfo[0].tbCb->txCntr == 0) - { - if (bwAvlbl < sfrPool->bw - sfrPool->bwAlloced) - { - if (isUeCellEdge) - { - dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; - } - bwAvlbl = sfrPool->bw - sfrPool->bwAlloced; - poolWithMaxAvlblBw = sfrPool; - } - n = cmLListNext(l); - - if ((isUeCellEdge == FALSE) && (n == NULLP)) - { - if(l != &dlSf->sfrTotalPoolInfo.cePool) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - n = cmLListFirst(l); - } - } - - if (n == NULLP) - { - if (bwAvlbl == 0) - { - if (isUeCellEdge) - { - dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; - } - else - { - dlSf->sfrTotalPoolInfo.ccBwFull = TRUE; - } - RETVALUE(FALSE); - } - else - { - /* set the remaining RBs for the requested UE */ - allocInfo->rbsReq = poolWithMaxAvlblBw->bw - - poolWithMaxAvlblBw->bwAlloced; - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - noLyrs = allocInfo->tbInfo[0].noLyr; - allocInfo->tbInfo[0].bytesReq = - rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; - *sfrpoolInfo = poolWithMaxAvlblBw; - RETVALUE(TRUE); - } - } - } - else - { - n = cmLListNext(l); - - if ((isUeCellEdge == FALSE) && (n == NULLP)) - { - if(l != &dlSf->sfrTotalPoolInfo.cePool) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - n = cmLListFirst(l); - } - } - - if (n == NULLP) - { - RETVALUE(FALSE); - } - } - - } - } - } - RETVALUE(FALSE); -} -#endif /* end of ifndef LTE_TDD*/ -/* LTE_ADV_FLAG_REMOVED_END */ - -/** - * @brief To check if DL BW available for non-DLFS allocation. - * - * @details - * - * Function : rgSCHCmnNonDlfsUeRbAlloc - * - * Processing Steps: - * - Determine availability based on RA Type. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchDlRbAlloc *allocInfo - * - * @return Bool - * -# TRUE - * -# FALSE - **/ -#ifdef ANSI -PRIVATE Bool rgSCHCmnNonDlfsBwAvlbl -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo -) -#else -PRIVATE Bool rgSCHCmnNonDlfsBwAvlbl(cell, dlSf, allocInfo) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -#endif -{ - U8 tbs; - U8 noLyrs; - U8 ignoredDfctRbg = FALSE; - - TRC2(rgSCHCmnNonDlfsBwAvlbl); - if (dlSf->bw <= dlSf->bwAlloced) - { - RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId, "(%d:%d)FAILED CRNTI:%d", - dlSf->bw, dlSf->bwAlloced,allocInfo->rnti); - RETVALUE(FALSE); - } - if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - /* Fix for ccpu00123919 : Number of RBs in case of RETX should be same as - * that of initial transmission. */ - if(allocInfo->tbInfo[0].tbCb->txCntr) - { - /* If RB assignment is being done for RETX. Then if reqRbs are - * a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is - * not a multiple of rbgSize then check if lsgRbgDfct exists */ - if (allocInfo->rbsReq % cell->rbgSize == 0) - { - if (dlSf->lstRbgDfct) - { - /* In this scenario we are wasting the last RBG for this dlSf */ - - dlSf->type0End--; - dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); - /* Fix: MUE_PERTTI_DL */ - dlSf->lstRbgDfct = 0; - ignoredDfctRbg = TRUE; - - } - } - else - { - if (dlSf->lstRbgDfct) - { - /* Check if type0 allocation can cater to this RETX requirement */ - if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct)) - { - RETVALUE(FALSE); - } - } - else - { - /* cannot allocate same number of required RBs */ - RETVALUE(FALSE); - } - } - } - - /* Condition is modified approprialtely to find - * if rbsReq is less than available RBS*/ - if(allocInfo->rbsReq <= (((dlSf->type0End - dlSf->type2End + 1)*\ - cell->rbgSize) - dlSf->lstRbgDfct)) - { - RETVALUE(TRUE); - } - /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB - * allocation in TDD when requested RBs are more than available RBs*/ - else - { - /* MS_WORKAROUND for ccpu00122022 */ - if (dlSf->bw < dlSf->bwAlloced + cell->rbgSize) - { - /* ccpu00132358- Re-assigning the values which were updated above - * if it is RETX and Last RBG available*/ - if(ignoredDfctRbg == TRUE) - { - dlSf->type0End++; - dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct); - dlSf->lstRbgDfct = 1; - } - - - RETVALUE(FALSE); - } - /* Fix: Number of RBs in case of RETX should be same as - * that of initial transmission. */ - if(allocInfo->tbInfo[0].tbCb->txCntr == 0 -#ifdef LTE_ADV - && (FALSE == rgSCHLaaIsLaaTB(allocInfo)) -#endif - ) - { - /* Setting the remaining RBs for the requested UE*/ - allocInfo->rbsReq = (((dlSf->type0End - dlSf->type2End + 1)*\ - cell->rbgSize) - dlSf->lstRbgDfct); - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - noLyrs = allocInfo->tbInfo[0].noLyr; - allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; - /* DwPts Scheduling Changes Start */ -#if LTE_TDD - if (dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - allocInfo->tbInfo[0].bytesReq = - rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8; - } -#endif - /* DwPts Scheduling Changes End */ - } - else - { - /* ccpu00132358- Re-assigning the values which were updated above - * if it is RETX and Last RBG available*/ - if(ignoredDfctRbg == TRUE) - { - dlSf->type0End++; - dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct); - dlSf->lstRbgDfct = 1; - } - - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "FAILED for CRNTI:%d", - allocInfo->rnti); - printf ("RB Alloc failed for LAA TB type 0\n"); - RETVALUE(FALSE); - } - RETVALUE(TRUE); - } - } - else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - if (allocInfo->rbsReq <= (dlSf->bw - dlSf->bwAlloced)) - { - RETVALUE(TRUE); - } - /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB - * allocation in TDD when requested RBs are more than available RBs*/ - else - { - /* Fix: Number of RBs in case of RETX should be same as - * that of initial transmission. */ - if((allocInfo->tbInfo[0].tbCb->txCntr == 0) -#ifdef LTE_ADV - && (FALSE == rgSCHLaaIsLaaTB(allocInfo)) -#endif - ) - { - /* set the remaining RBs for the requested UE */ - allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced; - RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); - noLyrs = allocInfo->tbInfo[0].noLyr; - allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if (dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - allocInfo->tbInfo[0].bytesReq = - rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8; - } -#endif - /* DwPts Scheduling Changes End */ - } - else - { - printf ("RB Alloc failed for LAA TB type 2\n"); - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"FAILED for CRNTI:%d",allocInfo->rnti); - RETVALUE(FALSE); - } - /* Fix: Number of RBs in case of RETX should be same as - * that of initial transmission. */ - RETVALUE(TRUE); - } - } - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"FAILED for CRNTI:%d",allocInfo->rnti); - RETVALUE(FALSE); -} -/* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD -/** - * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. - * - * @details - * - * Function : rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] U8 rbStrt - * @param[in] U8 numRb - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -) -#else -PUBLIC Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, rbStrt, numRb) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -U8 rbStrt; -U8 numRb; -#endif -{ - CmLListCp *l; - CmLList *n; - RgSchSFRPoolInfo *sfrPool; - TRC2(rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc); - - l = &dlSf->sfrTotalPoolInfo.ccPool; - - dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); - dlSf->bwAlloced += numRb; - dlSf->type2Start += numRb; - n = cmLListFirst(l); - - while(n->node) - { - sfrPool = (RgSchSFRPoolInfo*)(n->node); - n = cmLListNext(l); - - /* If the pool contains some RBs allocated in this allocation, e.g: Pool is [30.50]. Pool->type2Start is 40 , dlSf->type2Start is 45. then update the variables in pool */ - if((sfrPool->poolendRB >= dlSf->type2Start) && (sfrPool->type2Start < dlSf->type2Start)) - { - sfrPool->type2End = dlSf->type2End; - sfrPool->bwAlloced = dlSf->type2Start - sfrPool->poolstartRB; - sfrPool->type2Start = dlSf->type2Start; - } - else - { - /* If the pool contains all RBs allocated in this allocation*/ - if(dlSf->type2Start > sfrPool->poolendRB) - { - sfrPool->type2End = sfrPool->type0End + 1; - sfrPool->bwAlloced = sfrPool->bw; - sfrPool->type2Start = sfrPool->poolendRB + 1; - } - } - if (!n) - { - if (l != &dlSf->sfrTotalPoolInfo.cePool) - { - l = &dlSf->sfrTotalPoolInfo.cePool; - n = cmLListFirst(l); - } - else - RETVOID; - } - } - RETVOID; -} - -/** - * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. - * - * @details - * - * Function : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] U8 rbStrt - * @param[in] U8 numRb - * - * @return Void - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -) -#else -PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc(cell, ue, dlSf, rbStrt, numRb) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlSf *dlSf; -U8 rbStrt; -U8 numRb; -#endif -{ - CmLListCp *l; - CmLList *n; - RgSchSFRPoolInfo *sfrCCPool1 = NULL; - RgSchSFRPoolInfo *sfrCCPool2 = NULL; - S16 ret = RFAILED; - - TRC2(rgSCHCmnNonDlfsUpdDSFRTyp2Alloc); - /* Move the type2End pivot forward */ - - - l = &dlSf->sfrTotalPoolInfo.ccPool; - n = cmLListFirst(l); - while(n) - { - sfrCCPool1 = (RgSchSFRPoolInfo*)(n->node); - /* KWork fix */ - if (sfrCCPool1 == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" - "sfrCCPool1 is NULL for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - n = cmLListNext(l); - if(n) - { - sfrCCPool2 = (RgSchSFRPoolInfo*)(n->node); - n = cmLListNext(l); - } - if((sfrCCPool1) && (sfrCCPool2)) - { - /* Based on RNTP info, the CC user is assigned high power per subframe basis */ - if(((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) && - (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb)) || - ((dlSf->type2Start >= sfrCCPool2->pwrHiCCRange.startRb) && - (dlSf->type2Start + numRb < sfrCCPool2->pwrHiCCRange.endRb))) - { - ue->lteAdvUeCb.isCCUePHigh = TRUE; - - /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ - ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" - "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - } - else - { - if((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) && - (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb)) - { - ue->lteAdvUeCb.isCCUePHigh = TRUE; - - /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ - ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" - "rgSCHCmnBuildRntpInfo() function returned RFAILED CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - } - } - dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); -#ifndef LTEMAC_SPS - dlSf->bwAlloced += numRb; - /*MS_FIX for ccpu00123918*/ - dlSf->type2Start += numRb; -#endif - RETVALUE(ROK); -} -#endif /* end of ifndef LTE_TDD*/ -/* LTE_ADV_FLAG_REMOVED_END */ -/** - * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. - * - * @details - * - * Function : rgSCHCmnNonDlfsUpdTyp2Alloc - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] U8 rbStrt - * @param[in] U8 numRb - * - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -U8 rbStrt, -U8 numRb -) -#else -PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, rbStrt, numRb) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -U8 rbStrt; -U8 numRb; -#endif -{ - TRC2(rgSCHCmnNonDlfsUpdTyp2Alloc); - /* Move the type2End pivot forward */ - dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); -//#ifndef LTEMAC_SPS - dlSf->bwAlloced += numRb; - /*Fix for ccpu00123918*/ - dlSf->type2Start += numRb; -//#endif - RETVOID; -} - -/** - * @brief To do DL allocation using TYPE0 RA. - * - * @details - * - * Function : rgSCHCmnNonDlfsType0Alloc - * - * Processing Steps: - * - Perform TYPE0 allocation using the RBGs between - * type0End and type2End. - * - Build the allocation mask as per RBG positioning. - * - Update the allocation parameters. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchDlRbAlloc *allocInfo - * - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsType0Alloc -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlRbAlloc *allocInfo, -RgSchUeCb *ue -) -#else -PRIVATE Void rgSCHCmnNonDlfsType0Alloc(cell, dlSf, allocInfo, dlUe) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlRbAlloc *allocInfo; -RgSchUeCb *ue; -#endif -{ - U32 dlAllocMsk = 0; - U8 rbgFiller = dlSf->lstRbgDfct; - U8 noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize); - //U8 noRbgs = (allocInfo->rbsReq + rbgFiller)/ cell->rbgSize; - U8 noRbs; - U8 noLyr; - U8 iTbs; - U32 tb1BytesAlloc = 0; - U32 tb2BytesAlloc = 0; - RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnNonDlfsType0Alloc); - //if(noRbgs == 0) noRbgs = 1; /* Not required as ceilling is used above*/ - - /* Fix for ccpu00123919*/ - noRbs = (noRbgs * cell->rbgSize) - rbgFiller; - if (dlSf->bwAlloced + noRbs > dlSf->bw) - { - if (--noRbgs == 0) - { - RETVOID; - } - noRbs = (noRbgs * cell->rbgSize) - rbgFiller; - } - - /* Fix for ccpu00138701: Ceilling is using to derive num of RBGs, Therefore, - * after this operation,checking Max TB size and Max RBs are not crossed - * if it is crossed then decrement num of RBGs. */ - //if((noRbs + rbgFiller) % cell->rbgSize) - if((noRbs > allocInfo->rbsReq) && - (allocInfo->rbsReq + rbgFiller) % cell->rbgSize) - {/* considering ue category limitation - * due to ceiling */ - -#ifdef LTE_ADV - if (rgSCHLaaIsLaaTB(allocInfo)== FALSE) -#endif - { - if ((allocInfo->tbInfo[0].schdlngForTb) && (!allocInfo->tbInfo[0].tbCb->txCntr)) - { - iTbs = allocInfo->tbInfo[0].iTbs; - noLyr = allocInfo->tbInfo[0].noLyr; - tb1BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; - } - - if ((allocInfo->tbInfo[1].schdlngForTb) && (!allocInfo->tbInfo[1].tbCb->txCntr)) - { - iTbs = allocInfo->tbInfo[1].iTbs; - noLyr = allocInfo->tbInfo[1].noLyr; - tb2BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; - } - } - - /* Only Check for New Tx No need for Retx */ - if (tb1BytesAlloc || tb2BytesAlloc) - { - if (( ue->dl.aggTbBits >= dlUe->maxTbBits) || - (tb1BytesAlloc >= dlUe->maxTbSz/8) || - (tb2BytesAlloc >= dlUe->maxTbSz/8) || - (noRbs >= dlUe->maxRb)) - { - if (--noRbgs == 0) - { - RETVOID; - } - noRbs = (noRbgs * cell->rbgSize) - rbgFiller; - } - } - } - /* type0End would have been initially (during subfrm Init) at the bit position - * (cell->noOfRbgs - 1), 0 being the most significant. - * Getting DlAllocMsk for noRbgs and at the appropriate position */ - dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - dlSf->type0End)); - /* Move backwards the type0End pivot */ - dlSf->type0End -= noRbgs; - /*Fix for ccpu00123919*/ - /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/ - /* Update the bwAlloced field accordingly */ -//#ifndef LTEMAC_SPS /* ccpu00129474*/ - dlSf->bwAlloced += noRbs; -//#endif - /* Update Type0 Alloc Info */ - allocInfo->allocInfo.raType0.numDlAlloc = noRbgs; - allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk; - allocInfo->rbsAlloc = noRbs; - - /* Update Tb info for each scheduled TB */ - iTbs = allocInfo->tbInfo[0].iTbs; - noLyr = allocInfo->tbInfo[0].noLyr; - /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant. - * RETX TB Size is same as Init TX TB Size */ - if (allocInfo->tbInfo[0].tbCb->txCntr) - { - allocInfo->tbInfo[0].bytesAlloc = - allocInfo->tbInfo[0].bytesReq; - } - else - { - allocInfo->tbInfo[0].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if (dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - allocInfo->tbInfo[0].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8; - } -#endif - /* DwPts Scheduling Changes End */ - } - - if (allocInfo->tbInfo[1].schdlngForTb) - { - iTbs = allocInfo->tbInfo[1].iTbs; - noLyr = allocInfo->tbInfo[1].noLyr; - /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant - * RETX TB Size is same as Init TX TB Size */ - if (allocInfo->tbInfo[1].tbCb->txCntr) - { - allocInfo->tbInfo[1].bytesAlloc = - allocInfo->tbInfo[1].bytesReq; - } - else - { - allocInfo->tbInfo[1].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;; - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if (dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - allocInfo->tbInfo[1].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8; - } -#endif - /* DwPts Scheduling Changes End */ - } - } - - /* The last RBG which can be smaller than the RBG size is consedered - * only for the first time allocation of TYPE0 UE */ - dlSf->lstRbgDfct = 0; - RETVOID; -} -#ifndef LTE_TDD - -/** - * @brief To prepare RNTP value from the PRB allocation (P-High -> 1 and P-Low -> 0) - * - * @details - * - * Function : rgSCHCmnBuildRntpInfo - * - * Processing Steps: - * - * @param[in] U8 *rntpPtr - * @param[in] U8 startRb - * @param[in] U8 numRb - * - * @return Void - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnBuildRntpInfo -( -RgSchCellCb *cell, -U8 *rntpPtr, -U8 startRb, -U8 nmbRb, -U16 bw -) -#else -PRIVATE S16 rgSCHCmnBuildRntpInfo(cell, rntpPtr, startRb, nmbRb, bw) -RgSchCellCb *cell; -U8 *rntpPtr; -U8 startRb; -U8 nmbRb; -U16 bw; -#endif -{ - U16 rbPtrStartIdx; /* Start Index of Octete Buffer to be filled */ - U16 rbPtrEndIdx; /* End Index of Octete Buffer to be filled */ - U16 rbBitLoc; /* Bit Location to be set as 1 in the current Byte */ - U16 nmbRbPerByte; /* PRB's to be set in the current Byte (in case of multiple Bytes) */ - - TRC2(rgSCHCmnBuildRntpInfo); - - rbPtrStartIdx = (startRb)/8; - rbPtrEndIdx = (startRb + nmbRb)/8; - - if (rntpPtr == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHCmnBuildRntpInfo():" - "rntpPtr can't be NULLP (Memory Allocation Failed)"); - RETVALUE(RFAILED); - } - - while(rbPtrStartIdx <= rbPtrEndIdx) - { - rbBitLoc = (startRb)%8; - - /* case 1: startRb and endRb lies in same Byte */ - if (rbPtrStartIdx == rbPtrEndIdx) - { - rntpPtr[rbPtrStartIdx] = rntpPtr[rbPtrStartIdx] - | (((1<type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); - sfrPool->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); - -#ifndef LTEMAC_SPS - dlSf->type2Start += numRb; - dlSf->bwAlloced += numRb; - - if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - /* Based on RNTP info, the CC user is assigned high power per subframe basis */ - if(FALSE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge) - { - if((sfrPool->type2Start >= sfrPool->pwrHiCCRange.startRb) && - (sfrPool->type2Start + numRb < sfrPool->pwrHiCCRange.endRb)) - { - ue->lteAdvUeCb.isCCUePHigh = TRUE; - - /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ - ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():" - "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - } - else - { - /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ - ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():" - "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - } - } - sfrPool->type2Start += numRb; - sfrPool->bwAlloced += numRb; -#endif - - RETVALUE(ROK); -} - -/** - * @brief To do DL allocation using TYPE0 RA. - * - * @details - * - * Function : rgSCHCmnNonDlfsSFRPoolType0Alloc - * - * Processing Steps: - * - Perform TYPE0 allocation using the RBGs between type0End and type2End. - * - Build the allocation mask as per RBG positioning. - * - Update the allocation parameters. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchDlRbAlloc *allocInfo - * - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsSFRPoolType0Alloc -( -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchSFRPoolInfo *poolInfo, -RgSchDlRbAlloc *allocInfo -) -#else -PRIVATE Void rgSCHCmnNonDlfsSFRPoolType0Alloc(cell, dlSf, poolInfo, allocInfo) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchSFRPoolInfo *poolInfo; -RgSchDlRbAlloc *allocInfo; -#endif -{ - U32 dlAllocMsk = 0; - U8 rbgFiller = 0; - U8 noRbgs = 0; - U8 noRbs; - U8 noLyr; - U8 iTbs; - - TRC2(rgSCHCmnNonDlfsSFRPoolType0Alloc); - - if (poolInfo->poolstartRB + poolInfo->bw == dlSf->bw) - { - if (poolInfo->type0End == dlSf->bw/4) - { - rbgFiller = dlSf->lstRbgDfct; - /* The last RBG which can be smaller than the RBG size is consedered - * only for the first time allocation of TYPE0 UE */ - dlSf->lstRbgDfct = 0; - } - } - - noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize); - - /* Abhinav to-do start */ - /* MS_FIX for ccpu00123919*/ - noRbs = (noRbgs * cell->rbgSize) - rbgFiller; - if (dlSf->bwAlloced + noRbs > dlSf->bw) - { - if (--noRbgs == 0) - { - RETVOID; - } - noRbs = (noRbgs * cell->rbgSize) - rbgFiller; - } - /* Abhinav to-do end */ - - - - /* type0End would have been initially (during subfrm Init) at the bit position - * (cell->noOfRbgs - 1), 0 being the most significant. - * Getting DlAllocMsk for noRbgs and at the appropriate position */ - dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - poolInfo->type0End)); - /* Move backwards the type0End pivot */ - poolInfo->type0End -= noRbgs; - /*MS_FIX for ccpu00123919*/ - /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/ - /* Update the bwAlloced field accordingly */ - poolInfo->bwAlloced += noRbs + dlSf->lstRbgDfct; - dlSf->bwAlloced += noRbs + dlSf->lstRbgDfct; - - /* Update Type0 Alloc Info */ - allocInfo->allocInfo.raType0.numDlAlloc = noRbgs; - allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk; - allocInfo->rbsAlloc = noRbs; - - /* Update Tb info for each scheduled TB */ - iTbs = allocInfo->tbInfo[0].iTbs; - noLyr = allocInfo->tbInfo[0].noLyr; - /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant. - * RETX TB Size is same as Init TX TB Size */ - if (allocInfo->tbInfo[0].tbCb->txCntr) - { - allocInfo->tbInfo[0].bytesAlloc = - allocInfo->tbInfo[0].bytesReq; - } - else - { - allocInfo->tbInfo[0].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; - } - - if (allocInfo->tbInfo[1].schdlngForTb) - { - iTbs = allocInfo->tbInfo[1].iTbs; - noLyr = allocInfo->tbInfo[1].noLyr; - /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant - * RETX TB Size is same as Init TX TB Size */ - if (allocInfo->tbInfo[1].tbCb->txCntr) - { - allocInfo->tbInfo[1].bytesAlloc = - allocInfo->tbInfo[1].bytesReq; - } - else - { - allocInfo->tbInfo[1].bytesAlloc = - rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;; - } - } - - /* The last RBG which can be smaller than the RBG size is consedered - * only for the first time allocation of TYPE0 UE */ - dlSf->lstRbgDfct = 0; - RETVOID; -} - -/** - * @brief Computes RNTP Info for a subframe. - * - * @details - * - * Function : rgSCHCmnNonDlfsDsfrRntpComp - * - * Processing Steps: - * - Computes RNTP info from individual pools. - * - * @param[in] RgSchDlSf *dlSf - * - * @return void - - **/ -#ifdef ANSI -PRIVATE void rgSCHCmnNonDlfsDsfrRntpComp -( -RgSchCellCb *cell, -RgSchDlSf *dlSf -) -#else -PRIVATE void rgSCHCmnNonDlfsDsfrRntpComp(cell, dlSf) -RgSchCellCb *cell; -RgSchDlSf *dlSf; -#endif -{ - PRIVATE U16 samples = 0; - U16 i; - U16 bwBytes = (dlSf->bw-1)/8; - RgrLoadInfIndInfo *rgrLoadInf; - U16 len; - U16 ret = ROK; - - TRC2(rgSCHCmnNonDlfsDsfrRntpComp); - - len = (dlSf->bw % 8 == 0) ? dlSf->bw/8 : dlSf->bw/8 + 1; - - /* RNTP info is ORed every TTI and the sample is stored in cell control block */ - for(i = 0; i <= bwBytes; i++) - { - cell->rntpAggrInfo.val[i] |= dlSf->rntpInfo.val[i]; - } - samples = samples + 1; - /* After every 1000 ms, the RNTP info will be sent to application to be further sent to all neighbouring eNB - informing them about the load indication for cell edge users */ - if(RG_SCH_MAX_RNTP_SAMPLES == samples) - { - /* ccpu00134492 */ - ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf, - sizeof(RgrLoadInfIndInfo)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Could not " - "allocate memory for sending LoadInfo"); - RETVOID; - } - - rgrLoadInf->u.rntpInfo.pres = cell->rntpAggrInfo.pres; - /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ - rgrLoadInf->u.rntpInfo.len = len; - - /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ - rgrLoadInf->u.rntpInfo.val = cell->rntpAggrInfo.val; - rgrLoadInf->cellId = cell->cellId; - - /* dsfr_pal_fixes ** 22-March-2013 ** SKS */ - rgrLoadInf->bw = dlSf->bw; - rgrLoadInf->type = RGR_SFR; - - ret = rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf); - if(ret == RFAILED) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsDsfrRntpComp():" - "rgSCHUtlRgrLoadInfInd() returned RFAILED"); - } - - cmMemset(cell->rntpAggrInfo.val,0,len); - samples = 0; - } - } -/* LTE_ADV_FLAG_REMOVED_END */ - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - * @brief Performs RB allocation per UE from a pool. - * - * @details - * - * Function : rgSCHCmnSFRNonDlfsUeRbAlloc - * - * Processing Steps: - * - Allocate consecutively available RBs. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlSf *dlSf - * @param[out] U8 *isDlBwAvail - * - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnSFRNonDlfsUeRbAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *dlSf, -U8 *isDlBwAvail -) -#else -PRIVATE S16 rgSCHCmnSFRNonDlfsUeRbAlloc(cell, ue, dlSf, isDlBwAvail) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlSf *dlSf; -U8 *isDlBwAvail; -#endif -{ - U32 y; - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *dlUe; - Bool isUECellEdge; - RgSchSFRPoolInfo *sfrpoolInfo = NULLP; - - TRC2(rgSCHCmnSFRNonDlfsUeRbAlloc); - - isUECellEdge = RG_SCH_CMN_IS_UE_CELL_EDGE(ue); - - dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - *isDlBwAvail = TRUE; - - /*Find which pool is available for this UE*/ - if (rgSCHCmnNonDlfsSFRBwAvlbl(cell, &sfrpoolInfo, dlSf, allocInfo, isUECellEdge) != TRUE) - { - /* SFR_FIX - If this is CE UE there may be BW available in CC Pool - So CC UEs will be scheduled */ - if (isUECellEdge) - { - *isDlBwAvail = TRUE; - } - else - { - *isDlBwAvail = FALSE; - } - RETVALUE(RFAILED); - } - - if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX || dlUe->proc->tbInfo[1].isAckNackDtx) - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE); - } - else - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE); - } - - if (!(allocInfo->pdcch)) - { - /* Returning ROK since PDCCH might be available for another UE and further allocations could be done */ - RETVALUE(RFAILED); - } - -#ifdef LTEMAC_SPS - allocInfo->rnti = ue->ueId; -#endif - - if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) - { - allocInfo->allocInfo.raType2.isLocal = TRUE; - /* rg004.201 patch - ccpu00109921 fix end */ - /* MS_FIX for ccpu00123918*/ - allocInfo->allocInfo.raType2.rbStart = (U8)sfrpoolInfo->type2Start; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - /* rg007.201 - Changes for MIMO feature addition */ - /* rg008.201 - Removed dependency on MIMO compile-time flag */ - rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc(cell, ue, dlSf, sfrpoolInfo, \ - allocInfo->allocInfo.raType2.rbStart, \ - allocInfo->allocInfo.raType2.numRb); - allocInfo->rbsAlloc = allocInfo->rbsReq; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - } - else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) - { - rgSCHCmnNonDlfsSFRPoolType0Alloc(cell, dlSf, sfrpoolInfo, allocInfo); - } -#ifndef LTE_TDD -#ifdef DEBUGP - rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,0); - if(allocInfo->tbInfo[1].schdlngForTb == TRUE) - { - rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,1); - } -#endif -#endif - -#if defined(LTEMAC_SPS) - /* Update the sub-frame with new allocation */ - dlSf->bwAlloced += allocInfo->rbsReq; -#endif - - RETVALUE(ROK); -} -/* LTE_ADV_FLAG_REMOVED_END */ -#endif /* LTE_TDD */ - -/** - * @brief Performs RB allocation per UE for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsUeRbAlloc - * - * Processing Steps: - * - Allocate consecutively available RBs. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlSf *dlSf - * @param[out] U8 *isDlBwAvail - * - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlSf *dlSf, -U8 *isDlBwAvail -) -#else -PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc(cell, ue, dlSf, isDlBwAvail) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlSf *dlSf; -U8 *isDlBwAvail; -#endif -{ - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *dlUe; -#ifdef LAA_DBG - U32 dbgRbsReq = 0; -#endif - TRC2(rgSCHCmnNonDlfsUeRbAlloc); - -#ifdef RG_5GTF - RgSch5gtfUeCb *ue5gtfCb = &(ue->ue5gtfCb); - RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[ue5gtfCb->BeamId]); -#endif - dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - *isDlBwAvail = TRUE; - - if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) - { - RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, - "5GTF_ERROR : vrbg allocated > 25 :ue (%u)", - ue->ueId); - printf("5GTF_ERROR vrbg allocated > 25\n"); - RETVALUE(RFAILED); - } - - if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX - || dlUe->proc->tbInfo[1].isAckNackDtx) - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE); - } - else - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE); - } - if (!(allocInfo->pdcch)) - { - /* Returning ROK since PDCCH might be available for another UE and - * further allocations could be done */ - RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, - "5GTF_ERROR : PDCCH allocation failed :ue (%u)", - ue->ueId); - printf("5GTF_ERROR PDCCH allocation failed\n"); - RETVALUE(RFAILED); - } -#ifdef RG_5GTF - //maxPrb = RGSCH_MIN((allocInfo->vrbgReq * MAX_5GTF_VRBG_SIZE), ue5gtfCb->maxPrb); - //maxPrb = RGSCH_MIN(maxPrb, - //((beamInfo->totVrbgAvail - beamInfo->vrbgStart)* MAX_5GTF_VRBG_SIZE))); - //TODO_SID Need to check for vrbg available after scheduling for same beam. - allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart; - allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq; - //TODO_SID: Setting for max TP - allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1; - allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, - allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg); - allocInfo->tbInfo[0].tbCb->dlGrnt.SCID = 0; - allocInfo->tbInfo[0].tbCb->dlGrnt.dciFormat = allocInfo->dciFormat; - //Filling temporarily - allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); - allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); - - beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; - beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; -#endif - - RETVALUE(ROK); -} - -#ifdef RGR_V1 -/** - * @brief Performs RB allocation for Msg4 for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsCcchSduAlloc - * - * Processing Steps: - * - For each element in the list, Call rgSCHCmnNonDlfsCcchSduRbAlloc(). - * - If allocation is successful, add the ueCb to scheduled list of CCCH - * SDU. - * - else, add UeCb to non-scheduled list. - * - * @param[in] RgSchCellCb *cell - * @param[in, out] RgSchCmnCcchSduRbAlloc *allocInfo - * @param[in] U8 isRetx - * - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsCcchSduAlloc -( -RgSchCellCb *cell, -RgSchCmnCcchSduRbAlloc *allocInfo, -U8 isRetx -) -#else -PRIVATE Void rgSCHCmnNonDlfsCcchSduAlloc(cell, allocInfo, isRetx) -RgSchCellCb *cell; -RgSchCmnCcchSduRbAlloc *allocInfo; -U8 isRetx; -#endif -{ - S16 ret; - CmLListCp *ccchSduLst = NULLP; - CmLListCp *schdCcchSduLst = NULLP; - CmLListCp *nonSchdCcchSduLst = NULLP; - CmLList *schdLnkNode = NULLP; - CmLList *toBeSchdLnk = NULLP; - RgSchDlSf *dlSf = allocInfo->ccchSduDlSf; - RgSchUeCb *ueCb = NULLP; - RgSchDlHqProcCb *hqP = NULLP; - TRC2(rgSCHCmnNonDlfsCcchSduAlloc); - - if (isRetx) - { - /* Initialize re-transmitting lists */ - ccchSduLst = &(allocInfo->ccchSduRetxLst); - schdCcchSduLst = &(allocInfo->schdCcchSduRetxLst); - nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduRetxLst); - } - else - { - /* Initialize transmitting lists */ - ccchSduLst = &(allocInfo->ccchSduTxLst); - schdCcchSduLst = &(allocInfo->schdCcchSduTxLst); - nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduTxLst); - } - - /* Perform allocaations for the list */ - toBeSchdLnk = cmLListFirst(ccchSduLst); - for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - ueCb = hqP->hqE->ue; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - ret = rgSCHCmnNonDlfsCcchSduRbAlloc(cell, ueCb, dlSf); - if (ret != ROK) - { - /* Allocation failed: Add remaining MSG4 nodes to non-scheduled - * list and return */ - do - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - ueCb = hqP->hqE->ue; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - cmLListAdd2Tail(nonSchdCcchSduLst, schdLnkNode); - toBeSchdLnk = toBeSchdLnk->next; - } while(toBeSchdLnk); - RETVOID; - } - - /* Allocation successful: Add UE to the scheduled list */ - cmLListAdd2Tail(schdCcchSduLst, schdLnkNode); - } - - - RETVOID; -} - -/** - * @brief Performs RB allocation for CcchSdu for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsCcchSduRbAlloc - * - * Processing Steps: - * - Fetch PDCCH - * - Allocate consecutively available RBs - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * @param[in] RgSchDlSf *dlSf - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc -( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgSchDlSf *dlSf -) -#else -PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc(cell, ueCb, dlSf) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -RgSchDlSf *dlSf; -#endif -{ - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); - - TRC2(rgSCHCmnNonDlfsCcchSduRbAlloc); - - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb,cell); - - /* [ccpu00138802]-MOD-If Bw is less than required, return fail - It will be allocated in next TTI */ -#ifdef LTEMAC_SPS - if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && - (dlSf->bwAlloced == dlSf->bw)) -#else - if((dlSf->bwAlloced == dlSf->bw) || - (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced))) -#endif - { - RETVALUE(RFAILED); - } - /* Retrieve PDCCH */ - /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ - if (ueDl->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX) - { - /* allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, dlSf, y, ueDl->cqi, - * TFU_DCI_FORMAT_1A, TRUE);*/ - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, TRUE); - } - else - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE); - } - if (!(allocInfo->pdcch)) - { - /* Returning RFAILED since PDCCH not available for any CCCH allocations */ - RETVALUE(RFAILED); - } - - /* Update allocation information */ - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - allocInfo->allocInfo.raType2.isLocal = TRUE; - - /*Fix for ccpu00123918*/ - /* Push this harq process back to the free queue */ - allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - allocInfo->rbsAlloc = allocInfo->rbsReq; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - /* Update the sub-frame with new allocation */ - /* ccpu00129469 */ - /* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD - if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) - { - rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, - allocInfo->allocInfo.raType2.rbStart, - allocInfo->allocInfo.raType2.numRb); - } - else -#endif /* end of ifndef LTE_TDD*/ - { - rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, - allocInfo->allocInfo.raType2.rbStart, - allocInfo->allocInfo.raType2.numRb); - } - - /* LTE_ADV_FLAG_REMOVED_END */ - /* ccpu00131941 - bwAlloced is updated from SPS bandwidth */ - - - RETVALUE(ROK); -} -#endif - -/** - * @brief Performs RB allocation for Msg4 for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsMsg4RbAlloc - * - * Processing Steps: - * - Fetch PDCCH - * - Allocate consecutively available RBs - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchRaCb *raCb - * @param[in] RgSchDlSf *dlSf - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc -( -RgSchCellCb *cell, -RgSchRaCb *raCb, -RgSchDlSf *dlSf -) -#else -PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc(cell, raCb, dlSf) -RgSchCellCb *cell; -RgSchRaCb *raCb; -RgSchDlSf *dlSf; -#endif -{ - RgSchDlRbAlloc *allocInfo; - TRC2(rgSCHCmnNonDlfsMsg4RbAlloc); - - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_RACB(raCb); - -#ifdef RG_5GTF - RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]); - if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) - { - RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, - "5GTF_ERROR : vrbg allocated > 25 :ue (%u)", - raCb->ue->ueId); - printf("5GTF_ERROR vrbg allocated > 25\n"); - RETVALUE(RFAILED); - } -#endif -#ifdef LTEMAC_SPS - if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && - (dlSf->bwAlloced == dlSf->bw)) -#else - if((dlSf->bwAlloced == dlSf->bw) || - (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced))) -#endif - { - - RETVALUE(RFAILED); - } - - /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ - if (raCb->dlHqE->msg4Proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX) - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, TRUE); - } - else - { - allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, FALSE); - } - if (!(allocInfo->pdcch)) - { - /* Returning RFAILED since PDCCH not available for any CCCH allocations */ - RETVALUE(RFAILED); - } - -#ifndef RG_5GTF - /* SR_RACH_STATS : MSG4 TX Failed */ - allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE; - - /* Update allocation information */ - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - allocInfo->allocInfo.raType2.isLocal = TRUE; - - - /*Fix for ccpu00123918*/ - allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; - allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; - /* LTE_ADV_FLAG_REMOVED_START */ -#ifndef LTE_TDD - if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) - { - rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \ - allocInfo->allocInfo.raType2.rbStart, \ - allocInfo->allocInfo.raType2.numRb); - } - else -#endif /* end of ifndef LTE_TDD */ - { - rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \ - allocInfo->allocInfo.raType2.rbStart, \ - allocInfo->allocInfo.raType2.numRb); - } - /* LTE_ADV_FLAG_REMOVED_END */ - - allocInfo->rbsAlloc = allocInfo->rbsReq; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - -#else - - allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE; - - allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart; - allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq; - - /* Update allocation information */ - allocInfo->dciFormat = TFU_DCI_FORMAT_B1; - - allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1; - allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, - allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg); - - allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); - allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); - - - beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; - beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; - allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; - -#endif - - RETVALUE(ROK); -} - -/** - * @brief Performs RB allocation for Msg4 lists of frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsMsg4Alloc - * - * Processing Steps: - * - For each element in the list, Call rgSCHCmnNonDlfsMsg4RbAlloc(). - * - If allocation is successful, add the raCb to scheduled list of MSG4. - * - else, add RaCb to non-scheduled list. - * - * @param[in] RgSchCellCb *cell - * @param[in, out] RgSchCmnMsg4RbAlloc *allocInfo - * @param[in] U8 isRetx - * - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc -( -RgSchCellCb *cell, -RgSchCmnMsg4RbAlloc *allocInfo, -U8 isRetx -) -#else -PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc(cell, allocInfo, isRetx) -RgSchCellCb *cell; -RgSchCmnMsg4RbAlloc *allocInfo; -U8 isRetx; -#endif -{ - S16 ret; - CmLListCp *msg4Lst = NULLP; - CmLListCp *schdMsg4Lst = NULLP; - CmLListCp *nonSchdMsg4Lst = NULLP; - CmLList *schdLnkNode = NULLP; - CmLList *toBeSchdLnk = NULLP; - RgSchDlSf *dlSf = allocInfo->msg4DlSf; - RgSchRaCb *raCb = NULLP; - RgSchDlHqProcCb *hqP = NULLP; - TRC2(rgSCHCmnNonDlfsMsg4Alloc); - - if (isRetx) - { - /* Initialize re-transmitting lists */ - msg4Lst = &(allocInfo->msg4RetxLst); - schdMsg4Lst = &(allocInfo->schdMsg4RetxLst); - nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4RetxLst); - } - else - { - /* Initialize transmitting lists */ - msg4Lst = &(allocInfo->msg4TxLst); - schdMsg4Lst = &(allocInfo->schdMsg4TxLst); - nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4TxLst); - } - - /* Perform allocaations for the list */ - toBeSchdLnk = cmLListFirst(msg4Lst); - for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - raCb = hqP->hqE->raCb; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - ret = rgSCHCmnNonDlfsMsg4RbAlloc(cell, raCb, dlSf); - if (ret != ROK) - { - /* Allocation failed: Add remaining MSG4 nodes to non-scheduled - * list and return */ - do - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - raCb = hqP->hqE->raCb; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - cmLListAdd2Tail(nonSchdMsg4Lst, schdLnkNode); - toBeSchdLnk = toBeSchdLnk->next; - } while(toBeSchdLnk); - RETVOID; - } - - /* Allocation successful: Add UE to the scheduled list */ - cmLListAdd2Tail(schdMsg4Lst, schdLnkNode); - if (isRetx) - { - } - } - - - RETVOID; -} - -/** - * @brief Performs RB allocation for the list of UEs of a frequency - * non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsDedRbAlloc - * - * Processing Steps: - * - For each element in the list, Call rgSCHCmnNonDlfsUeRbAlloc(). - * - If allocation is successful, add the ueCb to scheduled list of UEs. - * - else, add ueCb to non-scheduled list of UEs. - * - * @param[in] RgSchCellCb *cell - * @param[in, out] RgSchCmnUeRbAlloc *allocInfo - * @param[in] CmLListCp *ueLst, - * @param[in, out] CmLListCp *schdHqPLst, - * @param[in, out] CmLListCp *nonSchdHqPLst - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnNonDlfsDedRbAlloc -( -RgSchCellCb *cell, -RgSchCmnUeRbAlloc *allocInfo, -CmLListCp *ueLst, -CmLListCp *schdHqPLst, -CmLListCp *nonSchdHqPLst -) -#else -PUBLIC Void rgSCHCmnNonDlfsDedRbAlloc(cell, allocInfo, ueLst, - schdHqPLst, nonSchdHqPLst) -RgSchCellCb *cell; -RgSchCmnUeRbAlloc *allocInfo; -CmLListCp *ueLst; -CmLListCp *schdHqPLst; -CmLListCp *nonSchdHqPLst; -#endif -{ - S16 ret; - CmLList *schdLnkNode = NULLP; - CmLList *toBeSchdLnk = NULLP; - RgSchDlSf *dlSf = allocInfo->dedDlSf; - RgSchUeCb *ue = NULLP; - RgSchDlHqProcCb *hqP = NULLP; - U8 isDlBwAvail; - TRC2(rgSCHCmnNonDlfsDedRbAlloc); - - - /* Perform allocaations for the list */ - toBeSchdLnk = cmLListFirst(ueLst); - for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - ue = hqP->hqE->ue; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - - ret = rgSCHCmnNonDlfsUeRbAlloc(cell, ue, dlSf, &isDlBwAvail); - if (!isDlBwAvail) - { - /* Allocation failed: Add remaining UEs to non-scheduled - * list and return */ - do - { - hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); - ue = hqP->hqE->ue; - schdLnkNode = &hqP->schdLstLnk; - RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); - cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode); - toBeSchdLnk = toBeSchdLnk->next; - } while(toBeSchdLnk); - break; - } - - if (ret == ROK) - { -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.dl5gtfRbAllocPass++; -#endif - /* Allocation successful: Add UE to the scheduled list */ - cmLListAdd2Tail(schdHqPLst, schdLnkNode); - } - else - { -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.dl5gtfRbAllocFail++; -#endif - /* Allocation failed : Add UE to the non-scheduled list */ - printf("5GTF_ERROR Dl rb alloc failed adding nonSchdHqPLst\n"); - cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode); - } - } - - RETVOID; -} - -/** - * @brief Handles RB allocation for frequency non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsRbAlloc - * - * Invoking Module Processing: - * - SCH shall invoke this if downlink frequency selective is disabled for - * the cell for RB allocation. - * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs - * estimate and subframe for each allocation to be made to SCH. - * - * Processing Steps: - * - Allocate sequentially for common channels. - * - For transmitting and re-transmitting UE list. - * - For each UE: - * - Perform wide-band allocations for UE in increasing order of - * frequency. - * - Determine Imcs for the allocation. - * - Determine RA type. - * - Determine DCI format. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - **/ - -#ifdef ANSI -PUBLIC Void rgSCHCmnNonDlfsRbAlloc -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PUBLIC Void rgSCHCmnNonDlfsRbAlloc(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - U8 raRspCnt = 0; - RgSchDlRbAlloc *reqAllocInfo; - TRC2(rgSCHCmnNonDlfsRbAlloc); - - /* Allocate for MSG4 retransmissions */ - if (allocInfo->msg4Alloc.msg4RetxLst.count) - { - printf("5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc RetxLst\n"); - rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), TRUE); - } - - /* Allocate for MSG4 transmissions */ - /* Assuming all the nodes in the list need allocations: rbsReq is valid */ - if (allocInfo->msg4Alloc.msg4TxLst.count) - { - printf("5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc txLst\n"); - rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), FALSE); - } -#ifdef RGR_V1 - /* Allocate for CCCH SDU (received after guard timer expiry) - * retransmissions */ - if (allocInfo->ccchSduAlloc.ccchSduRetxLst.count) - { - printf("5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n"); - rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), TRUE); - } - - /* Allocate for CCCD SDU transmissions */ - /* Allocate for CCCH SDU (received after guard timer expiry) transmissions */ - if (allocInfo->ccchSduAlloc.ccchSduTxLst.count) - { - printf("5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n"); - rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), FALSE); - } -#endif - - /* Allocate for Random access response */ - for (raRspCnt = 0; raRspCnt < RG_SCH_CMN_MAX_CMN_PDCCH; ++raRspCnt) - { - /* Assuming that the requests will be filled in sequentially */ - reqAllocInfo = &(allocInfo->raRspAlloc[raRspCnt]); - if (!reqAllocInfo->rbsReq) - { - break; - } - printf("5GTF_ERROR calling RAR rgSCHCmnNonDlfsCmnRbAlloc\n"); - // if ((rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo)) != ROK) - if ((rgSCHCmnNonDlfsCmnRbAllocRar(cell, reqAllocInfo)) != ROK) - { - break; - } - } - - /* Allocate for RETX+TX UEs */ - if(allocInfo->dedAlloc.txRetxHqPLst.count) - { - printf("5GTF_ERROR TX RETX rgSCHCmnNonDlfsDedRbAlloc\n"); - rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), - &(allocInfo->dedAlloc.txRetxHqPLst), - &(allocInfo->dedAlloc.schdTxRetxHqPLst), - &(allocInfo->dedAlloc.nonSchdTxRetxHqPLst)); - } - - if((allocInfo->dedAlloc.retxHqPLst.count)) - { - rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), - &(allocInfo->dedAlloc.retxHqPLst), - &(allocInfo->dedAlloc.schdRetxHqPLst), - &(allocInfo->dedAlloc.nonSchdRetxHqPLst)); - } - - /* Allocate for transmitting UEs */ - if((allocInfo->dedAlloc.txHqPLst.count)) - { - rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), - &(allocInfo->dedAlloc.txHqPLst), - &(allocInfo->dedAlloc.schdTxHqPLst), - &(allocInfo->dedAlloc.nonSchdTxHqPLst)); - } - { - RgSchCmnCell *cmnCell = RG_SCH_CMN_GET_CELL(cell); - if ((allocInfo->dedAlloc.txRetxHqPLst.count + - allocInfo->dedAlloc.retxHqPLst.count + - allocInfo->dedAlloc.txHqPLst.count) > - cmnCell->dl.maxUePerDlSf) - { -#ifndef ALIGN_64BIT - RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"UEs selected by" - " scheduler exceed maximumUePerDlSf(%u)tx-retx %ld retx %ld tx %ld\n", - cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count, - allocInfo->dedAlloc.retxHqPLst.count, - allocInfo->dedAlloc.txHqPLst.count)); -#else - RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"UEs selected by" - " scheduler exceed maximumUePerDlSf(%u)tx-retx %d retx %d tx %d\n", - cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count, - allocInfo->dedAlloc.retxHqPLst.count, - allocInfo->dedAlloc.txHqPLst.count)); -#endif - } - } -#ifndef LTE_TDD - /* LTE_ADV_FLAG_REMOVED_START */ - if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - printf("5GTF_ERROR RETX rgSCHCmnNonDlfsDsfrRntpComp\n"); - rgSCHCmnNonDlfsDsfrRntpComp(cell, allocInfo->dedAlloc.dedDlSf); - } - /* LTE_ADV_FLAG_REMOVED_END */ -#endif /* LTE_TDD */ - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHCmnCalcRiv - * - * Desc : This function calculates RIV. - * - * Ret : None. - * - * Notes: None. - * - * File : rg_sch_utl.c - * - **********************************************************/ -#ifdef LTEMAC_SPS -#ifdef ANSI -PUBLIC U32 rgSCHCmnCalcRiv -( -U8 bw, -U8 rbStart, -U8 numRb -) -#else -PUBLIC U32 rgSCHCmnCalcRiv(bw, rbStart, numRb) -U8 bw; -U8 rbStart; -U8 numRb; -#endif -#else -#ifdef ANSI -PUBLIC U32 rgSCHCmnCalcRiv -( -U8 bw, -U8 rbStart, -U8 numRb -) -#else -PUBLIC U32 rgSCHCmnCalcRiv(bw, rbStart, numRb) -U8 bw; -U8 rbStart; -U8 numRb; -#endif -#endif -{ - U8 numRbMinus1 = numRb - 1; - U32 riv; - - TRC2(rgSCHCmnCalcRiv); - - if (numRbMinus1 <= bw/2) - { - riv = bw * numRbMinus1 + rbStart; - } - else - { - riv = bw * (bw - numRbMinus1) + (bw - rbStart - 1); - } - RETVALUE(riv); -} /* rgSCHCmnCalcRiv */ - -#ifdef LTE_TDD -/** - * @brief This function allocates and copies the RACH response scheduling - * related information into cell control block. - * - * @details - * - * Function: rgSCHCmnDlCpyRachInfo - * Purpose: This function allocates and copies the RACH response - * scheduling related information into cell control block - * for each DL subframe. - * - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES] - * @param[in] U8 raArrSz - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlCpyRachInfo -( -RgSchCellCb *cell, -RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES], -U8 raArrSz -) -#else -PRIVATE S16 rgSCHCmnDlCpyRachInfo(cell, rachRspLst, raArrSz) -RgSchCellCb *cell; -RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES]; -U8 raArrSz; -#endif -{ - U8 ulDlCfgIdx = cell->ulDlCfgIdx; - U8 sfNum; - S16 sfnIdx; - U16 subfrmIdx; - U8 numRfs; - U8 numSubfrms; - U8 sfcount; - S16 ret; - - TRC2(rgSCHCmnDlCpyRachInfo); - - /* Allocate RACH response information for each DL - * subframe in a radio frame */ - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cell->rachRspLst, - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1] * - sizeof(RgSchTddRachRspLst)); - if (ret != ROK) - { - RETVALUE(ret); - } - - for(sfnIdx=raArrSz-1; sfnIdx>=0; sfnIdx--) - { - for(subfrmIdx=0; subfrmIdx < RGSCH_NUM_SUB_FRAMES; subfrmIdx++) - { - subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx]; - if(subfrmIdx == RGSCH_NUM_SUB_FRAMES) - { - break; - } - - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx],subfrmIdx); - numSubfrms = - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; - - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddNumDlSubfrmTbl[ulDlCfgIdx],subfrmIdx); - sfNum = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][subfrmIdx]-1; - numRfs = cell->rachRspLst[sfNum].numRadiofrms; - /* For each DL subframe in which RACH response can - * be sent is updated */ - if(numSubfrms > 0) - { - cell->rachRspLst[sfNum].rachRsp[numRfs].sfnOffset = - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset; - for(sfcount=0; sfcount < numSubfrms; sfcount++) - { - cell->rachRspLst[sfNum].rachRsp[numRfs].\ - subframe[sfcount] = - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].\ - subframe[sfcount]; - } - cell->rachRspLst[sfNum].rachRsp[numRfs].numSubfrms = - rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; - cell->rachRspLst[sfNum].numRadiofrms++; - } - - /* Copy the subframes to be deleted at ths subframe */ - numSubfrms = - rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms; - if(numSubfrms > 0) - { - cell->rachRspLst[sfNum].delInfo.sfnOffset = - rachRspLst[sfnIdx][subfrmIdx].delInfo.sfnOffset; - for(sfcount=0; sfcount < numSubfrms; sfcount++) - { - cell->rachRspLst[sfNum].delInfo.subframe[sfcount] = - rachRspLst[sfnIdx][subfrmIdx].delInfo.subframe[sfcount]; - } - cell->rachRspLst[sfNum].delInfo.numSubfrms = - rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms; - } - } - } - RETVALUE(ROK); -} -#endif -/** - * @brief This function determines the iTbs based on the new CFI, - * CQI and BLER based delta iTbs - * - * @details - * - * Function: rgSchCmnFetchItbs - * Purpose: Fetch the new iTbs when CFI changes. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlUe *ueDl - * @param[in] U8 cqi - * - * @return S32 iTbs - * - **/ -#ifdef LTE_TDD -#ifdef ANSI -PRIVATE S32 rgSchCmnFetchItbs -( -RgSchCellCb *cell, -RgSchCmnDlUe *ueDl, -RgSchDlSf *subFrm, -U8 cqi, -U8 cfi, -U8 cwIdx, -U8 noLyr -) -#else -PRIVATE S32 rgSchCmnFetchItbs (cell, ueDl, subFrm, cqi, cfi, cwIdx, noLyr) -RgSchCellCb *cell; -RgSchCmnDlUe *ueDl; -RgSchDlSf *subFrm; -U8 cqi; -U8 cfi; -U8 cwIdx; -U8 noLyr; -#endif -#else -#ifdef ANSI -PRIVATE S32 rgSchCmnFetchItbs -( -RgSchCellCb *cell, -RgSchCmnDlUe *ueDl, -U8 cqi, -U8 cfi, -U8 cwIdx, -U8 noLyr -) -#else -PRIVATE S32 rgSchCmnFetchItbs (cell, ueDl, cqi, cfi, cwIdx, noLyr) -RgSchCellCb *cell; -RgSchCmnDlUe *ueDl; -U8 cqi; -U8 cfi; -U8 cwIdx; -U8 noLyr; -#endif -#endif -{ - - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - S32 iTbs = 0; - - TRC2(rgSchCmnFetchItbs); - -#ifdef LTE_TDD - /* Special Handling for Spl Sf when CFI is 3 as - * CFI in Spl Sf will be max 2 */ - if(subFrm->sfType == RG_SCH_SPL_SF_DATA) - { - if((cellDl->currCfi == 3) || - ((cell->bwCfg.dlTotalBw <= 10) && (cellDl->currCfi == 1))) - { - /* Use CFI 2 in this case */ - iTbs = (ueDl->laCb[cwIdx].deltaiTbs + - ((*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][2]))[cqi])* 100)/100; - - RG_SCH_CHK_ITBS_RANGE(iTbs, RGSCH_NUM_ITBS - 1); - } - else - { - iTbs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1]; - } - iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs); - } - else /* CFI Changed. Update with new iTbs Reset the BLER*/ -#endif - { - S32 tmpiTbs = (*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][cfi]))[cqi]; - - iTbs = (ueDl->laCb[cwIdx].deltaiTbs + tmpiTbs*100)/100; - - RG_SCH_CHK_ITBS_RANGE(iTbs, tmpiTbs); - - iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs); - - ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1] = iTbs; - - ueDl->lastCfi = cfi; - ueDl->laCb[cwIdx].deltaiTbs = 0; - } - - RETVALUE(iTbs); -} - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 1/2/6/7. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRb1Tb1Cw - * Purpose: Allocate TB1 on CW1. - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRbTM1/2/6/7 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRb1Tb1Cw -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - S16 ret; - U8 numRb; - TRC2(rgSCHCmnDlAllocTxRb1Tb1Cw); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); -#ifdef RG_5GTF - if (ue->ue5gtfCb.rank == 2) - { - allocInfo->dciFormat = TFU_DCI_FORMAT_B2; - } - else - { - allocInfo->dciFormat = TFU_DCI_FORMAT_B1; - } -#else - allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ - allocInfo->raType); -#endif - ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ - bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - /* Adding UE to RbAllocInfo TX Lst */ - rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); - /* Fill UE alloc Info */ - allocInfo->rbsReq = numRb; - allocInfo->dlSf = subFrm; -#ifdef RG_5GTF - allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE; -#endif - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 1/2/6/7. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRb1Tb1Cw - * Purpose: Allocate TB1 on CW1. - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRbTM1/2/6/7 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRb1Tb1Cw -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - S16 ret; - U8 numRb; - TRC2(rgSCHCmnDlAllocRetxRb1Tb1Cw); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - -#ifndef RG_5GTF - /* 5GTF: RETX DCI format same as TX */ - allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ - &allocInfo->raType); -#endif - - /* Get the Allocation in terms of RBs that are required for - * this retx of TB1 */ - ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0], - 1, &numRb, effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - /* Fix : syed If TxRetx allocation failed then add the UE along with the proc - * to the nonSchdTxRetxUeLst and let spfc scheduler take care of it during - * finalization. */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - /* Fill UE alloc Info */ - allocInfo->rbsReq = numRb; - allocInfo->dlSf = subFrm; -#ifdef RG_5GTF - allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE; -#endif - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 2. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM1 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM1 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM1(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocTxRbTM1); - rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 2. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM1 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM1 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM1(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocRetxRbTM1); - rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 2. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM2 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM2 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM2(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocTxRbTM2); - rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 2. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM2 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM2 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM2(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocRetxRbTM2); - rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 3. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM3 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM3 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM3(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - - TRC2(rgSCHCmnDlAllocTxRbTM3); - - /* Both TBs free for TX allocation */ - rgSCHCmnDlTM3TxTx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 3. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM3 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM3 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM3(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - - TRC2(rgSCHCmnDlAllocRetxRbTM3); - - if ((proc->tbInfo[0].state == HQ_TB_NACKED) && - (proc->tbInfo[1].state == HQ_TB_NACKED)) - { -#ifdef LAA_DBG_LOG - printf ("RETX RB TM3 nack for both hqp %d cell %d \n", proc->procId, proc->hqE->cell->cellId); -#endif - /* Both TBs require RETX allocation */ - rgSCHCmnDlTM3RetxRetx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - } - else - { - /* One of the TBs need RETX allocation. Other TB may/maynot - * be available for new TX allocation. */ - rgSCHCmnDlTM3TxRetx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - } - - RETVOID; -} - - -/** - * @brief This function performs the DCI format selection in case of - * Transmit Diversity scheme where there can be more - * than 1 option for DCI format selection. - * - * @details - * - * Function: rgSCHCmnSlctPdcchFrmt - * Purpose: 1. If DLFS is enabled, then choose TM specific - * DCI format for Transmit diversity. All the - * TM Specific DCI Formats support Type0 and/or - * Type1 resource allocation scheme. DLFS - * supports only Type-0&1 Resource allocation. - * 2. If DLFS is not enabled, select a DCI format - * which is of smaller size. Since Non-DLFS - * scheduler supports all Resource allocation - * schemes, selection is based on efficiency. - * - * Invoked by: DL UE Allocation by Common Scheduler. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[out] U8 *raType - * @return TfuDciFormat - * - **/ -#ifdef ANSI -PUBLIC TfuDciFormat rgSCHCmnSlctPdcchFrmt -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 *raType -) -#else -PUBLIC TfuDciFormat rgSCHCmnSlctPdcchFrmt(cell, ue, raType) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 *raType; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHCmnSlctPdcchFrmt); - - /* ccpu00140894- Selective DCI Format and RA type should be selected only - * after TX Mode transition is completed*/ - if ((cellSch->dl.isDlFreqSel) && (ue->txModeTransCmplt)) - { - *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciRAType; - RETVALUE(rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciFrmt); - } - else - { - *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciRAType; - RETVALUE(rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciFrmt); - } -} - - -/** - * @brief This function handles Retx allocation in case of TM3 UEs - * where both the TBs were NACKED previously. - * - * @details - * - * Function: rgSCHCmnDlTM3RetxRetx - * Purpose: If forceTD flag enabled - * TD for TB1 on CW1. - * Else - * DCI Frmt 2A and RA Type 0 - * RI layered SM of both TBs on 2 CWs - * Add UE to cell Alloc Info. - * Fill UE alloc Info. - * - * - * Successful allocation is indicated by non-zero effBo value. - * - * Invoked by: rgSCHCmnDlAllocRbTM3 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM3RetxRetx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM3RetxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - S16 ret; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - Bool swpFlg; - U8 precInfo; - U8 noTxLyrs; - U8 precInfoAntIdx; - - TRC2(rgSCHCmnDlTM3RetxRetx); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - swpFlg = FALSE; -/* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */ - { - allocInfo->dciFormat = TFU_DCI_FORMAT_2A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE0; - - ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\ - effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - /* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */ - noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs; -#ifdef FOUR_TX_ANTENNA - /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1 should - * have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */ - if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2) - { - swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; - } -#endif - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); - } - -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to allocInfo RETX Lst */ - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - } - /* Fill UE alloc Info scratch pad */ - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ - precInfo, noTxLyrs, subFrm); - - RETVOID; -} - - -/** - * @brief This function handles Retx allocation in case of TM4 UEs - * where both the TBs were NACKED previously. - * - * @details - * - * Function: rgSCHCmnDlTM4RetxRetx - * Purpose: If forceTD flag enabled - * TD for TB1 on CW1. - * Else - * DCI Frmt 2 and RA Type 0 - * If RI == 1 - * 1 layer SM of TB1 on CW1. - * Else - * RI layered SM of both TBs on 2 CWs - * Add UE to cell Alloc Info. - * Fill UE alloc Info. - * - * - * Successful allocation is indicated by non-zero effBo value. - * - * Invoked by: rgSCHCmnDlAllocRbTM4 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM4RetxRetx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM4RetxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - S16 ret; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - Bool swpFlg = FALSE; - U8 precInfo; -#ifdef FOUR_TX_ANTENNA - U8 precInfoAntIdx; -#endif - U8 noTxLyrs; - - TRC2(rgSCHCmnDlTM4RetxRetx); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - /* Irrespective of RI Schedule both CWs */ - allocInfo->dciFormat = TFU_DCI_FORMAT_2; - allocInfo->raType = RG_SCH_CMN_RA_TYPE0; - - ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\ - effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs; - precInfo = 0; -#ifdef FOUR_TX_ANTENNA - /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1 - * should have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */ - if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2) - { - swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; -} -precInfoAntIdx = cell->numTxAntPorts/2 - 1; -precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); -#endif - -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to allocInfo RETX Lst */ - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - } - /* Fill UE alloc Info scratch pad */ - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ - precInfo, noTxLyrs, subFrm); - - RETVOID; -} - - - -/** - * @brief This function determines Transmission attributes - * incase of Spatial multiplexing for TX and RETX TBs. - * - * @details - * - * Function: rgSCHCmnDlSMGetAttrForTxRetx - * Purpose: 1. Reached here for a TM3/4 UE's HqP whose one of the TBs is - * NACKED and the other TB is either NACKED or WAITING. - * 2. Select the NACKED TB for RETX allocation. - * 3. Allocation preference for RETX TB by mapping it to a better - * CW (better in terms of efficiency). - * 4. Determine the state of the other TB. - * Determine if swapFlag were to be set. - * Swap flag would be set if Retx TB is cross - * mapped to a CW. - * 5. If UE has new data available for TX and if the other TB's state - * is ACKED then set furtherScope as TRUE. - * - * Invoked by: rgSCHCmnDlTM3[4]TxRetx - * - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchDlHqTbCb **retxTb - * @param[out] RgSchDlHqTbCb **txTb - * @param[out] Bool *frthrScp - * @param[out] Bool *swpFlg - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlSMGetAttrForTxRetx -( -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -RgSchDlHqTbCb **retxTb, -RgSchDlHqTbCb **txTb, -Bool *frthrScp, -Bool *swpFlg -) -#else -PRIVATE Void rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, frthrScp,\ - swpFlg) -RgSchUeCb *ue; -RgSchDlHqProcCb *proc; -RgSchDlHqTbCb **retxTb; -RgSchDlHqTbCb **txTb; -Bool *frthrScp; -Bool *swpFlg; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,proc->hqE->cell); - RgSchDlRbAlloc *allocInfo; - - TRC2(rgSCHCmnDlSMGetAttrForTxRetx); - - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - *retxTb = &proc->tbInfo[0]; - *txTb = &proc->tbInfo[1]; - /* TENB_BRDCM_TM4- Currently disabling swapflag for TM3/TM4, since - * HqFeedback processing does not consider a swapped hq feedback */ - if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 1)) - { - *swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; - } - if (proc->tbInfo[1].state == HQ_TB_ACKED) - { - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell); - *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData; - } - } - else - { - *retxTb = &proc->tbInfo[1]; - *txTb = &proc->tbInfo[0]; - /* TENB_BRDCM_TM4 - Currently disabling swapflag for TM3/TM4, since - * HqFeedback processing does not consider a swapped hq feedback */ - if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 0)) - { - *swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; - } - if (proc->tbInfo[0].state == HQ_TB_ACKED) - { - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell); - *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData; - } - } - RETVOID; -} - - -/** - * @brief Determine Precoding information for TM3 2 TX Antenna. - * - * @details - * - * Function: rgSCHCmnDlTM3PrecInf2 - * Purpose: - * - * Invoked by: rgSCHCmnDlGetAttrForTM3 - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 numTxLyrs - * @param[in] Bool bothCwEnbld - * @return U8 - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnDlTM3PrecInf2 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -) -#else -PRIVATE U8 rgSCHCmnDlTM3PrecInf2(ue, numTxLyrs, bothCwEnbld) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 numTxLyrs; -Bool bothCwEnbld; -#endif -{ - TRC2(rgSCHCmnDlTM3PrecInf2); - - RETVALUE(0); -} - - -/** - * @brief Determine Precoding information for TM4 2 TX Antenna. - * - * @details - * - * Function: rgSCHCmnDlTM4PrecInf2 - * Purpose: To determine a logic of deriving precoding index - * information from 36.212 table 5.3.3.1.5-4 - * - * Invoked by: rgSCHCmnDlGetAttrForTM4 - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 numTxLyrs - * @param[in] Bool bothCwEnbld - * @return U8 - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnDlTM4PrecInf2 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -) -#else -PRIVATE U8 rgSCHCmnDlTM4PrecInf2(ue, numTxLyrs, bothCwEnbld) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 numTxLyrs; -Bool bothCwEnbld; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 precIdx; - - TRC2(rgSCHCmnDlTM4PrecInf2); - - if (ueDl->mimoInfo.ri == numTxLyrs) - { - if (ueDl->mimoInfo.ri == 2) - { - /* PrecInfo corresponding to 2 CW - Transmission */ - if (ue->mimoInfo.puschFdbkVld) - { - precIdx = 2; - } - else - { - precIdx = ueDl->mimoInfo.pmi - 1; - } - } - else - { - /* PrecInfo corresponding to 1 CW - * Transmission */ - if (ue->mimoInfo.puschFdbkVld) - { - precIdx = 5; - } - else - { - precIdx = ueDl->mimoInfo.pmi + 1; - } - } - } - else if (ueDl->mimoInfo.ri > numTxLyrs) - { - /* In case of choosing among the columns of a - * precoding matrix, choose the column corresponding - * to the MAX-CQI */ - if (ue->mimoInfo.puschFdbkVld) - { - precIdx = 5; - } - else - { - precIdx = (ueDl->mimoInfo.pmi- 1)* 2 + 1; - } - } - else /* if RI < numTxLyrs */ - { - precIdx = (ueDl->mimoInfo.pmi < 2)? 0:1; - } - RETVALUE(precIdx); -} - - -/** - * @brief Determine Precoding information for TM3 4 TX Antenna. - * - * @details - * - * Function: rgSCHCmnDlTM3PrecInf4 - * Purpose: To determine a logic of deriving precoding index - * information from 36.212 table 5.3.3.1.5A-2 - * - * Invoked by: rgSCHCmnDlGetAttrForTM3 - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 numTxLyrs - * @param[in] Bool bothCwEnbld - * @return U8 - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnDlTM3PrecInf4 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -) -#else -PRIVATE U8 rgSCHCmnDlTM3PrecInf4(ue, numTxLyrs, bothCwEnbld) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 numTxLyrs; -Bool bothCwEnbld; -#endif -{ - U8 precIdx; - - TRC2(rgSCHCmnDlTM3PrecInf4); - - if (bothCwEnbld) - { - precIdx = numTxLyrs - 2; - } - else /* one 1 CW transmission */ - { - precIdx = 1; - } - RETVALUE(precIdx); -} - - -/** - * @brief Determine Precoding information for TM4 4 TX Antenna. - * - * @details - * - * Function: rgSCHCmnDlTM4PrecInf4 - * Purpose: To determine a logic of deriving precoding index - * information from 36.212 table 5.3.3.1.5-5 - * - * Invoked by: rgSCHCmnDlGetAttrForTM4 - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 numTxLyrs - * @param[in] Bool bothCwEnbld - * @return U8 - * - **/ -#ifdef ANSI -PRIVATE U8 rgSCHCmnDlTM4PrecInf4 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 numTxLyrs, -Bool bothCwEnbld -) -#else -PRIVATE U8 rgSCHCmnDlTM4PrecInf4(cell, ue, numTxLyrs, bothCwEnbld) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 numTxLyrs; -Bool bothCwEnbld; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 precInfoBaseIdx, precIdx; - - TRC2(rgSCHCmnDlTM4PrecInf4); - - precInfoBaseIdx = (ue->mimoInfo.puschFdbkVld)? (16): - (ueDl->mimoInfo.pmi); - if (bothCwEnbld) - { - precIdx = precInfoBaseIdx + (numTxLyrs-2)*17; - } - else /* one 1 CW transmission */ - { - precInfoBaseIdx += 1; - precIdx = precInfoBaseIdx + (numTxLyrs-1)*17; - } - RETVALUE(precIdx); -} - - -/** - * @brief This function determines Transmission attributes - * incase of TM3 scheduling. - * - * @details - * - * Function: rgSCHCmnDlGetAttrForTM3 - * Purpose: Determine retx TB and tx TB based on TB states. - * If forceTD enabled - * perform only retx TB allocation. - * If retxTB == TB2 then DCI Frmt = 2A, RA Type = 0. - * Else DCI Frmt and RA Type based on cell->isDlfsEnbld - * If RI == 1 - * perform retxTB allocation on CW1. - * Else if RI > 1 - * Determine further Scope and Swap Flag attributes - * assuming a 2 CW transmission of RetxTB and new Tx TB. - * If no further scope for new TX allocation - * Allocate only retx TB using 2 layers if - * this TB was previously transmitted using 2 layers AND - * number of Tx antenna ports == 4. - * otherwise do single layer precoding. - * - * Invoked by: rgSCHCmnDlTM3TxRetx - * - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @param[out] U8 *numTxLyrs - * @param[out] Bool *isTraDiv - * @param[out] U8 *prcdngInf - * @param[out] U8 *raType - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlGetAttrForTM3 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U8 *numTxLyrs, -TfuDciFormat *dciFrmt, -U8 *prcdngInf, -RgSchDlHqTbCb **retxTb, -RgSchDlHqTbCb **txTb, -Bool *frthrScp, -Bool *swpFlg, -U8 *raType -) -#else -PRIVATE Void rgSCHCmnDlGetAttrForTM3(cell, ue, proc, numTxLyrs, dciFrmt,\ - prcdngInf, retxTb, txTb, frthrScp, swpFlg, raType) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlHqProcCb *proc; -U8 *numTxLyrs; -TfuDciFormat *dciFrmt; -U8 *prcdngInf; -RgSchDlHqTbCb **retxTb; -RgSchDlHqTbCb **txTb; -Bool *frthrScp; -Bool *swpFlg; -U8 *raType; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 precInfoAntIdx; - - TRC2(rgSCHCmnDlGetAttrForTM3); - - /* Avoiding Tx-Retx for LAA cell as firstSchedTime is associated with - HQP */ - /* Integration_fix: SPS Proc shall always have only one Cw */ -#ifdef LTEMAC_SPS - if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD)) -#ifdef LTE_ADV - ||(TRUE == rgSCHLaaSCellEnabled(cell)) -#endif - ) -#else - if ((ueDl->mimoInfo.forceTD) -#ifdef LTE_ADV - || (TRUE == rgSCHLaaSCellEnabled(cell)) -#endif - ) -#endif - { - /* Transmit Diversity. Format based on dlfsEnabled - * No further scope */ - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - *retxTb = &proc->tbInfo[0]; - *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); - } - else - { - *retxTb = &proc->tbInfo[1]; - *dciFrmt = TFU_DCI_FORMAT_2A; - *raType = RG_SCH_CMN_RA_TYPE0; - } - *numTxLyrs = 1; - *frthrScp = FALSE; - *prcdngInf = 0; - RETVOID; - } - - /* Determine the 2 TB transmission attributes */ - rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \ - frthrScp, swpFlg); - if (*frthrScp) - { - /* Prefer allocation of RETX TB over 2 layers rather than combining - * it with a new TX. */ - if ((ueDl->mimoInfo.ri == 2) - && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4)) - { - /* Allocate TB on CW1, using 2 Lyrs, - * Format 2, precoding accordingly */ - *numTxLyrs = 2; - *frthrScp = FALSE; - } - else - { - *numTxLyrs= ((*retxTb)->numLyrs + ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)].noLyr); - - if((*retxTb)->tbIdx == 0 && ((*retxTb)->numLyrs == 2 ) && *numTxLyrs ==3) - { - *swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; - } - else if((*retxTb)->tbIdx == 1 && ((*retxTb)->numLyrs == 1) && *numTxLyrs ==3) - { - *swpFlg = TRUE; - proc->cwSwpEnabled = TRUE; - } - } - - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])\ - (cell, ue, ueDl->mimoInfo.ri, *frthrScp); - *dciFrmt = TFU_DCI_FORMAT_2A; - *raType = RG_SCH_CMN_RA_TYPE0; - } - else /* frthrScp == FALSE */ - { - if (cell->numTxAntPorts == 2) - { - /* Transmit Diversity */ - *numTxLyrs = 1; - if ((*retxTb)->tbIdx == 0) - { - *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); - } - else - { - /* If retxTB is TB2 then use format 2A */ - *dciFrmt = TFU_DCI_FORMAT_2A; - *raType = RG_SCH_CMN_RA_TYPE0; - } - *prcdngInf = 0; - RETVOID; - } - else /* NumAntPorts == 4 */ - { - if ((*retxTb)->numLyrs == 2) - { - /* Allocate TB on CW1, using 2 Lyrs, - * Format 2A, precoding accordingly */ - *numTxLyrs = 2; - *dciFrmt = TFU_DCI_FORMAT_2A; - *raType = RG_SCH_CMN_RA_TYPE0; - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, *numTxLyrs, *frthrScp); - RETVOID; - } - else - { - /* Transmit Diversity */ - *numTxLyrs = 1; - if ((*retxTb)->tbIdx == 0) - { - *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); - } - else - { - /* If retxTB is TB2 then use format 2A */ - *dciFrmt = TFU_DCI_FORMAT_2A; - *raType = RG_SCH_CMN_RA_TYPE0; - } - *prcdngInf = 0; - RETVOID; - } - } - } - - RETVOID; -} - - - -/** - * @brief This function determines Transmission attributes - * incase of TM4 scheduling. - * - * @details - * - * Function: rgSCHCmnDlGetAttrForTM4 - * Purpose: Determine retx TB and tx TB based on TB states. - * If forceTD enabled - * perform only retx TB allocation. - * If retxTB == TB2 then DCI Frmt = 2, RA Type = 0. - * Else DCI Frmt and RA Type based on cell->isDlfsEnbld - * If RI == 1 - * perform retxTB allocation on CW1. - * Else if RI > 1 - * Determine further Scope and Swap Flag attributes - * assuming a 2 CW transmission of RetxTB and new Tx TB. - * If no further scope for new TX allocation - * Allocate only retx TB using 2 layers if - * this TB was previously transmitted using 2 layers AND - * number of Tx antenna ports == 4. - * otherwise do single layer precoding. - * - * Invoked by: rgSCHCmnDlTM4TxRetx - * - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @param[out] U8 *numTxLyrs - * @param[out] Bool *isTraDiv - * @param[out] U8 *prcdngInf - * @param[out] U8 *raType - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlGetAttrForTM4 -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U8 *numTxLyrs, -TfuDciFormat *dciFrmt, -U8 *prcdngInf, -RgSchDlHqTbCb **retxTb, -RgSchDlHqTbCb **txTb, -Bool *frthrScp, -Bool *swpFlg, -U8 *raType -) -#else -PRIVATE Void rgSCHCmnDlGetAttrForTM4(cell, ue, proc, numTxLyrs, dciFrmt,\ - prcdngInf, retxTb, txTb, frthrScp, swpFlg, raType) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlHqProcCb *proc; -U8 *numTxLyrs; -TfuDciFormat *dciFrmt; -U8 *prcdngInf; -RgSchDlHqTbCb **retxTb; -RgSchDlHqTbCb **txTb; -Bool *frthrScp; -Bool *swpFlg; -U8 *raType; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - U8 precInfoAntIdx; - - TRC2(rgSCHCmnDlGetAttrForTM4); - - *frthrScp = FALSE; - /* Integration_fix: SPS Proc shall always have only one Cw */ -#ifdef LTEMAC_SPS - if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD)) -#ifdef LTE_ADV - ||(TRUE == rgSCHLaaSCellEnabled(cell)) -#endif - ) -#else - if ((ueDl->mimoInfo.forceTD) -#ifdef LTE_ADV - || (TRUE == rgSCHLaaSCellEnabled(cell)) -#endif - ) -#endif - { - /* Transmit Diversity. Format based on dlfsEnabled - * No further scope */ - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - *retxTb = &proc->tbInfo[0]; - *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); - } - else - { - *retxTb = &proc->tbInfo[1]; - *dciFrmt = TFU_DCI_FORMAT_2; - *raType = RG_SCH_CMN_RA_TYPE0; - } - *numTxLyrs = 1; - *frthrScp = FALSE; - *prcdngInf = 0; - RETVOID; - } - - if (ueDl->mimoInfo.ri == 1) - { - /* single layer precoding. Format 2. - * No further scope */ - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - *retxTb = &proc->tbInfo[0]; - } - else - { - *retxTb = &proc->tbInfo[1]; - } - *numTxLyrs = 1; - *dciFrmt = TFU_DCI_FORMAT_2; - *raType = RG_SCH_CMN_RA_TYPE0; - *frthrScp = FALSE; - *prcdngInf = 0; /*When RI= 1*/ - RETVOID; - } - - /* Determine the 2 TB transmission attributes */ - rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \ - frthrScp, swpFlg); - *dciFrmt = TFU_DCI_FORMAT_2; - *raType = RG_SCH_CMN_RA_TYPE0; - if (*frthrScp) - { - /* Prefer allocation of RETX TB over 2 layers rather than combining - * it with a new TX. */ - if ((ueDl->mimoInfo.ri == 2) - && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4)) - { - /* Allocate TB on CW1, using 2 Lyrs, - * Format 2, precoding accordingly */ - *numTxLyrs = 2; - *frthrScp = FALSE; - } - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx]) - (cell, ue, ueDl->mimoInfo.ri, *frthrScp); - } - else /* frthrScp == FALSE */ - { - if (cell->numTxAntPorts == 2) - { - /* single layer precoding. Format 2. */ - *numTxLyrs = 1; - *prcdngInf = (getPrecInfoFunc[1][cell->numTxAntPorts/2 - 1])\ - (cell, ue, *numTxLyrs, *frthrScp); - RETVOID; - } - else /* NumAntPorts == 4 */ - { - if ((*retxTb)->numLyrs == 2) - { - /* Allocate TB on CW1, using 2 Lyrs, - * Format 2, precoding accordingly */ - *numTxLyrs = 2; - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\ - (cell, ue, *numTxLyrs, *frthrScp); - RETVOID; - } - else - { - /* Allocate TB with 1 lyr precoding, - * Format 2, precoding info accordingly */ - *numTxLyrs = 1; - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\ - (cell, ue, *numTxLyrs, *frthrScp); - RETVOID; - } - } - } - - RETVOID; -} - - -/** - * @brief This function handles Retx allocation in case of TM3 UEs - * where previously one of the TBs was NACKED and the other - * TB is either ACKED/WAITING. - * - * @details - * - * Function: rgSCHCmnDlTM3TxRetx - * Purpose: Determine the TX attributes for TM3 TxRetx Allocation. - * If futher Scope for New Tx Allocation on other TB - * Perform RETX alloc'n on 1 CW and TX alloc'n on other. - * Add UE to cell wide RetxTx List. - * Else - * Perform only RETX alloc'n on CW1. - * Add UE to cell wide Retx List. - * - * effBo is set to a non-zero value if allocation is - * successful. - * - * Invoked by: rgSCHCmnDlAllocRbTM3 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM3TxRetx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM3TxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - S16 ret; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - RgSchDlHqTbCb *retxTb, *txTb; - Bool frthrScp; - Bool swpFlg; - U8 prcdngInf; - U8 numTxLyrs; - - TRC2(rgSCHCmnDlTM3TxRetx); - frthrScp = FALSE; - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - swpFlg = FALSE; - - /* Determine the transmission attributes */ - rgSCHCmnDlGetAttrForTM3(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\ - &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\ - &allocInfo->raType); - - if (frthrScp) - { -#ifdef LAA_DBG_LOG - printf ("TX RETX called from proc %d cell %d \n",proc->procId, cell->cellId); -#endif - ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\ - &numRb, effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - /* Adding UE to RbAllocInfo RETX-TX Lst */ - rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc); - } - else - { - ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb, - numTxLyrs, &numRb, effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to allocInfo RETX Lst */ - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - } - } - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ - prcdngInf, numTxLyrs, subFrm); - - RETVOID; -} - - -/** - * @brief This function handles Retx allocation in case of TM4 UEs - * where previously one of the TBs was NACKED and the other - * TB is either ACKED/WAITING. - * - * @details - * - * Function: rgSCHCmnDlTM4TxRetx - * Purpose: Determine the TX attributes for TM4 TxRetx Allocation. - * If futher Scope for New Tx Allocation on other TB - * Perform RETX alloc'n on 1 CW and TX alloc'n on other. - * Add UE to cell wide RetxTx List. - * Else - * Perform only RETX alloc'n on CW1. - * Add UE to cell wide Retx List. - * - * effBo is set to a non-zero value if allocation is - * successful. - * - * Invoked by: rgSCHCmnDlAllocRbTM4 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM4TxRetx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM4TxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - S16 ret; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - RgSchDlHqTbCb *retxTb, *txTb; - Bool frthrScp; - Bool swpFlg; - U8 prcdngInf; - U8 numTxLyrs; - - TRC2(rgSCHCmnDlTM4TxRetx); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - swpFlg = FALSE; - - /* Determine the transmission attributes */ - rgSCHCmnDlGetAttrForTM4(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\ - &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\ - &allocInfo->raType); - - if (frthrScp) - { - ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\ - &numRb, effBo); - if (ret == RFAILED) - { - /* Fix : syed If TxRetx allocation failed then add the UE along - * with the proc to the nonSchdTxRetxUeLst and let spfc scheduler - * take care of it during finalization. */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - /* Adding UE to RbAllocInfo RETX-TX Lst */ - rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc); - } - else - { - ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb, - numTxLyrs, &numRb, effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to allocInfo RETX Lst */ - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - } - } - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ - prcdngInf, numTxLyrs, subFrm) - - RETVOID; -} - - -/** - * @brief This function handles Retx allocation in case of TM4 UEs - * where previously both the TBs were ACKED and ACKED - * respectively. - * - * @details - * - * Function: rgSCHCmnDlTM3TxTx - * Purpose: Reached here for a TM3 UE's HqP's fresh allocation - * where both the TBs are free for TX scheduling. - * If forceTD flag is set - * perform TD on CW1 with TB1. - * precInfo = 0 - * else - * DCI Format = 2A. - * RA Type = Type0. - * RI layered precoding 2 TB on 2 CW. - * Set precoding info. - * Add UE to cellAllocInfo. - * Fill ueAllocInfo. - * - * effBo is set to a non-zero value if allocation is - * successful. - * - * Invoked by: rgSCHCmnDlAllocRbTM3 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM3TxTx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM3TxTx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchCmnDlUe *ueDl; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - U8 noTxLyrs; - U8 precInfo; - S16 ret; - U8 precInfoAntIdx; - - TRC2(rgSCHCmnDlTM3TxTx); - - ret = ROK; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - /* Integration_fix: SPS Proc shall always have only one Cw */ -#ifdef LTEMAC_SPS -#ifdef FOUR_TX_ANTENNA - if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */ -#else - if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD)) -#endif -#else - if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */ -#endif - { - allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ - &allocInfo->raType); - ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ - bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - noTxLyrs = 1; - precInfo = 0; /* TD */ - } - else /* Precoding */ - { - allocInfo->dciFormat = TFU_DCI_FORMAT_2A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE0; - - /* Spatial Multiplexing using 2 CWs */ - ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - noTxLyrs = ueDl->mimoInfo.ri; - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, getPrecInfoFunc[0], precInfoAntIdx); - precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); - } - -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to RbAllocInfo TX Lst */ - rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); - } - /* Fill UE allocInfo scrath pad */ - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \ - precInfo, noTxLyrs, subFrm); - - RETVOID; -} - - -/** - * @brief This function handles Retx allocation in case of TM4 UEs - * where previously both the TBs were ACKED and ACKED - * respectively. - * - * @details - * - * Function: rgSCHCmnDlTM4TxTx - * Purpose: Reached here for a TM4 UE's HqP's fresh allocation - * where both the TBs are free for TX scheduling. - * If forceTD flag is set - * perform TD on CW1 with TB1. - * precInfo = 0 - * else - * DCI Format = 2. - * RA Type = Type0. - * If Rank == 1 - * Single layer precoding of TB1 on CW1. - * Set precoding info. - * else - * RI layered precoding 2 TB on 2 CW. - * Set precoding info. - * Add UE to cellAllocInfo. - * Fill ueAllocInfo. - * - * effBo is set to a non-zero value if allocation is - * successful. - * - * Invoked by: rgSCHCmnDlAllocRbTM4 - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlTM4TxTx -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlTM4TxTx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchCmnDlUe *ueDl; - RgSchDlRbAlloc *allocInfo; - U8 numRb; - U8 precInfo; - U8 noTxLyrs; - U8 precInfoAntIdx; - S16 ret; - - TRC2(rgSCHCmnDlTM4TxTx); - - ret = ROK; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - /* Integration_fix: SPS Proc shall always have only one Cw */ -#ifdef LTEMAC_SPS -#ifdef FOUR_TX_ANTENNA - if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */ -#else - if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || - (ueDl->mimoInfo.forceTD)) -#endif -#else - if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */ -#endif - { - allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ - &allocInfo->raType); - - ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ - bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - noTxLyrs = 1; - precInfo = 0; /* TD */ - } - else /* Precoding */ - { - allocInfo->dciFormat = TFU_DCI_FORMAT_2; - allocInfo->raType = RG_SCH_CMN_RA_TYPE0; - - if (ueDl->mimoInfo.ri == 1) - { - /* Single Layer SM using FORMAT 2 */ - ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ - bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - noTxLyrs = 1; - precInfo = 0; /* PrecInfo as 0 for RI=1*/ - } - else - { - /* Spatial Multiplexing using 2 CWs */ - ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - noTxLyrs = ueDl->mimoInfo.ri; - precInfoAntIdx = cell->numTxAntPorts/2 - 1; - precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); - } - } - - -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to RbAllocInfo TX Lst */ - rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); - } - - /* Fill UE allocInfo scrath pad */ - RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \ - precInfo, noTxLyrs, subFrm); - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 4. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM4 - * Purpose: Invokes the functionality particular to the - * current state of the TBs of the "proc". - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM4 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM4(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocTxRbTM4); - - /* Both TBs free for TX allocation */ - rgSCHCmnDlTM4TxTx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 4. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM4 - * Purpose: Invokes the functionality particular to the - * current state of the TBs of the "proc". - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM4 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM4(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocRetxRbTM4); - - if ((proc->tbInfo[0].state == HQ_TB_NACKED) && - (proc->tbInfo[1].state == HQ_TB_NACKED)) - { - /* Both TBs require RETX allocation */ - rgSCHCmnDlTM4RetxRetx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - } - else - { - /* One of the TBs need RETX allocation. Other TB may/maynot - * be available for new TX allocation. */ - rgSCHCmnDlTM4TxRetx(cell, subFrm, ue, bo, effBo,\ - proc, cellWdAllocInfo); - } - - RETVOID; -} - -#ifdef RG_UNUSED - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 5. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM5 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM5 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM5(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocTxRbTM5); -#if (ERRCLASS & ERRCLS_DEBUG) - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Invalid TM 5 for CRNTI:%d",ue->ueId); -#endif - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 5. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM5 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM5 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM5(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocRetxRbTM5); -#if (ERRCLASS & ERRCLS_DEBUG) - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Invalid TM 5 for CRNTI:%d",ue->ueId); -#endif - RETVOID; -} -#endif - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 6. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM6 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM6 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM6(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *ueDl; - S16 ret; - U8 numRb; - - TRC2(rgSCHCmnDlAllocTxRbTM6); - - ret = ROK; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - if (ueDl->mimoInfo.forceTD) - { - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - } - else - { - allocInfo->dciFormat = TFU_DCI_FORMAT_1B; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - /* Fill precoding information for FORMAT 1B */ - /* First 4 least significant bits to indicate PMI. - * 4th most significant corresponds to pmi Confirmation. - */ - allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4; - allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi; - } - ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ - bo, &numRb, effBo); - if (ret == RFAILED) - { - /* If allocation couldn't be made then return */ - RETVOID; - } - -#ifdef LTEMAC_SPS - if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) -#endif - { - /* Adding UE to RbAllocInfo TX Lst */ - rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); - } - /* Fill UE alloc Info */ - allocInfo->rbsReq = numRb; - allocInfo->dlSf = subFrm; - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 6. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM6 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM6 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM6(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - RgSchCmnDlUe *ueDl; - S16 ret; - U8 numRb; - - TRC2(rgSCHCmnDlAllocRetxRbTM6); - - ret = ROK; - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - if (ueDl->mimoInfo.forceTD) - { - allocInfo->dciFormat = TFU_DCI_FORMAT_1A; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - } - else - { - allocInfo->dciFormat = TFU_DCI_FORMAT_1B; - allocInfo->raType = RG_SCH_CMN_RA_TYPE2; - /* Fill precoding information for FORMAT 1B */ - /* First 4 least significant bits to indicate PMI. - * 4th most significant corresponds to pmi Confirmation. - */ - allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4; - allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi; - } - - /* Get the Allocation in terms of RBs that are required for - * this retx of TB1 */ - ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0], - 1, &numRb, effBo); - if (ret == RFAILED) - { - /* Allocation couldn't be made for Retx */ - rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); - RETVOID; - } - /* Adding UE to allocInfo RETX Lst */ - rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); - /* Fill UE alloc Info */ - allocInfo->rbsReq = numRb; - allocInfo->dlSf = subFrm; - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * transmission for UEs configured with TM 7. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRbTM7 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocTxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocTxRbTM7 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocTxRbTM7(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocTxRbTM7); - rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * retransmission for UEs configured with TM 7. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRbTM7 - * Purpose: - * - * Reference Parameter effBo is filled with alloced bytes. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlAllocRetxRbTM7 -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PRIVATE Void rgSCHCmnDlAllocRetxRbTM7(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - TRC2(rgSCHCmnDlAllocRetxRbTM7); - rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); - RETVOID; -} - - -/** - * @brief This function invokes the TM specific DL TX RB Allocation routine. - * - * @details - * - * Function: rgSCHCmnDlAllocTxRb - * Purpose: This function invokes the TM specific - * DL TX RB Allocation routine. - * - * Invoked by: Specific Schedulers - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnDlAllocTxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PUBLIC S16 rgSCHCmnDlAllocTxRb(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - U32 newSchBits = 0; - U32 prevSchBits = 0; - RgSchDlRbAlloc *allocInfo; - - TRC2(rgSCHCmnDlAllocTxRb); - - if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) )) - { - ue->dl.aggTbBits = 0; - } - *effBo = 0; - - /* Calculate totals bits previously allocated */ - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - if (allocInfo->tbInfo[0].schdlngForTb) - { - prevSchBits += allocInfo->tbInfo[0].bytesReq; - } - if (allocInfo->tbInfo[1].schdlngForTb) - { - prevSchBits += allocInfo->tbInfo[1].bytesReq; - } - - /* Call TM specific RB allocation routine */ - (dlAllocTxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \ - proc, cellWdAllocInfo); - - if (*effBo) - { - /* Calculate totals bits newly allocated */ - if (allocInfo->tbInfo[0].schdlngForTb) - { - newSchBits += allocInfo->tbInfo[0].bytesReq; - } - if (allocInfo->tbInfo[1].schdlngForTb) - { - newSchBits += allocInfo->tbInfo[1].bytesReq; - } - if (newSchBits > prevSchBits) - { - ue->dl.aggTbBits += ((newSchBits - prevSchBits) * 8); - RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime)) - } - } - - RETVALUE(ROK); -} - -/* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD -/** - * @brief Retransmit decision for TDD. Retx is avoided in below cases - * 1) DL Sf -> Spl Sf - * 2) DL SF -> DL SF 0 - * - * @details - * - * Function: rgSCHCmnRetxAvoidTdd - * Purpose: Avoid allocating RETX for cases 1, 2 - * - * Invoked by: rgSCHCmnRetxAvoidTdd - * - * @param[in] RgSchDlSf *curSf - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlHqProcCb *proc - * @return Bool - * - **/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnRetxAvoidTdd -( -RgSchDlSf *curSf, -RgSchCellCb *cell, -RgSchDlHqProcCb *proc -) -#else -PUBLIC Bool rgSCHCmnRetxAvoidTdd(curSf, cell, proc) -RgSchDlSf *curSf; -RgSchCellCb *cell; -RgSchDlHqProcCb *proc; -#endif -{ - RgSchTddSfType txSfType = 0; - - TRC2(rgSCHCmnRetxAvoidTdd); - - /* Get the RBs of TB that will be retransmitted */ - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - txSfType = proc->tbInfo[0].sfType; - -#ifdef XEON_SPECIFIC_CHANGES -#ifndef XEON_TDD_SPCL - /* Avoid re-transmission on Normal SF when the corresponding TB wss transmitted on SPCL SF */ - if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0) - { - RETVALUE(TRUE); - } -#endif -#endif - } - if (proc->tbInfo[1].state == HQ_TB_NACKED) - { - /* Select the TxSf with the highest num of possible REs - * In ascending order -> 1) SPL SF 2) DL_SF_0 3) DL_SF */ - txSfType = RGSCH_MAX(txSfType, proc->tbInfo[1].sfType); - -#ifdef XEON_SPECIFIC_CHANGES -#ifndef XEON_TDD_SPCL - /* Avoid re-transmission on Normal SF when the corresponding TB wss tranmitted on SPCL SF */ - if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0) - { - RETVALUE(TRUE); - } -#endif -#endif - } - - if (txSfType > curSf->sfType) - { - /* Avoid retx */ - RETVALUE(TRUE); - } - - /* Allow Retx */ - RETVALUE(FALSE); -} - -#else -/* DwPTS Scheduling Changes End */ - -/** - * @brief Avoid allocating RETX incase of collision - * with reserved resources for BCH/PSS/SSS occassions. - * - * @details - * - * Function: rgSCHCmnRetxAllocAvoid - * Purpose: Avoid allocating RETX incase of collision - * with reserved resources for BCH/PSS/SSS occassions - * - * Invoked by: rgSCHCmnDlAllocRetxRb - * - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @return Bool - * - **/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnRetxAllocAvoid -( -RgSchDlSf *subFrm, -RgSchCellCb *cell, -RgSchDlHqProcCb *proc -) -#else -PUBLIC Bool rgSCHCmnRetxAllocAvoid(subFrm, cell, proc) -RgSchDlSf *subFrm; -RgSchCellCb *cell; -RgSchDlHqProcCb *proc; -#endif -{ - U8 reqRbs; - - TRC2(rgSCHCmnRetxAllocAvoid); - - if (proc->tbInfo[0].state == HQ_TB_NACKED) - { - reqRbs = proc->tbInfo[0].dlGrnt.numRb; - } - else - { - reqRbs = proc->tbInfo[1].dlGrnt.numRb; - } - /* Consider the dlGrnt.numRb of the Retransmitting proc->tbInfo - * and current available RBs to determine if this RETX TB - * will collide with the BCH/PSS/SSS occassion */ - if (subFrm->sfNum % 5 == 0) - { - if ((subFrm->bwAssigned < cell->pbchRbEnd) && - (((subFrm->bwAssigned + reqRbs) - cell->pbchRbStart) > 0)) - { - RETVALUE(TRUE); - } - } - RETVALUE(FALSE); -} - -#endif - - -/** - * @brief This function invokes the TM specific DL RETX RB Allocation routine. - * - * @details - * - * Function: rgSCHCmnDlAllocRetxRb - * Purpose: This function invokes the TM specific - * DL RETX RB Allocation routine. - * - * Invoked by: Specific Schedulers - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *effBo - * @param[in] RgSchDlHqProcCb *proc - * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHCmnDlAllocRetxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -U32 bo, -U32 *effBo, -RgSchDlHqProcCb *proc, -RgSchCmnDlRbAllocInfo *cellWdAllocInfo -) -#else -PUBLIC S16 rgSCHCmnDlAllocRetxRb(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -U32 bo; -U32 *effBo; -RgSchDlHqProcCb *proc; -RgSchCmnDlRbAllocInfo *cellWdAllocInfo; -#endif -{ - U32 newSchBits = 0; - RgSchDlRbAlloc *allocInfo; - - TRC2(rgSCHCmnDlAllocRetxRb); - - if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) )) - { - ue->dl.aggTbBits = 0; - } - - *effBo = 0; - /* Check for DL BW exhaustion */ - if (subFrm->bw <= subFrm->bwAssigned) - { - RETVALUE(RFAILED); - } - /* Call TM specific RB allocation routine */ - (dlAllocRetxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \ - proc, cellWdAllocInfo); - - if (*effBo) - { - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - /* Calculate totals bits newly allocated */ - if (allocInfo->tbInfo[0].schdlngForTb) - { - newSchBits += allocInfo->tbInfo[0].bytesReq; - } - if (allocInfo->tbInfo[1].schdlngForTb) - { - newSchBits += allocInfo->tbInfo[1].bytesReq; - } - ue->dl.aggTbBits += (newSchBits * 8); - RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime)) - } - - RETVALUE(ROK); -} - - -/** - * @brief This function determines the RBs and Bytes required for - * Transmission on 1 CW. - * - * @details - * - * Function: rgSCHCmnDlAlloc1CwTxRb - * Purpose: This function determines the RBs and Bytes required - * for Transmission of DL SVC BO on 1 CW. - * Also, takes care of SVC by SVC allocation by tracking - * previous SVCs allocations. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: DL UE Allocation - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqTbCb *tbInfo - * @param[in] U32 bo - * @param[out] U8 *numRb - * @param[out] U32 *effBo - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *tbInfo, -U32 bo, -U8 *numRb, -U32 *effBo -) -#else -PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, tbInfo, bo, numRb, effBo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -RgSchDlHqTbCb *tbInfo; -U32 bo; -U8 *numRb; -U32 *effBo; -#endif -{ - U32 tbSz; - U8 imcs; - U8 iTbs; - RgSchCmnDlUe *ueDl; - RgSchDlRbAlloc *allocInfo; - U32 oldReq; - U32 reqBytes; - /* Correcting wrap around issue. - * This change has been done at mutliple places in this function.*/ - U32 tempNumRb; - TRC2(rgSCHCmnDlAlloc1CwTxRb); - - reqBytes = bo; - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - oldReq = ueDl->outStndAlloc; - -#ifdef RG_5GTF - //TODO_SID: Currently setting max Tb size wrt to 5GTF TM3 - iTbs = ue->ue5gtfCb.mcs; - ueDl->maxTbSz = MAX_5GTF_TB_SIZE * ue->ue5gtfCb.rank; - ueDl->maxRb = MAX_5GTF_PRBS; -#endif - ueDl->outStndAlloc += bo; - /* consider Cumulative amount of this BO and bytes so far allocated */ - bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbSz/8); - /* Get the number of REs needed for this bo. */ - //noRes = ((bo * 8 * 1024) / eff); - - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - //tempNumRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]); - tempNumRb = MAX_5GTF_PRBS; - tbSz = RGSCH_MIN(bo, (rgSch5gtfTbSzTbl[iTbs]/8) * ue->ue5gtfCb.rank); - - /* DwPts Scheduling Changes End */ - *effBo = RGSCH_MIN(tbSz - oldReq, reqBytes); - -#ifdef RG_5GTF - //RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs); - imcs = iTbs; -#endif - - - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbSz, \ - iTbs, imcs, tbInfo, ue->ue5gtfCb.rank); - *numRb = (U8) tempNumRb; - - /* Update the subframe Allocated BW field */ - subFrm->bwAssigned = subFrm->bwAssigned + tempNumRb - allocInfo->rbsReq; - - RETVALUE(ROK); -} - - -/** - * @brief This function is invoked in the event of any TB's allocation - * being underutilized by the specific scheduler. Here we reduce iMcs - * to increase redundancy and hence increase reception quality at UE. - * - * @details - * - * Function: rgSCHCmnRdcImcsTxTb - * Purpose: This function shall reduce the iMcs in accordance with - * the total consumed bytes by the UE at allocation - * finalization. - * - * Invoked by: UE DL Allocation finalization routine - * of specific scheduler. - * - * @param[in] RgSchDlRbAlloc *allocInfo - * @param[in] U8 tbInfoIdx - * @param[in] U32 cnsmdBytes - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnRdcImcsTxTb -( -RgSchDlRbAlloc *allocInfo, -U8 tbInfoIdx, -U32 cnsmdBytes -) -#else -PUBLIC Void rgSCHCmnRdcImcsTxTb(allocInfo, tbInfoIdx, cnsmdBytes) -RgSchDlRbAlloc *allocInfo; -U8 tbInfoIdx; -U32 cnsmdBytes; -#endif -{ - RETVOID; - /*The below functionality is not needed.*/ - U8 noLyr; - U8 iTbs; - U16 numRb; - - TRC2(rgSCHCmnRdcImcsTxTb); - - iTbs = allocInfo->tbInfo[tbInfoIdx].iTbs; - noLyr = allocInfo->tbInfo[tbInfoIdx].noLyr; - numRb = allocInfo->rbsAlloc; - if ( numRb > 0) - { - if ((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) == cnsmdBytes) - { - RETVOID; - } - } - /* Get iTbs as suitable for the consumed bytes */ - while((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) > cnsmdBytes) - { - if (iTbs == 0) - { - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].\ - tbCb->dlGrnt.iMcs); - RETVOID; - } - iTbs--; - } - iTbs++; - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].tbCb->dlGrnt.iMcs); - - RETVOID; -} - - -/** - * @brief This function determines the RBs and Bytes required for - * Transmission on 2 CWs. - * - * @details - * - * Function: rgSCHCmnDlAlloc2CwTxRb - * Purpose: This function determines the RBs and Bytes required - * for Transmission of DL SVC BO on 2 CWs. - * Also, takes care of SVC by SVC allocation by tracking - * previous SVCs allocations. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: TM3 and TM4 DL UE Allocation - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @param[in] RgSchDlHqProcCb bo - * @param[out] U8 *numRb - * @param[out] U32 *effBo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U32 bo, -U8 *numRbRef, -U32 *effBo -) -#else -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, numRbRef, effBo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -RgSchDlHqProcCb *proc; -U32 bo; -U8 *numRbRef; -U32 *effBo; -#endif -{ - U32 noRes; - U32 eff1, eff2; - U32 tb1Sz, tb2Sz; - U8 imcs1, imcs2; - U8 noLyr1, noLyr2; - U8 iTbs1, iTbs2; - RgSchCmnDlCell *cellDl; - RgSchCmnDlUe *ueDl; - RgSchDlRbAlloc *allocInfo; - U32 oldReq; - U32 reqBytes; - /* Fix: MUE_PERTTI_DL */ - U32 numRb; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - U8 cfi = cellSch->dl.currCfi; - S16 availBw; - U32 availBits = 0; -#ifdef LTE_ADV - U32 boTmp = bo; -#endif - - TRC2(rgSCHCmnDlAlloc2CwTxRb); - - reqBytes = bo; - cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - oldReq = ueDl->outStndAlloc; - - - if (ueDl->maxTbBits > ue->dl.aggTbBits) - { - availBits = ueDl->maxTbBits - ue->dl.aggTbBits; - } - /* check if we can further allocate to this UE */ - if ((ue->dl.aggTbBits >= ueDl->maxTbBits) || - (allocInfo->tbInfo[0].bytesReq >= ueDl->maxTbSz/8) || - (allocInfo->tbInfo[1].bytesReq >= ueDl->maxTbSz/8) || - (allocInfo->rbsReq >= ueDl->maxRb)) - { - RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId, - "rgSCHCmnDlAllocRb(): UEs max allocation exceed"); - RETVALUE(RFAILED); - } - - noLyr1 = ueDl->mimoInfo.cwInfo[0].noLyr; - noLyr2 = ueDl->mimoInfo.cwInfo[1].noLyr; - - /* If there is no CFI change, continue to use the BLER based - * iTBS value */ - if (ueDl->lastCfi == cfi) - { - iTbs1 = ueDl->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1]; - iTbs2 = ueDl->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1]; - } - else - { - U8 cqi = ueDl->mimoInfo.cwInfo[0].cqi; -#ifdef LTE_TDD - iTbs1 = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 0, noLyr1); -#else - iTbs1 = (U8) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 0, noLyr1); -#endif - - cqi = ueDl->mimoInfo.cwInfo[1].cqi; -#ifdef LTE_TDD - iTbs2 = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 1, noLyr2); -#else - iTbs2 = (U8) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 1, noLyr2); -#endif - } - - /*ccpu00131191 and ccpu00131317 - Fix for RRC Reconfig failure - * issue for VoLTE call */ - //if ((proc->hasDcch) || (TRUE == rgSCHLaaSCellEnabled(cell))) - if (proc->hasDcch) - { - if (iTbs1 > 5) - { - iTbs1 = iTbs1 - 5; - } - else - { - iTbs1 = 0; - } - if (iTbs2 > 5) - { - iTbs2 = iTbs2 - 5; - } - else - { - iTbs2 = 0; - } - } - else if(!cellSch->dl.isDlFreqSel) - { -#ifdef LTE_TDD - /* for Tdd reduce iTbs only for SF0. SF5 contains only - * SSS and can be ignored */ - if (subFrm->sfNum == 0) - { - (iTbs1 > 1)? (iTbs1 -= 1) : (iTbs1 = 0); - (iTbs2 > 1)? (iTbs2 -= 1) : (iTbs2 = 0); - } - /* For SF 3 and 8 CRC is getting failed in DL. - Need to do proper fix after the replay from - BRCM PHY team*/ -#ifdef CA_PHY_BRDCM_61765 - if ((subFrm->sfNum == 3) || (subFrm->sfNum == 8)) - { - (iTbs1 > 2)? (iTbs1 -= 2) : (iTbs1 = 0); - (iTbs2 > 2)? (iTbs2 -= 2) : (iTbs2 = 0); - } -#endif -#else -#endif - } - -#ifdef LTE_TDD - if(subFrm->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); - } -#endif - - eff1 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1]; - eff2 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2]; - - - bo = RGSCH_MIN(bo,availBits/8); - ueDl->outStndAlloc += bo; - /* consider Cumulative amount of this BO and bytes so far allocated */ - bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbBits/8); - bo = RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff1)/(eff1+eff2)), - ueDl->maxTbSz/8) + - RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff2)/(eff1+eff2)), - (ueDl->maxTbSz)/8) + - 1; /* Add 1 to adjust the truncation at weighted averaging */ - /* Get the number of REs needed for this bo. */ - noRes = ((bo * 8 * 1024) / (eff1 + eff2)); - - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - numRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]); - /* Cannot exceed the maximum number of RBs per UE */ - if (numRb > ueDl->maxRb) - { - numRb = ueDl->maxRb; - } - else - { -#ifdef LTE_ADV - if(RFAILED == rgSCHLaaCmn2CwAdjustPrb(allocInfo, boTmp, &numRb, ueDl, noLyr1, noLyr2, iTbs1, iTbs2)) -#endif - { - while ((numRb <= ueDl->maxRb) && - (rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1] <= ueDl->maxTbSz) && - (rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1] <= ueDl->maxTbSz) && - ((rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8 + - rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8) <= bo)) - { - (numRb)++; - } - } - } - availBw = subFrm->bw - subFrm->bwAssigned; - /* Cannot exceed the total number of RBs in the cell */ - if ((S16)(numRb - allocInfo->rbsReq) > availBw) - { - numRb = availBw + allocInfo->rbsReq; - } - tb1Sz = rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8; - tb2Sz = rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8; - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD - if(subFrm->sfType == RG_SCH_SPL_SF_DATA) - { - /* Max Rb for Special Sf is approximated as 4/3 of maxRb */ - rgSCHCmnCalcDwPtsTbSz2Cw(cell, bo, (U8*)&numRb, ueDl->maxRb*4/3, - &iTbs1, &iTbs2, noLyr1, - noLyr2, &tb1Sz, &tb2Sz, cfi); - /* Check for available Bw */ - if ((S16)numRb - allocInfo->rbsReq > availBw) - { - numRb = availBw + allocInfo->rbsReq; - tb1Sz = rgTbSzTbl[noLyr1-1][iTbs1][RGSCH_MAX(numRb*3/4,1)-1]/8; - tb2Sz = rgTbSzTbl[noLyr2-1][iTbs2][RGSCH_MAX(numRb*3/4,1)-1]/8; - } - } -#endif - /* DwPts Scheduling Changes End */ - /* Update the subframe Allocated BW field */ - subFrm->bwAssigned = subFrm->bwAssigned + numRb - \ - allocInfo->rbsReq; - - *effBo = RGSCH_MIN((tb1Sz + tb2Sz) - oldReq, reqBytes); - -#ifdef LTE_ADV - if (ROK != rgSCHLaaCmn2TBPrbCheck(allocInfo, tb1Sz, tb2Sz, boTmp, effBo, iTbs1, iTbs2, numRb, proc)) - { - RETVALUE(RFAILED); - } -#endif - - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs1, imcs1); - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs2, imcs2); - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tb1Sz, \ - iTbs1, imcs1, &proc->tbInfo[0], noLyr1); - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \ - iTbs2, imcs2, &proc->tbInfo[1], noLyr2); - *numRbRef = (U8)numRb; - - - RETVALUE(ROK); -} - - -/** - * @brief This function determines the RBs and Bytes required for - * Transmission & Retransmission on 2 CWs. - * - * @details - * - * Function: rgSCHCmnDlAlloc2CwTxRetxRb - * Purpose: This function determines the RBs and Bytes required - * for Transmission & Retransmission on 2 CWs. Allocate - * RETX TB on a better CW and restrict new TX TB by - * RETX allocation. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: TM3 and TM4 DL UE Allocation - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqTbCb *reTxTb - * @param[in] RgSchDlHqTbCb *txTb - * @param[out] U8 *numRb - * @param[out] U32 *effBo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *reTxTb, -RgSchDlHqTbCb *txTb, -U8 *numRb, -U32 *effBo -) -#else -PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, reTxTb, txTb, numRb,\ - effBo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -RgSchDlHqTbCb *reTxTb; -RgSchDlHqTbCb *txTb; -U8 *numRb; -U32 *effBo; -#endif -{ - RgSchCmnDlUe *ueDl; - RgSchDlRbAlloc *allocInfo; - U8 imcs1, imcs2; - U8 noLyr2; - U16 tb2Sz; - RgSchCmnDlUeCwInfo *otherCw; - S16 availBw; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U8 cfi = cellDl->currCfi; - U8 iTbs; - - TRC2(rgSCHCmnDlAlloc2CwTxRetxRb); - - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - otherCw = &ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)]; - - - /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB - * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and - * MCS. */ - availBw = subFrm->bw - subFrm->bwAssigned; - *numRb = reTxTb->dlGrnt.numRb; - -#ifdef XEON_TDD_SPCL - *numRb = (reTxTb->initTxNumRbs); - if(reTxTb->sfType == RG_SCH_SPL_SF_DATA && subFrm->sfType != RG_SCH_SPL_SF_DATA) - { - *numRb = (reTxTb->initTxNumRbs*3/4); - - if(*numRb <= 3) - { - RLOG1(L_ERROR," Number of RBs [%d] are less than or equal to 3",*numRb); - RETVALUE(RFAILED); - } - } -#endif - - if ((S16)*numRb > availBw) - { - RETVALUE(RFAILED); - } - /* Update the subframe Allocated BW field */ - subFrm->bwAssigned += *numRb; - noLyr2 = otherCw->noLyr; - RG_SCH_CMN_GET_MCS_FOR_RETX(reTxTb, imcs1); - - /* If there is no CFI change, continue to use the BLER based - * iTBS value */ - if (ueDl->lastCfi == cfi) - { - iTbs = otherCw->iTbs[noLyr2-1]; - } - else - { -#ifdef LTE_TDD - iTbs = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, otherCw->cqi, cfi, - !(ueDl->mimoInfo.btrCwIdx), noLyr2); -#else - iTbs = (U8) rgSchCmnFetchItbs(cell, ueDl, otherCw->cqi, cfi, - !(ueDl->mimoInfo.btrCwIdx), noLyr2); -#endif - } - tb2Sz = rgTbSzTbl[noLyr2-1][iTbs][*numRb-1]/8; - /* DwPts Scheduling Changes Start */ -#ifdef LTE_TDD -#endif - /* DwPts Scheduling Changes End */ - RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs2); - - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], reTxTb->tbSz, \ - 0, imcs1, reTxTb, reTxTb->numLyrs); - - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \ - iTbs, imcs2, txTb, noLyr2); - - *effBo = reTxTb->tbSz + tb2Sz; - - RETVALUE(ROK); -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * Retransmission on 2 CWs. - * - * @details - * - * Function: rgSCHCmnDlAlloc2CwRetxRb - * Purpose: This function determines the RBs and Bytes required - * for BO Retransmission on 2 CWs. Allocate larger TB - * on a better CW and check if the smaller TB can be - * accomodated on the other CW. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqProcCb *proc - * @param[out] U8 *numRb - * @param[out] Bool *swpFlg - * @param[out] U32 *effBo - * @return Void - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqProcCb *proc, -U8 *numRb, -Bool *swpFlg, -U32 *effBo -) -#else -PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc,\ - numRb, swpFlg, effBo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -RgSchDlHqProcCb *proc; -U8 *numRb; -Bool *swpFlg; -U32 *effBo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - U8 imcs1; - U8 imcs2; - RgSchDlHqTbCb *lrgTbInfo, *othrTbInfo; - - TRC2(rgSCHCmnDlAlloc2CwRetxRb); - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - - /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB - * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and - * MCS. */ - lrgTbInfo = &proc->tbInfo[0]; - othrTbInfo = &proc->tbInfo[1]; - *numRb = lrgTbInfo->dlGrnt.numRb; -#ifdef XEON_TDD_SPCL - if((lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA || othrTbInfo->sfType == RG_SCH_SPL_SF_DATA)) - { - if(lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA) - { - *numRb = (lrgTbInfo->initTxNumRbs); - } - else - { - *numRb = (othrTbInfo->initTxNumRbs); - } - - if(subFrm->sfType != RG_SCH_SPL_SF_DATA) - { - *numRb = (*numRb)*3/4; - } - - if(*numRb <= 3) - { - RLOG1(L_ERROR," Number of RBs [%d] are less than or equal to 3",*numRb); - RETVALUE(RFAILED); - } - } -#endif - if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned)) - { - RETVALUE(RFAILED); - } - /* Update the subframe Allocated BW field */ - subFrm->bwAssigned += *numRb; - RG_SCH_CMN_GET_MCS_FOR_RETX(lrgTbInfo, imcs1); - RG_SCH_CMN_GET_MCS_FOR_RETX(othrTbInfo, imcs2); - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], lrgTbInfo->tbSz, \ - 0, imcs1, lrgTbInfo, lrgTbInfo->numLyrs); - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], othrTbInfo->tbSz, \ - 0, imcs2, othrTbInfo, othrTbInfo->numLyrs); - *effBo = lrgTbInfo->tbSz + othrTbInfo->tbSz; - - - - RETVALUE(ROK); -} - - -/** - * @brief This function determines the RBs and Bytes required for BO - * Retransmission on 1 CW. - * - * @details - * - * Function: rgSCHCmnDlAlloc1CwRetxRb - * Purpose: This function determines the RBs and Bytes required - * for BO Retransmission on 1 CW, the first CW. - * Returns RFAILED if BO not satisfied at all. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *subFrm - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlHqTbCb *tbInfo - * @param[in] U8 noLyr - * @param[out] U8 *numRb - * @param[out] U32 *effBo - * @return S16 - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -RgSchUeCb *ue, -RgSchDlHqTbCb *tbInfo, -U8 noLyr, -U8 *numRb, -U32 *effBo -) -#else -PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, tbInfo, noLyr,\ - numRb, effBo) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -RgSchUeCb *ue; -RgSchDlHqTbCb *tbInfo; -U8 noLyr; -U8 *numRb; -U32 *effBo; -#endif -{ - RgSchDlRbAlloc *allocInfo; - U8 imcs; - - TRC2(rgSCHCmnDlAlloc1CwRetxRb); - - allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); - - - /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB - * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and - * MCS. */ - *numRb = tbInfo->dlGrnt.numRb; - if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned)) - { - RETVALUE(RFAILED); - } - /* Update the subframe Allocated BW field */ - subFrm->bwAssigned += *numRb; - imcs = tbInfo->dlGrnt.iMcs; - allocInfo->dciFormat = tbInfo->dlGrnt.dciFormat; - /* Fix: For a RETX TB the iTbs is irrelevant, hence setting 0 */ - RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbInfo->tbSz, \ - 0, imcs, tbInfo, tbInfo->numLyrs); - *effBo = tbInfo->tbSz; - - RETVALUE(ROK); -} - -#ifdef LTEMAC_SPS - -/** - * @brief This function is called to handle Release PDCCH feedback for SPS UE - * - * @details - * - * Function: rgSCHCmnDlRelPdcchFbk - * Purpose: Invokes SPS module to handle release PDCCH feedback - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] Bool isAck - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlRelPdcchFbk -( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isAck -) -#else -PUBLIC Void rgSCHCmnDlRelPdcchFbk(cell, ue, isAck) -RgSchCellCb *cell; -RgSchUeCb *ue; -Bool isAck; -#endif -{ - - TRC2(rgSCHCmnDlRelPdcchFbk); - rgSCHCmnSpsDlRelPdcchFbk(cell, ue, isAck); - RETVOID; - -} - - -/** - * @brief This function is invoked to handle Ack processing for a HARQ proc. - * - * @details - * - * Function: rgSCHCmnDlProcAck - * Purpose: DTX processing for HARQ proc - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnDlProcAck -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHCmnDlProcAck(cell, hqP) -RgSchCellCb *cell; -RgSchDlHqProcCb *hqP; -#endif -{ - - TRC2(rgSCHCmnDlProcAck); - - if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) - { - /* Invoke SPS module if SPS service was scheduled for this HARQ proc */ - rgSCHCmnSpsDlProcAck(cell, hqP); - } - RETVOID; -} -#ifdef RGSCH_SPS_STATS -extern U32 rgSchStatCrntiCeRcvCnt; -#endif -/** - * @brief This function is invoked to handle CRNTI CE reception for an UE - * - * @details - * - * Function: rgSCHCmnHdlCrntiCE - * Purpose: Handle CRNTI CE reception - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnHdlCrntiCE -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHCmnHdlCrntiCE(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - - TRC2(rgSCHCmnHdlCrntiCE); -#ifdef RGSCH_SPS_STATS - rgSchStatCrntiCeRcvCnt++; -#endif - - /* When UL sync lost happened due to TA timer expiry UE is being moved to - PDCCH order inactivity list.But when CRNTI CE received in msg3 from UE - we are not moving UE into active state due to that RRC Reconfiguration is - not happening. - So here we are moving UE to active list whenever we receive the CRNTI CE and - UE is inactive */ - /* CR ccpu00144525 */ - if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) - { - /* Activate this UE if it was inactive */ - RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); - RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); - } - - /* Handling is same as reception of UE RESET for both DL and UL */ - if (ue->dl.dlSpsCfg.isDlSpsEnabled) - { - rgSCHCmnSpsDlUeReset(cell, ue); - } - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlUeReset(cell, ue); - } - - RETVOID; -} - - -/** - * @brief This function is called to handle relInd from MAC for a UE - * - * @details - * - * Function: rgSCHCmnUlSpsRelInd - * Purpose: Invokes SPS module to handle UL SPS release for a UE - * - * Invoked by: SCH_UTL - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] Bool isExplRel - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlSpsRelInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -Bool isExplRel -) -#else -PUBLIC Void rgSCHCmnUlSpsRelInd(cell, ue, isExplRel) -RgSchCellCb *cell; -RgSchUeCb *ue; -Bool isExplRel; -#endif -{ - - TRC2(rgSCHCmnUlSpsRelInd); - rgSCHCmnSpsUlProcRelInd(cell, ue, isExplRel); - RETVOID; - -} /* end of rgSCHCmnUlSpsRelInd */ - -/** - * @brief This function is called to handle SPS Activate Ind from MAC for a UE - * - * @details - * - * Function: rgSCHCmnUlSpsActInd - * Purpose: Invokes SPS module to handle UL SPS activate for a UE - * - * Invoked by: SCH_UTL - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlSpsActInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U16 spsSduSize -) -#else -PUBLIC Void rgSCHCmnUlSpsActInd(cell, ue,spsSduSize) -RgSchCellCb *cell; -RgSchUeCb *ue; -U16 spsSduSize; -#endif -{ - - TRC2(rgSCHCmnUlSpsActInd); - - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlProcActInd(cell, ue,spsSduSize); - } - RETVOID; - -} /* end of rgSCHCmnUlSpsActInd */ - -/** - * @brief This function is called to handle CRC in UL for UEs - * undergoing SPS release - * - * @details - * - * Function: rgSCHCmnUlCrcInd - * Purpose: Invokes SPS module to handle CRC in UL for SPS UE - * - * Invoked by: SCH_UTL - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo crcTime - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlCrcInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo crcTime -) -#else -PUBLIC Void rgSCHCmnUlCrcInd(cell, ue, crcTime) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo crcTime; -#endif -{ - - TRC2(rgSCHCmnUlCrcInd); - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlProcCrcInd(cell, ue, crcTime); - } - RETVOID; - -} /* end of rgSCHCmnUlCrcFailInd */ - -/** - * @brief This function is called to handle CRC failure in UL - * - * @details - * - * Function: rgSCHCmnUlCrcFailInd - * Purpose: Invokes SPS module to handle CRC failure in UL for SPS UE - * - * Invoked by: SCH_UTL - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo crcTime - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUlCrcFailInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo crcTime -) -#else -PUBLIC Void rgSCHCmnUlCrcFailInd(cell, ue, crcTime) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo crcTime; -#endif -{ - - TRC2(rgSCHCmnUlCrcFailInd); - if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) - { - rgSCHCmnSpsUlProcDtxInd(cell, ue, crcTime); - } - RETVOID; - -} /* end of rgSCHCmnUlCrcFailInd */ - -#endif /* LTEMAC_SPS */ - -/** - * @brief BCH,BCCH,PCCH Dowlink Scheduling Handler. - * - * @details - * - * Function: rgSCHCmnDlBcchPcchAlloc - * Purpose: This function calls common scheduler APIs to - * schedule for BCCH/PCCH. - * It then invokes Allocator for actual RB - * allocations. It processes on the actual resources allocated - * against requested to the allocator module. - * - * Invoked by: Common Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnDlBcchPcchAlloc -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnDlBcchPcchAlloc(cell) -RgSchCellCb *cell; -#endif -{ -#ifdef LTE_TDD - U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE; -#else -#ifdef LTEMAC_HDFDD - U8 nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; -#else - U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; -#endif -#endif - RgInfSfAlloc *nextsfAlloc = &(cell->sfAllocArr[nextSfIdx]); - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo; - - TRC2(rgSCHCmnDlBcchPcchAlloc); - - - /*Reset the bitmask for BCCH/PCCH*/ - rgSCHUtlResetSfAlloc(nextsfAlloc,TRUE,FALSE); -#ifndef DISABLE_MIB_SIB /* Not sending MIB and SIB to CL */ -#ifdef RGR_SI_SCH - rgSCHChkNUpdSiCfg(cell); - rgSCHSelectSi(cell); -#endif - - /*Perform the scheduling for BCCH,PCCH*/ - rgSCHCmnDlBcchPcch(cell, allocInfo, nextsfAlloc); - - /* Call common allocator for RB Allocation */ - rgSCHBcchPcchDlRbAlloc(cell, allocInfo); - - /* Finalize the Allocations for reqested Against alloced */ - rgSCHCmnDlBcchPcchFnlz(cell, allocInfo); -#endif /* DISABLE_MIB_SIB */ - RETVOID; -} - -/** - * @brief Handles RB allocation for BCCH/PCCH for downlink. - * - * @details - * - * Function : rgSCHBcchPcchDlRbAlloc - * - * Invoking Module Processing: - * - This function is invoked for DL RB allocation of BCCH/PCCH - * - * Processing Steps: - * - If cell is frequency selecive, - * - Call rgSCHDlfsBcchPcchAllocRb(). - * - else, - * - Do the processing - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlRbAllocInfo *allocInfo - * @return Void - **/ - -#ifdef ANSI -PRIVATE Void rgSCHBcchPcchDlRbAlloc -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHBcchPcchDlRbAlloc(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - TRC2(rgSCHBcchPcchDlRbAlloc); - - - if (cellSch->dl.isDlFreqSel) - { - cellSch->apisDlfs->rgSCHDlfsBcchPcchAllocRb(cell, allocInfo); - } - else - { - rgSCHCmnNonDlfsBcchPcchRbAlloc(cell, allocInfo); - } - - RETVOID; -} - -/** - * @brief Handles RB allocation for BCCH,PCCH for frequency - * non-selective cell. - * - * @details - * - * Function : rgSCHCmnNonDlfsBcchPcchRbAlloc - * - * Invoking Module Processing: - * - SCH shall invoke this if downlink frequency selective is disabled for - * the cell for RB allocation. - * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs - * estimate and subframe for each allocation to be made to SCH. - * - * Processing Steps: - * - Allocate sequentially for BCCH,PCCH common channels. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchCmnDlRbAllocInfo *allocInfo - * @return Void - **/ - -#ifdef ANSI -PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo -) -#else -PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc(cell, allocInfo) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -#endif -{ - RgSchDlRbAlloc *reqAllocInfo; - - TRC2(rgSCHCmnNonDlfsBcchPcchRbAlloc); - - /* 143473 */ - /* Allocate for PCCH */ - reqAllocInfo = &(allocInfo->pcchAlloc); - if (reqAllocInfo->rbsReq) - { - rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo); - } - /* Allocate for BCCH on DLSCH */ - reqAllocInfo = &(allocInfo->bcchAlloc); - if (reqAllocInfo->rbsReq) - { - rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo); - } - RETVOID; -} - - -#ifdef RGR_SI_SCH -/** - * @brief This function implements the handling to check and - * update the SI cfg at the start of the modificiation period. - * - * @details - * - * Function: rgSCHChkNUpdSiCfg - * Purpose: This function implements handling for update of SI Cfg - * at the start of modification period. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE Void rgSCHChkNUpdSiCfg -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHChkNUpdSiCfg(cell) -RgSchCellCb *cell; -#endif -{ - CmLteTimingInfo pdSchTmInfo; - - TRC2(rgSCHChkNUpdSiCfg); - - - pdSchTmInfo = cell->crntTime; -#ifdef LTEMAC_HDFDD - /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA - + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ - RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); -#else - RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA); -#endif - - - /* Updating the SIB1 for Warning SI message immediately after it is received - * from application. No need to wait for next modification period. - */ - if((pdSchTmInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0) - && (RGSCH_SIB1_TX_SF_NUM == (pdSchTmInfo.subframe % RGSCH_NUM_SUB_FRAMES))) - { - /*Check whether SIB1 with PWS has been updated*/ - if(cell->siCb.siBitMask & RGSCH_SI_SIB1_PWS_UPD) - { - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1, - cell->siCb.newSiInfo.sib1Info.sib1); - cell->siCb.crntSiInfo.sib1Info.mcs = - cell->siCb.newSiInfo.sib1Info.mcs; - cell->siCb.crntSiInfo.sib1Info.nPrb = - cell->siCb.newSiInfo.sib1Info.nPrb; - cell->siCb.crntSiInfo.sib1Info.msgLen = - cell->siCb.newSiInfo.sib1Info.msgLen; - cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_PWS_UPD; - } - } - - /*Check if this SFN and SF No marks the start of next modification - period. If current SFN,SF No doesn't marks the start of next - modification period, then return. */ - if(!((pdSchTmInfo.sfn % cell->siCfg.modPrd == 0) - && (0 == pdSchTmInfo.subframe))) - /*if(!((((pdSchTmInfo.hSfn * 1024) + pdSchTmInfo.sfn) % cell->siCfg.modPrd == 0) - && (0 == pdSchTmInfo.subframe)))*/ - { - RETVOID; - } - - /*Check whether MIB has been updated*/ - if(cell->siCb.siBitMask & RGSCH_SI_MIB_UPD) - { - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.mib, - cell->siCb.newSiInfo.mib); - cell->siCb.siBitMask &= ~RGSCH_SI_MIB_UPD; - } - - /*Check whether SIB1 has been updated*/ - if(cell->siCb.siBitMask & RGSCH_SI_SIB1_UPD) - { - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1, - cell->siCb.newSiInfo.sib1Info.sib1); - cell->siCb.crntSiInfo.sib1Info.mcs = cell->siCb.newSiInfo.sib1Info.mcs; - cell->siCb.crntSiInfo.sib1Info.nPrb = cell->siCb.newSiInfo.sib1Info.nPrb; - cell->siCb.crntSiInfo.sib1Info.msgLen = - cell->siCb.newSiInfo.sib1Info.msgLen; - cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_UPD; - } - - /*Check whether SIs have been updated*/ - if(cell->siCb.siBitMask & RGSCH_SI_SI_UPD) - { - U8 idx; - - /*Check if SI cfg have been modified And Check if numSi have - been changed, if yes then we would need to update the - pointers for all the SIs */ - if((cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) && - (cell->siCfg.numSi != cell->siCb.newSiCfg.numSi)) - { - for(idx = 0;idx < cell->siCb.newSiCfg.numSi;idx++) - { - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si, - cell->siCb.newSiInfo.siInfo[idx].si); - cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si; - cell->siCb.siArray[idx].isWarningSi = FALSE; - - cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs; - cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb; - cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen; - } - - /*If numSi have been reduced then we need to free the - pointers at the indexes in crntSiInfo which haven't - been exercised. If numSi has increased then nothing - additional is requires as above handling has taken - care.*/ - if(cell->siCfg.numSi > cell->siCb.newSiCfg.numSi) - { - for(idx = cell->siCb.newSiCfg.numSi; - idx < cell->siCfg.numSi;idx++) - { - RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si); - cell->siCb.siArray[idx].si = NULLP; - } - } - } - else - { - /*numSi has not been updated, we just need to update the - pointers for the SIs which are set to NON NULLP */ - /*ccpu00118260 - Correct Update of SIB2 */ - for(idx = 0;idx < cell->siCfg.numSi;idx++) - { - if(NULLP != cell->siCb.newSiInfo.siInfo[idx].si) - { - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si, - cell->siCb.newSiInfo.siInfo[idx].si); - - cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si; - cell->siCb.siArray[idx].isWarningSi = FALSE; - cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs; - cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb; - cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen; - } - } - } - cell->siCb.siBitMask &= ~RGSCH_SI_SI_UPD; - } - - /*Check whether SI cfg have been updated*/ - if(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) - { - cell->siCfg = cell->siCb.newSiCfg; - cell->siCb.siBitMask &= ~RGSCH_SI_SICFG_UPD; - } - - RETVOID; -} - - -/** - * @brief This function implements the selection of the SI - * that is to be scheduled. - * - * @details - * - * Function: rgSCHSelectSi - * Purpose: This function implements the selection of SI - * that is to be scheduled. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE Void rgSCHSelectSi -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHSelectSi(cell) -RgSchCellCb *cell; -#endif -{ - CmLteTimingInfo crntTmInfo; - U8 siWinSize; - U16 x; - U16 windowId; - - TRC2(rgSCHSelectSi); - - - crntTmInfo = cell->crntTime; -#ifdef LTEMAC_HDFDD - /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA - + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ - RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); -#else - RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA); -#endif - - siWinSize = cell->siCfg.siWinSize; - - /* Select SI only once at the starting of the new window */ - if(cell->siCb.inWindow) - { - if ((crntTmInfo.sfn % cell->siCfg.minPeriodicity) == 0 && - crntTmInfo.subframe == 0) - { - /* Reinit inWindow at the beginning of every SI window */ - cell->siCb.inWindow = siWinSize - 1; - } - else - { - cell->siCb.inWindow--; - RETVOID; - } - } - else /* New window. Re-init the winSize counter with the window length */ - { - if((cell->siCb.siArray[cell->siCb.siCtx.siId - 1].isWarningSi == TRUE)&& - (cell->siCb.siCtx.retxCntRem != 0)) - { - rgSCHUtlFreeWarningSiPdu(cell); - cell->siCb.siCtx.warningSiFlag = FALSE; - } - - cell->siCb.inWindow = siWinSize - 1; - } - - x = rgSCHCmnGetSiSetId(crntTmInfo.sfn, crntTmInfo.subframe, - cell->siCfg.minPeriodicity); - - /* Window Id within a SI set. This window Id directly maps to a - * unique SI Id */ - windowId = (((crntTmInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) + - crntTmInfo.subframe) - (x * (cell->siCfg.minPeriodicity * 10))) - / siWinSize; - - if(windowId >= RGR_MAX_NUM_SI) - RETVOID; - - /* Update the siCtx if there is a valid SI and its periodicity - * has occurred */ - if (NULLP != cell->siCb.siArray[windowId].si) - { - /* Warning SI Periodicity is same as SIB2 Periodicity */ - if(((cell->siCb.siArray[windowId].isWarningSi == FALSE) && - (x % (cell->siCfg.siPeriodicity[windowId] - /cell->siCfg.minPeriodicity) == 0)) || - ((cell->siCb.siArray[windowId].isWarningSi == TRUE) && - (x % (cell->siCfg.siPeriodicity[0] - /cell->siCfg.minPeriodicity) == 0))) - { - cell->siCb.siCtx.siId = windowId+1; - cell->siCb.siCtx.retxCntRem = cell->siCfg.retxCnt; - cell->siCb.siCtx.warningSiFlag = cell->siCb.siArray[windowId]. - isWarningSi; - cell->siCb.siCtx.timeToTx.sfn = crntTmInfo.sfn; - cell->siCb.siCtx.timeToTx.subframe = crntTmInfo.subframe; - - RG_SCH_ADD_TO_CRNT_TIME(cell->siCb.siCtx.timeToTx, - cell->siCb.siCtx.maxTimeToTx, (siWinSize - 1)) - } - } - else - {/* Update the siCtx with invalid si Id */ - cell->siCb.siCtx.siId = 0; - } - - RETVOID; -} - - -/** - * @brief This function implements scheduler DL allocation for - * SI. - * - * @details - * - * Function: rgSCHDlSiSched - * Purpose: This function implements scheduler for DL allocation - * for SI. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb* cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE Void rgSCHDlSiSched -( -RgSchCellCb *cell, -RgSchCmnDlRbAllocInfo *allocInfo, -RgInfSfAlloc *subfrmAlloc -) -#else -PRIVATE Void rgSCHDlSiSched(cell, allocInfo, subfrmAlloc) -RgSchCellCb *cell; -RgSchCmnDlRbAllocInfo *allocInfo; -RgInfSfAlloc *subfrmAlloc; -#endif -{ - CmLteTimingInfo crntTimInfo; - RgSchDlSf *sf; - U8 nPrb = 0; - U8 mcs = 0; - MsgLen msgLen = 0; - U32 rb=0; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - U16 lostRe; - U8 cfi = cellDl->currCfi; -#endif - /* DwPTS Scheduling Changes End */ - - TRC2(rgSCHDlSiSched); - - - crntTimInfo = cell->crntTime; -#ifdef LTEMAC_HDFDD - /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA - + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ - RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); -#else - RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA); -#endif - - /* Compute the subframe for which allocation is being made. - Essentially, we need pointer to the dl frame for this subframe */ - sf = rgSCHUtlSubFrmGet(cell, crntTimInfo); - - /*Check if scheduling of MIB is required */ -#ifdef EMTC_ENABLE - /* since we are adding the MIB repetition logic for EMTC UEs, checking if - * emtcEnabled or not, If enabled MIB would be repeted at as part of EMTC - * feature, otherwise scheduling at (n,0) */ - if(0 == cell->emtcEnable) - { -#endif - if((crntTimInfo.sfn % RGSCH_MIB_PERIODICITY == 0) - && (RGSCH_MIB_TX_SF_NUM == crntTimInfo.subframe)) - { - MsgLen mibLen = 0; - U8 sfnOctet, mibOct2 = 0; - U8 mibOct1 = 0; - /*If MIB has not been yet setup by Application, return*/ - if(NULLP == cell->siCb.crntSiInfo.mib) - RETVOID; - - SFndLenMsg(cell->siCb.crntSiInfo.mib, &mibLen); - sf->bch.tbSize = mibLen; - /*Fill the interface information */ - rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, NULLD, NULLD); - - /*Set the bits of MIB to reflect SFN */ - /*First get the Most signficant 8 bits of SFN */ - sfnOctet = (U8)(crntTimInfo.sfn >> 2); - /*Get the first two octets of MIB, and then update them - using the SFN octet value obtained above.*/ - if(ROK != SExamMsg((Data *)(&mibOct1), - cell->siCb.crntSiInfo.mib, 0)) - RETVOID; - - if(ROK != SExamMsg((Data *)(&mibOct2), - cell->siCb.crntSiInfo.mib, 1)) - RETVOID; - - /* ccpu00114572- Fix for improper way of MIB Octet setting for SFN */ - mibOct1 = (mibOct1 & 0xFC) | (sfnOctet >> 6); - mibOct2 = (mibOct2 & 0x03) | (sfnOctet << 2); - /* ccpu00114572- Fix ends*/ - - /*Now, replace the two octets in MIB */ - if(ROK != SRepMsg((Data)(mibOct1), - cell->siCb.crntSiInfo.mib, 0)) - RETVOID; - - if(ROK != SRepMsg((Data)(mibOct2), - cell->siCb.crntSiInfo.mib, 1)) - RETVOID; - - /*Copy the MIB msg buff into interface buffer */ - SCpyMsgMsg(cell->siCb.crntSiInfo.mib, - rgSchCb[cell->instIdx].rgSchInit.region, - rgSchCb[cell->instIdx].rgSchInit.pool, - &subfrmAlloc->cmnLcInfo.bchInfo.pdu); - /* Added Dl TB count for MIB message transmission - * This counter is incremented 4 times to consider - * the retransmission at the PHY level on PBCH channel*/ -#ifdef LTE_L2_MEAS - cell->dlUlTbCnt.tbTransDlTotalCnt += RG_SCH_MIB_CNT; -#endif - } -#ifdef EMTC_ENABLE - } -#endif - - allocInfo->bcchAlloc.schdFirst = FALSE; - /*Check if scheduling of SIB1 is required. - Check of (crntTimInfo.sfn % RGSCH_SIB1_PERIODICITY == 0) - is not required here since the below check takes care - of SFNs applicable for this one too.*/ - if((crntTimInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0) - && (RGSCH_SIB1_TX_SF_NUM == crntTimInfo.subframe)) - { - /*If SIB1 has not been yet setup by Application, return*/ - if(NULLP == (cell->siCb.crntSiInfo.sib1Info.sib1)) - { - RETVOID; - } - - allocInfo->bcchAlloc.schdFirst = TRUE; - mcs = cell->siCb.crntSiInfo.sib1Info.mcs; - nPrb = cell->siCb.crntSiInfo.sib1Info.nPrb; - msgLen = cell->siCb.crntSiInfo.sib1Info.msgLen; - } - else - { - /*Check if scheduling of SI can be performed.*/ - Bool invalid = FALSE; - - if(cell->siCb.siCtx.siId == 0) - RETVOID; - - /*Check if the Si-Window for the current Si-Context is completed*/ - invalid = rgSCHCmnChkPastWin(crntTimInfo, cell->siCb.siCtx.maxTimeToTx); - if(invalid) - { - /* LTE_ADV_FLAG_REMOVED_START */ - if(cell->siCb.siCtx.retxCntRem) - { - RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011,(ErrVal)cell->siCb.siCtx.siId, - "rgSCHDlSiSched(): SI not scheduled and window expired"); - } - /* LTE_ADV_FLAG_REMOVED_END */ - if(cell->siCb.siCtx.warningSiFlag == TRUE) - { - rgSCHUtlFreeWarningSiPdu(cell); - cell->siCb.siCtx.warningSiFlag = FALSE; - } - RETVOID; - } - - /*Check the timinginfo of the current SI-Context to see if its - transmission can be scheduled. */ - if(FALSE == (rgSCHCmnChkInWin(crntTimInfo, - cell->siCb.siCtx.timeToTx, - cell->siCb.siCtx.maxTimeToTx))) - { - RETVOID; - - } - /*Check if retransmission count has become 0*/ - if(0 == cell->siCb.siCtx.retxCntRem) - { - RETVOID; - } - - /* LTE_ADV_FLAG_REMOVED_START */ - /* Check if ABS is enabled/configured */ - if(RGR_ENABLE == cell->lteAdvCb.absCfg.status) - { - /* The pattern type is RGR_ABS_MUTE, then eNB need to blank the subframe */ - if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) - { - /* Determine next scheduling subframe is ABS or not */ - if(RG_SCH_ABS_ENABLED_ABS_SF == (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern - [((crntTimInfo.sfn*RGSCH_NUM_SUB_FRAMES) + crntTimInfo.subframe) % RGR_ABS_PATTERN_LEN])) - { - /* Skip the SI scheduling to next tti */ - RETVOID; - } - } - } - /* LTE_ADV_FLAG_REMOVED_END */ - - /*Schedule the transmission of the current SI-Context */ - /*Find out the messg length for the SI message */ - /* warningSiFlag is to differentiate between Warning SI - * and Other SI */ - if((rgSCHUtlGetMcsAndNPrb(cell, &nPrb, &mcs, &msgLen)) != ROK) - { - RETVOID; - } - - cell->siCb.siCtx.i = RGSCH_CALC_SF_DIFF(crntTimInfo, - cell->siCb.siCtx.timeToTx); - } - - - /*Get the number of rb required */ - /*rgSCHCmnClcRbAllocForFxdTb(cell, msgLen, cellDl->ccchCqi, &rb);*/ - if(cellDl->bitsPerRb==0) - { - while ((rgTbSzTbl[0][0][rb]) < (U32) (msgLen*8)) - { - rb++; - } - rb = rb+1; - } - else - { - rb = RGSCH_CEIL((msgLen*8), cellDl->bitsPerRb); - } - /* DwPTS Scheduling Changes Start */ -#ifdef LTE_TDD - if (sf->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); - - /* Calculate the less RE's because of DwPTS */ - lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]); - - /* Increase number of RBs in Spl SF to compensate for lost REs */ - rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); - } -#endif - /* DwPTS Scheduling Changes End */ - /*ccpu00115595- end*/ - /* Additional check to see if required RBs - * exceeds the available */ - if (rb > sf->bw - sf->bwAssigned) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHDlSiSched(): " - "BW allocation failed CRNTI:%d",RGSCH_SI_RNTI); - RETVOID; - } - - /* Update the subframe Allocated BW field */ - sf->bwAssigned = sf->bwAssigned + rb; - - /*Fill the parameters in allocInfo */ - allocInfo->bcchAlloc.rnti = RGSCH_SI_RNTI; - allocInfo->bcchAlloc.dlSf = sf; - allocInfo->bcchAlloc.rbsReq = rb; - /*ccpu00116710- MCS is not getting assigned */ - allocInfo->bcchAlloc.tbInfo[0].imcs = mcs; - - /* ccpu00117510 - ADD - Assignment of nPrb and other information */ - allocInfo->bcchAlloc.nPrb = nPrb; - allocInfo->bcchAlloc.tbInfo[0].bytesReq = msgLen; - allocInfo->bcchAlloc.tbInfo[0].noLyr = 1; - RETVOID; -} -#endif /*RGR_SI_SCH*/ - - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT -/** - * @brief This function Updates the DL CQI for the UE. - * - * @details - * - * Function: rgSCHCmnUeDlPwrCtColltCqiRept - * Purpose: Manages PUSH N CQI reporting - * Step 1: Store the CQI in collation array - * Step 2: Increament the tracking count - * Step 3: Check is it time to to send the report - * Step 4: if yes, Send StaInd to RRM - * Step 4.1: Fill StaInd for sending collated N CQI rpeorts - * Step 4.2: Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM - * Step 4.2.1: If sending was not sucessful, return RFAILED - * Step 4.2.2: If sending was sucessful, return ROK - * Step 5: If no, return - * Invoked by: rgSCHCmnDlCqiInd - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeCqiRept *ueCqiRpt - * @return Void - * - **/ -#ifdef ANSI -PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeCqiRept *ueCqiRpt -) -#else -PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept(cell, ue, ueCqiRpt) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeCqiRept *ueCqiRpt; -#endif -{ - U8 *cqiCount = NULLP; - S16 retVal; - RgrStaIndInfo *staInfo = NULLP; - - TRC2(rgSCHCmnUeDlPwrCtColltCqiRept) - - /* Step 1: Store the CQI in collation array */ - /* Step 2: Increament the tracking count */ - cqiCount = &(ue->schCqiInfo.cqiCount); - ue->schCqiInfo.cqiRept[(*cqiCount)++] = - *ueCqiRpt; - - - /* Step 3: Check is it time to to send the report */ - if(RG_SCH_CQIR_IS_TIMTOSEND_CQIREPT(ue)) - { - /* Step 4: if yes, Send StaInd to RRM */ - retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo, - sizeof(RgrStaIndInfo)); - if (retVal != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not " - "allocate memory for sending StaInd CRNTI:%d",ue->ueId); - RETVALUE(retVal); - } - - /* Step 4.1: Fill StaInd for sending collated N CQI rpeorts */ -#ifdef CA_DBG - { - extern U32 gCqiReptToAppCount; - gCqiReptToAppCount++; - - } - -#endif - retVal = rgSCHUtlFillSndStaInd(cell, ue, staInfo, - ue->cqiReptCfgInfo.numColltdCqiRept); - RETVALUE(retVal); - - } - - RETVALUE(ROK); -} /* End of rgSCHCmnUeDlPwrCtColltCqiRept */ - -#endif /* End of RGR_CQI_REPT */ - -/** - * @brief This function checks for the retransmisson - * for a DTX scenario. - * @details - * - * Function: - * Purpose: - * Invoked by: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnChkRetxAllowDtx -( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -RgSchDlHqProcCb *proc, -Bool *reTxAllwd -) -#else -PUBLIC Void rgSCHCmnChkRetxAllowDtx(cell, ueCb, proc, reTxAllwd) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -RgSchDlHqProcCb *proc; -Bool *reTxAllwd; -#endif -{ - TRC3(rgSCHCmnChkRetxAllowDtx) - - - *reTxAllwd = TRUE; - /* Fix */ - if ((proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX)) - { - *reTxAllwd = FALSE; - } - - RETVOID; -} - -/** - * @brief API for calculating the SI Set Id - * - * @details - * - * Function: rgSCHCmnGetSiSetId - * - * This API is used for calculating the SI Set Id, as shown below - * - * siSetId = 0 siSetId = 1 - * |******************|******************|----------------> - * (0,0) (8,0) (16,0) (SFN, SF) - * - * - * @param[in] U16 sfn - * @param[in] U8 sf - * @return U16 siSetId - **/ -#ifdef ANSI -PUBLIC U16 rgSCHCmnGetSiSetId -( -U16 sfn, -U8 sf, -U16 minPeriodicity -) -#else -PUBLIC U16 rgSCHCmnGetSiSetId(sfn, sf, minPeriodicity) -U16 sfn; -U8 sf -U16 minPeriodicity; -#endif -{ - /* 80 is the minimum SI periodicity in sf. Also - * all other SI periodicities are multiples of 80 */ - RETVALUE (((sfn * RGSCH_NUM_SUB_FRAMES_5G) + sf) / (minPeriodicity * 10)); -} -#ifdef LTE_TDD -/** - * @brief API for calculating the DwPts Rb, Itbs and tbSz - * - * @details - * - * Function: rgSCHCmnCalcDwPtsTbSz - * - * @param[in] RgSchCellCb *cell - * @param[in] U32 bo - * @param[in/out] U8 *rb - * @param[in/out] U8 *iTbs - * @param[in] U8 lyr - * @param[in] U8 cfi - * @return U32 tbSz - **/ -#ifdef ANSI -PRIVATE U32 rgSCHCmnCalcDwPtsTbSz -( -RgSchCellCb *cell, -U32 bo, -U8 *rb, -U8 *iTbs, -U8 lyr, -U8 cfi -) -#else -PRIVATE U32 rgSCHCmnCalcDwPtsTbSz(cell, bo, rb, iTbs, lyr, cfi) -RgSchCellCb *cell; -U32 bo; -U8 *rb; -U8 *iTbs; -U8 lyr; -U8 cfi; -#endif -{ - U32 tbSz; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U32 numRE = *rb * cellDl->noResPerRb[cfi]; - U32 numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]); - - TRC2(rgSCHCmnCalcDwPtsTbSz); - - /* DwPts Rb cannot exceed the cell Bw */ - numDwPtsRb = RGSCH_MIN(numDwPtsRb, cellDl->maxDlBwPerUe); - - /* Adjust the iTbs for optimum usage of the DwPts region. - * Using the same iTbs adjustment will not work for all - * special subframe configurations and iTbs levels. Hence use the - * static iTbs Delta table for adjusting the iTbs */ - RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs); - - if (bo) - { - while(rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1] < bo*8 && - numDwPtsRb < cellDl->maxDlBwPerUe) - { - (numDwPtsRb)++; - } - - tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1]; - } - else - { - tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1]; - } - *rb = numDwPtsRb; - - RETVALUE(tbSz/8); -} - -/** - * @brief API for calculating the DwPts Rb, Itbs and tbSz - * - * @details - * - * Function: rgSCHCmnCalcDwPtsTbSz2Cw - * - * @param[in] RgSchCellCb *cell - * @param[in] U32 bo - * @param[in/out] U8 *rb - * @param[in] U8 maxRb - * @param[in/out] U8 *iTbs1 - * @param[in/out] U8 *iTbs2 - * @param[in] U8 lyr1 - * @param[in] U8 lyr2 - * @return[in/out] U32 *tb1Sz - * @return[in/out] U32 *tb2Sz - * @param[in] U8 cfi - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw -( -RgSchCellCb *cell, -U32 bo, -U8 *rb, -U8 maxRb, -U8 *iTbs1, -U8 *iTbs2, -U8 lyr1, -U8 lyr2, -U32 *tb1Sz, -U32 *tb2Sz, -U8 cfi -) -#else -PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw(cell, bo, rb, maxRb, iTbs1, iTbs2, - lyr1, lyr2, tb1Sz, tb2Sz, cfi) -RgSchCellCb *cell; -U32 bo; -U8 *rb; -U8 maxRb; -U8 *iTbs1; -U8 *iTbs2; -U8 lyr1; -U8 lyr2; -U32 *tb1Sz; -U32 *tb2Sz; -U8 cfi; -#endif -{ - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - U32 numRE = *rb * cellDl->noResPerRb[cfi]; - U32 numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]); - - TRC2(rgSCHCmnCalcDwPtsTbSz2Cw); - - /* DwPts Rb cannot exceed the cell Bw */ - numDwPtsRb = RGSCH_MIN(numDwPtsRb, maxRb); - - /* Adjust the iTbs for optimum usage of the DwPts region. - * Using the same iTbs adjustment will not work for all - * special subframe configurations and iTbs levels. Hence use the - * static iTbs Delta table for adjusting the iTbs */ - RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs1); - RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs2); - - while((rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1] + - rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1])< bo*8 && - numDwPtsRb < maxRb) - { - (numDwPtsRb)++; - } - - *tb1Sz = rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8; - *tb2Sz = rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8; - - *rb = numDwPtsRb; - - RETVOID; -} - -#endif - -/** - * @brief Updates the GBR LCGs when datInd is received from MAC - * - * @details - * - * Function: rgSCHCmnUpdUeDataIndLcg(cell, ue, datInd) - * Purpose: This function updates the GBR LCGs - * when datInd is received from MAC. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgInfUeDatInd *datInd - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHCmnUpdUeDataIndLcg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgInfUeDatInd *datInd -) -#else -PUBLIC Void rgSCHCmnUpdUeDataIndLcg(cell, ue, datInd) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgInfUeDatInd *datInd; -#endif -{ - U32 idx = 0; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - - TRC2(rgSCHCmnUpdUeDataIndLcg); - - for (idx = 0; (idx < RGINF_MAX_LCG_PER_UE - 1); idx++) - { - if (datInd->lcgInfo[idx].bytesRcvd != 0) - { - U8 lcgId = datInd->lcgInfo[idx].lcgId; - U32 bytesRcvd = datInd->lcgInfo[idx].bytesRcvd; - - if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) - { - RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); - if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) - { - if(bytesRcvd > cmnLcg->effGbr) - { - bytesRcvd -= cmnLcg->effGbr; - cmnLcg->effDeltaMbr = (cmnLcg->effDeltaMbr > bytesRcvd) ? \ - (cmnLcg->effDeltaMbr - bytesRcvd) : (0); - cmnLcg->effGbr = 0; - } - else - { - cmnLcg->effGbr -= bytesRcvd; - } - /* To keep BS updated with the amount of data received for the GBR */ - cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \ - (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0); - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr+cmnLcg->effDeltaMbr); - } - else if(lcgId != 0) - { - ue->ul.effAmbr = (ue->ul.effAmbr > datInd->lcgInfo[idx].bytesRcvd) ? \ - (ue->ul.effAmbr - datInd->lcgInfo[idx].bytesRcvd) : (0); - cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \ - (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0); - cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); - ue->ul.nonGbrLcgBs = (ue->ul.nonGbrLcgBs > datInd->lcgInfo[idx].bytesRcvd) ? \ - (ue->ul.nonGbrLcgBs - datInd->lcgInfo[idx].bytesRcvd) : (0); - } - ue->ul.nonLcg0Bs = (ue->ul.nonLcg0Bs > datInd->lcgInfo[idx].bytesRcvd) ? \ - (ue->ul.nonLcg0Bs - datInd->lcgInfo[idx].bytesRcvd) : (0); - } - } - else - { - break; - } - } -#ifdef EMTC_ENABLE - if(TRUE == ue->isEmtcUe) - { - if (cellSch->apisEmtcUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "\n rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure")); - } - - } - else -#endif - { - if (cellSch->apisUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "\n rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure")); - } - } -} - - -/** @brief This function initializes DL allocation lists and prepares - * for scheduling - * - * @details - * - * Function: rgSCHCmnInitRbAlloc - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSCHCmnInitRbAlloc -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHCmnInitRbAlloc (cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - CmLteTimingInfo frm; - RgSchDlSf *dlSf; - U8 idx; - - TRC2(rgSCHCmnInitRbAlloc); - -/* Initializing RgSchCmnUlRbAllocInfo structure.*/ - rgSCHCmnInitDlRbAllocInfo(&cellSch->allocInfo); - - frm = cellSch->dl.time; - - dlSf = rgSCHUtlSubFrmGet(cell, frm); -#ifdef RG_5GTF - dlSf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; - dlSf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; - for(idx = 0; idx < MAX_5GTF_BEAMS; idx++) - { - dlSf->sfBeamInfo[idx].totVrbgAllocated = 0; - dlSf->sfBeamInfo[idx].totVrbgRequired = 0; - dlSf->sfBeamInfo[idx].vrbgStart = 0; - } -#endif - dlSf->remUeCnt = cellSch->dl.maxUePerDlSf; - /* Updating the Subframe information in RBAllocInfo */ - cellSch->allocInfo.dedAlloc.dedDlSf = dlSf; - cellSch->allocInfo.msg4Alloc.msg4DlSf = dlSf; - - /* LTE_ADV_FLAG_REMOVED_START */ - /* Determine next scheduling subframe is ABS or not */ - if(RGR_ENABLE == cell->lteAdvCb.absCfg.status) - { - cell->lteAdvCb.absPatternDlIdx = - ((frm.sfn*RGSCH_NUM_SUB_FRAMES_5G) + frm.subframe) % RGR_ABS_PATTERN_LEN; - cell->lteAdvCb.absDlSfInfo = (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern[ - cell->lteAdvCb.absPatternDlIdx]); - - } - else - { - cell->lteAdvCb.absDlSfInfo = RG_SCH_ABS_DISABLED; - } - /* LTE_ADV_FLAG_REMOVED_END */ - -#ifdef RGR_V1 - cellSch->allocInfo.ccchSduAlloc.ccchSduDlSf = dlSf; -#endif -#ifdef LTEMAC_SPS - /* Update subframe-wide allocation information with SPS allocation */ - rgSCHCmnSpsDlUpdDlSfAllocWithSps(cell, frm, dlSf); -#endif - RETVOID; -} - - - -#ifdef DL_LA -/** - * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and - * actual iTbs - * - * @details - * - * Function: rgSCHCmnSendTxModeInd(cell, ueUl, newTxMode) - * Purpose: This function sends the TX mode Change - * indication to RRM - * change - * - * Invoked by: CMN - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 newTxMode - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHCmnSendTxModeInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 newTxMode -) -#else -PRIVATE Void rgSCHCmnSendTxModeInd(cell, ue, newTxMode) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 newTxMode; -#endif -{ - RgmTransModeInd *txModeChgInd; - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - - TRC2(rgSCHCmnSendTxModeInd); - - if(!(ueDl->mimoInfo.forceTD & RG_SCH_CMN_TD_TXMODE_RECFG)) - { - /* Mem Alloc */ - if(SGetSBuf(cell->rgmSap->sapCfg.sapPst.region, - cell->rgmSap->sapCfg.sapPst.pool, (Data**)&txModeChgInd, - sizeof(RgmTransModeInd)) != ROK) - { - RETVOID; - } - RG_SCH_FILL_RGM_TRANSMODE_IND(ue->ueId, cell->cellId, newTxMode, txModeChgInd); - RgUiRgmChangeTransModeInd(&(cell->rgmSap->sapCfg.sapPst), - cell->rgmSap->sapCfg.suId, txModeChgInd); - } - - ue->mimoInfo.txModUpChgFactor = 0; - ue->mimoInfo.txModDownChgFactor = 0; - ueDl->laCb[0].deltaiTbs = 0; - - RETVOID; -} - -/** - * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and - * actual iTbs - * - * @details - * - * Function: rgSchCheckAndTriggerModeChange(cell, ueUl, iTbsNew) - * Purpose: This function update and check for threashold for TM mode - * change - * - * Invoked by: CMN - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 iTbs - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSchCheckAndTriggerModeChange -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 reportediTbs, -U8 previTbs, -U8 maxiTbs -) -#else -PUBLIC Void rgSchCheckAndTriggerModeChange(cell, ue, reportediTbs, previTbs, maxiTbs) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 reportediTbs; -U8 previTbs; -U8 maxiTbs; -#endif -{ - RgrTxMode txMode; /*!< UE's Transmission Mode */ - RgrTxMode modTxMode; /*!< UE's Transmission Mode */ - - TRC2(rgSchCheckAndTriggerModeChange); - - txMode = ue->mimoInfo.txMode; - - /* Check for Step down */ - /* Step down only when TM4 is configured. */ - if(RGR_UE_TM_4 == txMode) - { - if((previTbs <= reportediTbs) && ((reportediTbs - previTbs) >= RG_SCH_MODE_CHNG_STEPDOWN_CHECK_FACTOR)) - { - ue->mimoInfo.txModDownChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR; - } - else - { - ue->mimoInfo.txModDownChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR; - } - - ue->mimoInfo.txModDownChgFactor = - RGSCH_MAX(ue->mimoInfo.txModDownChgFactor, -(RG_SCH_MODE_CHNG_STEPDOWN_THRSHD)); - - if(ue->mimoInfo.txModDownChgFactor >= RG_SCH_MODE_CHNG_STEPDOWN_THRSHD) - { - /* Trigger Mode step down */ - modTxMode = RGR_UE_TM_3; - rgSCHCmnSendTxModeInd(cell, ue, modTxMode); - } - } - - /* Check for Setup up */ - /* Step Up only when TM3 is configured, Max possible Mode is TM4*/ - if(RGR_UE_TM_3 == txMode) - { - if((previTbs > reportediTbs) || (maxiTbs == previTbs)) - { - ue->mimoInfo.txModUpChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR; - } - else - { - ue->mimoInfo.txModUpChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR; - } - - ue->mimoInfo.txModUpChgFactor = - RGSCH_MAX(ue->mimoInfo.txModUpChgFactor, -(RG_SCH_MODE_CHNG_STEPUP_THRSHD)); - - /* Check if TM step up need to be triggered */ - if(ue->mimoInfo.txModUpChgFactor >= RG_SCH_MODE_CHNG_STEPUP_THRSHD) - { - /* Trigger mode chnage */ - modTxMode = RGR_UE_TM_4; - rgSCHCmnSendTxModeInd(cell, ue, modTxMode); - } - } - - RETVOID; -} -#endif - -/** -* @brief Updates the GBR LCGs when datInd is received from MAC - * - * @details - * - * Function: rgSCHCmnIsDlCsgPrio (cell) - * Purpose: This function returns if csg UEs are - * having priority at current time - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgInfUeDatInd *datInd - * @return Void - **/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnIsDlCsgPrio -( -RgSchCellCb *cell -) -#else -PUBLIC Bool rgSCHCmnIsDlCsgPrio(cell) -RgSchCellCb *cell; -#endif -{ - - RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell); - - TRC2(rgSCHCmnIsDlCsgPrio) - /* Calculating the percentage resource allocated */ - if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode) - { - RETVALUE(FALSE); - } - else - { - if(((cmnDlCell->ncsgPrbCnt * 100) / cmnDlCell->totPrbCnt) < cell->minDlResNonCsg) - { - RETVALUE(FALSE); - } - else - { - RETVALUE(TRUE); - } - } -} - -/** -* @brief Updates the GBR LCGs when datInd is received from MAC - * - * @details - * - * Function: rgSCHCmnIsUlCsgPrio (cell) - * Purpose: This function returns if csg UEs are - * having priority at current time - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgInfUeDatInd *datInd - * @return Void - **/ -#ifdef ANSI -PUBLIC Bool rgSCHCmnIsUlCsgPrio -( -RgSchCellCb *cell -) -#else -PUBLIC Bool rgSCHCmnIsUlCsgPrio(cell) -RgSchCellCb *cell; -#endif -{ - RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); - - TRC2(rgSCHCmnIsUlCsgPrio) - - /* Calculating the percentage resource allocated */ - if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode) - { - RETVALUE(FALSE); - } - else - { - if (((cmnUlCell->ncsgPrbCnt * 100) /cmnUlCell->totPrbCnt) < cell->minUlResNonCsg) - { - RETVALUE(FALSE); - } - else - { - RETVALUE(TRUE); - } - } -} -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_ex_ms.c b/src/5gnrmac/rg_sch_ex_ms.c deleted file mode 100755 index b75e33960..000000000 --- a/src/5gnrmac/rg_sch_ex_ms.c +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code SSI Interface Implementation - - File: rg_sch_ex_ms.c - -**********************************************************************/ - -/** @file rg_ex_ms.c -@brief This file contains the implementation of callback functions -registered with SSI during the LTE MAC Task initialization. -*/ -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system services */ -#include "cm5.h" /* common timers defines */ -#include "cm_hash.h" /* common hash list defines */ -#include "cm_llist.h" /* common linked list defines */ -#include "cm_mblk.h" /* memory management */ -#include "cm_tkns.h" /* common tokens */ -#include "cm_lte.h" /* common tokens */ -#include "tfu.h" /* RGU defines */ -#include "lrg.h" /* layer management defines for LTE-MAC */ -#include "rgr.h" /* layer management defines for LTE-MAC */ -#include "rgm.h" /* layer management defines for LTE-MAC */ -#include "rg_env.h" /* customisable defines and macros for LTE-MAC */ -#include "rg_sch_err.h" /* defines and macros for Scheduler */ -#include "rg_sch_inf.h" /* defines and macros for Scheduler */ -#include "rg_sch.h" /* defines and macros for Scheduler */ - - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* RGU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for Scheduler */ - - - - -/** - * @brief Task Activation callback function. - * - * @details - * - * Function : schActvTsk - * - * Primitives invoked by MAC's users/providers through - * a loosely coupled interface arrive here by means of - * SSI's message handling. This API is registered with - * SSI during the Task Registration of MAC. - * - * @param[in] Pst *pst, post structure of the Primitive. - * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer. - * @param[in] Reason reason. - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 schActvTsk -( -Pst *pst, /* post structure */ -Buffer *mBuf /* message buffer */ -) -#else -PUBLIC S16 schActvTsk(pst, mBuf) -Pst *pst; /* post structure */ -Buffer *mBuf; /* message buffer */ -#endif -{ - TRC2(schActvTsk) - - switch(pst->srcEnt) - { - /* The originator of this message is the stack manager, - * unpack and go to the respective primitive processing function */ - case ENTSM: - switch(pst->event) - { -#ifdef LCRGMILRG - case EVTLRGSCHCFGREQ: - /* Process a config. request */ - cmUnpkLrgSchCfgReq(RgMiLrgSchCfgReq, pst, mBuf); - break; - case EVTLRGSCHCNTRLREQ: - /* Process a control request */ - cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf); - break; - case EVTLRGSCHSTAIND: - /* Process a control request */ - cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf); - break; -#ifdef LTE_L2_MEAS - case EVTLRGSCHL2MEASREQ: - /* Process L2 Measurement request */ - cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf); - break; - case EVTLRGSCHL2MEASSTOPREQ: - /* Process L2 Measurement Stop request */ - cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf); - break; - case EVTLRGSCHL2MEASSENDREQ: - /* Process L2 Measurement Send request */ - cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf); - break; -#endif -#endif /* LCRGMILRG */ - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - case ENTNX: - switch(pst->event) - { -#ifdef LCRGUIRGR - case EVTRGRBNDREQ: - cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf); - break; - case EVTRGRUBNDREQ: - cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf); - break; - case EVTRGRCFGREQ: - cmUnpkRgrCfgReq(RgUiRgrCfgReq, pst, mBuf); - break; -#ifdef RGR_SI_SCH - case EVTRGRSICFGREQ: - cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf); - break; - case EVTRGRWARNINGSICFGREQ: - cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf); - break; - - case EVTRGRWARNINGSISTOPREQ: - cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf); - break; -#endif/*RGR_SI_SCH */ - /* LTE_ADV_FLAG_REMOVED_START */ - case EVTRGRLOADINFREQ: - cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf); - break; - /* LTE_ADV_FLAG_REMOVED_END */ -#endif - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - case ENTTF: - switch(pst->event) - { -/*#ifdef LCRGLITFU L2Split */ -#if (defined(LCRGLITFU) || defined(LWLCRGLITFU)) - case EVTTFUSCHBNDCFM: - cmUnpkTfuBndCfm(RgLiTfuSchBndCfm, pst, mBuf); - break; - case EVTTFURAREQIND: - cmUnpkTfuRaReqInd(RgLiTfuRaReqInd, pst, mBuf); - break; - case EVTTFUULCQIIND: - cmUnpkTfuUlCqiInd(RgLiTfuUlCqiInd, pst, mBuf); - break; - case EVTTFUHQIND: - cmUnpkTfuHqInd(RgLiTfuHqInd, pst, mBuf); - break; - case EVTTFUSRIND: - cmUnpkTfuSrInd(RgLiTfuSrInd, pst, mBuf); - break; - case EVTTFUDLCQIIND: - cmUnpkTfuDlCqiInd(RgLiTfuDlCqiInd, pst, mBuf); - break; - case EVTTFUCRCIND: - /*cmUnpkTfuCrcIndInfo(RgLiTfuCrcInd, pst, mBuf); */ - cmUnpkTfuCrcInd(RgLiTfuCrcInd, pst, mBuf); - break; - case EVTTFUTIMINGADVIND: - cmUnpkTfuTimingAdvInd(RgLiTfuTimingAdvInd, pst, mBuf); - break; - case EVTTFUSCHTTIIND: - cmUnpkTfuSchTtiInd(RgLiTfuSchTtiInd, pst, mBuf); - break; - case EVTTFUPUCCHDELPWR: - cmUnpkTfuPucchDeltaPwr(RgLiTfuPucchDeltaPwrInd, pst, mBuf); - break; - case EVTTFUDOAIND: - cmUnpkTfuDoaInd(RgLiTfuDoaInd, pst, mBuf); - break; -#ifdef TFU_UPGRADE - case EVTTFURAWCQIIND: - cmUnpkTfuRawCqiInd(RgLiTfuRawCqiInd, pst, mBuf); - break; - case EVTTFUSRSIND: - cmUnpkTfuSrsInd(RgLiTfuSrsInd, pst, mBuf); - break; -#endif - /*LAA: Error Indication on SCell*/ - case EVTTFUERRIND: - cmUnpkTfuErrInd(RgLiTfuErrInd, pst, mBuf); - break; -#endif - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - case ENTRG: /* When MAC sends a msg to Scheduler instance */ - switch(pst->event) - { -#ifdef LCSCH - case EVTINFDEDBOUPDTREQ: - cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf); - break; - case EVTINFCMNBOUPDTREQ: - cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf); - break; - case EVTINFSFRECPIND: - cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf); - break; - /*Fix: start: Inform UE delete to scheduler*/ - case EVTINFUEDELIND: - cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf); - break; - /*Fix: end: Inform UE delete to scheduler*/ -#ifdef LTE_L2_MEAS - case EVTINFL2MEASCFM: - cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf); - break; - case EVTINFL2MEASSTOPCFM: - cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf); - break; -#endif -#endif - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - case ENTRM: /* When RRM sends msg to scheduler */ - switch(pst->event) - { - case EVTRGMBNDREQ: - cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf); - break; - case EVTRGMUBNDREQ: - cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf); - break; - case EVTRGMCFGPRBRPRT: - cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf); - break; - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - default: - RGSCH_FREE_MSG(mBuf); - break; - } - SExitTsk(); - RETVALUE(ROK); -}/* end of schActvTsk */ - - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_gom.c b/src/5gnrmac/rg_sch_gom.c deleted file mode 100755 index d754c50d9..000000000 --- a/src/5gnrmac/rg_sch_gom.c +++ /dev/null @@ -1,1871 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch_gom.c - -**********************************************************************/ - -/** @file rg_sch_gom.c -@brief This module does processing related to handling of upper interface APIs -invoked by RRM towards MAC. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_MODULE_ID=4096; -static int RLOG_FILE_ID=164; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system service interface */ -#include "cm_hash.h" /* common hash list */ -#include "cm_mblk.h" /* common memory link list library */ -#include "cm_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ -#include "lrg.h" -#include "rgr.h" -#include "tfu.h" -#include "rg_env.h" -#include "rg_sch_inf.h" -#include "rg_sch.h" -#include "rg_sch_err.h" -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer */ -#include "ssi.x" /* system service interface */ -#include "cm5.x" /* common timers */ -#include "cm_lib.x" /* common library */ -#include "cm_hash.x" /* common hash list */ -#include "cm_llist.x" /* common linked list library */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common LTE */ -#include "lrg.x" -#include "rgr.x" -#include "tfu.x" -#include "rg_sch_inf.x" -#include "rg_sch.x" - -/* local defines */ -PRIVATE S16 rgSCHGomHndlCfgReq ARGS((RgSchCb *instCb, SpId spId, - RgrCfg *cfg, RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHGomHndlRecfgReq ARGS((RgSchCb *instCb, SpId spId, - RgrRecfg *recfg, RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHGomHndlResetReq ARGS((RgSchCb *instCb,SpId spId,RgrRst *reset, - RgSchErrInfo *errInfo)); -PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq ARGS((RgrCfgReqInfo *rgrCfgReq, - CmLteCellId *cellId)); -PRIVATE S16 rgSCHGomCfgReq ARGS((Region reg, Pool pool, RgSchCb *instCb, - SpId spId, RgrCfgTransId transId, RgrCfgReqInfo *cfgReqInfo)); -PRIVATE S16 rgSCHGomEnqCfgReq ARGS((Region reg, Pool pool, RgSchCellCb *cell, - RgrCfgTransId transId, RgrCfgReqInfo *rgrCfgReq)); -PRIVATE S16 rgSCHGomHndlDelReq ARGS((RgSchCb *instCb,SpId spId, - RgrDel *del,RgSchErrInfo *errInfo)); -#ifdef LTE_ADV -PRIVATE S16 rgSCHGomHndlSCellActDeactReq ARGS((RgSchCb *instCb, SpId spId, - RgrSCellActDeactEvnt *sCellActDeactEvnt, RgSchErrInfo *errInfo, U8 action)); -#endif /* LTE_ADV */ -#ifdef EMTC_ENABLE -EXTERN S16 rgSchEmtcGetSiWinPerd ARGS(( -RgSchCellCb *cell, -U16 *siWinSize, -U16 *minPeriod -)); -extern S16 rgSCHEmtcUtlCalMcsAndNPrb -( - RgSchCellCb *cell, - U8 cfgType, - MsgLen msgLen, - U8 siId - ); - -EXTERN S32 rgSCHEmtcUtlGetAllwdCchTbSzForSI ARGS( -( -U32 bo -)); - -EXTERN Void rgSCHEmtcWarningSiCfg ARGS( -( -RgSchCellCb *cell, -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo, -U16 idx -)); -#endif - - -/* local typedefs */ - -/* local externs */ - -/* forward references */ - - - -/** - * @brief Handler for config request from RRM to Schedular. - * - * @details - * - * Function: rgSCHGomHndlCfg - * - * This API is called from schedulers UIM and it handles config request - * from RRM to Scheduler. - * - * Processing Steps: - * - If the request is for the inactive cell, - * - Handle request.Call rgSCHGomCfgReq. - * - Else, - * - Enqueue the request. Call rgSCHGomEnqCfgReq. - * - * @param[in] Region reg - * @param[in] Poll pool - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrCfgReqInfo *cfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGomHndlCfg -( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrCfgReqInfo *cfgReqInfo -) -#else -PUBLIC S16 rgSCHGomHndlCfg(reg, pool, instCb, spId, transId, cfgReqInfo) -Region reg; -Pool pool; -RgSchCb *instCb; -SpId spId; -RgrCfgTransId transId; -RgrCfgReqInfo *cfgReqInfo; -#endif -{ - S16 ret; - CmLteCellId cellId; - RgSchCellCb *cell = NULLP; - U8 cfmStatus = RGR_CFG_CFM_NOK; -#ifdef DEBUGP - Inst inst = (instCb->rgSchInit.inst ); -#endif - - TRC2(rgSCHGomHndlCfg); - /* Apply the configuration for Cell Configuration or Delete */ - if (cfgReqInfo->action != RGR_RECONFIG) - { - ret = rgSCHGomCfgReq (reg, pool, instCb, spId, transId, cfgReqInfo); - RETVALUE(ret); - } - - /* Fetch the cell Id for the recieved request */ - if((rgSCHGomGetCellIdFrmCfgReq(cfgReqInfo, &cellId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Action.Config Type Error"); - - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - /* Extract the cell and Enquee Config Request */ - if(NULLP != instCb->rgrSap[spId].cell) - { - if(cellId != instCb->rgrSap[spId].cell->cellId) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellId, "Cell with Id %d already exists " - "on sap %d", instCb->rgrSap[spId].cell->cellId, spId); - - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - cell = instCb->rgrSap[spId].cell; - - /* Enqueue the configuration */ - ret = rgSCHGomEnqCfgReq(reg, pool, cell, transId, cfgReqInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "rgSCHGomHndlCfg: Enqueuing CfgReq " - "Failed "); - - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); - } - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - -}/* rgSCHGomHndlCfg */ - - -/** - * @brief Handler to handle config request from RRM to Scheduler. - * - * @details - * - * Function: rgSCHGomCfgReq - * - * This API handles processing for config request from RRM to Scheduler. - * - * Processing Steps: - * - If Configuration request, call rgSCHGomHndlCfgReq. - * - Else if Reconfiguration request, call rgSCHGomHndlRecfgReq. - * - If successful, send configuration confirm to RRM. - * Call rgSCHUtlRgrCfgCfm else FAIL. - * - * @param[in] Region reg - * @param[in] Poll pool - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrCfgReqInfo *cfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomCfgReq -( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrCfgReqInfo *cfgReqInfo -) -#else -PRIVATE S16 rgSCHGomCfgReq(reg, pool, instCb, spId, transId, cfgReqInfo) -Region reg; -Pool pool; -RgSchCb *instCb; -SpId spId; -RgrCfgTransId transId; -RgrCfgReqInfo *cfgReqInfo; -#endif -{ - U8 cfmStatus = RGR_CFG_CFM_OK; - S16 ret; - RgSchErrInfo errInfo; -#ifdef DEBUGP - Inst inst = (instCb->rgSchInit.inst ); -#endif - TRC2(rgSCHGomCfgReq); -#ifdef EMTC_ENABLE -printf("\n AT MAC rgSCHGomCfgReq \n"); -#endif - - /* Process Config/Reconfig/Delete request from RRM */ - switch (cfgReqInfo->action) - { - case RGR_CONFIG: - { - ret = rgSCHGomHndlCfgReq(instCb, spId, - &cfgReqInfo->u.cfgInfo, &errInfo); - break; - } - case RGR_RECONFIG: - { - ret = rgSCHGomHndlRecfgReq(instCb, spId, - &cfgReqInfo->u.recfgInfo, &errInfo); - break; - } - case RGR_RESET: - { - ret = rgSCHGomHndlResetReq(instCb, spId, - &cfgReqInfo->u.rstInfo, &errInfo); - break; - } - case RGR_DELETE: - { - ret = rgSCHGomHndlDelReq(instCb, spId, - &cfgReqInfo->u.delInfo, &errInfo); - break; - } -#ifdef LTE_ADV - case RGR_SCELL_ACT: - case RGR_SCELL_DEACT: - case RGR_SCELL_READY: - { - ret = rgSCHGomHndlSCellActDeactReq(instCb, spId, - &cfgReqInfo->u.sCellActDeactEvnt, &errInfo, cfgReqInfo->action); - break; - } -#endif /* LTE_ADV */ - default: - { - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid configuration " - "action %d", cfgReqInfo->action); - ret = RFAILED; - } - } /* End of switch */ - - if (ret != ROK) - { - cfmStatus = RGR_CFG_CFM_NOK; - } - - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; -#ifdef EMTC_ENABLE -printf("\n AT MAC sending RGR cfg cfm \n"); -#endif - - /* Send back confirmation status to RRM */ - rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); -#ifdef EMTC_ENABLE -printf("\n AT MAC RGR cfg cfm sent\n"); -#endif - - RETVALUE(ret); -} /* rgSCHGomCfgReq */ - - -/** - * @brief Handler to enqueuing config request from RRM to Scheduler. - * - * @details - * - * Function: rgSCHGomEnqCfgReq - * - * This API enqueues config request from RRM to MAC. - * - * Processing Steps: - * - Allocate the configuration request element. - * - Copy the contents of the recieved configuration to config request - * element and free the recieved configuration pointer. - * - If the configuration is without activation time, - * - Enqueue the request in crntRgrCfgLst of the cell at the end of - * the list. - * - Else - * - Enqueue the request in pndngRgrCfgLst of the cell. - * - * @param[in] Region reg, - * @param[in] Pool pool - * @param[in] RgSchCellCb *cell - * @param[in] RgrCfgTransId transId - * @param[in] RgrCfgReqInfo *rgrCfgReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomEnqCfgReq -( -Region reg, -Pool pool, -RgSchCellCb *cell, -RgrCfgTransId transId, -RgrCfgReqInfo *rgrCfgReq -) -#else -PRIVATE S16 rgSCHGomEnqCfgReq(reg, pool, cell, transId, rgrCfgReq) -Region reg; -Pool pool; -RgSchCellCb *cell; -RgrCfgTransId transId; -RgrCfgReqInfo *rgrCfgReq; -#endif -{ - S16 ret; - U32 sfDiff; - RgSchCfgElem *rgrCfgElem = NULLP; - CmLteTimingInfo actvTime; - Inst inst = cell->instIdx; - - TRC2(rgSCHGomEnqCfgReq); - - /* Allocate memory for config Element */ - ret = rgSCHUtlAllocSBuf(inst, (Data **)&rgrCfgElem, sizeof(RgSchCfgElem)); - if ((ret != ROK) || ((U8 *)rgrCfgElem == NULLP)) - { - RETVALUE(RFAILED); - } - - /* Initialize the configuration element */ - cmMemcpy((U8*)rgrCfgElem->rgrCfg.transId.trans,(U8*)transId.trans, - sizeof(transId.trans)); - rgrCfgElem->rgrCfg.reg = reg; - rgrCfgElem->rgrCfg.pool = pool; - rgrCfgElem->rgrCfg.rgrCfgReq = rgrCfgReq; - rgrCfgElem->cfgReqLstEnt.prev = NULLP; - rgrCfgElem->cfgReqLstEnt.next = NULLP; - rgrCfgElem->cfgReqLstEnt.node = (PTR )rgrCfgElem; - - /* Add configuration element to current/pending cfgLst */ - if (((rgrCfgReq->action == RGR_RECONFIG) && - (rgrCfgReq->u.recfgInfo.recfgType == RGR_CELL_CFG) && - (rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.pres == TRUE))) - - { - actvTime = - rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.actvTime; - - /* Check if the activation time is valid */ - if (actvTime.sfn >= RGSCH_MAX_SFN - || actvTime.subframe >= RGSCH_NUM_SUB_FRAMES_5G) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId, "Invalid activation time for RGR " - "config request: activation sfn %d activation subframe %d current " - "sfn %d current subframe %d", actvTime.sfn, actvTime.subframe, - cell->crntTime.sfn, cell->crntTime.subframe); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem)); - RETVALUE(RFAILED); - } - - sfDiff = RGSCH_CALC_SF_DIFF(actvTime, cell->crntTime); - - if (sfDiff > (RGR_ACTV_WIN_SIZE * RGSCH_NUM_SUB_FRAMES_5G)) - { - RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,"Invalid activation time for RGR" - " config request: activation sfn %d activation subframe %d " - "current sfn %d current subframe %d", actvTime.sfn, - actvTime.subframe, cell->crntTime.sfn, cell->crntTime.subframe); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem)); - RETVALUE(RFAILED); - } - - if (sfDiff) - { - /* Add to pending cfgReqLst */ - rgrCfgElem->actvTime = actvTime; - rgSCHDbmInsPndngRgrCfgElem(cell, rgrCfgElem); - /* Cfm to be sent only after applying request */ - RETVALUE(ROK); - } - } - - /* Add to current cfgReq list */ - rgSCHDbmInsCrntRgrCfgElem(cell, rgrCfgElem); - /* Cfm to be sent only after applying request */ - RETVALUE(ROK); -} /* rgSCHGomEnqCfgReq */ - - -/** - * @brief Handler for TTI processing for configurations recieved from RRM. - * - * @details - * - * Function: rgSCHGomTtiHndlr - * - * This API does TTI processing for configurations recieved from RRM. - * - * Processing Steps: - * - It dequeues config request from the current configuration list. - * For each config request in the list: - * - Processes the request. Call rgSCHGomCfgReq. - * - It dequeues config request for the current tti from the pending - * configuration list. For each config request in the list: - * - Processes the request. Call rgSCHGomCfgReq. - * - * @param[in] RgSchCellCb *cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGomTtiHndlr -( -RgSchCellCb *cell, -SpId spId -) -#else -PUBLIC S16 rgSCHGomTtiHndlr(cell, spId) -RgSchCellCb *cell; -SpId spId; -#endif -{ - RgSchCfgElem *cfgElem; - Inst inst= cell->instIdx; - TRC2(rgSCHGomTtiHndlr); - - /* Dequeue from current config list */ - while ((cfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP) - { - rgSCHDbmDelCrntRgrCfgElem(cell, cfgElem); - rgSCHGomCfgReq(cfgElem->rgrCfg.reg,cfgElem->rgrCfg.pool, - &rgSchCb[inst], spId, cfgElem->rgrCfg.transId, - cfgElem->rgrCfg.rgrCfgReq); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem)); - } - - /* Handle config requests from pending config list */ - while((cfgElem = rgSCHDbmGetPndngRgrCfgElemByKey(cell, cell->crntTime)) != NULLP) - { - rgSCHDbmDelPndngRgrCfgElem(cell, cfgElem); - rgSCHGomCfgReq(cfgElem->rgrCfg.reg, cfgElem->rgrCfg.pool, - &rgSchCb[inst], spId, cfgElem->rgrCfg.transId, - cfgElem->rgrCfg.rgrCfgReq); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem)); - } - - RETVALUE(ROK); -} - - -/** - * @brief Handler to handle configuration request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlCfgReq - * - * This API handles processing for configuration request from RRM to MAC. - * - * - Processing Steps: - * - Validate configuration request parameters at CFG module. - * Call rgSCHCfgVldtRgrCellCfg for cell configuration. - * - If validated successfully, send configuration request to CFG. - * Call rgSCHCfgRgrCellCfg else FAIL. - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrCfg *cfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomHndlCfgReq -( -RgSchCb *instCb, -SpId spId, -RgrCfg *cfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHGomHndlCfgReq(instCb, spId, cfg, errInfo) -RgSchCb *instCb; -SpId spId; -RgrCfg *cfg; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst ); - RgSchUeCb *ue; - - TRC2(rgSCHGomHndlCfgReq); - - errInfo->errType = RGSCHERR_GOM_CFG_REQ; - - /* Validate and process the configuration request */ - switch (cfg->cfgType) - { - case RGR_CELL_CFG: - { - ret = rgSCHCfgVldtRgrCellCfg(inst, &cfg->u.cellCfg, cell, errInfo); - if (ret != ROK) - { - RLOG1(L_ERROR,"Rgr Cell configuration " - "validation FAILED: Cell %d", cfg->u.cellCfg.cellId); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrCellCfg(instCb, spId, &cfg->u.cellCfg, errInfo); - break; - } - case RGR_UE_CFG: - case RGR_SCELL_UE_CFG: - { - ret = rgSCHCfgVldtRgrUeCfg(inst, &cfg->u.ueCfg, &cell, errInfo); - if (ret != ROK) - { - RLOG1(L_ERROR,"Ue configuration validation" - " FAILED: CRNTI:%d", cfg->u.ueCfg.crnti); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrUeCfg(cell, &cfg->u.ueCfg, errInfo); - break; - } - case RGR_LCH_CFG: - { - ret = rgSCHCfgVldtRgrLcCfg(inst, &cfg->u.lchCfg, &cell, &ue, errInfo); - if (ret != ROK) - { - RLOG1(L_ERROR,"LC configuration validation " - "FAILED: LCID:%d", cfg->u.lchCfg.lcId); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrLchCfg(cell, ue, &cfg->u.lchCfg, errInfo); - break; - } - case RGR_LCG_CFG: - { - ret = rgSCHCfgVldtRgrLcgCfg(inst, &cfg->u.lcgCfg, &cell, &ue, errInfo); - if (ret != ROK) - { - RLOG1(L_ERROR,"LCG configuration validation " - "FAILED: LCGID:%d", cfg->u.lcgCfg.ulInfo.lcgId); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrLcgCfg(cell, ue, &cfg->u.lcgCfg, errInfo); - break; - } - case RGR_ENB_CFG: - { - ret = rgSCHCfgVldtRgrSchedEnbCfg(inst, &cfg->u.schedEnbCfg, errInfo); - if (ret != ROK) - { - RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCH ENB configuration validation " - "FAILED: \n" )); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrSchedEnbCfg(inst, spId, &cfg->u.schedEnbCfg, errInfo); - break; - } - default: - { -#if(ERRCLASS & ERRCLS_INT_PAR) - RLOG1(L_ERROR,"Should never come here: " - "cfgType %d", cfg->cfgType); -#endif - RETVALUE(RFAILED); - } - } - - RETVALUE(ret); -} /* rgSCHGomHndlCfgReq */ - -#ifdef LTE_ADV -/** - * @brief Handler to handle re-configuration request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlSCellActDeactReq - * - * This API handles processing for SCell Activation Request from RRM to SCH. - * - * - Processing Steps: - * - Validate sCell Actication request parameters at CFG module. - * - If validated successfully, send configuration request to CFG. - * - call activation function for each SCells configured - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrSCellActDeactEvnt *sCellActDeactEvnt - * @param[in] U8 action - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomHndlSCellActDeactReq -( -RgSchCb *instCb, -SpId spId, -RgrSCellActDeactEvnt *sCellActDeactEvnt, -RgSchErrInfo *errInfo, -U8 action -) -#else -PRIVATE S16 rgSCHGomHndlSCellActDeactReq(instCb, spId, sCellActDeactEvnt, errInfo, action) -RgSchCb *instCb; -SpId spId; -RgrSCellActDeactEvnt *sCellActDeactEvnt; -RgSchErrInfo *errInfo; -U8 action; -#endif -{ - RgSchUeCb *ue = NULLP; - U16 idx = 0; - U16 sCellIdx = 0; - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst); - - TRC2(rgSCHGomHndlSCellActDeactReq); - RGSCHDBGPRM(inst,(rgSchPBuf(inst), "Processing RGR SCell Actication request:" - "%d\n", sCellActDeactEvnt->crnti)); - - errInfo->errType = RGSCHERR_GOM_SCELL_REQ; - - /* Fetch the Ue */ - if ((ue = rgSCHDbmGetUeCb(cell, sCellActDeactEvnt->crnti)) == NULLP) - { - RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UE: does not exist\n", - sCellActDeactEvnt->crnti)); - RETVALUE(RFAILED); - } - - for(idx = 0; idx < sCellActDeactEvnt->numOfSCells; idx++) - { - sCellIdx = sCellActDeactEvnt->sCellActDeactInfo[idx].sCellIdx; - - if (ROK != (rgSCHSCellTrigActDeact(cell, ue, sCellIdx, action))) - { - RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCell Actication failed" - "for UE [%d] with SCellIdx [%d]\n", - sCellActDeactEvnt->crnti, idx)); - RETVALUE(RFAILED); - - } - - } - RGSCHDBGINFO(inst,(rgSchPBuf(inst), "RGR Reconfiguration processed\n")); - RETVALUE(ROK); -} /* rgSCHGomHndlSCellActDeactReq */ - -#endif /* LTE_ADV */ -/** - * @brief Handler to handle re-configuration request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlRecfgReq - * - * This API handles processing for re-configuration request from RRM to MAC. - * - * - Processing Steps: - * - Validate re-configuration request parameters at CFG module. - * Call rgSCHCfgVldtRgrCellRecfg for cell re-configuration. - * - If validated successfully, send configuration request to CFG. - * Call rgSCHCfgRgrCellRecfg else FAIL. - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrRecfg *recfg - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomHndlRecfgReq -( -RgSchCb *instCb, -SpId spId, -RgrRecfg *recfg, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHGomHndlRecfgReq(instCb, spId, recfg, errInfo) -RgSchCb *instCb; -SpId spId; -RgrRecfg *recfg; -RgSchErrInfo *errInfo; -#endif -{ - RgSchUeCb *ue = NULLP; - RgSchDlLcCb *dlLc = NULLP; /* PURIFY_FIX:UMR */ - S16 ret; - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst ); - - TRC2(rgSCHGomHndlRecfgReq); - - errInfo->errType = RGSCHERR_GOM_RECFG_REQ; - - /* Validate and process the re-configuration request */ - switch (recfg->recfgType) - { - case RGR_CELL_CFG: - { - ret = rgSCHCfgVldtRgrCellRecfg(inst, &recfg->u.cellRecfg, &cell, - errInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,recfg->u.cellRecfg.cellId,"Rgr Cell Recfg Validation " - "FAILED"); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrCellRecfg(cell, &recfg->u.cellRecfg, errInfo); - break; - } - case RGR_UE_CFG: - case RGR_SCELL_UE_CFG: - { - ret = rgSCHCfgVldtRgrUeRecfg(inst, &recfg->u.ueRecfg, &cell, &ue, errInfo); - if ( ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.ueRecfg.cellId,"Ue Recfg Validation FAILED" - "OLD CRNTI:%d",recfg->u.ueRecfg.oldCrnti); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrUeRecfg(cell, ue, &recfg->u.ueRecfg, errInfo); - break; - } - case RGR_LCH_CFG: - { - ret = rgSCHCfgVldtRgrLchRecfg(inst, &recfg->u.lchRecfg, &cell, &ue, - &dlLc, errInfo); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lchRecfg.cellId,"Lc Recfg Validation FAILED" - "LCID:%d",recfg->u.lchRecfg.lcId); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrLchRecfg(cell, ue, dlLc, &recfg->u.lchRecfg, errInfo); - break; - } - case RGR_LCG_CFG: - { - ret = rgSCHCfgVldtRgrLcgRecfg(inst, &recfg->u.lcgRecfg, cell, &ue, - errInfo); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lcgRecfg.cellId, "Lcg Recfg Validation FAILED" - "LCGID:%d",recfg->u.lcgRecfg.ulRecfg.lcgId); - RETVALUE(RFAILED); - } - ret = rgSCHCfgRgrLcgRecfg(cell, ue, &recfg->u.lcgRecfg, errInfo); - break; - } - default: - { -#if(ERRCLASS & ERRCLS_INT_PAR) - RLOG1(L_ERROR,"Should never come here: recfgType %d", recfg->recfgType); -#endif - RETVALUE(RFAILED); - } - } - - RETVALUE(ret); -} /* rgSCHGomHndlRecfgReq */ - -/** - * @brief Handler to handle UE reset request from RRM to Scheduler. - * - * @details - * - * Function: rgSCHGomHndlResetReq - * - * This API handles processing for UE reset request from RRM to Scheduler. - * - * - Processing Steps: - * - Validate UE reset request parameters at CFG module. - * Call rgSCHCfgVldtRgrUeReset for UE reset. - * - If validated successfully, send UE reset request to CFG. - * Call rgSCHCfgRgrUeReset else FAIL. - * - * @param[in] RgrRst *rstInfo - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomHndlResetReq -( -RgSchCb *instCb, -SpId spId, -RgrRst *reset, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHGomHndlResetReq(instCb, spId, reset, errInfo) -RgSchCb *instCb; -SpId spId; -RgrRst *reset; -RgSchErrInfo *errInfo; -#endif -{ - S16 ret; - RgSchCellCb *cell= instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst ); - RgSchUeCb *ue = NULLP; - - TRC2(rgSCHGomHndlResetReq); - - - errInfo->errType = RGSCHERR_GOM_RESET_REQ; - - /* Validate and process the UE reset request */ - ret = rgSCHCfgVldtRgrUeReset(inst, reset, cell, &ue, errInfo); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset Validation FAILED" - "CRNTI:%d",reset->crnti); - RETVALUE(RFAILED); - } - - ret = rgSCHCfgRgrUeReset(cell, ue, reset, errInfo); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset FAILED" - "CRNTI:%d",reset->crnti); - RETVALUE(RFAILED); - } - - RETVALUE(ret); -} /* rgSCHGomHndlResetReq */ - - -/** - * @brief Handler for processing Cell/Ue/Logical channel delete request - * recieved from RRM. - * - * @details - * - * Function: rgSCHGomHndlDelReq - * - * This API handles processing of delete request from RRM to MAC. - * - * Processing Steps: - * - Fetch corresponding control block and pass it to CFG module. - * - If control block does not exist, FAIL. - * - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrDel *del - * @param[out] RgSchErrInfo *errInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHGomHndlDelReq -( -RgSchCb *instCb, -SpId spId, -RgrDel *del, -RgSchErrInfo *errInfo -) -#else -PRIVATE S16 rgSCHGomHndlDelReq(instCb, spId, del, errInfo) -RgSchCb *instCb; -SpId spId; -RgrDel *del; -RgSchErrInfo *errInfo; -#endif -{ - - S16 ret; -#ifdef DEBUGP - Inst inst = (instCb->rgSchInit.inst); -#endif - VOLATILE U32 startTime=0; - - TRC2(rgSCHGomHndlDelReq); - - errInfo->errType = RGSCHERR_GOM_DEL_REQ; - - if(instCb->rgrSap[spId].cell == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Cell doesnt exist"); - RETVALUE(RFAILED); - } - - /* Process the delete request */ - switch (del->delType) - { - case RGR_CELL_CFG: - { - ret = rgSCHCfgRgrCellDel(instCb->rgrSap[spId].cell, del, errInfo); - if(ret == ROK) - { - /* TODO::Needs to be revisited after tti flow CaDev Start */ - U8 idx = (U8)((instCb->rgrSap[spId].cell->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); - instCb->cells[idx] = NULLP; - /* CaDev End */ - instCb->rgrSap[spId].cell = NULLP; - instCb->tfuSap[spId].cell = NULLP; - } - break; - } - case RGR_UE_CFG: - case RGR_SCELL_UE_CFG: - { - - /*starting Task*/ - SStartTask(&startTime, PID_SCH_UE_DEL); - - ret = rgSCHCfgRgrUeDel(instCb->rgrSap[spId].cell, del, errInfo); - - /*stoping Task*/ - SStopTask(startTime, PID_SCH_UE_DEL); - - break; - } - case RGR_LCH_CFG: - { - ret = rgSCHCfgRgrLcDel(instCb->rgrSap[spId].cell, del, errInfo); - break; - } - case RGR_LCG_CFG: - { - ret = rgSCHCfgRgrLcgDel(instCb->rgrSap[spId].cell, del, errInfo); - break; - } - default: - { -#if(ERRCLASS & ERRCLS_INT_PAR) - RLOG1(L_ERROR,"Should never come here: delType %d", del->delType); -#endif - RETVALUE(RFAILED); - } - } - - RETVALUE(ret); -} /* rgSCHGomHndlDelReq */ - - - - -/*********************************************************** - * - * Func : rgSCHGomGetCellIdFrmCfgReq - * - * - * Desc : - * - Processing Steps: - * - Retrieves the cell Id for a config request. - * - * @param[in] RgrCfgReqInfo *rgrCfgReq - * @param[out] CmLteCellId *cellId - * Ret : ROK on fetching cellId - * RFAILED on failure - * - * Notes: - * - * File : rg_sch_gom.c - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq -( -RgrCfgReqInfo *rgrCfgReq, -CmLteCellId *cellId -) -#else -PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq(rgrCfgReq, cellId) -RgrCfgReqInfo *rgrCfgReq; -CmLteCellId *cellId; -#endif -{ - - TRC2(rgSCHGomGetCellIdFrmCfgReq); - - - /* Extract CellId depending on the action and Config Type in the Request - * As of now this function is called for only re configuration so removed - * othe CASES below if needed we can add them*/ - switch (rgrCfgReq->action) - { - case RGR_RECONFIG: - { - if (rgrCfgReq->u.recfgInfo.recfgType ==RGR_CELL_CFG) - { - *cellId = rgrCfgReq->u.recfgInfo.u.cellRecfg.cellId; - } - else if ((rgrCfgReq->u.recfgInfo.recfgType == RGR_SCELL_UE_CFG) || - (rgrCfgReq->u.recfgInfo.recfgType == RGR_UE_CFG)) - { - *cellId = rgrCfgReq->u.recfgInfo.u.ueRecfg.cellId; - } - else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCH_CFG) - { - *cellId = rgrCfgReq->u.recfgInfo.u.lchRecfg.cellId; - } - else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCG_CFG) - { - *cellId = rgrCfgReq->u.recfgInfo.u.lcgRecfg.cellId; - } - else - { - RETVALUE(RFAILED); - } - break; - } - default: - { - RETVALUE(RFAILED); - } - } /* End of Switch */ - - RETVALUE(ROK); -} /* rgSCHGomGetCellIdFrmCfgReq */ - -#ifdef RGR_SI_SCH -/** - * @brief Handler to handle SI configuration request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlSiCfg - * - * This API handles processing for SI configuration request from RRM to MAC. - * - * - Processing Steps: - * - Validate SI configuration request parameters at CFG module. - * Call rgSCHCfgVldtSiCfg for SI configuration. - * - If validated successfully, send configuration request to CFG. - * Call rgSCHCfgRgrCellCfg else FAIL. - * - * @param[in] Region reg - * @param[in] Pool pool - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrSiCfgReqInfo *cfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGomHndlSiCfg -( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrSiCfgReqInfo *cfgReqInfo -) -#else -PUBLIC S16 rgSCHGomHndlSiCfg(reg, pool, instCb, spId, transId, cfgReqInfo) -Region reg; -Pool pool; -RgSchCb *instCb; -SpId spId; -RgrCfgTransId transId; -RgrSiCfgReqInfo *cfgReqInfo; -#endif -{ - S16 ret; - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst ); - RgSchErrInfo errInfo; - U8 cfmStatus = RGR_CFG_CFM_NOK; - MsgLen msgLen = 0, pduLen; - S32 tbSz = 0; - U8 nPrb = 0; - U8 mcs = 0; - - TRC2(rgSCHGomHndlSiCfg); - - - /* check if cell does not exists */ - if (((U8 *)cell == NULLP) || (cell->cellId != cfgReqInfo->cellId)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Cell Control block does not exist" - ); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - - /*Validate the received SI configuration */ - ret = rgSCHCfgVldtRgrSiCfg(inst, cfgReqInfo, cell, &errInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " - "validation FAILED"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - /*ccpu00140789: Stopping SI scheduling*/ - if(RGR_SI_STOP == cfgReqInfo->cfgType) - { - if((cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)&& - (cell->siCb.siArray[cfgReqInfo->siId-1].si != NULLP)) - { - cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP; - RGSCH_FREE_MSG(cell->siCb.siArray[cfgReqInfo->siId-1].si); - cell->siCb.siArray[cfgReqInfo->siId-1].si = NULLP; - if(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP) - { - RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si); - cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP; - } - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - cfmStatus = RGR_CFG_CFM_OK; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(ROK); - } - else - { - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - RETVALUE(RFAILED); - } - } - - /* Check if the pdu sent from application - * matches a transport block size. if not, - * add padding bytes. This is usually done - * by RRC but since we are bypassing RRC, - * MAC is taking over that responsibility - */ - if ( RGR_SI_CFG_TYPE_MIB != cfgReqInfo->cfgType ) - { - SFndLenMsg(cfgReqInfo->pdu, &msgLen); - - /* check if the application pdu matches a tb size */ - tbSz = rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs); - - if ( tbSz != (msgLen*8) ) - { - MsgLen nmPadBytes = 0; - Data* padding = NULLP; - - /* need to add padding bytes */ - nmPadBytes = (tbSz - (msgLen*8))/8; - - if ( SGetSBuf(reg,pool,&padding,nmPadBytes) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " - "SGetSBuf failed for padding failed"); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - - cmMemset((U8*)padding,(U8)0,nmPadBytes); - -#ifdef MS_MBUF_CORRUPTION - MS_BUF_ADD_ALLOC_CALLER(); -#endif - if ( SAddPstMsgMult((Data*)padding,nmPadBytes,cfgReqInfo->pdu) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " - "Failed to add padding bytes"); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes); - padding = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes); - padding = NULLP; - }/* if (tbSz != ...*/ - }/* if (RGR_SI_CFG_TYPE_SI...*/ - - /*Set the received pdu at the appropriate place */ - switch(cfgReqInfo->cfgType) - { - case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */ - RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.mib, - cell->siCb.newSiInfo.mib, - cfgReqInfo->pdu, cell->siCb.siBitMask, - RGSCH_SI_MIB_UPD); - break; - - case RGR_SI_CFG_TYPE_SIB1_PWS: - { - SFndLenMsg(cfgReqInfo->pdu, &pduLen); - ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" - "value"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - - RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, - cell->siCb.newSiInfo.sib1Info.sib1, - cfgReqInfo->pdu, cell->siCb.siBitMask, - RGSCH_SI_SIB1_PWS_UPD); - } - break; - - case RGR_SI_CFG_TYPE_SIB1: - SFndLenMsg(cfgReqInfo->pdu, &pduLen); - ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" - "value"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, - cell->siCb.newSiInfo.sib1Info.sib1, - cfgReqInfo->pdu, cell->siCb.siBitMask, - RGSCH_SI_SIB1_UPD); - break; - - case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */ - SFndLenMsg(cfgReqInfo->pdu, &pduLen); - ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, - cfgReqInfo->siId); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" - "value"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - /* Si recfg, where numSi changes */ - if (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) - { - Buffer **newSiPdu = &cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si; - if(*newSiPdu != NULLP) - { - RGSCH_FREE_MSG(*newSiPdu); - } - *newSiPdu = (Buffer *)cfgReqInfo->pdu; - cell->siCb.siBitMask |= RGSCH_SI_SI_UPD; - } - else /* Initial Si cfg or si recfg where numSi did not change */ - { - U8 bitMask; - /* Initial Si cfg */ - if (cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si == NULLP) - { - cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu; - cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE; - bitMask = RGSCH_SI_DFLT; - } - else - { - bitMask = RGSCH_SI_SI_UPD; - } - - RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si, - cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si, - cfgReqInfo->pdu, - cell->siCb.siBitMask, bitMask); - } - break; - - case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */ - SFndLenMsg(cfgReqInfo->pdu, &pduLen); - ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, - cfgReqInfo->siId); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" - "value"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - /* No need to wait for Modification period boundary */ - cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu; - RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si, - cfgReqInfo->pdu); - cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE; - break; - default: - RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Invalid cfgType " - "parameter value"); - RGSCH_FREE_MSG(cfgReqInfo->pdu); - SPutSBuf(reg, pool, (Data *)cfgReqInfo, - (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - - SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); - cfgReqInfo = NULLP; - cfmStatus = RGR_CFG_CFM_OK; - rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); - - - RETVALUE(ROK); -} /* rgSCHGomHndlSiCfg */ - - -/** - * @brief Handler to handle Warning SI configuration request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlWarningSiCfg - * - * This API handles processing for Warning SI configuration request from - * RRM to MAC. - * - * - * @param[in] Region reg - * @param[in] Pool pool - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGomHndlWarningSiCfg -( -Region reg, -Pool pool, -RgSchCb *instCb, -SpId spId, -RgrCfgTransId transId, -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo -) -#else -PUBLIC S16 rgSCHGomHndlWarningSiCfg(reg, pool, instCb, spId, transId, -warningSiCfgReqInfo) -Region reg; -Pool pool; -RgSchCb *instCb; -SpId spId; -RgrCfgTransId transId; -RgrWarningSiCfgReqInfo *warningSiCfgReqInfo; -#endif -{ - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - U8 cfmStatus = RGR_CFG_CFM_NOK; - U16 idx; - U8 siId = warningSiCfgReqInfo->siId; - U8 j, mcs=0, nPrb=0; - RgSchWarningSiSeg *warningSiMsg; - RgSchWarningSiPdu *pduNode; - CmLList *node; - MsgLen msgLen = 0; - Bool freeNodeFound = FALSE; - U16 siWinSize = 0; - U16 minPeriod = 0; -#ifdef EMTC_ENABLE - U8 isEmtc = warningSiCfgReqInfo->emtcEnable; -#endif - - TRC2(rgSCHGomHndlWarningSiCfg); - -#ifdef EMTC_ENABLE - if(TRUE == isEmtc) - { - rgSchEmtcGetSiWinPerd(cell, &siWinSize, &minPeriod); - } - else -#endif - { - siWinSize = cell->siCfg.siWinSize; - minPeriod = cell->siCfg.minPeriodicity; - } - /* check if cell does not exists */ - if (((U8 *)cell == NULLP) || - (cell->cellId != warningSiCfgReqInfo->cellId) || - (warningSiCfgReqInfo->siId > - ((minPeriod * 10)/siWinSize))) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,warningSiCfgReqInfo->cellId,"Warning SI Cfg Failed for siId = %d" - "warning cellID:%d",warningSiCfgReqInfo->siId,warningSiCfgReqInfo->cellId); - rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst); - SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - warningSiCfgReqInfo = NULLP; - rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - - /* Search for free index in WarningSi */ - for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) - { - if((cell->siCb.warningSi[idx].siId == 0 || - cell->siCb.warningSi[idx].siId == warningSiCfgReqInfo->siId)) - { - warningSiMsg = (RgSchWarningSiSeg *)&cell->siCb.warningSi[idx].warningSiMsg; - - /* Search for free SI node */ - /* ccpu00136659: CMAS ETWS design changes */ - if (warningSiMsg->segLstCp.first == NULLP) /* Free SI Node */ - { - warningSiMsg->transId = transId; - pduNode = (RgSchWarningSiPdu *)&cell->siCb.warningSi[idx]. - warningSiMsg.pduNode; - CM_LLIST_FIRST_NODE(&warningSiCfgReqInfo->siPduLst, node); - j = 0; - - /* Get the PDUs one by one from the received pduLst of warning - * message and calculate the MCS and nPrb of each pdu once. - * Store the pdu in warningSiMsg pduLst, which will be scheduled - * later while sending warning message as part of SIB11/SIB12 - */ - while((node != NULLP) && (j < RGR_MAX_WARNING_SI_SEG)) - - { - pduNode[j].pdu = (Buffer *)node->node; - if(pduNode[j].pdu != NULLP) - { - SFndLenMsg(pduNode[j].pdu, &msgLen); - /*Get the nPrb and mcs parametr values */ -#ifdef EMTC_ENABLE - if (rgSCHEmtcUtlGetAllwdCchTbSzForSI(msgLen*8) != (msgLen*8)) -#else - if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8)) -#endif - - { - RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011, - (ErrVal)msgLen, - "rgSCHGomHndlWarningSiCfg():msgLen does not match\ - any valid TB Size."); - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Warning SI Cfg Failed" - "for siId = %d", warningSiCfgReqInfo->siId); - rgSCHUtlFreeWarningSiSeg(reg, pool, - &warningSiCfgReqInfo->siPduLst); - SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - warningSiCfgReqInfo = NULLP; - rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, - siId, transId,cfmStatus); - RETVALUE(RFAILED); - - } - } - pduNode[j].mcs = mcs; - pduNode[j].nPrb = nPrb; - pduNode[j].msgLen = msgLen; - /* ccpu00136659: CMAS ETWS design changes */ - cmLListAdd2Tail(&warningSiMsg->segLstCp, &pduNode[j].lnk); - pduNode[j].lnk.node = (PTR)&pduNode[j]; - j++; - node = node->next; - } - - /* ccpu00132385- nodes in received SI config linked list should - * be freed after processing the config.*/ - while(warningSiCfgReqInfo->siPduLst.first != NULLP) - { - node = warningSiCfgReqInfo->siPduLst.first; - cmLListDelFrm(&(warningSiCfgReqInfo->siPduLst), node); - SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList)); - node = NULLP; - } - - cell->siCb.warningSi[idx].siId = warningSiCfgReqInfo->siId; - cell->siCb.warningSi[idx].idx = idx; -#ifdef EMTC_ENABLE - if(TRUE == isEmtc) - { - rgSCHEmtcWarningSiCfg(cell,warningSiCfgReqInfo,idx); - } - else -#endif - { - cell->siCb.siArray[warningSiCfgReqInfo->siId-1].si = - &cell->siCb.warningSi[idx]; - cell->siCb.siArray[warningSiCfgReqInfo->siId-1].isWarningSi = - TRUE; - } - freeNodeFound = TRUE; - break; - } - } - } - - if (freeNodeFound == FALSE) - { - RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"No SI Index is free"); - rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst); - SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - warningSiCfgReqInfo = NULLP; - rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, - cfmStatus); - RETVALUE(RFAILED); - } - - SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, - sizeof(RgrWarningSiCfgReqInfo)); - warningSiCfgReqInfo = NULLP; - RETVALUE(ROK); -} - - -/** - * @brief Handler to handle SI Stop request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlWarningSiStopReq - * - * This API handles processing for SI stop request from RRM to MAC. - * - * @param[in] Region reg - * @param[in] Pool pool - * @param[in] RgSchCb *instCb - * @param[in] SpId siId - * @return void - **/ -#ifdef ANSI -PUBLIC Void rgSCHGomHndlWarningSiStopReq -( -Region reg, -Pool pool, -RgSchCb *instCb, -U8 siId, -RgrCfgTransId transId, -SpId spId -) -#else -PUBLIC Void rgSCHGomHndlWarningSiStopReq(reg, pool, instCb, siId, transId, spId) -Region reg; -Pool pool; -RgSchCb *instCb; -U8 siId; -RgrCfgTransId transId; -SpId spId; -#endif -{ - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - U16 idx; - CmLList *node; - RgSchWarningSiPdu *warningSiPdu; - Buffer *pdu; - - TRC3(rgSCHGomHndlWarningSiStopReq) - - for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) - { - if(cell->siCb.warningSi[idx].siId == siId) - { - if ((cmMemcmp ((U8 *)&cell->siCb.warningSi[idx].warningSiMsg.transId, - (U8 *)&transId, sizeof(RgrCfgTransId))) == 0) - { - /* ccpu00136659: CMAS ETWS design changes */ - CM_LLIST_FIRST_NODE(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node); - while(node != NULLP) - { - /* On receiving the warning stop message, remove one by one - * each PDU from the warning SI list - */ - /* ccpu00136659: CMAS ETWS design changes */ - node = (CmLList *)&cell->siCb.warningSi[idx].warningSiMsg.segLstCp.first; - warningSiPdu = (RgSchWarningSiPdu *)node->node; - pdu = warningSiPdu->pdu; - cmLListDelFrm(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node); - RGSCH_FREE_MSG(pdu); - node = node->next; - } - } - } - } - RETVOID; -} - -#endif/*RGR_SI_SCH */ - -/* LTE_ADV_FLAG_REMOVED_START */ - -/** - * @brief This function sets the Phigh range for CC users corresponding to the CC Pool - * @details - * - * Function: rgSchUpdtRNTPInfo - * - * Invoked by: rgSCHGomHndlLoadInf - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @param[in] RgrLoadInfReqInfo *loadInfReq - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSchUpdtRNTPInfo -( - RgSchCellCb *cell, - RgSchDlSf *sf, - RgrLoadInfReqInfo *loadInfReq - ) -#else -PRIVATE Void rgSchUpdtRNTPInfo(cell, sf) - RgSchCellCb *cell; - RgSchDlSf *sf; - RgrLoadInfReqInfo *loadInfReq; - -#endif -{ - /* Initialise the variables */ - RgSchSFRPoolInfo *sfrCCPool; - CmLListCp *l; - CmLList *n; - S16 ret = RFAILED; - - TRC2(rgSchUpdtRNTPInfo); - - l = &sf->sfrTotalPoolInfo.ccPool; - - /*Get the first node from the CC Pool*/ - n = cmLListFirst(l); - while(n) - { - sfrCCPool = (RgSchSFRPoolInfo*)n->node; - if (sfrCCPool->poolendRB == loadInfReq->rgrCcPHighEndRb) - { - sfrCCPool->pwrHiCCRange.endRb = loadInfReq->rgrCcPHighEndRb; - sfrCCPool->pwrHiCCRange.startRb = loadInfReq->rgrCcPHighStartRb; - RETVALUE(ROK); - } - else - { - n = cmLListNext(l); - } - } - RETVALUE(ret); -} -/** - * @brief Handler to handle LOAD INF request from RRM to MAC. - * - * @details - * - * Function: rgSCHGomHndlLoadInf - * - * This API handles processing for LOAD INF request from RRM to MAC. - * - * - Processing Steps: - * - Validate LOAD INF request parameters at CFG module. - * Call rgSCHCfgVldtRgrLoadInf for SI configuration. - * - If validated successfully, send configuration request. - * - * @param[in] Region reg - * @param[in] Pool pool - * @param[in] RgSchCb *instCb - * @param[in] SpId spId - * @param[in] RgrCfgTransId transId - * @param[in] RgrLoadInfReqInfo *loadInfReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGomHndlLoadInf -( - Region reg, - Pool pool, - RgSchCb *instCb, - SpId spId, - RgrCfgTransId transId, - RgrLoadInfReqInfo *loadInfReq - ) -#else -PUBLIC S16 rgSCHGomHndlLoadInf(reg, pool, instCb, spId, transId, loadInfReq) - Region reg; - Pool pool; - RgSchCb *instCb; - SpId spId; - RgrCfgTransId transId; - RgrLoadInfReqInfo *loadInfReq; -#endif -{ - S16 ret; - RgSchCellCb *cell = instCb->rgrSap[spId].cell; - Inst inst = (instCb->rgSchInit.inst ); - RgSchErrInfo errInfo; - U16 i; - - TRC2(rgSCHGomHndlLoadInf); - - - /* check if cell does not exists */ - if (((U8 *)cell == NULLP) || (cell->cellId != loadInfReq->cellId)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,loadInfReq->cellId,"Cell Control block does not exist" - "for load cellId:%d",loadInfReq->cellId); - SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); - RETVALUE(RFAILED); - } - - if (cell->lteAdvCb.dsfrCfg.status == RGR_DISABLE) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHGomHndlLoadInf(): DSFR Feature not enabled"); - SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); - RETVALUE(RFAILED); - } - /* Validate the received LOAD INF Configuration */ - ret = rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, &errInfo); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Rgr LOAD INF Configuration " - "validation FAILED"); - SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); - RETVALUE(RFAILED); - } - /* Update the RNTP info rcvd in the respective cell centre pool so that Phigh can be - sent for the UEs scheduled in that particular RB range*/ - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - if((rgSchUpdtRNTPInfo(cell, cell->subFrms[i], loadInfReq) != ROK)) - { - RETVALUE(RFAILED); - } - } - - SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); - - - RETVALUE(ROK); -} /* rgSCHGomHndlLoadInf */ -/* LTE_ADV_FLAG_REMOVED_END */ - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_inf.x b/src/5gnrmac/rg_sch_inf.x deleted file mode 100755 index b64067ac1..000000000 --- a/src/5gnrmac/rg_sch_inf.x +++ /dev/null @@ -1,1450 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/********************************************************************** - - Name: LTE-MAC layer - - Type: C Include File - - Desc: Structures, variables, and typedefs required by the interface between - MAC and Scheduler. - - File: rg_sch_inf.x - -**********************************************************************/ -/** - @file rg_sch_inf.x - @brief Structure declarations and definitions for MAC-SCH interface. - */ - -#ifndef __GKSCH_X__ -#define __GKSCH_X__ - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef EMTC_ENABLE -/** - * @brief This structure contains the uplink grant information that is sent in - response to the random access request from the UE for CEmodeA. - */ -typedef struct rgInfEmtcCEmodeARarUlGrt -{ - U8 msg3PUSCHNbIdx; /*!< Indicates the Msg3 PUSCH narrowband index. */ - U8 rbStart; /*!< Start Resource block of allocation. */ - U8 numRb; /*!< Number of resource blocks allocated. */ - U8 msg3PUSCHNumRep; /*!< Number of repetitions for Msg3 PUSCH. */ - U8 iMcsCrnt; /*!< Current MCS index of the grant. */ - U8 tpc; /*!< TPC command for the uplink grant. */ - U8 cqiBit; /*!< Indicates the CQI is enabled or not. */ - U8 delayBit; /*!< Indicates the Delay bit. */ - U8 msg34MPDCCHNbIdx; /*!< Indicates Msg3/4 MPDCCH narrowband index. */ -} RgInfEmtcCEmodeARarUlGrnt; - -/** - * @brief This structure contains the uplink grant information that is sent in - response to the random access request from the UE for CEmodeB. - */ -typedef struct rgInfEmtcCEmodeBRarUlGrnt -{ - U8 msg3PUSCHNbIdx; /*!< Indicates the Msg3 PUSCH narrowband index. */ - U8 rbStart; /*!< Start Resource block of allocation. */ - U8 numRb; /*!< Number of resource blocks allocated. */ - U8 msg3PUSCHNumRep; /*!< Number of repetitions for Msg3 PUSCH. */ - U8 iTbsCrnt; /*!< Current TBS index of the grant. */ - U8 msg34MPDCCHNbIdx; /*!< Indicates Msg3/4 MPDCCH narrowband index. */ -}RgInfEmtcCEmodeBRarUlGrnt; - -typedef enum rgEmtcCEmodeType -{ - RG_EMTC_CEMODE_A, - RG_EMTC_CEMODE_B, - RG_EMTC_CEMODE_INV -}RgEmtcCEmodeType; - -/** - * @brief This structure contains the uplink grant information that is sent in - response to the random access request from the UE for EMTC. - */ -typedef struct rgInfEmtcRarUlGrnt -{ - U8 rgEmtcCEmodeType; - union - { - RgInfEmtcCEmodeARarUlGrnt emtcCEmodeARarUlGrnt; - RgInfEmtcCEmodeBRarUlGrnt emtcCEmodeBRarUlGrnt; - }u; -}RgInfEmtcRarUlGrnt; - -#endif /* EMTC_ENABLE */ -/** - * @brief This structure contains common channel buffer occupancy report information. - */ -typedef struct rgInfCmnBoRpt -{ - S16 cellSapId; - CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cell IDs. */ - CmLteLcId lcId; /*!< Identifies the logical channel. lcId value range is defined in - Section 6.2.1 in 36.321 specification. */ - CmLteLcType lcType; /*!< Identifies the Logical channel type.lcType can take the following values: - CM_LTE_LCH_BCCH - CM_LTE_LCH_PCCH - CM_LTE_LCH_CCCH - CM_LTE_LCH_DCCH - CM_LTE_LCH_DTCH */ - S32 bo; /*!< Buffer occupancy reported by RLC in bytes. */ -#ifdef EMTC_ENABLE - U8 emtcDIReason; /*!< Reason for DI message to send. */ - U8 pnb; /*!< Pagging narrowBand on which Ue perfom paging reception*/ -#endif - union /*!< lcType in the primitive is the union selector. */ - { - CmLteTimingInfo timeToTx; /*!< Timing info for the BO, applicable for BCCH and PCCH. */ - CmLteRnti rnti; /*!< Temporary C-RNTI, only for CCCH. RNTI range is specified - in Section 7.1 in 36.321 specification. */ - } u; -} RgInfCmnBoRpt; -/** - * @brief This structure contains dedicated channel buffer occupancy report - * information. - */ -typedef struct rgInfDedBoRpt -{ - S16 cellSapId; /*!< Identifies the cell SAP. cellSapId value must be within the set of configured cell SAP IDs. */ - CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cellIds. */ - CmLteRnti rnti; /*!< Identifies the UE. RNTI value range is specified in Section 7.1 in 25.321 specification. */ - CmLteLcId lcId; /*!< Identifies the logical channel. lcId value range is defined in Section 6.2.1 in 36.321 specification. */ - S32 bo; /*!< Number of bytes reported as Buffer occupancy by RLC. */ -#ifdef CCPU_OPT - Bool staPduPrsnt; /*!< Is status PDU present reported by RLC. */ - U16 estRlcHdrSz;/*!< Estimated hader size reported by RLC */ -#endif - U32 staPduBo; /*!< Number of bytes reported as Buffer occupancy for status PDU by RLC. - This is already included in BO.*/ - U32 oldestSduArrTime; /*!< Oldest SDU Arrival Time from Upper Layer */ - Bool setMaxUlPrio; /*!< set when Pollbit is set from RLC in PDU */ - Bool setMaxDlPrio; /*!< Set when there is a status PDU in the DL*/ -} RgInfDedBoRpt; - -/*Fix: start: Indicate UE deletion from MAC to Scheduler*/ -/** - * @brief This structure contains the RNTI which is deleted at MAC - * information. - */ -typedef struct rgInfUeDelInd -{ - S16 cellSapId; /*!< Identifies the cell SAP. cellSapId value must be within the set of configured cell SAP IDs. */ - CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cellIds. */ - CmLteRnti rnti; /*!< Identifies the UE. RNTI value range is specified in Section 7.1 in 25.321 specification. */ -} RgInfUeDelInd; - -/*Fix: end: Indicate UE deletion from MAC to Scheduler*/ - - - -/** - * @brief This structure contains the uplink grant information that is sent in - response to the random access request from the UE. - */ -typedef struct rgInfRarUlGrnt -{ -#ifndef MAC_5GTF_UPDATE - U8 hop; /*!< Indicates the hopping flag. */ -#else - U8 xPuschRange; /*!< xPUSCH range */ -#endif - U8 rbStart; /*!< Start Resource block of allocation. */ - U8 numRb; /*!< Number of resource blocks allocated. */ - U8 tpc; /*!< TPC command for the uplink grant. */ - U8 iMcsCrnt; /*!< Current MCS index of the grant. */ - U8 delayBit; /*!< Indicates the Delay bit. */ -#ifndef MAC_5GTF_UPDATE - U8 cqiBit; /*!< Indicates the CQI is enabled or not. */ -#else - U8 numBsiRep; /*!< Number of BSI reports. */ - U8 bsiBetaOffIdx; /*!< Index of BSI beta offset used in Msg3 */ - U8 pcrs; /*!< UL dual PCRS */ -#endif -} RgInfRarUlGrnt; - -/** - * @brief This structure carries timing adjustment, uplink grant information for the specific temporary C-RNTI. - */ -typedef struct rgInfCrntiInfo -{ - CmLteRnti tmpCrnti; /*!< Temporary C-RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ - U8 rapId; /*!< rapId identifies the index of the Random Access Preamble. rapId ranges from 0 to 63.*/ - TknU16 ta; /*!< Timing Adjustment. Timing Adjustment Value range is defined in Section 6.1.3.5 in 36.321 specification. */ - RgInfRarUlGrnt grnt; /*!< Uplink Grant to go in RAR. */ - Bool isContFree; /*!< Indicates whether the procedure is contention-free or not. */ -#ifdef EMTC_ENABLE - RgInfEmtcRarUlGrnt emtcGrnt; /*!< Uplink grant for EMTC UE to go in RAR. */ -#endif -}RgInfCrntiInfo; - -/** - * @brief This structure carries information about downlink control format, scheduled TB size, - backoff indicator value, and the set of Random Access Responses within this RA-RNTI. -*/ -typedef struct rgInfRaRntiInfo -{ - U16 raRnti; /*!< RA-RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ - TfuPdschDciInfo dciInfo; /*!< PDCCH allocated for RA-RNTI. For more information - refer to TFU Interface Service Definition (p/n 1100091). */ - U32 schdTbSz; /*!< Scheduled TB size. schdTbSz value range is defined in Section 7.1.7.2.1 in 36.213 - specification. */ - TknU8 backOffInd; /*!< Indicates the Backoff Indicator value. backOffInd value range - is defined in Section 7.2 in 36.321 specification. */ - U8 numCrnti; /*!< Number of valid RARs in the array. */ - RgInfCrntiInfo *crntiInfo; /*!< RAR information. */ -}RgInfRaRntiInfo; - -/** - * @brief This structure contains information about the RA-RNTIs for which - * random access responses are generated. - */ -typedef struct rgInfRarInfo -{ - U8 numRaRntis; /*!< Indicates the number of valid RA-RNTIs present. */ - RgInfRaRntiInfo *raRntiInfo; /*!< Contains allocation information per RA-RNTI. */ - U16 txPwrOffset; /*!< PDSCH tx power offset for RAR transmission */ -}RgInfRarInfo; - -/** - * @brief Logical channel allocation information. - */ -typedef struct rgInfLcDatInfo -{ - CmLList lchLstEnt; /*!< Is not used when part of resource allocation. */ - U8 lcId; /*!< Identifies the logical channel. lcId value range is defined - in Section 6.2.1 in 36.321 specification. */ - U32 numBytes; /*!< Number of bytes allocated/received to logical channel. */ -} RgInfLcDatInfo; - -/** - * @brief This structure contains control element information received from a - * particular UE.Extended PHR information - */ -typedef struct rgInfExtPhrSCellInfo -{ - U8 sCellIdx; /*!< SCELL index for which PHR is reported */ - U8 phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6a in 36.321 specification. */ - U8 pCmax; /*!< PCMAX value. PCMAX value is defined in Table 6.1.3.6a-1 in 36.321 specification. */ - U8 pBackOff; /*!< If UE applied back off due to P-MPRc in 36.321 specification. */ -}RgInfExtPhrSCellInfo; -typedef struct rgInfExtPhrCEInfo -{ - U8 type2Phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6a in 36.321 specification. */ - U8 type2PCMax; /*!< PCMAX value. PCMAX value is defined in Table 6.1.3.6a-1 in 36.321 specification. */ - U8 numServCells; /*!< Number of serving cells for which PHR is reported */ - RgInfExtPhrSCellInfo servCellPhr[CM_LTE_MAX_CELLS]; -}RgInfExtPhrCEInfo; /*!< EXT PHR value. EXT PHR value is defined in Section 6.1.3.6a in 36.321 R10 specification. */ - -/** - * @brief This structure contains control element information received from a - * particular UE. - */ -typedef struct rgInfCeInfo -{ - U16 bitMask; /*!< Bitmask for the MAC Control elements present. */ - struct - { - U16 cRnti; /*!< C-RNTI value. RNTI range is specified in Section 7.1 in 36.321 specification. */ - U8 phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6 in 36.321 specification. */ - union - { - U8 truncBsr; /*!< Truncated BSR value. BSR value is defined in - Section 6.1.3.1 in 36.321 specification. */ - U8 shortBsr; /*!< Short BSR value.BSR value is defined in - Section 6.1.3.1 in 36.321 specification. */ - struct - { - U8 bs1; /*!< Buffer size 1 of long BSR. */ - U8 bs2; /*!< Buffer size 2 of long BSR. */ - U8 bs3; /*!< Buffer size 3 of long BSR. */ - U8 bs4; /*!< Buffer size 4 of long BSR. */ - }longBsr; /*!< BSR value is defined in Section 6.1.3.1 in 36.321 specification. */ - }bsr; - RgInfExtPhrCEInfo extPhr; /*!< EXT PHR value. EXT PHR value is defined in Section 6.1.3.6a in 36.321 R10 specification. */ -#ifdef MAC_5GTF_UPDATE - struct - { - U8 bar; /*!< Beam Adjusment Request */ - U8 numBsiFields; /*!< Number of BSI fields UE sent in BSI Feedback */ - struct - { - U16 bi; /*!< BSI Feedback : 9 bits Beam Index */ - U8 brsrp; /*!< BSI Feedback :7 bits BRSRP */ - }bsiFdbk[4]; - }beam; -#endif - } ces; - /* L2_COUNTERS */ -#ifdef LTE_L2_MEAS - U8 ulActLCs[RGINF_MAX_NUM_DED_LC]; - /*!< List of LCs for which Data is received in UL */ -#endif - - -#ifdef LTEMAC_SPS - U16 spsSduSize; -#endif - -} RgInfCeInfo; - -typedef struct rgInfLcgInfo -{ - U8 lcgId; /*!< LCGID. GBR DRB LCG */ - U32 bytesRcvd; /*!< Contains bytes received for LCG */ -}RgInfLcgInfo; - -/** - * @brief This structure contains control element information received from a - * particular UE identified by the RNTI. - */ -typedef struct rgInfUeDatInd -{ - CmLteRnti rnti; /*!< RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ - CmLList ueLstEnt; /*!< UE linked list entry. */ - RgInfCeInfo ceInfo; /*!< Contains the control elements received from the UE. */ - RgInfLcgInfo lcgInfo[RGINF_MAX_LCG_PER_UE - 1]; /*!< Contains the bytes received per DRB LCG. */ -}RgInfUeDatInd; - -/** - * @brief This structure carries the control element information received for a - set of UEs along with timing information. - */ -typedef struct rgInfSfDatInd -{ - CmMemListCp memCp; /*!< Memory control point. */ - CmLListCp ueLst; /*!< Pointer to the UE linked list. */ - /* RRM_SP1_START */ - U32 qcisUlPrbCnt[RGINF_MAX_GBR_QCI_REPORTS];/*!< UL gbr LC's PRB count*/ - /* RRM_SP1_END */ - S16 cellSapId; /*!< Cell SAP Identifier. CellSAP ID value must be within the set of configured cell SAP IDs. */ - CmLteCellId cellId; /*!< Identifies the cell. CellId must be within the set of configured cell IDs. */ - CmLteTimingInfo timingInfo; /*!< Contains information about SFN and subframe. SFN ranges from 0 to 1023 whereas subframe ranges from 0 to 9. */ -}RgInfSfDatInd; - -/** - * @brief This structure carries the information about scheduled logical - * channels within this transport block along with timing adjustment - * information. - */ -typedef struct rgInfUeTbInfo -{ - Bool disTb; /*!< Currently, not used, but is - applicable in MIMO case. */ - Bool isReTx; /*!< Indicates the TB transmission type. */ - TknU8 ta; /*!< Timing Adjustment. */ -#ifdef LTE_ADV - TknU8 sCellActCe; /* !< SCell Act values and whether - scheduled or not */ -#endif - - /* Changed as a result of CR timer implementation*/ - U8 contResCe; /*!< Indicating presence of Contention Resolution CE across MAC-SCH - interface to - * identify CCCH SDU transmissions which need to - * be done without the - * contention resolution CE.*/ - - U8 numSchLch; /*!< Indicates the number of logical - channels scheduled. */ - U32 schdTbSz; - RgInfLcDatInfo schdDat[RGINF_MAX_NUM_DED_LC]; /*!< Contains - information about scheduled logical - channel. */ -} RgInfUeTbInfo; - -/** - @brief This structure carries the information reagarding secondary MAC like its - instance Id and HARQ process's Id - */ -typedef struct rgLaaTbReqInfo -{ - U8 sMacInstId; - U8 sCellHqPId; - U8 tbId; - U16 hqPStamp; -}RgLaaTbReqInfo; - -/** - * @brief This structure carries the UE-specific Resource allocation - * information like RNTI, downlink control format, HARQ process Identifier, - * scheduled TB size, and Transport Block information. - */ -typedef struct rgInfUeAlloc -{ - CmLteRnti rnti; /*!< RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ - -/* Added support for SPS*/ -#ifdef LTEMAC_SPS - CmLteRnti pdcchRnti; /*!< RNTI used for PDCCH scrambling */ -#endif - - - - TfuPdschDciInfo dciInfo; /*!< Contains Downlink Control Information. For more information, - refer to TFU Interface Service Definition (p/n 1100091). */ - U8 hqProcId; /*!< HARQ process Identifier. hqProcId ranges between 1 and 8 for FDD mode and 1 and 15 for TDD mode */ - S8 tbStrtIdx; - TknU32 doa; - TfuTxMode txMode; - Bool puschRptUsd;/*!< True, if Precoding Information in PDCCH has to be - in-accordance with the latest PUSCH report */ - TfuDlCqiPuschInfo puschPmiInfo;/*!< PUSCH report details for explicit PMI - * information to PHY during a PDSCH */ - - - U8 nmbOfTBs; /*!< Indicates the number of TBs. Currently this is set to 1. */ - RgInfUeTbInfo tbInfo[RGINF_MAX_TB_PER_UE]; /*!< Contains TB identifier. */ - /* LTE_ADV_FLAG_REMOVED_START */ -#ifdef TFU_UPGRADE - U8 pa; /*!< DL Power control paramter P_A - configured by higher layers - Ref: RRC 36.331, 6.3.2, PDSCH-Config */ -#endif - U8 isEnbSFR; /*To check if SFR is enabled*/ - /* LTE_ADV_FLAG_REMOVED_END */ -#ifdef LTE_ADV - Bool fillCtrlPdu; /*!< Based upon this flag RLC will fill RLC Control PDU - In a tti if P-cell is present then control PDU - should be kept in P-cell otherwise S-cell*/ -#endif - RgLaaTbReqInfo tbReqInfo; /*!< LAA: TB information for the TBs which - need to be fetched from the SCell*/ -}RgInfUeAlloc; - -/** - * @brief This structure carries the Resource allocation information for the - * set of scheduled UEs. - */ -typedef struct rgInfUeInfo -{ - U8 numUes; /*!< Number of UEs allocated. */ - RgInfUeAlloc *allocInfo; /*!< Allocation information per UE. */ -}RgInfUeInfo; - -/** - * @brief This structure contains the RNTI and downlink control format - * information for the scheduled BCCH logical channel. - */ -typedef struct rgInfBcchInfo -{ - CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ - TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. For more information, - refer to TFU Interface Service Definition (p/n 1100091).*/ -/* Modified for SI Enhancement*/ -#ifndef RGR_SI_SCH - CmLteLcId lcId; /*!< Logical Channel Identifier.lcId value range is defined in - Section 6.2.1 in 36.321 specification. */ - Bool sndStatInd; /*!< Currently this is set to 1 for fresh transmission of BCCH data. */ -#else - Buffer *pdu; /*!< PDU being specified for BCCH. */ -#endif - U16 txPwrOffset; /*!< PDSCH tx power offset for BCCH - transmission */ -}RgInfBcchInfo; - -/** - * @brief This structure contains the RNTI and the downlink control information for the scheduled PCCH logical channel. - */ -typedef struct rgInfPcchInfo -{ - CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ - TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. - For more information, refer to TFU Interface Service Definition (p/n 1100091). */ - CmLteLcId lcId; /*!< Logical Channel Identifier. lcId value range is defined in - Section 6.2.1 in 36.321 specification. */ - - U16 txPwrOffset; /*!< PDSCH tx power offset for PCCH - transmission */ -}RgInfPcchInfo; - -/** - * @brief This structure contains the scheduled logical channel information - * mapped onto the BCH transport channel. - */ -typedef struct rgInfBchInfo -{ -/* Modified for SI Enhancement*/ -#ifndef RGR_SI_SCH - CmLteLcId lcId; /*!< Logical Channel Identifier. lcId value range is defined in Section 6.2.1 in 36.321 specification. */ -#else - Buffer *pdu; /*!< PDU being specified for BCH */ -#endif -}RgInfBchInfo; - -/** - * @brief This structure contains the scheduling information of BCH, PCCH, and - * BCCH channel information. - */ -typedef struct rgInfCmnLcInfo -{ - U16 bitMask; /*!< Bitmask representing all the common channels present. */ - RgInfBchInfo bchInfo; /*!< BCH channel Information. */ - RgInfPcchInfo pcchInfo; /*!< Paging Logical Channel Information. */ - RgInfBcchInfo bcchInfo; /*!< Broadcast Logical Channel Information. */ -}RgInfCmnLcInfo; - -#ifdef EMTC_ENABLE -/** - * @brief This structure contains the scheduled logical channel information - * mapped onto the BCH transport channel. - */ -typedef struct rgInfEmtcBcchInfo -{ - CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ - TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. For more information */ - Buffer *pdu; /*!< PDU being specified for BCH */ -}RgInfEmtcBcchInfo; - -/** - * @brief This structure contains the scheduling information of BCH, PCCH, and - * BCCH channel information. - */ -typedef struct rgInfEmtcCmnLcInfo -{ - U16 bitMask; /*!< Bitmask representing all the common channels present. */ - RgInfBchInfo bchInfo; /*!< BCH channel Information. */ - RgInfPcchInfo pcchInfo; /*!< Paging Logical Channel Information. */ - RgInfEmtcBcchInfo emtcBcchInfo; /*!< Broadcast Logical Channel Information. */ -}RgInfEmtcCmnLcInfo; -#endif - -#ifdef LTE_L2_MEAS -/** - * @brief UE-specific allocation information needed for measurements. - * */ -typedef struct rgInfUeUlAlloc -{ - CmLteRnti rnti; /*!< UE ID */ - U8 numPrb; /*!< Number of total PRB's allocated for this UE */ -} RgInfUeUlAlloc; - -/** - * @brief Allocation information of all UEs in this subframe. - * */ -typedef struct rgInfUlUeInfo -{ - U8 numUes; /*!< Number of UE's*/ - CmLteTimingInfo timingInfo; /*!< Uplink timing information */ - RgInfUeUlAlloc *ulAllocInfo;/*!< Uplink Allocations information */ -}RgInfUlUeInfo; -#endif /*LTE_L2_MEAS */ - -/** -*@brief this structure contains the lcId on which flow control need to be performed and the number of packets allowed for admission */ -typedef struct rgInfLcInfo -{ - CmLteLcId lcId; /*!< lcId for flow control*/ - U32 pktAdmitCnt; /*! NOK and reason -> INVALID */ - union { - RgInfPrbCfm prbCfm; /*!< Avgerage PRB usage per QCI*/ - } u; -} RgInfL2MeasCfm; - -/** - * @brief This API is invoked from l2 Measurements module at scheduler. - * When Scheduler receives a measurement request from stack manager for Average - * PRB usage Per QCI in Uplink, Scheduler invokes this API towards LTE MAC - * for the calculations. LTE MAC utilizes the uplink allocations information provided - * by scheduler for every subframe and data indications received for this calculation. - * This API carries a transId to uniquely identify the confirm received for - * this request from LTEMAC. - * */ -EXTERN S16 RgSchMacL2MeasReq ARGS(( - Pst* pst, - RgInfL2MeasReq* l2MeasReq -)); -/** - * @brief This API is invoked from l2 Measurements module at scheduler. - * When Scheduler receives a measurement send request from stack manager, - * it sends L2 measurement to layer manager. - * */ - -EXTERN S16 RgSchMacL2MeasSendReq ARGS(( - Pst* pst, - RgInfL2MeasSndReq* l2MeasReq -)); -/** - * @brief This API is invoked from l2 Measurements module at scheduler. - * When Scheduler receives a measurement stop request from stack manager, - * it stops L2 Measurement - */ -EXTERN S16 RgSchMacL2MeasStopReq ARGS(( - Pst* pst, - RgInfL2MeasStopReq* l2MeasReq -)); - -/** - * @brief This API is invoked from L2 Measurement module at LTE MAC. When LTE MAC - * completes calculation of Avergae PRB usage per QCI in Uplink for a given time - * period, It invokes this API to indicate result back to scheduler. LTE - * MAC sends the same transId received in measurement request from Scheduler. - * */ -EXTERN S16 RgMacSchL2MeasCfm ARGS(( - Pst* pst, - RgInfL2MeasCfm* l2MeasCfm -)); -/** - * @brief This API is invoked from L2 Measurement module at LTE MAC. When LTE MAC - * stops L2 measurement, it sends L2 measurement cfm. - * */ - -EXTERN S16 RgMacSchL2MeasStopCfm ARGS(( - Pst* pst, - RgInfL2MeasCfm* l2MeasCfm -)); - -EXTERN S16 RgMacSchL2MeasStop ARGS -(( -Pst* pst, -RgInfL2MeasCfm *measInfo -)); -#endif /* LTE_L2_MEAS */ - -typedef struct rgInfLcgRegReq -{ - CmLteCellId cellId; /*!< Cell Identifier */ - CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE - RNTI range is specified in Section - 7.1 in 25.321 Specification. */ - U8 lcgId; - Bool isGbr; /* Indicate if the LCG is Gbr */ -} RgInfLcgRegReq; - - -/* Added support for SPS*/ -#ifdef LTEMAC_SPS -/** - * @brief This structure contains the logical channel information related to - * uplink SPS for a particular UE identified by the CRNTI. - */ -typedef struct rgInfSpsLcInfo -{ - CmLteCellId cellId; /*!< Cell Identifier */ - CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE - RNTI range is specified in Section - 7.1 in 25.321 Specification. */ - CmLteRnti spsRnti; /*!< SPS RNTI. RNTI range is specified in - Section 7.1 in 25.321 Specification. */ - U8 spsLcCnt; /*!< identifies the number of SPS - configured logical channels */ - U8 spsLcId[RGINF_MAX_NUM_DED_LC]; /*!< Logical Channel - Identifier. lcId value range is - defined in Section 6.2.1 - in 36.321 Specification. */ - U8 implRelCnt; /*!< "implicitRelAfter" vallue */ - U16 spsPrd; /*!< SPS periodicity of the UE */ -} RgInfSpsLcInfo; - -/** - * @brief This structure contains UL SPS param Reset related to - * uplink SPS for a particular UE identified by the CRNTI. - */ -typedef struct rgInfUlSpsReset -{ - CmLteCellId cellId; /*!< Cell Identifier */ - CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE - RNTI range is specified in Section - 7.1 in 25.321 Specification. */ -} RgInfUlSpsReset; - - -/** - * @brief This structure contains the information to release UL SPS for a UE */ -typedef struct rgInfSpsRelInfo -{ - S16 cellSapId; /*!< identifies the cell SAP. Value range - should be within the set of - configured cell SAP(s).*/ - CmLteRnti cRnti; /*!< RNTI of the UE */ - Bool isExplRel; /*!< TRUE if explicit release needs to be - sent to UE */ -} RgInfSpsRelInfo; -#endif /* LTEMAC_SPS */ - -/* - * Function Prototypes - */ -/** - * @brief Request from Scheduler to MAC to register a cell. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacCellRegReq ARGS(( - Pst* pst, - RgInfCellReg* regReq -)); - -typedef S16 (*CellRegReq) ARGS(( - Pst* pst, - RgInfCellReg* regReq -)); - -/** - * @brief Request from Scheduler to MAC to register a cell. - * @details The scheduler invokes this primitive after the scheduler cell - * configuration is completed. Before calling this primitive, the scheduler - * creates a mapping of the cell which is uniquely idetified by cell ID and - * scheduler instance that is serving the cell. - */ -EXTERN S16 RgSchMacCellRegReq ARGS(( - Pst* pst, - RgInfCellReg* regReq -)); -/** - * @brief Request from Scheduler to MAC to register a cell. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkSchMacCellRegReq ARGS(( - CellRegReq func, - Pst* pst, - Buffer *mBuf -)); -/** - * @brief Request from MAC to scheduler to update dedicated BO. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkMacSchDedBoUpdtReq ARGS(( - Pst* pst, - RgInfDedBoRpt* boRpt -)); - -typedef S16 (*DedBoUpdtReq) ARGS(( - Pst* pst, - RgInfDedBoRpt* boRpt -)); - -/** - * @brief Request from MAC to scheduler to update dedicated BO. - * @details MAC layer invokes this primitive towards scheduler when it - * receives status response from the RLC for dedicated channels. Scheduler - * takes the buffer occupancy information into consideration while taking - * scheduling decisons. - */ -EXTERN S16 RgMacSchDedBoUpdtReq ARGS(( - Pst* pst, - RgInfDedBoRpt* boRpt -)); -/** - * @brief Request from MAC to scheduler to update dedicated BO. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkMacSchDedBoUpdtReq ARGS(( - DedBoUpdtReq func, - Pst* pst, - Buffer *mBuf -)); -/** - * @brief Request from MAC to scheduler to update common channel BO. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkMacSchCmnBoUpdtReq ARGS(( - Pst* pst, - RgInfCmnBoRpt* boRpt -)); - -typedef S16 (*CmnBoUpdtReq) ARGS(( - Pst* pst, - RgInfCmnBoRpt* boRpt -)); - -/** - * @brief Request from MAC to scheduler to update common channel BO. - * @details MAC layer invokes this primitive towards scheduler when it - * receives status response from the RLC for common channels. Scheduler - * takes the buffer occupancy information into consideration while taking - * scheduling decisons. - */ -EXTERN S16 RgMacSchCmnBoUpdtReq ARGS(( - Pst* pst, - RgInfCmnBoRpt* boRpt -)); -/** - * @brief Request from MAC to scheduler to update common channel BO. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkMacSchCmnBoUpdtReq ARGS(( - CmnBoUpdtReq func, - Pst* pst, - Buffer *mBuf -)); - -/*Fix: start:Indicate UE deletion at MAC to scheduler*/ -/** - * @brief UE delete indication from MAC to scheduler. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkMacSchUeDelInd ARGS(( - Pst* pst, - RgInfUeDelInd* ueDelInd -)); - -typedef S16 (*UeDelInd) ARGS(( - Pst* pst, - RgInfUeDelInd* ueDelInd -)); - -/** - * @brief UE deletion indication from MAC to scheduler. - * @details MAC layer invokes this primitive towards scheduler when it - * receives UE delete Request. As the UE is now deleted at MAC, it should - * not be scheduled. - */ -EXTERN S16 RgMacSchUeDelInd ARGS(( - Pst* pst, - RgInfUeDelInd* ueDelInd -)); -/** - * @brief UE delete Indication Request from MAC to scheduler. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkMacSchUeDelInd ARGS(( - UeDelInd func, - Pst* pst, - Buffer *mBuf -)); -/*Fix: end:Indicate UE deletion at MAC to scheduler*/ -/** - * @brief Data Indication Request from MAC to scheduler. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkMacSchSfRecpInd ARGS(( - Pst* pst, - RgInfSfDatInd* datInd -)); - -typedef S16 (*SfRecpInd) ARGS(( - Pst* pst, - RgInfSfDatInd* datInd -)); - -/** - * @brief Data Indication Request from MAC to scheduler. - * @details MAC layer invokes this primitive towards scheduler when it - * receives MAC Control Elements from the data received from the UE. Scheduler - * takes these control elements into consideration while taking scheduling - * decisons for the uplink. - */ -EXTERN S16 RgMacSchSfRecpInd ARGS(( - Pst* pst, - RgInfSfDatInd* datInd -)); -/** - * @brief Data Indication Request from MAC to scheduler. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkMacSchSfRecpInd ARGS(( - SfRecpInd func, - Pst* pst, - Buffer *mBuf -)); -/** - * @brief Resource Allocation Request from Scheduler to MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacSfAllocReq ARGS(( - Pst* pst, - RgInfSfAlloc* resAllocReq -)); - -typedef S16 (*SfAllocReq) ARGS(( - Pst* pst, - RgInfSfAlloc* resAllocReq -)); - -/** - * @brief Resource Allocation Request from Scheduler to MAC. - * @details Scheduler invokes this primitive for every TTI towards MAC to - * inform the scheduling decisions taken for uplink grants, common channels - * and list of UEs to be scheduling during this TTI. - */ -EXTERN S16 RgSchMacSfAllocReq ARGS(( - Pst* pst, - RgInfSfAlloc* resAllocReq -)); -/** - * @brief Resource Allocation Request from Scheduler to MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkSchMacSfAllocReq ARGS(( - SfAllocReq func, - Pst* pst, - Buffer *mBuf -)); -/** - * @brief Request from Scheduler to release HARQ processes at MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacRlsHqReq ARGS(( - Pst* pst, - RgInfRlsHqInfo* sfHqInfo -)); - -typedef S16 (*RlsHqReq) ARGS(( - Pst* pst, - RgInfRlsHqInfo* sfHqInfo -)); - -/** - * @brief Request from Scheduler to release HARQ processes at MAC. - * @details Scheduler calls this primitive to send the list of UEs for - * which the HARQ buffers are released to MAC. The Scheduler invokes this - * primitive when a positive acknowledgement is received for the TB transmitted - * or a TB is retransmitted for the allowed maximum number of retransmissions. - */ -EXTERN S16 RgSchMacRlsHqReq ARGS(( - Pst* pst, - RgInfRlsHqInfo* sfHqInfo -)); -/** - * @brief Request from Scheduler to release HARQ processes at MAC. - * @details This primitive is used for light-weight loose coupling. - */ - -EXTERN S16 cmUnpkSchMacRlsHqReq ARGS(( - RlsHqReq func, - Pst* pst, - Buffer *mBuf -)); - -/** - * @brief Request from Scheduler to reset HARQ Entity at MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacRstHqEntReq ARGS(( - Pst* pst, - RgInfResetHqEnt* hqEntInfo -)); - -typedef S16 (*RstHqEntReq) ARGS(( - Pst* pst, - RgInfResetHqEnt* hqEntInfo -)); - -/** - * @brief Request from Scheduler to reset HARQ entity at MAC for a scell of an ue. - * This is triggered upon deactivation of a scell - */ -EXTERN S16 RgSchMacRstHqEntReq ARGS(( - Pst* pst, - RgInfResetHqEnt* hqEntInfo -)); -/** - * @brief Request from Scheduler to release HARQ processes at MAC. - * @details This primitive is used for light-weight loose coupling. - */ - -EXTERN S16 cmUnpkSchMacRstHqEntReq ARGS(( - RstHqEntReq func, - Pst* pst, - Buffer *mBuf -)); -/** - * @brief Request from Scheduler to release RNTI at MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacRlsRntiReq ARGS(( - Pst* pst, - RgInfRlsRnti* rlsRnti -)); - -typedef S16 (*RlsRntiReq) ARGS(( - Pst* pst, - RgInfRlsRnti* rlsRnti -)); - -/** - * @brief Request from Scheduler to release RNTI at MAC. - * @details The Scheduler calls this primitive to send the list of RNTIs for - * which the RRC Connection is being rejected. - */ -EXTERN S16 RgSchMacRlsRntiReq ARGS(( - Pst* pst, - RgInfRlsRnti* rlsRnt -)); -/** - * @brief Request from Scheduler to release RNTI at MAC. - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmUnpkSchMacRlsRntiReq ARGS(( - RlsRntiReq func, - Pst* pst, - Buffer *mBuf -)); -/* Added support for SPS*/ - -typedef S16 (*LcgReg) ARGS(( - Pst* pst, - RgInfLcgRegReq *lcgRegReq -)); - -EXTERN S16 cmPkSchMacLcgRegReq ARGS(( - Pst* pst, - RgInfLcgRegReq *lcgRegReq -)); - -EXTERN S16 RgSchMacLcgRegReq ARGS((Pst *pst, RgInfLcgRegReq *lcgRegReq)); - -EXTERN S16 cmUnpkSchMacLcgRegReq ARGS(( - LcgReg func, - Pst *pst, - Buffer *mBuf -)); - -EXTERN S16 RgSchMacLcgReg ARGS((Pst* pst, RgInfLcgRegReq *lcgRegReq)); - -#ifdef LTEMAC_SPS -/** - * @brief Primitive from Scheduler to MAC to register the logical channels of - * a SPS UE - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacSpsLcRegReq ARGS(( - Pst* pst, - RgInfSpsLcInfo *lcInfo -)); - -typedef S16 (*SpsLcReg) ARGS(( - Pst* pst, - RgInfSpsLcInfo *lcInfo -)); - -/** - * @brief Request from Scheduler to register the SPS related logical channels. - * @details Scheduler calls this primitive to send the list of logical channels - * that belong to the SPS logical channel group. - */ -EXTERN S16 RgSchMacSpsLcRegReq ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo)); - -EXTERN S16 cmUnpkSchMacSpsLcRegReq ARGS(( - SpsLcReg func, - Pst *pst, - Buffer *mBuf -)); - - -/** - * @brief Primitive from Scheduler to MAC to Reset UL SPS related Params - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacUlSpsResetReq ARGS(( - Pst* pst, - RgInfUlSpsReset *ulSpsResetInfo -)); - -typedef S16 (*UlSpsReset) ARGS(( - Pst* pst, - RgInfUlSpsReset *ulSpsResetInfo -)); - -/** - * @brief Request from Scheduler to reset UL SPS Params - * @details Scheduler calls this primitive to reset implicit and explicit - * release counters for the UE - */ -EXTERN S16 RgSchMacUlSpsResetReq ARGS((Pst *pst, RgInfUlSpsReset *ulSpsResetInfo)); - -EXTERN S16 cmUnpkSchMacUlSpsResetReq ARGS(( - UlSpsReset func, - Pst *pst, - Buffer *mBuf -)); - - - -/** - * @brief Primitive from Scheduler to MAC to deregister the logical channels of - * a SPS UE - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkSchMacSpsLcDeregReq ARGS(( - Pst* pst, - CmLteCellId cellId, - CmLteRnti crnti -)); - -typedef S16 (*SpsLcDereg) ARGS(( - Pst* pst, - CmLteCellId cellId, - CmLteRnti crnti -)); - -/** - * @brief Request from Scheduler to deregister the SPS related logical channels. - * @details Scheduler calls this primitive to send the deregistration request - * for a UE once SPS is released for it - */ -EXTERN S16 RgSchMacSpsLcDeregReq ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti - crnti)); - -EXTERN S16 cmUnpkSchMacSpsLcDeregReq ARGS(( - SpsLcDereg func, - Pst* pst, - Buffer *mBuf -)); - -/** - * @brief Primitive from MAC to Scheduler to indicate release of UL SPS for a UE - * @details This primitive is used for light-weight loose coupling. - */ -EXTERN S16 cmPkMacSchSpsRelInd ARGS(( - Pst* pst, - RgInfSpsRelInfo* relInfo -)); - -typedef S16 (*SpsRelInd) ARGS(( - Pst* pst, - RgInfSpsRelInfo* relInfo -)); - -/** - * @brief Indication from MAC to Scheduler to release UL SPS for a UE - * @details MAC calls this primitive to inform the scheduler that UL SPS needs - * to be released for a UE - */ -EXTERN S16 RgMacSchSpsRelInd ARGS((Pst *pst, RgInfSpsRelInfo *relInfo)); - -EXTERN S16 cmUnpkMacSchSpsRelInd ARGS(( - SpsRelInd func, - Pst* pst, - Buffer *mBuf -)); - -#endif -#ifdef LTE_L2_MEAS -EXTERN S16 cmPkMacSchL2MeasCfm ARGS(( -Pst* pst, -RgInfL2MeasCfm *measCfm -)); - -EXTERN S16 cmPkMacSchL2MeasStopCfm ARGS(( -Pst* pst, -RgInfL2MeasCfm *measCfm -)); - - -EXTERN S16 cmPkSchMacL2MeasReq ARGS(( - Pst* pst, - RgInfL2MeasReq *measInfo -)); - -EXTERN S16 cmPkSchMacL2MeasStopReq ARGS(( - Pst* pst, - RgInfL2MeasStopReq *measInfo -)); - -EXTERN S16 cmPkSchMacL2MeasSendReq ARGS(( - Pst* pst, - RgInfL2MeasSndReq *measInfo -)); -typedef S16 (*L2MeasReq) ARGS(( - Pst* pst, - RgInfL2MeasReq *measInfo -)); - -typedef S16 (*L2MeasStopReq) ARGS(( - Pst* pst, - RgInfL2MeasStopReq *measInfo -)); - -typedef S16 (*L2MeasSendReq) ARGS(( - Pst* pst, - RgInfL2MeasSndReq *measInfo -)); -typedef S16 (*L2MeasStopCfm) ARGS(( - Pst *pst, - RgInfL2MeasCfm *measCfm -)); - -typedef S16 (*L2MeasCfm) ARGS(( - Pst *pst, - RgInfL2MeasCfm *measCfm -)); -EXTERN S16 cmUnpkMacSchL2MeasCfm ARGS -(( -L2MeasCfm func, -Pst *pst, -Buffer *mBuf -)); -EXTERN S16 cmUnpkSchMacL2MeasReq ARGS(( - L2MeasReq func, - Pst *pst, - Buffer *mBuf -)); -EXTERN S16 cmUnpkSchMacL2MeasSendReq ARGS(( - L2MeasSendReq func, - Pst *pst, - Buffer *mBuf -)); -EXTERN S16 cmUnpkSchMacL2MeasStopReq ARGS(( - L2MeasStopReq func, - Pst *pst, - Buffer *mBuf -)); - -EXTERN S16 cmUnpkMacSchL2MeasStopCfm ARGS(( - L2MeasCfm func, - Pst *pst, - Buffer *mBuf -)); -#endif -EXTERN S16 RgSchMacRlsRnti ARGS((Pst* pst, RgInfRlsRnti* rlsRnti)); -EXTERN S16 RgSchMacRlsHq ARGS((Pst* pst, RgInfRlsHqInfo* sfHqInfo)); -EXTERN S16 RgSchMacSfAlloc ARGS((Pst* pst, RgInfSfAlloc* resAllocReq)); -EXTERN S16 RgSchMacRstHqEnt ARGS((Pst* pst, RgInfResetHqEnt* hqEntInfo)); -EXTERN S16 RgMacSchSfRecp ARGS((Pst* pst, RgInfSfDatInd* datInd)); -EXTERN S16 RgMacSchCmnBoUpdt ARGS(( Pst* pst, RgInfCmnBoRpt* boRpt)); -EXTERN S16 RgMacSchDedBoUpdt ARGS(( Pst* pst, RgInfDedBoRpt* boRpt)); -EXTERN S16 RgSchMacCellReg ARGS((Pst* pst,RgInfCellReg* regReq)); -#ifdef LTE_L2_MEAS -EXTERN S16 RgSchMacL2Meas ARGS((Pst* pst, RgInfL2MeasReq* l2MeasReq)); -EXTERN S16 RgMacSchL2Meas ARGS((Pst* pst, RgInfL2MeasCfm* l2MeasCfm)); -EXTERN S16 RgSchMacL2MeasStop ARGS((Pst* pst, RgInfL2MeasStopReq *measInfo)); -EXTERN S16 RgSchMacL2MeasSend ARGS((Pst* pst, RgInfL2MeasSndReq *measInfo)); -#endif /* LTE_L2_MEAS */ -/* Added support for SPS*/ -#ifdef LTEMAC_SPS -EXTERN S16 RgSchMacSpsLcReg ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo)); -EXTERN S16 RgSchMacUlSpsReset ARGS((Pst *pst, RgInfUlSpsReset *lcInfo)); -EXTERN S16 RgSchMacSpsLcDereg ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti - crnti)); -EXTERN S16 RgMacSchSpsRel ARGS((Pst *pst, RgInfSpsRelInfo* relInfo)); -#endif -EXTERN S16 RgMacSchUeDel ARGS((Pst* pst, RgInfUeDelInd* ueDelInd)); - -#ifdef __cplusplus -} -#endif -#endif /* __GKSCH_X__*/ - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_lmm.c b/src/5gnrmac/rg_sch_lmm.c deleted file mode 100755 index f451a1e9d..000000000 --- a/src/5gnrmac/rg_sch_lmm.c +++ /dev/null @@ -1,1458 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Layer Manager Interface Module - - File: rg_sch_lmm.c - -**********************************************************************/ - -/** @file rg_sch_lmm.c -@brief This file contains the Layer Management interface module implementation for scheduler. - The functions for the configuration, control, status and statistics - request primitives are defined here. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_MODULE_ID=4096; -static int RLOG_FILE_ID=167; - -/* header include files (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general */ -#include "ssi.h" /* system services */ -#include "cm_tkns.h" /* Common Token Defines */ -#include "cm_llist.h" /* Common Link List Defines */ -#include "cm_hash.h" /* Common Hash List Defines */ -#include "cm_mblk.h" /* common memory link list library */ -#include "cm_lte.h" /* Common LTE Defines */ -#include "rg_env.h" /* MAC Environment Defines */ -#include "rgr.h" /* RGR Interface defines */ -#include "tfu.h" /* RGU Interface defines */ -#include "lrg.h" /* LRG Interface defines */ -#include "rgm.h" /* RGM Interface defines */ -#include "rg_sch.h" /* Scheduler defines */ -#include "rg_sch_inf.h" /* Scheduler defines */ -#include "rg_sch_err.h" /* MAC error defines */ -#ifdef LTE_L2_MEAS -#include "rg_sch_cmn.h" /* typedefs for Scheduler */ -#endif -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general */ -#include "ssi.x" /* system services */ -#include "cm5.x" /* system services */ -#include "cm_tkns.x" /* Common Token Definitions */ -#include "cm_llist.x" /* Common Link List Definitions */ -#include "cm_lib.x" /* Common Library Definitions */ -#include "cm_hash.x" /* Common Hash List Definitions */ -#include "cm_mblk.x" /* common memory link list library */ -#include "cm_lte.x" /* Common LTE Defines */ -#include "rgr.x" /* RGR Interface includes */ -#include "rgm.x" /* RGM Interface includes */ -#include "tfu.x" /* RGU Interface includes */ -#include "lrg.x" /* LRG Interface includes */ -#include "rg_sch_inf.x" /* Scheduler defines */ -#include "rg_sch.x" /* Scheduler includes */ -#ifdef LTE_L2_MEAS -#include "rg_sch_cmn.x" /* typedefs for Scheduler */ -#endif -#ifndef LTE_L2_MEAS -PUBLIC Void rgSCHCmnInit ARGS((Void)); -#endif -/* forward references */ - - -PRIVATE U16 rgSCHLmmSapCfg ARGS(( - Inst inst, - RgCfg *cfg, - U8 sapIdx, - Elmnt sapType -)); - -PRIVATE Void rgSCHLmmShutdown ARGS(( - Inst inst -)); - - -PUBLIC void printSchCellInfo(void) -{ - U8 idx=0; - U8 inst=0; - for (idx = 0; idx < rgSchCb[inst].numSaps; idx++) - { - /* Unbind all the TFU SAP */ - /* Free the memory held by the cell associated - * with this SAP */ - if (rgSchCb[inst].tfuSap[idx].cell != NULLP) - { - RLOG1(L_INFO,"CELL %d\n", idx); - RLOG1(L_INFO,"NUM UEs :%d\n",rgSchCb[inst].tfuSap[idx].cell->ueLst.nmbEnt); - } - } -} - - -/** - * @brief Task Initiation callback function. - * - * @details - * - * Function : schActvInit - * - * This function is supplied as one of parameters during MAC's - * task registration. SSI will invoke this function once, after - * it creates and attaches this TAPA Task to a system task. - * - * @param[in] Ent Entity, the entity ID of this task. - * @param[in] Inst Inst, the instance ID of this task. - * @param[in] Region Region, the region ID registered for memory - * usage of this task. - * @param[in] Reason Reason. - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 schActvInit -( -Ent entity, /* entity */ -Inst instId, /* instance */ -Region region, /* region */ -Reason reason /* reason */ -) -#else -PUBLIC S16 schActvInit(entity, instId, region, reason) -Ent entity; /* entity */ -Inst instId; /* instance */ -Region region; /* region */ -Reason reason; /* reason */ -#endif -{ - Inst inst = (instId - RGSCH_INST_START); - - TRC2(schActvInit); - - /* Initialize the MAC TskInit structure to zero */ - cmMemset ((U8 *)&rgSchCb[inst], 0, sizeof(RgSchCb)); - - /* Initialize the MAC TskInit with received values */ - rgSchCb[inst].rgSchInit.ent = entity; - rgSchCb[inst].rgSchInit.inst = inst; - rgSchCb[inst].rgSchInit.region = region; - rgSchCb[inst].rgSchInit.pool = 0; - rgSchCb[inst].rgSchInit.reason = reason; - rgSchCb[inst].rgSchInit.cfgDone = FALSE; - rgSchCb[inst].rgSchInit.acnt = FALSE; - rgSchCb[inst].rgSchInit.usta = FALSE; - rgSchCb[inst].rgSchInit.trc = FALSE; -#ifdef DEBUGP -#ifdef RG_DEBUG - /* disabling debugs by default */ - /* rgSchCb[inst].rgSchInit.dbgMask = 0xffffffff; */ -#endif -#endif /* DEBUGP */ - rgSchCb[inst].rgSchInit.procId = SFndProcId(); - - rgSchCb[inst].rgrSap = NULLP; - rgSchCb[inst].tfuSap = NULLP; - rgSchCb[inst].rgmSap = NULLP; - rgSCHCmnInit(); - - RETVALUE(ROK); -} /* schActvInit */ - - -/** - * @brief SAP Configuration Handler. - * - * @details - * - * Function : rgSCHLmmSapCfg - * - * This function in called by RgMiLrgSchCfgReq(). It handles the - * interface SAP configuration of the scheduler instance. It - * initializes the sapState to LRG_UNBND. Returns - * reason for success/failure of this function. - * - * @param[in] RgCfg *cfg, the Configuaration information - * @return U16 - * -# LCM_REASON_GENCFG_NOT_DONE - * -# LCM_REASON_INVALID_SAP - * -# LCM_REASON_NOT_APPL - **/ -#ifdef ANSI -PRIVATE U16 rgSCHLmmSapCfg -( -Inst dInst, -RgCfg *cfg, /* Configuaration information */ -U8 sapIdx, /* SAP index */ -Elmnt sapType /* SAP Type */ -) -#else -PRIVATE U16 rgSCHLmmSapCfg(dInst, cfg, sapIdx, sapType) -Inst dInst; -RgCfg *cfg; /* Configuaration information */ -U8 sapIdx; /* SAP index */ -Elmnt sapType; /* SAP Type */ -#endif -{ - U16 ret = LCM_REASON_NOT_APPL; - RgSchLowSapCfgInfo *lowSapCfg = NULLP; - RgSchUpSapCfgInfo *upSapCfg = NULLP; - Inst inst = (dInst - RGSCH_INST_START); - - TRC2(rgSCHLmmSapCfg) - - /* Check if Gen Config has been done */ - - switch(sapType) - { - case STRGRSAP: -#ifndef CL_MAC_LWLC - if ((cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_TC) && - (cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_LC)) - { - ret = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" - " Selector value for RGR."); - break; - } -#endif - if(rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) - { - rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState = LRG_UNBND; - } - upSapCfg = &rgSchCb[inst].rgrSap[sapIdx].sapCfg; - - upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgrSap[sapIdx].ent; - upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgrSap[sapIdx].inst; - upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgrSap[sapIdx].procId; - upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; - upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + - RGSCH_INST_START; - upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; - upSapCfg->sapPst.region = cfg->s.schInstCfg.rgrSap[sapIdx].mem.region; - upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgrSap[sapIdx].mem.pool; - upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgrSap[sapIdx].selector; - upSapCfg->sapPst.route = cfg->s.schInstCfg.rgrSap[sapIdx].route; - upSapCfg->sapPst.intfVer = 0; - upSapCfg->sapPst.event = 0; - upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgrSap[sapIdx].prior; - upSapCfg->suId = cfg->s.schInstCfg.rgrSap[sapIdx].suId; - upSapCfg->spId = cfg->s.schInstCfg.rgrSap[sapIdx].spId; - break; - case STTFUSAP: -#ifndef CL_MAC_LWLC - if ((cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_TC) && - (cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_LC)) - { - ret = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" - " Selector value for TFU."); - break; - } -#endif - if (rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) - { - rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState = LRG_UNBND; - } - /* Initialize the sap timer */ - cmInitTimers(&(rgSchCb[inst].tfuSap[sapIdx].tmrBlk), 1); - lowSapCfg = &rgSchCb[inst].tfuSap[sapIdx].sapCfg; - - lowSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.tfuSap[sapIdx].ent; - lowSapCfg->sapPst.dstInst = cfg->s.schInstCfg.tfuSap[sapIdx].inst; - lowSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.tfuSap[sapIdx].procId; - lowSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; - lowSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + - RGSCH_INST_START; - lowSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; - lowSapCfg->sapPst.region = cfg->s.schInstCfg.tfuSap[sapIdx].mem.region; - lowSapCfg->sapPst.pool = cfg->s.schInstCfg.tfuSap[sapIdx].mem.pool; - lowSapCfg->sapPst.selector = cfg->s.schInstCfg.tfuSap[sapIdx].selector; - lowSapCfg->sapPst.route = cfg->s.schInstCfg.tfuSap[sapIdx].route; - lowSapCfg->sapPst.intfVer = 0; - lowSapCfg->sapPst.event = 0; - lowSapCfg->sapPst.prior = cfg->s.schInstCfg.tfuSap[sapIdx].prior; - lowSapCfg->suId = cfg->s.schInstCfg.tfuSap[sapIdx].suId; - lowSapCfg->spId = cfg->s.schInstCfg.tfuSap[sapIdx].spId; - cmMemcpy((U8 *)&lowSapCfg->bndTmr, - (U8 *)&cfg->s.schInstCfg.tfuSap[sapIdx].bndTmr, - sizeof(TmrCfg)); - break; - case STRGMSAP: -#ifndef RGM_LWLC - if ((cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LWLC) && - (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LC) && - (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_TC)) - { - ret = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" - " Selector value for RGM."); - break; - } -#endif - if (rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) - { - rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState = LRG_UNBND; - } - upSapCfg = &rgSchCb[inst].rgmSap[sapIdx].sapCfg; - upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgmSap[sapIdx].ent; - upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgmSap[sapIdx].inst; - upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgmSap[sapIdx].procId; - upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; - upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + - RGSCH_INST_START; - upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; - upSapCfg->sapPst.region = cfg->s.schInstCfg.rgmSap[sapIdx].mem.region; - upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgmSap[sapIdx].mem.pool; - upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgmSap[sapIdx].selector; - upSapCfg->sapPst.route = cfg->s.schInstCfg.rgmSap[sapIdx].route; - upSapCfg->sapPst.intfVer = 0; - upSapCfg->sapPst.event = 0; - upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgmSap[sapIdx].prior; - upSapCfg->suId = cfg->s.schInstCfg.rgmSap[sapIdx].suId; - upSapCfg->spId = cfg->s.schInstCfg.rgmSap[sapIdx].spId; - - break; - default: - /* would never reach here */ - break; - } - RETVALUE(ret); -} - - -/** - * @brief Scheduler instance Configuration Handler. - * - * @details - * - * Function : rgSCHLmmInstCfg - * - * This function in called by RgMiLrgSchCfgReq(). It handles the - * general and SAP configurations of the scheduler instance. It initializes - * the hash lists of rgSchCb. Returns - * reason for success/failure of this function. - * - * @param[in] RgCfg *cfg, the Configuaration information - * @return U16 - * -# LCM_REASON_NOT_APPL - * -# LCM_REASON_INVALID_MSGTYPE - * -# LCM_REASON_MEM_NOAVAIL - **/ -#ifdef ANSI -PUBLIC U16 rgSCHLmmInstCfg -( -RgCfg *cfg, /* Configuaration information */ -Inst dInst -) -#else -PUBLIC U16 rgSCHLmmInstCfg(cfg,dInst) -RgCfg *cfg; /* Configuaration information */ -Inst dInst; -#endif -{ - U16 ret = LCM_REASON_NOT_APPL; - Inst inst = (dInst - RGSCH_INST_START); - U8 idx; - - TRC2(rgSCHLmmInstCfg) - - /* Check if Instance Configuration is done already */ - if (rgSchCb[inst].rgSchInit.cfgDone == TRUE) - { - RETVALUE(LCM_REASON_INVALID_MSGTYPE); - } - if ((cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_TC) && - (cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_LC)) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg(): unsupported " - "Selector value for lmPst."); - RETVALUE(LCM_REASON_INVALID_PAR_VAL); - } - /* Update the Pst structure for LM interface */ - cmMemcpy((U8 *)&rgSchCb[inst].rgSchInit.lmPst, - (U8 *)&cfg->s.schInstCfg.genCfg.lmPst, - sizeof(Pst)); - - rgSchCb[inst].rgSchInit.inst = inst; - rgSchCb[inst].rgSchInit.lmPst.srcProcId = rgSchCb[inst].rgSchInit.procId; - rgSchCb[inst].rgSchInit.lmPst.srcEnt = rgSchCb[inst].rgSchInit.ent; - rgSchCb[inst].rgSchInit.lmPst.srcInst = rgSchCb[inst].rgSchInit.inst + - RGSCH_INST_START; - rgSchCb[inst].rgSchInit.lmPst.event = EVTNONE; - - rgSchCb[inst].rgSchInit.region = cfg->s.schInstCfg.genCfg.mem.region; - rgSchCb[inst].rgSchInit.pool = cfg->s.schInstCfg.genCfg.mem.pool; - rgSchCb[inst].genCfg.tmrRes = cfg->s.schInstCfg.genCfg.tmrRes; -#ifdef LTE_ADV - rgSchCb[inst].genCfg.forceCntrlSrbBoOnPCel = cfg->s.schInstCfg.genCfg.forceCntrlSrbBoOnPCel; - rgSchCb[inst].genCfg.isSCellActDeactAlgoEnable = cfg->s.schInstCfg.genCfg.isSCellActDeactAlgoEnable; -#endif - rgSchCb[inst].genCfg.startCellId = cfg->s.schInstCfg.genCfg.startCellId; - - /* allocate RGR saps */ - if (SGetSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data **)&rgSchCb[inst].rgrSap, - (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for " - "RGR saps failed"); - RETVALUE(RFAILED); - } - /* allocate RGM saps */ - if (SGetSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data **)&rgSchCb[inst].rgmSap, - (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for " - "RGM saps failed"); - RETVALUE(RFAILED); - } - - - /* allocate TFU saps */ - if (SGetSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data **)&rgSchCb[inst].tfuSap, - (sizeof(RgSchLowSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for TFU " - "saps failed"); - RETVALUE(RFAILED); - } - - /* allocate for bndCfmResponses */ - if (SGetSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data **)&rgSchCb[inst].genCfg.bndCfmResp, - (sizeof(RgSchLmResponse) * cfg->s.schInstCfg.numSaps)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for bind" - " confirm responses failed"); - RETVALUE(RFAILED); - } - -#ifdef LTE_ADV - rgSCHLaaInitEnbCb(&rgSchCb[inst]); -#endif - - rgSchCb[inst].numSaps = cfg->s.schInstCfg.numSaps; - for (idx = 0; idx < cfg->s.schInstCfg.numSaps; idx++) - { - /* Initialize SAP State and configure SAP */ - rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG; - rgSchCb[inst].rgrSap[idx].cell = NULLP; - rgSCHLmmSapCfg(dInst, cfg, idx, STRGRSAP); - - rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG; - rgSchCb[inst].rgmSap[idx].cell = NULLP; - rgSCHLmmSapCfg(dInst, cfg, idx, STRGMSAP); - - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG; - rgSchCb[inst].tfuSap[idx].cell = NULLP; - rgSCHLmmSapCfg(dInst, cfg, idx, STTFUSAP); - rgSchCb[inst].tfuSap[idx].numBndRetries = 0; - } - /* Initialzie the timer queue */ - cmMemset((U8 *)&rgSchCb[inst].tmrTq, 0, sizeof(CmTqType)*RGSCH_TQ_SIZE); - /* Initialize the timer control point */ - cmMemset((U8 *)&rgSchCb[inst].tmrTqCp, 0, sizeof(CmTqCp)); - rgSchCb[inst].tmrTqCp.tmrLen = RGSCH_TQ_SIZE; - - /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */ - /* Timer Registration request to SSI */ - if (SRegTmrMt(rgSchCb[inst].rgSchInit.ent, dInst, - (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg(): Failed to " - "register timer."); - RETVALUE(LCM_REASON_MEM_NOAVAIL); - } - - /* Set Config done in TskInit */ - rgSchCb[inst].rgSchInit.cfgDone = TRUE; - - RETVALUE(ret); -} - - -/*********************************************************** - * - * Func : rgSCHLmmShutdown - * - * - * Desc : Handles the scheduler instance shutdown request. Calls - * rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation. - * - * - * Ret : Void - * - * Notes: - * - * File : rg_sch_lmm.c - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHLmmShutdown -( -Inst inst -) -#else -PRIVATE Void rgSCHLmmShutdown(inst) -Inst inst; -#endif -{ - Inst dInst = inst + RGSCH_INST_START; - U8 idx; -#ifdef LTE_L2_MEAS - CmLList *lnk = NULLP; - RgSchCb *instCb = &rgSchCb[inst]; - RgSchCellCb *cell = NULLP; - RgSchL2MeasCb *measCb; - U8 ulAllocIdx; - RgSchCmnUlCell *cellUl; - RgSchClcBoRpt *bo = NULL; -#endif - - TRC2(rgSCHLmmShutdown) - -#ifdef LTE_L2_MEAS - for (idx = 0; idx < instCb->numSaps; idx++) - { - /* got the cell break the loop */ - cell = instCb->rgrSap[idx].cell; - if(cell != NULLP) - { - /* Free the memory held up by ulAllocInfo */ - cellUl = RG_SCH_CMN_GET_UL_CELL(cell); -#ifdef LTE_TDD - for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++) -#else - for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++) -#endif - { - if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\ - ulAllocInfo)), - cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc)); - } - } - /* Free the memory allocated to measCb */ - lnk = cell->l2mList.first; - while(lnk != NULLP) - { - measCb = (RgSchL2MeasCb *)lnk->node; - cmLListDelFrm(&cell->l2mList, lnk); - lnk = lnk->next; - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\ - sizeof(RgSchL2MeasCb)); - } - - /* Free mem if any present for boLst for common channels */ - for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++) - { - lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first; - while (lnk) - { - bo = (RgSchClcBoRpt *)(lnk->node); - lnk = lnk->next; - cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt); - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); - } - } - } - } -#endif - -#ifdef LTE_ADV - rgSCHLaaDeInitEnbCb(&rgSchCb[inst]); -#endif - for (idx = 0; idx < rgSchCb[inst].numSaps; idx++) - { - /* Unbind all the TFU SAP */ - if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) - { - rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND); - if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) - { - rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]); - } - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; - } - if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND) - { - rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND); - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; - } - /* Free the memory held by the cell associated with this SAP */ - if (rgSchCb[inst].tfuSap[idx].cell != NULLP) - rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell); - rgSchCb[inst].tfuSap[idx].cell = NULLP; - } - /* Free the memory held by the scheduler instance */ - /* Deallocate RGR saps */ - SPutSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data *)rgSchCb[inst].rgrSap, - (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps)); - rgSchCb[inst].rgrSap = NULLP; - /* Deallocate RGM saps */ - SPutSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data *)rgSchCb[inst].rgmSap, - (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps)); - rgSchCb[inst].rgmSap = NULLP; - - /* Deallocate TFU saps */ - SPutSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data *)rgSchCb[inst].tfuSap, - (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps)); - rgSchCb[inst].tfuSap = NULLP; - - /* Deallocate bndCfmResponses */ - SPutSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, - (Data *)rgSchCb[inst].genCfg.bndCfmResp, - (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps)); - rgSchCb[inst].genCfg.bndCfmResp = NULLP; - /* De-register the Timer Service */ - (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst, - (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr); - - /* call back the task initialization function to intialize - * the global rgSchCb[inst] Struct */ - schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.reason); - - /* Set Config done in TskInit */ - rgSchCb[inst].rgSchInit.cfgDone = FALSE; - - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHLmmGenCntrl - * - * - * Desc : Processes the LM control request for STGEN elmnt. - * - * - * Ret : Void - * - * Notes: - * - * File : rg_sch_lmm.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHLmmGenCntrl -( -RgMngmt *cntrl, -RgMngmt *cfm, -Pst *cfmPst -) -#else -PUBLIC Void rgSCHLmmGenCntrl(cntrl, cfm, cfmPst) -RgMngmt *cntrl; -RgMngmt *cfm; -Pst *cfmPst; -#endif -{ - Inst inst = (cfmPst->srcInst - RGSCH_INST_START); /* Scheduler instance ID */ - TRC2(rgSCHLmmGenCntrl) - - cfm->cfm.status = LCM_PRIM_OK; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - - - switch(cntrl->t.cntrl.action) - { - case AENA: - /* Action is Enable */ - switch(cntrl->t.cntrl.subAction) - { - case SAUSTA: - /* Enable Unsolicited Status (alarms) */ - rgSchCb[inst].rgSchInit.usta = TRUE; - /*Store the response and TransId for sending the Alarms */ - cmMemcpy((U8 *)&rgSchCb[inst].genCfg.ustaResp.response, - (U8 *)&cntrl->hdr.response, sizeof(Resp)); - rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId; - break; - case SADBG: - /* Enable Debug Printing */ -#ifdef DEBUGP - rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask; -#endif - break; -#ifdef PHY_ERROR_LOGING - case SAELMNT: - { - rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs; - rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb; - rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart; - rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart; - rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog; - rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime; - rgSchUlAllocCntr.crcOk = 0; - rgSchUlAllocCntr.crcErr = 0; - rgSchUlAllocCntr.numUlPackets = 0; - rgSchUlAllocCntr.numPrach = 0; - rgSchUlAllocCntr.taZero = 0; -#ifdef MAC_SCH_STATS - /* Reset - * L2 - * statistics - * */ - cmMemset((U8 *)&hqRetxStats, 0, sizeof(RgSchHqRetxStats)); - cmMemset((U8 *)&hqFailStats, 0, sizeof(RgSchNackAckStats)); -#endif - break; - } -#endif - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): " - "invalid subaction=%d", cntrl->t.cntrl.subAction); - break; - } - break; - case ADISIMM: - /* Action is Diable immidiately */ - switch(cntrl->t.cntrl.subAction) - { - case SAUSTA: - /* Disable Unsolicited Status (alarms) */ - rgSchCb[inst].rgSchInit.usta = FALSE; - break; - case SADBG: - /* Disable Debug Printing */ -#ifdef DEBUGP - rgSchCb[inst].rgSchInit.dbgMask &=\ - ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask; -#endif - break; - - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl():" - " invalid subaction=%d", cntrl->t.cntrl.subAction); - break; - } - break; - case ASHUTDOWN: - /* Free all the memory dynamically allocated by MAC */ - rgSCHLmmShutdown(inst); - break; - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): invalid" - " action=%d", cntrl->t.cntrl.action); - break; - } - RgMiLrgSchCntrlCfm(cfmPst, cfm); - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHLmmSapCntrl - * - * - * Desc : Processes the LM control request for STxxxSAP elmnt. - * - * - * Ret : Void - * - * Notes: - * - * File : rg_sch_lmm.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHLmmSapCntrl -( -RgMngmt *cntrl, -RgMngmt *cfm, -Pst *cfmPst -) -#else -PUBLIC Void rgSCHLmmSapCntrl(cntrl, cfm, cfmPst) -RgMngmt *cntrl; -RgMngmt *cfm; -Pst *cfmPst; -#endif -{ - U8 idx; - - /* TODO Pass InstId instead of using InstId from cfmPst */ - Inst inst = (cfmPst->srcInst - RGSCH_INST_START); /* Scheduler instance Id */ - TRC2(rgSCHLmmSapCntrl) - - /* Only TFU SAP can be controlled by LM */ - switch(cntrl->hdr.elmId.elmnt) - { - case STTFUSAP: - idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.suId; - if (idx > LRG_MAX_SAPS_PER_INST) - { - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_SAP; - } - switch(cntrl->t.cntrl.action) - { - case ABND: - /* Bind Enable Request */ - if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) || - (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)) - { - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_SAP; - } - else - { - if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) - { - rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR, - rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val, - (PTR)&rgSchCb[inst].tfuSap[idx]); - } - /* Change SAP state */ - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM; - rgSchCb[inst].tfuSap[idx].numBndRetries++; - /* Store the response and TransId for sending - * the Control confirm */ - cmMemcpy((U8 *)&rgSchCb[inst].genCfg.bndCfmResp[idx].response, - (U8 *)&cntrl->hdr.response, sizeof(Resp)); - rgSchCb[inst].genCfg.bndCfmResp[idx].transId = - cntrl->hdr.transId; - - cfm->cfm.status = LCM_PRIM_OK_NDONE; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - - /* Sending Control Confirm before sending Bind - * Request to TFU */ - RgMiLrgSchCntrlCfm(cfmPst, cfm); - - rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId, - rgSchCb[inst].tfuSap[idx].sapCfg.spId); - RETVOID; - } - break; - case AUBND: - /* Unbind request */ - - /* Check if the SAP is configured */ - if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) || - (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND)) - { - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE; - } - else - { - rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, - TFU_UBNDREQ_MNGMT); - if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) - { - rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, - (PTR)&rgSchCb[inst].tfuSap[idx]); - } - /* Change SAP state */ - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; - cfm->cfm.status = LCM_PRIM_OK; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - } - break; - case ADEL: - /* Delete SAP, does initialization of SAP */ - if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) || - (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)) - { - rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, - TFU_UBNDREQ_MNGMT); - if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) - { - rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, - (PTR)&rgSchCb[inst].tfuSap[idx]); - } - } - cmMemset((U8 *)&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb)); - rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG; - cfm->cfm.status = LCM_PRIM_OK; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - break; - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " - "invalid action=%d", cntrl->t.cntrl.action); - break; - } - break; - case STRGRSAP: - idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId; - if (idx > LRG_MAX_SAPS_PER_INST) - { - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_SAP; - } - switch(cntrl->t.cntrl.action) - { - case ADEL: - cmMemset((U8 *)&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb)); - rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG; - cfm->cfm.status = LCM_PRIM_OK; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - break; - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " - "invalid action=%d", cntrl->t.cntrl.action); - break; - } - break; - case STRGMSAP: - idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId; - if (idx > LRG_MAX_SAPS_PER_INST) - { - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_SAP; - } - switch(cntrl->t.cntrl.action) - { - case ADEL: - cmMemset((U8 *)&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb)); - rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG; - cfm->cfm.status = LCM_PRIM_OK; - cfm->cfm.reason = LCM_REASON_NOT_APPL; - break; - default: - cfm->cfm.status = LCM_PRIM_NOK; - cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " - "invalid action=%d", cntrl->t.cntrl.action); - break; - } - break; - - default: - /* Would never come here. */ - RETVOID; - } - RgMiLrgSchCntrlCfm(cfmPst, cfm); - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHLmmFillCfmPst - * - * - * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst - * and the cfm->hdr.response. - * - * - * Ret : Void - * - * Notes: - * - * File : rg_sch_lmm.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHLmmFillCfmPst -( -Pst *reqPst, -Pst *cfmPst, -RgMngmt *cfm -) -#else -PUBLIC Void rgSCHLmmFillCfmPst(reqPst, cfmPst, cfm) -Pst *reqPst; -Pst *cfmPst; -RgMngmt *cfm; -#endif -{ - Inst inst; - - TRC2(rgSCHLmmFillCfmPst) - - inst = (reqPst->dstInst - RGSCH_INST_START); - - cfmPst->srcEnt = rgSchCb[inst].rgSchInit.ent; - cfmPst->srcInst = rgSchCb[inst].rgSchInit.inst + RGSCH_INST_START; - cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId; - cfmPst->dstEnt = reqPst->srcEnt; - cfmPst->dstInst = reqPst->srcInst; - cfmPst->dstProcId = reqPst->srcProcId; - - cfmPst->selector = cfm->hdr.response.selector; - cfmPst->prior = cfm->hdr.response.prior; - cfmPst->route = cfm->hdr.response.route; - cfmPst->region = cfm->hdr.response.mem.region; - cfmPst->pool = cfm->hdr.response.mem.pool; - - RETVOID; -} - - -/** - * @brief Timer start handler. - * - * @details - * - * Function : rgSCHLmmStartTmr - * - * This function based on the input parameters starts the timer for - * "tmrVal" duration. As of now scheduler instance uses the timer - * functionality for BndReq only. Hence there is no conditional - * code based on "tmrEvnt". - * - * @param[in] S16 tmrEvnt, the Timer Event - * @param[in] U32 tmrVal, the Wait Time - * @param[in] PTR cb, Entry for which Timer expired - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHLmmStartTmr -( -Inst inst, -S16 tmrEvnt, /* Timer Event */ -U32 tmrVal, /* Wait Time */ -PTR cb /* Entry for which Timer Expired */ -) -#else -PUBLIC S16 rgSCHLmmStartTmr(inst, tmrEvnt, tmrVal, cb) -Inst inst; /* scheduler instance ID */ -S16 tmrEvnt; /* Timer Event */ -U32 tmrVal; /* Wait Time */ -PTR cb; /* Entry for which Timer Expired */ -#endif -{ - CmTmrArg arg; -/* Inst dInst = inst + RGSCH_INST_START; */ - - TRC2(rgSCHLmmStartTmr) - - UNUSED(tmrEvnt); - - /* Initialize the arg structure */ - cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg)); - - arg.tqCp = &rgSchCb[inst].tmrTqCp; - arg.tq = rgSchCb[inst].tmrTq; - arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk; - arg.cb = cb; - arg.tNum = 0; - arg.max = RGSCH_MAX_TIMER; - arg.evnt = RGSCH_BNDREQ_TMR; - arg.wait = tmrVal; - cmPlcCbTq(&arg); - - RETVALUE(ROK); -} - - -/** - * @brief Timer stop handler. - * - * @details - * - * Function : rgSCHLmmStopTmr - * - * This function based on the input parameters stops the timer for - * "tmrEvnt". As of now Scheduler instance uses the timer functionality for - * BndReq only. Hence there is no conditional code based on "tmrEvnt". - * Once the bind happens and this timer is stopped, the timer functionality - * is deregistered with SSI. As there is no further use of timer processing. - * - * @param[in] S16 tmrEvnt, the Timer Event - * @param[in] PTR cb, Entry for which Timer expired - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHLmmStopTmr -( -Inst inst, /* Scheduler instance */ -S16 tmrEvnt, /* Timer Event */ -PTR cb /* Entry for which Timer Expired */ -) -#else -PUBLIC S16 rgSCHLmmStopTmr(inst, tmrEvnt, cb) -Inst inst; /* Scheduler instance */ -S16 tmrEvnt; /* Timer Event */ -PTR cb; /* Entry for which Timer Expired */ -#endif -{ - CmTmrArg arg; - U8 i; - S16 ret; - - TRC2(rgSCHLmmStopTmr) - - ret = RFAILED; - - for(i=0;itmrBlk.tmrEvnt == tmrEvnt) - { - /* Initialize the arg structure */ - cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg)); - - arg.tqCp = &rgSchCb[inst].tmrTqCp; - arg.tq = rgSchCb[inst].tmrTq; - arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk); - arg.cb = cb; - arg.max = RGSCH_MAX_TIMER; - arg.evnt = tmrEvnt; - - arg.tNum = i; - cmRmvCbTq(&arg); - ret = ROK; - break; - } - - } - - - RETVALUE(ret); -} - - -/** - * @brief Timer Expiry handler. - * - * @details - * - * Function : rgSCHLmmTmrExpiry - * - * This is a callback function used as an input parameter to cmPrcTmr() - * to check expiry of any timer. In this function, we are only concerned - * about tmrEvnt=Bind timer. - * - * @param[in] PTR cb, Entry for which Timer expired - * @param[in] S16 tmrEvnt, the Timer Event - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHLmmTmrExpiry -( -PTR cb, /* Pointer to timer control block */ -S16 tmrEvnt /* Timer Event */ -) -#else -PUBLIC S16 rgSCHLmmTmrExpiry(cb,tmrEvnt) -PTR cb; /* Pointer to timer control block */ -S16 tmrEvnt; /* Timer Event */ -#endif -{ - S16 ret = ROK; - RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb; -#ifdef DEBUGP - Inst inst = tfuSap->cell->instIdx; -#endif - TRC2(rgSCHLmmTmrExpiry) - - - switch(tmrEvnt) - { - case RGSCH_BNDREQ_TMR: - tfuSap->numBndRetries++; - if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY) - { - rgSCHLmmStaInd((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START), - (U16)LCM_CATEGORY_INTERFACE, (U16)LCM_EVENT_BND_FAIL, - (U16)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP); - } - else - { - /* Restart the bind timer */ - if (tfuSap->sapCfg.bndTmr.enb == TRUE) - { - ret = rgSCHLmmStartTmr((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START), - RGSCH_BNDREQ_TMR, - (U32)tfuSap->sapCfg.bndTmr.val, cb); - } - - /* Send bind request */ - rgSCHUtlTfuBndReq((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START), - tfuSap->sapCfg.suId, tfuSap->sapCfg.spId); - } - break; - default: - RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmTmrExpiry(): Invalid" - " tmrEvnt=%d", tmrEvnt); - ret = RFAILED; - break; - } - RETVALUE(ret); -} - - -/** - * @brief Layer Manager Control Confirm generation handler - * for Bind Confirm reception at TFU interface. - * RgLiTfuBndCfm() forwards the confirmation to this - * function. All SAP state related handling is restricted - * to LMM modules, hence the cfm forwarding. - * - * @details - * - * Function : rgSCHLmmBndCfm - * - * This API is used by the LIM module of MAC to forward - * the Bind Confirm it receives over the TFU interface. - * - * @param[in] Pst *pst, Post Structure - * @param[in] SuId suId, Service user ID - * @param[in] U8 status, Status - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHLmmBndCfm -( -Pst *pst, /* Post Structure */ -SuId suId, /* Service user ID */ -U8 status /* Status */ -) -#else -PUBLIC S16 rgSCHLmmBndCfm(pst,suId,status) -Pst *pst; /* Post Structure */ -SuId suId; /* Service user Id */ -U8 status; /* Status */ -#endif -{ - S16 ret = ROK; - RgMngmt cntrlCfm; - Pst cfmPst; - Inst inst = (pst->dstInst - RGSCH_INST_START); /* scheduler instance */ - - TRC2(rgSCHLmmBndCfm) - - - /* check the SAP State */ - switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState) - { - case LRG_WAIT_BNDCFM: - break; - case LRG_BND: - /* SAP is already bound */ - RETVALUE(ROK); - default: - RETVALUE(RFAILED); - } - - cfmPst = rgSchCb[inst].rgSchInit.lmPst; - cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector; - cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior; - cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route; - cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region; - cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool; - - cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt)); - - switch(status) - { - case CM_BND_OK: /* status is OK */ - /* Change SAP state to Bound */ - rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND; - if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE) - { - ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]); - } - /* Send Control Confirm with status as OK to Layer Manager */ - cntrlCfm.cfm.status = LCM_PRIM_OK; - cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL; - /* Sending Status Indication to Layer Manager */ - rgSCHLmmStaInd((U8)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START), - LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK, - LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP); - break; - - default: - /* Change SAP state to UnBound */ - rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND; - if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE) - { - ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]); - } - /* Send Control Confirm with status as NOK to Layer Manager */ - cntrlCfm.cfm.status = LCM_PRIM_NOK; - cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM; - break; - } - rgSchCb[inst].tfuSap[suId].numBndRetries = 0; - cntrlCfm.hdr.elmId.elmnt = STTFUSAP; - cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId; - - ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm); - - RETVALUE(ret); -} - -/** - * @brief Layer Manager Unsolicited Status Indication generation. - * - * @details - * - * Function : rgSCHLmmStaInd - * - * This API is used by the other modules of MAC to send a unsolicited - * status indication to the Layer Manager. - * - * @param[in] U16 category, the Alarm category - * @param[in] U16 event, the Alarm event - * @param[in] U16 cause, the cause of the Alarm - * @param[in] RgUstaDgn *dgn, Alarm Diagonostics - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHLmmStaInd -( -Inst inst, -U16 category, -U16 event, -U16 cause, -RgUstaDgn *dgn -) -#else -PUBLIC S16 rgSCHLmmStaInd(inst, category, event, cause, dgn) -Inst inst; -U16 category; -U16 event; -U16 cause; -RgUstaDgn *dgn; -#endif -{ - RgMngmt usta; - - TRC2(rgSCHLmmStaInd) - - if(rgSchCb[inst].rgSchInit.usta == FALSE) - { - RETVALUE(ROK); - } - - cmMemset((U8 *)&usta, 0, sizeof(RgMngmt)); - - SGetDateTime(&usta.t.usta.cmAlarm.dt); - usta.t.usta.cmAlarm.category = category; - usta.t.usta.cmAlarm.event = event; - usta.t.usta.cmAlarm.cause = cause; - if (dgn != NULLP) - { - cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn)); - } - - rgSchCb[inst].rgSchInit.lmPst.selector = - rgSchCb[inst].genCfg.ustaResp.response.selector; - rgSchCb[inst].rgSchInit.lmPst.prior = - rgSchCb[inst].genCfg.ustaResp.response.prior; - rgSchCb[inst].rgSchInit.lmPst.route = - rgSchCb[inst].genCfg.ustaResp.response.route; - rgSchCb[inst].rgSchInit.lmPst.region = - rgSchCb[inst].genCfg.ustaResp.response.mem.region; - rgSchCb[inst].rgSchInit.lmPst.pool = - rgSchCb[inst].genCfg.ustaResp.response.mem.pool; - usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId; - - RETVALUE(RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta)); -} - - -/** - * @brief Scheduler instance timer call back function registered with SSI. - * - * @details - * - * Function : schActvTmr - * - * This function is invoked by SSI for every timer activation - * period expiry. Note that SS_MT_TMR flag needs to be enabled for this - * as isntId is needed.As part of SRegTmr call for scheduler instance - * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as - * callback function - * - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 schActvTmr -( -Ent ent, -Inst inst -) -#else -PUBLIC S16 schActvTmr(ent, inst) -Ent ent; -Inst inst; -#endif -{ - Inst schInst = (inst - RGSCH_INST_START); - TRC2(schActvTmr) - - /* Check if any timer in the scheduler instance has expired */ - cmPrcTmr(&rgSchCb[schInst].tmrTqCp, - rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry); - - RETVALUE(ROK); - -} /* end of schActvTmr */ - - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_tom.c b/src/5gnrmac/rg_sch_tom.c deleted file mode 100755 index f3ae5fac1..000000000 --- a/src/5gnrmac/rg_sch_tom.c +++ /dev/null @@ -1,8877 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch_tom.c - -**********************************************************************/ - -/** @file rg_sch_tom.c -@brief This module does processing related to handling of lower interface APIs -invoked by PHY towards scheduler. -*/ -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=228; -static int RLOG_MODULE_ID=4096; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system services */ -#include "cm5.h" /* common timers defines */ -#include "cm_hash.h" /* common hash list defines */ -#include "cm_llist.h" /* common linked list defines */ -#include "cm_mblk.h" /* memory management */ -#include "cm_tkns.h" /* common tokens */ -#include "cm_lte.h" /* common tokens */ -#include "tfu.h" /* RGU defines */ -#include "lrg.h" /* layer management defines for LTE-MAC */ -#include "rgr.h" /* layer management defines for LTE-MAC */ -#include "rgm.h" /* layer management defines for LTE-MAC */ -#include "rg_env.h" /* defines and macros for MAC */ -#include "rg_sch_err.h" /* defines and macros for MAC */ -#include "rg_sch_inf.h" /* defines and macros for MAC */ -#include "rg_sch.h" /* defines and macros for MAC */ -#include "rg_sch_cmn.h" /* typedefs for MAC */ -#include "rl_interface.h" -#include "rl_common.h" - - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* RGU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for MAC */ -#include "rg_sch_cmn.x" /* typedefs for MAC */ -#ifdef EMTC_ENABLE -#include "rg_sch_emtc_ext.x" -#endif -/* local defines */ -#ifdef EMTC_ENABLE -EXTERN Bool rgSCHEmtcChkEmtcUe ARGS( -( -RgSchCellCb *cell, -U16 rapId -)); -EXTERN Void rgSchTomTtiEmtcSched ARGS( -( - RgSchCellCb *cell -)); - -EXTERN S16 rgSCHEmtcRamVldtProcRaReq -( -U8 raRntiCnt, -U8 raReqCnt, -RgSchCellCb *cell, -TfuRaReqIndInfo *raReqInd, -RgSchUeCb *ue, -Bool *isEmtcUe, -RgSchErrInfo *err -); -EXTERN Void rgSCHEmtcUpdCqiInfo -( -RgSchUeCb *ue, -RgSchUePCqiCb *cqiCb, -U16 *cqiIdx -); -EXTERN Void rgSCHEmtcUpdSRInfo -( -RgSchUeCb *ue, -U16 *srIdx -); -EXTERN Void rgSCHCmnEmtcHdlCrcFailInd -( -RgSchCellCb *cell, -RgSchRaCb *raCb -); -EXTERN S16 rgSCHEmtcTomUtlProcAtCrc -( -RgSchCellCb *cell, -CmLteTimingInfo crntHiDci0Frm, -TfuCntrlReqInfo *cntrlInfo, -RgSchErrInfo *err -); -EXTERN Void rgSCHEmtcInitUeRecpReqLst -( -TfuRecpReqInfo *recpReqInfo -); -EXTERN Void rgSCHEmtcFillPucchRecpInfo -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqCb, -U16 *hqRes -); -EXTERN Bool rgSCHEmtcAddRecpInfoToLst -( -RgSchDlHqProcCb *hqCb, -TfuRecpReqInfo *recpReqInfo, -TfuUeRecpReqInfo *pucchRecpInfo, -Bool isEmtcUe -); -EXTERN Void rgSCHEmtcWillUeRptCqi -( -RgSchUeCb *ue, -Bool *willUeRprtCqi -); -EXTERN Void rgSchEmtcTomTtiCnsldtSfAlloc -( -RgSchCellCb *cell -); - -EXTERN S16 rgSchEmtcTomTtiL1DlAndUlCfg -( -RgSchCellCb *cell, -RgTfuCntrlReqInfo *cntrlInfo -); - -EXTERN S16 rgSCHTomEmtcUtlFillDatRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err -); - -EXTERN S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err -); - -EXTERN S16 rgSCHEmtcDhmRlsDlsfHqProc -( -RgSchCellCb *cell, -CmLteTimingInfo timingInfo -); - -EXTERN Void rgSCHEmtcCmnUlSch -( - RgSchCellCb *cell -); - -#ifdef RG_ULSCHED_AT_CRC -EXTERN S16 rgSCHEmtcTomUtlProcDlSfAtCrc -( -RgSchEmtcDlSf *ulSf, -CmLteTimingInfo crntUlFrm, -RgSchCellCb *cell, -TfuCntrlReqInfo *cntrlInfo, -RgSchErrInfo *err -); - -EXTERN RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet -( -RgSchCellCb *cell, -CmLteTimingInfo frm -); -#endif - -EXTERN U32 gDlMpdcchBlank; -EXTERN U32 gUlMpdcchBlank; -EXTERN S16 rgSCHUtlIotResPrcTti -( -RgSchCellCb *cell -); - -#endif - -EXTERN RgSchUeCb* rgSCHCmnGetHoUe -( -RgSchCellCb *cell, -U16 rapId -); -EXTERN RgSchUeCb* rgSCHCmnGetPoUe -( -RgSchCellCb *cell, -U16 rapId, -CmLteTimingInfo timingInfo -); -PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq ARGS( -( - RgSchCellCb *cell, - U8 cqiReq, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - )); - -PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq ARGS( -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - )); - -PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS( -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - )); - -PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq ARGS( -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres - )); - - -#ifdef CA_DBG -EXTERN U32 delayedApiCnt; -U32 gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0; -U32 gSCellSchedCount=0,gPrimarySchedCount=0; -U32 gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0; -U32 gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0; -U32 gHqFdbkCount = 0; - - - -U32 gCqiRecpCount = 0; -U32 gCqiRecpPuschCount = 0; -U32 gCqiRcvdCount = 0; -Bool gF1bCsPres = FALSE; -U32 gRiReqCount = 0; -U32 gCqiReqCount = 0; -U32 gF1bCsCount = 0; -U32 gACqiRcvdCount = 0; -U32 gCqiReptToAppCount = 0; -U32 gRawACqiCount= 0; -U32 gCqiDropCount,gPucchDropCount; -U32 gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount; -U32 gDci0Count = 0; -U32 gUlCrcFailCount = 0; -U32 gUlCrcPassCount = 0; -U32 gPuschCqiDropCount = 0; -U32 gCaDbgCaFrmt = 0; -U32 gCaDbgNonCaFrmt = 0; -U32 gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0; -#endif - -#ifdef EMTC_ENABLE -U32 gUlCrcFailCounter = 0; -U32 gUlCrcPassCounter = 0; -#endif - -#ifdef RG_5GTF -EXTERN U32 gUl5gtfPdcchSend; -PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS( -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - )); -#endif - - -/* local typedefs */ -PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */ -PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */ - -/* local externs */ -/* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI - * processing */ -#ifdef LTE_L2_MEAS - U64 glblTtiCnt = 0; -#endif -U32 ri1Cnt ; -U32 ri2Cnt ; -U32 gDlNumUePerTti[20] = {0}; -U32 gUlNumUePerTti[20] = {0}; -PRIVATE S16 rgSCHTomUtlProcDlSf ARGS(( - RgSchDlSf *dlSf, - RgSchDlSf *ulSf, - RgSchCellCb *cell, - RgTfuCntrlReqInfo *cntrlInfo, - RgSchErrInfo *err)); -#ifdef RG_ULSCHED_AT_CRC -PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS(( - RgSchDlSf *ulSf, - CmLteTimingInfo crntUlFrm, - RgSchCellCb *cell, - TfuCntrlReqInfo *cntrlInfo, - RgSchErrInfo *err)); -#endif /* RG_ULSCHED_AT_CRC */ -#ifdef LTE_TDD -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS(( - RgSchCellCb *cell, - RgSchErrInfo *err)); -#endif /* TFU_UPGRADE */ -#endif -PRIVATE S16 rgSCHTomUtlFillPhich ARGS(( - RgSchCellCb *cell, - TfuCntrlReqInfo *cntrlInfo, - RgSchDlSf *dlSf, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS(( - RgSchCellCb *cell, - TfuCntrlReqInfo *cntrlInfo, - RgSchDlSf *dlSf, - RgSchErrInfo *err)); -PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS(( - RgSchCellCb *cell, - TfuCntrlReqInfo *cntrlInfo, - RgSchDlSf *ulSf, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlProcTA ARGS(( - RgSchCellCb *cell)); -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - RgSchErrInfo *err)); -#endif -#ifdef TFU_UPGRADE - -PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS -(( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo - )); - -PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS -(( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuRecpReqInfo *recpReqInfo, - TfuUeRecpReqInfo *pucchRecpInfo, - U16 validIdx - )); - -PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS -(( - RgSchCellCb *cell, - TfuRecpReqInfo *recpReqInfo, - RgSchUeCb *ue, - TfuUeRecpReqInfo *pucchRecpInfo, - U16 validIdx, - Bool isDatPresOnSecCell - )); - -PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS -(( - RgSchUeCb *ueCb -)); - -PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS -(( -RgSchUeCb *ueCb, -U8 numTxAnt, -U8 *ri -)); - -PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS -(( -RgSchUeCb *ueCb, -TfuCqiPucchMode21 *mode21Info, -U8 numTxAnt, -U8 *ri -)); - -PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -U16 validIdx -)); - -PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchUePCqiCb *cqiCb -)); - -PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchUePCqiCb *riCb -)); - -PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); - -PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS -(( -RgSchCellCb *cell, -RgSchUeCb *ue -)); - -PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS -(( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - TfuRecpReqInfo *recpReqInfo - )); - -PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS(( - RgSchUeCb *ue, - Bool *willueRprtCqiRii)); - -PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); - -PRIVATE S16 rgSCHTomUtlGenIndices ARGS(( - U32 label, - U8 posM, - U8 valN, - U8 valK, - TfuSubbandInfo* sbInfo)); - -#endif -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err)); -#else -PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS(( - TfuRecpReqInfo *recpReq, - RgSchCellCb *cell, - RgSchErrInfo *err)); -#endif - -#ifdef LTE_TDD -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS(( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - U16 validIdx - )); -#else -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS(( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf - )); -#endif -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS(( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - U16 validIdx - )); -#else -PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS(( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf - )); -#endif - -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS(( - RgSchDlHqProcCb *hqCb, - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cellCb, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - CmLteRnti rnti, - RgrTddAckNackMode ackNackMode, - RgSchUePucchRecpInfo **pucchInfoRef, - RgSchPdcch *pdcch, - TknU16 n1PucchTkn, - Bool *allocRef, - U8 hqSz - )); -#endif -#ifdef LTEMAC_SPS -EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell); -#ifndef LTE_TDD -#ifdef TFU_UPGRADE -PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS -(( - RgSchCellCb *cell, - RgSchDlSf *dlSf, - TfuRecpReqInfo *recpReqInfo, - U16 validIdx, - RgSchErrInfo *err - )); -#else - PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS -(( - RgSchCellCb *cell, - RgSchDlSf *dlSf, - TfuRecpReqInfo *recpReqInfo, - RgSchErrInfo *err - )); -#endif -#endif -#endif - -PRIVATE Void rgSchTomTtiMiscFunctions ARGS -(( -RgSchCellCb *cell -)); - -PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS -(( -RgSchCellCb *cell -)); - -PRIVATE Void rgSchTomTtiDlSch ARGS -(( -RgSchCellCb *cell -)); - -PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS -(( -RgSchCellCb *cell -)); - -PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS -(( -RgSchCellCb *cell, -RgTfuCntrlReqInfo *cntrlInfo -)); - -#ifdef RGR_RRM_TICK -PRIVATE Void rgSCHTomUtlSendSfnTick ARGS -(( -RgSchCellCb *cell -)); -#endif - -PRIVATE Void rgSchTomFillCellTtiInfo ARGS -(( -TfuTtiIndInfo *ttiInd, -Inst schInst, -U8 *nCell, -RgSchCellCb *cells[] -)); -#ifdef LTE_TDD -PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS -(( -RgSchCellCb *cell -)); -PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS -(( -RgSchCellCb *cell -)); -#ifdef LTE_ADV -PRIVATE Void rgSCHTomUtlGethqRes ARGS -(( -U8 noFdbks, -RgSchDlSf *dlSf, -RgSchPdcch *pdcch, -RgSchCellCb *cellCb, -U16 *hqRes -)); -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS -(( - RgSchDlHqProcCb *hqCb, - TfuUePucchRecpReq *hqRecpReq, - U8 noFdbks, - RgSchDlSf *dlSf, - RgSchPdcch *pdcch, - RgSchCellCb *cellCb -)); -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS -(( - RgSchDlHqProcCb *hqCb, - TfuUePucchRecpReq *hqRecpReq, - U8 noFdbks, - RgSchDlSf *dlSf, - RgSchPdcch *pdcch, - RgSchCellCb *cellCb, - U8 elemIdx -)); -#endif/*LTE_ADV*/ -#endif/*LTE_TDD*/ - -PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt; - -#ifdef RG_5GTF -U32 rgSch5gtfCqi2Mcs[15] = - {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; -#endif -/* forward references */ -#ifdef TFU_UPGRADE -/*HARQ Feedback interpretation in accordance with Femto Forum. -Note: There is no value as '0' in Femto Forum Spec but in order to retain -the existing usage in MAC (and its Acceptance), its being considered*/ -CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4}; -/*added #defines instead of magic numbers*/ -CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={ -{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28}, -{0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378}, -{0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,1330,1540,1771,2024,2300,2600,2925,3276}, -{0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060,3876,4845,5985,7315,8855,10626,12650,14950,17550,20475}, -{0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568,11628,15504,20349,26334,33649,42504,53130,65780,80730,98280}, -{0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564,27132,38760,54264,74613,100947,134596,177100,230230,296010,376740} -}; - - -/*ccpu00116923 - ADD - SRS present support*/ -/*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */ -/* Table 5.5.3.3-1 */ -#ifndef LTE_TDD -CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = { - {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE}, - {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE}, - {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE}, - {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE}, - {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, - {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE}, - {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE}, - {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE}, - {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE}, - {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, - {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, - {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, - {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, - {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE}, - {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE}, - {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE} -}; -#else -/* Table 5.5.3.3-2 */ -CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = { - {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, - {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE}, - {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE}, - {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE}, - {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE}, - {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE}, - {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE}, - {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE}, - {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, - {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, - {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE}, - {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE}, - {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE}, - {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE}, - {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, - {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE} -}; -#endif -PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4}; -PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1}; -#endif - -/** - * @brief get Ue for dedicated preamble rach - * - * @details - * - * Function: rgSCHGetDedPrmUe - * - * Invoked by: rgSCHTomRaReqInd - * - * @param[in] RgSchCellCb *cell - * @param[in] TfuRaReqIndInfo *raReqInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHGetDedPrmUe -( -RgSchCellCb *cell, -U16 rapId, -CmLteTimingInfo timingInfo, -RgSchUeCb **ue -) -#else -PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue) -RgSchCellCb *cell; -U16 rapId; -CmLteTimingInfo timingInfo; -RgSchUeCb **ue; -#endif -{ - RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); - - printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm); - /* Finding UE in handOver List */ - if ((rapId < cellSch->rachCfg.dedPrmStart) || - (rapId > cellSch->rachCfg.dedPrmStart + - cellSch->rachCfg.numDedPrm - 1)) - { - /* This ded Preamble corresponds to handover */ - *ue = rgSCHCmnGetHoUe(cell, rapId); - printf(" his ded Preamble corresponds to hando\n"); - } - else/* Finding UE from PDCCH Order Mappings */ - { - /* Get the UE which has transmitted this RaReq */ - *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo); - printf(" ==== inding UE from PDCCH Order Mapping\n"); - } - RETVALUE(ROK); -} -/** - * @brief Handler for processing Random Access request indication - * recieved from PHY. - * - * @details - * - * Function: rgSCHTomRaReqInd - * - * Handler for processing Random Access request indication recieved from - * PHY. - * - * Invoked by: RgLiTfuRaReqInd of LIM - * - * Processing Steps: - * - Validate the information received: cellId value and raRnti values - * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd) - * - * @param[in] RgSchCellCb *cell - * @param[in] TfuRaReqIndInfo *raReqInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomRaReqInd -( -RgSchCellCb *cell, -TfuRaReqIndInfo *raReqInd -) -#else -PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd) -RgSchCellCb *cell; -TfuRaReqIndInfo *raReqInd; -#endif -{ - S16 ret; - U8 raRntiCnt; - U8 raReqCnt; - RgSchErrInfo err; - Bool isEmtcUe = FALSE; - U16 rapId; - RgSchUeCb *ue = NULLP; - - TRC2(rgSCHTomRaReqInd); - - if(cell->cellId != raReqInd->cellId) - { - err.errType = RGSCHERR_TOM_RAREQIND; - err.errCause = RGSCHERR_TOM_INV_CELL_ID; - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)" - " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause); - RETVALUE(RFAILED); - } - - for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++) - { - for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++) - { - rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId; - - if(RGSCH_IS_DEDPRM(cell, rapId)) - { - rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue); - if(NULLP == ue) - { - /* Since rapId is within dedicated range and No ue context - * is found means it is a spurious rach. So ignore it.*/ - continue; - } - } - - if(FALSE == isEmtcUe) - { -#if (ERRCLASS & ERRCLS_DEBUG) - if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI) - { - RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013, - (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti, - ("rgSCHTomRaReqInd(): raRnti is out of range\n")); - continue; - } -#endif - ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti, - (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt], - raReqInd->timingInfo, ue, &err); - if(ret == RFAILED) - { - err.errType = RGSCHERR_TOM_RAREQIND; - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, - "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) " - "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti, - err.errType, err.errCause); - continue; - } - } - } - } - RETVALUE(ROK); -} /* rgSCHTomRaReqInd */ - - -/** - * @brief Handler for processing uplink CQI indication recieved from PHY. - * - * @details - * - * Function: rgSCHTomUlCqiInd - * - * Handler for processing uplink CQI indication recieved from PHY. - * - * Invoked by: RgLiTfuUlCqiInd - * - * Processing Steps: - * - Gets UE - * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd - * - * @param[in] RgSchCellCb *cell - * @param[in] TfuUlCqiIndInfo *ulCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUlCqiInd -( -RgSchCellCb *cell, -TfuUlCqiIndInfo *ulCqiInd -) -#else -PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd) -RgSchCellCb *cell; -TfuUlCqiIndInfo *ulCqiInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuUlCqiRpt *ulCqiInfo; - TRC2(rgSCHTomUlCqiInd); - - node = ulCqiInd->ulCqiRpt.first; - if(cell->cellId != ulCqiInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)", - ulCqiInd->cellId); - RETVALUE(RFAILED); - } - - for (;node; node=node->next) - { - ulCqiInfo = (TfuUlCqiRpt *)node->node; -#if (ERRCLASS & ERRCLS_DEBUG) - if(ulCqiInfo->numSubband == 0) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is" - "out of range RNTI:%d",ulCqiInfo->rnti); - continue; - } -#endif - if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP) - { -#ifdef LTEMAC_SPS - if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get " - "the ue for RNTI:%d", ulCqiInfo->rnti); - continue; - } - } - /* wideband cqi is directly reported now. and also isTxPort0 */ - rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo); - } - RETVALUE(ROK); -} /* rgSCHTomUlCqiInd */ - -/** - * @brief Handler for processing PUCCH power adjustment indication - * - * @details - * - * Function: rgSCHTomPucchDeltaPwrInd - * - * Handler for processing PUCCH power adjustment indication - * received from PHY. - * - * Invoked by: RgLiTfuPucchDeltaPwrInd - * - * Processing Steps: - * - Gets UE - * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd - * - * @param[in] RgSchCellCb *cell - * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomPucchDeltaPwrInd -( -RgSchCellCb *cell, -TfuPucchDeltaPwrIndInfo *pucchDeltaPwr -) -#else -PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr) -RgSchCellCb *cell; -TfuPucchDeltaPwrIndInfo *pucchDeltaPwr; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuPucchDeltaPwr *ueElem; - - TRC2(rgSCHTomPucchDeltaPwrInd); - - if(cell->cellId != pucchDeltaPwr->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)", - pucchDeltaPwr->cellId); - RETVALUE(RFAILED); - } - - node = pucchDeltaPwr->pucchDeltaPwrLst.first; - for (;node; node=node->next) - { - ueElem = (TfuPucchDeltaPwr *)node->node; - if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP) - { -#ifdef LTEMAC_SPS - if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP) -#endif - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d " - "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ", - ueElem->rnti); - continue; - } - } - rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr); - } - RETVALUE(ROK); -} /* rgSCHTomPucchDeltaPwrInd */ - -/** - * @brief Handler for processing harq ACK/NACK indication recieved from PHY. - * - * @details - * - * Function: rgSCHTomHarqAckInd - * - * Handler for processing harq ACK/NACK indication recieved from PHY. - * - * Invoked by: RgLiTfuHqInd - * - * Processing Steps: - * For each HqAckInfo received - * - Get UE - * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd - * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd - * - * @param[in] TfuHqIndInfo *harqAckInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomHarqAckInd -( -RgSchCellCb *cell, -TfuHqIndInfo *harqAckInd -) -#else -PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd) -RgSchCellCb *cell; -TfuHqIndInfo *harqAckInd; -#endif -{ - RgSchErrInfo err; - RgSchUeCb *ue; - RgSchRaCb *raCb; - CmLList *node; - TfuHqInfo *hqInfo; - Pst pst; -#ifdef TFU_UPGRADE - U8 tbCnt; -#endif - - RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); - U32 cellIdx; - RgSchCellCb *iterCellP; - - TRC2(rgSCHTomHarqAckInd); - - if(cell->cellId != harqAckInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get" - " the cell for cellId (%d)", harqAckInd->cellId); - err.errType = RGSCHERR_TOM_HARQACKIND; - err.errCause = RGSCHERR_TOM_INV_CELL_ID; - RETVALUE(RFAILED); - } -#ifdef RG_5GTF - node = harqAckInd->hqIndLst.first; - for (;node; node=node->next) - { - hqInfo = (TfuHqInfo *)node->node; - { - RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); - TfuHqFdbk fdbk = hqInfo->isAck[0]; - raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti); - ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti); - if (ue != NULLP && raCb == NULLP) - { - if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " - "HARQ feedback processing failed errType(%d)errCause(%d)n", - err.errType, err.errCause); - continue; - } - } - } - - } - - if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " - "subframe for cellId (%d) ", cell->cellId); - err.errType = RGSCHERR_TOM_HARQACKIND; - } - - for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) - { - if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) - { - iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; - - rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); - if(rlsHqBufs->numUes) - { - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); - RgSchMacRlsHq (&pst, rlsHqBufs); - } - rlsHqBufs->numUes = 0; - } - } -#else - rlsHqBufs->numUes = 0; - node = harqAckInd->hqIndLst.first; - for (;node; node=node->next) - { - hqInfo = (TfuHqInfo *)node->node; - for(tbCnt=0; tbCntisAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]]; - } - raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti); - ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti); - if (ue == NULLP && raCb != NULLP) - { -#ifdef RG_UNUSED - rgSCHRamMsg4FdbkInd (raCb); -#endif - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d)", - err.errType, err.errCause); - continue; - } - continue; - } - else if (ue != NULLP && raCb == NULLP) - { - /* Get the Downlink HARQ entity from ue */ - if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT, - cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " - "HARQ feedback processing failed errType(%d)errCause(%d)n", - err.errType, err.errCause); - continue; - } - } - else if (ue != NULLP && raCb != NULLP) - { - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d).", - err.errType, err.errCause); - continue; - } - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " - "UE CB or RA CB ", hqInfo->rnti); - err.errType = RGSCHERR_TOM_HARQACKIND; - continue; - } - } - - /* Check with TDD call DHM*/ - if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " - "subframe for cellId (%d) ", harqAckInd->cellId); - err.errType = RGSCHERR_TOM_HARQACKIND; - } - - for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) - { - if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) - { - iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; - - rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); - if(rlsHqBufs->numUes) - { - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); - RgSchMacRlsHq (&pst, rlsHqBufs); - } - rlsHqBufs->numUes = 0; - } - } -#endif - RETVALUE(ROK); -} /* rgSCHTomHarqAckInd */ - - -/** - * @brief Handler for processing Scheduling Request indication - * recieved from PHY for a list of UEs. - * - * @details - * - * Function: rgSCHTomSrInd - * - * Handler for processing Scheduling Request indication recieved from PHY - * for UEs. - * - * Invoked by: RgLiTfuSrInd - * - * Processing Steps: - * - Get UE - * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd - * - * @param[in] TfuSrIndInfo *srInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomSrInd -( -RgSchCellCb *cell, -TfuSrIndInfo *srInd -) -#else -PUBLIC S16 rgSCHTomSrInd(cell, srInd) -RgSchCellCb *cell; -TfuSrIndInfo *srInd; -#endif -{ - S16 ret = RFAILED; - RgSchErrInfo err; - RgSchUeCb *ue; - CmLList *node; - TfuSrInfo *srInfo; - - TRC2(rgSCHTomSrInd); - - if(cell->cellId != srInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId" - ":%d ", srInd->cellId); - err.errType = RGSCHERR_TOM_SRIND; - err.errCause = RGSCHERR_TOM_INV_CELL_ID; - RETVALUE(RFAILED); - } - - - node = srInd->srLst.first; - for (;node; node=node->next) - { - rgNumSrRecvd++; - - srInfo = (TfuSrInfo *)node->node; - ue = rgSCHDbmGetUeCb (cell, srInfo->rnti); - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", - srInfo->rnti); - continue; - } - rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo); - /*Need to activate UE as SR received*/ - if (ue->isDrxEnabled) - { - rgSCHDrxSrInd(cell, ue); - } - ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err); - if (ret != ROK) - { - err.errType = RGSCHERR_TOM_SRIND; - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed " - "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti); - continue; - } - } - RETVALUE(ret); -} /* end of rgSCHTomSrInd */ - -/** - * @brief Handler for processing downlink CQI indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomDoaInd - * - * Handler for processing DOA recieved from PHY - * for a set of UEs. - * - * Invoked by: RgLiTfuDoaInd - * - * Processing Steps: - * - Get UE - * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd - * - * @param[in] TfuDoaIndInfo *doaInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomDoaInd -( -RgSchCellCb *cell, -TfuDoaIndInfo *doaInd -) -#else -PUBLIC S16 rgSCHTomDoaInd(cell, doaInd ) -RgSchCellCb *cell; -TfuDoaIndInfo *doaInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuDoaRpt *doaInfo; - TRC2(rgSCHTomDoaInd); - - if(cell->cellId != doaInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId" - ":%d", doaInd->cellId); - RETVALUE(RFAILED); - } - - - node = doaInd->doaRpt.first; - for (;node; node=node->next) - { - doaInfo = (TfuDoaRpt *)node->node; - ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti); - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", - doaInfo->rnti); - continue; - } - rgSCHUtlDoaInd(cell, ue, doaInfo); - } - RETVALUE(ROK); -} /* rgSCHTomDoaInd */ -/** - * @brief Handler for processing downlink CQI indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomDlCqiInd - * - * Handler for processing downlink CQI indication recieved from PHY - * for a set of UEs. - * - * Invoked by: RgLiTfuDlCqiInd - * - * Processing Steps: - * - Get UE - * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd - * - * @param[in] TfuDlCqiIndInfo *dlCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomDlCqiInd -( -RgSchCellCb *cell, -TfuDlCqiIndInfo *dlCqiInd -) -#else -PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd) -RgSchCellCb *cell; -TfuDlCqiIndInfo *dlCqiInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuDlCqiRpt *dlCqiInfo; - TRC2(rgSCHTomDlCqiInd); - - if(cell->cellId != dlCqiInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" - ":%d", dlCqiInd->cellId); - RETVALUE(RFAILED); - } - - - node = dlCqiInd->dlCqiRptsLst.first; - for (;node; node=node->next) - { - dlCqiInfo = (TfuDlCqiRpt *)node->node; - ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti); - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB", - dlCqiInfo->rnti); - continue; - } - rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo); - rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo); - } - RETVALUE(ROK); -} /* rgSCHTomDlCqiInd */ - -/** - * @brief Handler for moving PCQI instance for the next periodic occasion - * - * @details - * - * Function: rgSCHTomUtlMovePcqiNxtOccasion - * - * Handler for moving PCQI instance for the next periodic occasion - * - * Invoked by: rgSCHTomUtlFill* - * - * Processing Steps: - * - For a UE move its occurence instance to next occasion - * depending on its periodicity - * - Remove it from the current list and insert it to the list - * having the index matching with the derived number. - * - * @param[in] RgSchCellCb *cell, - * [in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion -( - RgSchCellCb *cell, - RgSchUeCb *ue, - RgSchUePCqiCb *cqiCb - ) -#else -PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb) - RgSchCellCb *cell; - RgSchUeCb *ue; - RgSchUePCqiCb *cqiCb; -#endif -{ - U16 cqiIdx = 0; - - CmLteTimingInfo timingInfo; - TRC2(rgSCHTomUtlMovePcqiNxtOccasion); - - if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) - { -#ifdef xLTE_TDD - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA); -#else - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, - TFU_RECPREQ_DLDELTA); -#endif - RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri); - rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb); - } - /* Compute Next Transmission Instance */ - cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx; - cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - /* Delete from current List and move to new list */ - if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, - &cqiCb->cqiLstEnt)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", - ue->ueId); - } - cqiCb->nCqiTrIdx = cqiIdx; - cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst), - &(cqiCb->cqiLstEnt)); -#ifdef LTE_ADV - rgSCHUtlSCellHndlCqiCollsn(cqiCb); -#endif - - RETVALUE(ROK); -} /* rgSCHTomUtlMovePcqiNxtOccasion */ - -/** - * @brief Handler for moving RI instance for the next periodic occasion - * - * @details - * - * Function: rgSCHTomUtlMovePriNxtOccasion - * - * Handler for moving PCQI instance for the next periodic occasion - * - * Invoked by: rgSCHTomUtlFill* - * - * Processing Steps: - * - For a UE move its occurence instance to next occasion - * depending on its periodicity - * - Remove it from the current list and insert it to the list - * having the index matching with the derived number. - * - * @param[in] RgSchCellCb *cell, - * [in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion -( - RgSchCellCb *cell, - RgSchUeCb *ue, - RgSchUePCqiCb *riCb - ) -#else -PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb) - RgSchCellCb *cell; - RgSchUeCb *ue; - RgSchUePCqiCb *riCb; -#endif -{ - U16 riIdx; - U16 riDist=0; - U16 effPeriodicity; - U16 riTrInsTime; - U16 crntTime; - U16 tempIdx; - - TRC2(rgSCHTomUtlMovePriNxtOccasion); - crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) - +(cell->crntTime.subframe); -#ifdef XEON_SPECIFIC_CHANGES - RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime); -#endif - /* Compute Next Transmission Instance */ - if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP) - { - effPeriodicity = riCb->cqiPeri * riCb->riPeri; - tempIdx = effPeriodicity + riCb->nRiTrIdx; - } - else - { - effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri); - /* In case of SFN wraparound, the SB CQI reporting cycle breaks - * and RI->WB CQI->SBCQI.. should resume. RI is repositioned - * accordingly. WBCQI handling is naturally accomplished */ - if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) > - (RGSCH_MAX_SUBFRM_5G - 1)) - { - riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity; - tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime); - /* In case of SFN wraparound, riDist should be distance from crntTime - * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity - * to make riDist calculation consistent for both SFN wraparound - * case and normal case */ - effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime; - } - else - { - tempIdx = effPeriodicity + riCb->nRiTrIdx; - } - } - riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) - { - riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), - (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity)); - } - else - { - riDist = 0; - } - - /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it - * then the next occasion idx will be same as current Idx, Hence need not - * to delete and add - */ - if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0) - { - /* Delete from current List and move to new list */ - if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst, - &riCb->riLstEnt)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node", - ue->ueId); - } - RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst); - cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst, - &riCb->riLstEnt); - RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst); - } - else - { - if(riDist > 0) - { - riDist--; - } - } - riCb->nRiTrIdx = riIdx; - riCb->riDist = riDist; - -#ifdef LTE_ADV - rgSCHUtlSCellHndlRiCollsn(riCb); -#endif - RETVALUE(ROK); -} /* rgSCHTomUtlMovePriNxtOccasion */ - -/** - * @brief Handler for moving SR instance for the next periodic occasion - * - * @details - * - * Function: rgSCHTomUtlMoveSrNxtOccasion - * - * Handler for moving SR instance for the next periodic occasion - * - * Invoked by: rgSCHTomUtlFill* - * - * Processing Steps: - * - For a UE move its occurence instance to next occasion - * depending on its periodicity - * - Remove it from the current list and insert it to the list - * having the index matching with the derived number. - * - * @param[in] RgSchCellCb *cell, - * [in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion -( - RgSchCellCb *cell, - RgSchUeCb *ue - ) -#else -PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue) - RgSchCellCb *cell; - RgSchUeCb *ue; -#endif -{ - U16 srIdx = 0; - - TRC2(rgSCHTomUtlMoveSrNxtOccasion); - - /* Compute Next Transmission Instance */ - srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx; - srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - /* Delete from current List and move to new list */ - if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst, - &ue->srCb.srLstEnt)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", - ue->ueId); - } - ue->srCb.nSrTrIdx = srIdx; - cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst, - &ue->srCb.srLstEnt); - - RETVALUE(ROK); -} /* rgSCHTomUtlMoveSrNxtOccasion */ - -/** - * @brief Handler for moving SRS instance for the next periodic occasion - * - * @details - * - * Function: rgSCHTomUtlMoveSrsNxtOccasion - * - * Handler for moving SRS instance for the next periodic occasion - * - * Invoked by: rgSCHTomUtlFill* - * - * Processing Steps: - * - For a UE move its occurence instance to next occasion - * depending on its periodicity - * - Remove it from the current list and insert it to the list - * having the index matching with the derived number. - * - * @param[in] RgSchCellCb *cell, - * [in] RgSchUeCb *ue - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion -( - RgSchCellCb *cell, - RgSchUeCb *ue - ) -#else -PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue) - RgSchCellCb *cell; - RgSchUeCb *ue; -#endif -{ - U16 srsIdx; - U16 srsDist; - U16 tempIdx; - U16 crntTime; - - - TRC2(rgSCHTomUtlMoveSrsNxtOccasion); - crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) - +(cell->crntTime.subframe); - - /* Compute Next Transmission Instance */ - tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx; - srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE; - if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE) - { - srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), - (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri)); - } - else - { - srsDist =0; - } - - /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it - * then the next occasion idx will be same as current Idx, Hence need not - * to delete and add - */ - if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0) - { - /* Delete from current List and move to new list */ - if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst, - &ue->srsCb.srsLstEnt)) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", - ue->ueId); - } - cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst, - &ue->srsCb.srsLstEnt); - } - else - { - if(srsDist > 0) - { - srsDist--; - } - } - ue->srsCb.nSrsTrIdx = srsIdx; - ue->srsCb.srsDist = srsDist; - - RETVALUE(ROK); -} /* rgSCHTomUtlMoveSrsNxtOccasion */ - - -/** - * @brief Handler for processing RAW CQI indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomRawCqiInd - * - * Handler for processing RAW CQI indication recieved from PHY - * for a set of UEs. - * - * Invoked by: RgLiTfuRawCqiInd - * - * Processing Steps: - * - Get UE - * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd - * - * @param[in] TfuRawCqiIndInfo *rawCqiInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomRawCqiInd -( - RgSchCellCb *cell, - TfuRawCqiIndInfo *rawCqiInd -) -#else -PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd) - RgSchCellCb *cell; - TfuRawCqiIndInfo *rawCqiInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuRawCqiRpt* rawCqiInfo; - - TfuDlCqiRpt dlCqiInfo; - Bool skipPerCqiRpt = FALSE; - RgSchErrInfo err; - U32 cellIdx; - RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); - RgSchCellCb *iterCellP; -#if DL_LA - RgSchCmnDlUe *ueDl; -#endif - U8 cqi; - U8 ri; - U8 hqAck; - Pst pst; - RgSchRaCb *raCb; - TfuHqInfo hqInfo; - - TRC2(rgSCHTomRawCqiInd); - - if(cell->cellId != rawCqiInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" - ":%d", rawCqiInd->cellId); - RETVALUE(RFAILED); - } - - - node = rawCqiInd->rawCqiRpt.first; - for (;node; node=node->next) - { - rawCqiInfo = (TfuRawCqiRpt *)node->node; - ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti); - raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti); - /* - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB", - rawCqiInfo->crnti); - continue; - } - */ -#ifdef RG_5GTF - /* - if (rawCqiInfo->numBits >= 5) - printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", - cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload, - rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.subframe); - */ - if (rawCqiInfo->numBits == 1) - { - RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); - U8 fdbk = TFU_HQFDB_NACK; - /* Process HARQ FdbkInd */ - hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1; - if (hqAck) - { - fdbk = TFU_HQFDB_ACK; - hqInfo.isAck[0] = fdbk; - } - if (ue != NULLP && raCb == NULLP) - { - if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " - "HARQ feedback processing failed errType(%d)errCause(%d)n", - err.errType, err.errCause); - continue; - } - } - else if (ue == NULLP && raCb != NULLP) - { - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d)", - err.errType, err.errCause); - continue; - } - continue; - } - else if (ue != NULLP && raCb != NULLP) - { - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d).", - err.errType, err.errCause); - continue; - } - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " - "UE CB or RA CB ", rawCqiInfo->crnti); - err.errType = RGSCHERR_TOM_HARQACKIND; - continue; - } - /* - printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits, - rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.subframe); - */ - } - else if (rawCqiInfo->numBits == 5) - { - /* Process CQI-RI Ind*/ - ri = (rawCqiInfo->uciPayload >> 27) & 0x1; - cqi = (rawCqiInfo->uciPayload >> 28) & 0xF; - if(ue) { - if (cqi == 0) - { - printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi); - cqi = 15; - } - ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1]; - ue->ue5gtfCb.rank = ri + 1; -#ifdef DL_LA - if (rawCqiInfo->numBits > 1) - { - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - ueDl->mimoInfo.cwInfo[0].cqi = cqi; - ueDl->cqiFlag = TRUE; - rgSCHCmnDlSetUeAllocLmtLa(cell, ue); - // rgSCHCheckAndSetTxScheme(cell, ue); - } -#endif - } - /* - printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri); - */ - } - else if (rawCqiInfo->numBits == 6) - { - RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); - TfuHqFdbk fdbk = TFU_HQFDB_NACK; - /* Process both HARQ and CQI-RI Ind*/ - ri = (rawCqiInfo->uciPayload >> 26) & 0x1; - cqi = (rawCqiInfo->uciPayload >> 27) & 0xF; - hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1; - if (cqi == 0) - { - printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi); - cqi = 13; - } - ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1]; - ue->ue5gtfCb.rank = ri + 1; -#ifdef DL_LA - if (rawCqiInfo->numBits > 1) - { - ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); - ueDl->mimoInfo.cwInfo[0].cqi = cqi; - ueDl->cqiFlag = TRUE; - rgSCHCmnDlSetUeAllocLmtLa(cell, ue); - // rgSCHCheckAndSetTxScheme(cell, ue); - } -#endif - if (hqAck) - { - fdbk = TFU_HQFDB_ACK; - hqInfo.isAck[0] = fdbk; - } - if (ue != NULLP && raCb == NULLP) - { - if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " - "HARQ feedback processing failed errType(%d)errCause(%d)n", - err.errType, err.errCause); - continue; - } - } - else if (ue == NULLP && raCb != NULLP) - { - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d)", - err.errType, err.errCause); - continue; - } - continue; - } - else if (ue != NULLP && raCb != NULLP) - { - if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, - cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) - { - err.errType = RGSCHERR_TOM_HARQACKIND; - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" - " feedback processing failed errType(%d) errCause(%d).", - err.errType, err.errCause); - continue; - } - } - else - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " - "UE CB or RA CB ", rawCqiInfo->crnti); - err.errType = RGSCHERR_TOM_HARQACKIND; - continue; - } - - /* - printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck); - */ - } - } - - if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " - "subframe for cellId (%d) ", cell->cellId); - err.errType = RGSCHERR_TOM_HARQACKIND; - } - - for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) - { - if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) - { - iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; - - rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); - if(rlsHqBufs->numUes) - { - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); - RgSchMacRlsHq (&pst, rlsHqBufs); - } - rlsHqBufs->numUes = 0; - } - } - RETVALUE(ROK); -} /* rgSCHTomRawCqiInd */ - -/** - * @brief Handler for processing SRS indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomSrsInd - * - * Handler for SRS indication recieved from PHY - * for a set of UEs. - * - * Invoked by: RgLiTfuSrsInd - * - * Processing Steps: - * - Get UE - * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd - * - * @param[in] TfuSrsIndInfo *srsInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomSrsInd -( - RgSchCellCb *cell, - TfuSrsIndInfo *srsInd - ) -#else -PUBLIC S16 rgSCHTomSrsInd(cell, srsInd) - RgSchCellCb *cell; - TfuSrsIndInfo *srsInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuSrsRpt* srsInfo; - - TRC2(rgSCHTomSrsInd); - - if(cell->cellId != srsInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" - ":%d", srsInd->cellId); - RETVALUE(RFAILED); - } - - node = srsInd->srsRpt.first; - for (;node; node=node->next) - { - srsInfo = (TfuSrsRpt *)node->node; - ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId); - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " - "UE CB", srsInfo->ueId); - continue; - } - rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo); - rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo); - } - RETVALUE(ROK); -} /* rgSCHTomSrsInd */ - -/* -* -* Fun: rgSCHTomUtlGenIndices -* -* Desc: This function reconstructs the Subband Indices for -* of M selected Subbands conveyed by the UE for APeriodic Modes -* 2-0 and 2-2. It decodes the Label which uniquely encodes M out -* of N subbands. -* -* -* Ret: ROK -* -* Notes: None -* -* File: rg_sch_utl.c -* -*/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlGenIndices -( - U32 label, - U8 posM, - U8 valN, - U8 valK, - TfuSubbandInfo* sbInfo - ) -#else -PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo) - U32 label; - U8 posM; - U8 valN; - U8 valK; - TfuSubbandInfo* sbInfo; -#endif -{ - U8 idx, kval, xval, xmin; - U32 binCoe; - xmin =1; - for(kval=0; kvallabel) - { - xval = xval+1; - RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1)); - binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1]; - } - idx = xval; - sbInfo[kval].numRb = valK; - sbInfo[kval].rbStart = idx*valK; - xmin = idx+1; - label = label-binCoe; - } - RETVALUE(ROK); -} /* end of rgSCHTomUtlGenIndices*/ -#endif -/** - * @brief Handler for processing decode failure indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomCrcInd - * - * Handler for processing decode failure indication recieved from - * PHY for a set of UEs. - * - * Invoked by: RgLiTfuCrcInd of rg_sch.x - * - * Processing Steps: - * - Validate the information received and retrieve cell and ue. - * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure(). - * - * @param[in] TfuCrcIndInfo *crcInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomCrcInd -( -RgSchCellCb *cell, -TfuCrcIndInfo *crcInd -) -#else -PUBLIC S16 rgSCHTomCrcInd(cell, crcInd) -RgSchCellCb *cell; -TfuCrcIndInfo *crcInd; -#endif -{ - RgSchUeCb *ue = NULLP; - RgSchRaCb *raCb = NULLP; - CmLList *node; - TfuCrcInfo *crcInfo; -#ifdef RG_ULSCHED_AT_CRC - RgSchErrInfo err; - RgSchDlSf *ulSf; - CmLteTimingInfo crntHiDci0Frm; - //RgSchCmnUlCell *cellUl; - Inst inst = cell->instIdx; - TfuCntrlReqInfo *cntrlInfo; - U32 ret; -#ifdef LTE_TDD - U8 Mval; - U8 idx; -#endif -#endif -#ifdef LTE_TDD - RgSchUlHqProcCb *hqProc; -#endif - -#ifdef LTE_L2_MEAS - RgSchUlHqProcCb *ulHqProc; -#endif - - TRC2(rgSCHTomCrcInd); - - if(cell->cellId != crcInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" - ":%d", crcInd->cellId); - RETVALUE(RFAILED); - } -#ifdef RG_ULSCHED_AT_CRC -#ifndef LTE_ADV - { - static CmLteTimingInfo lastCrc = {2000,0}; - CmLteTimingInfo crntCrc = cell->crntTime; - if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc)) - { - /*Removed the WA to drop 2nd CRC*/ - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC " - "twice per TTI @(%u,%u)", cell->crntTime.sfn, - cell->crntTime.subframe); - } - lastCrc = crntCrc; - } -#endif -#endif - node = crcInd->crcLst.first; - for (;node; node=node->next) - { - crcInfo = (TfuCrcInfo*)node->node; - ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti); - if (ue == NULLP) - { -#ifdef LTEMAC_SPS - /* Fetch from SPS List */ - ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti); - if (ue == NULLP) -#endif - { - raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti); - if (raCb == NULLP) - { - continue; - } - } - } - /* Added Ul TB count for Uplink data scheduled*/ -#ifdef LTE_L2_MEAS - if(raCb) - { - ulHqProc = &(raCb->msg3HqProc); - if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1)) - { - cell->dlUlTbCnt.tbTransUlTotalCnt++; - } - } - else - { - rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc); - if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx) - { - cell->dlUlTbCnt.tbTransUlTotalCnt++; - } - } -#endif - - if (crcInfo->isFailure == FALSE) - { - if(raCb) - { - rgSCHRamMsg3DatInd(raCb); -#ifdef LTE_TDD - /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/ - hqProc = &(raCb->msg3HqProc); - RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.subframe, - hqProc); -#endif - raCb = NULLP; - } - else - { -#ifdef EMTC_ENABLE - gUlCrcPassCounter++; -#endif -#ifdef CA_DBG - gUlCrcPassCount++; -#endif - RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime); -#ifndef MAC_SCH_STATS - rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo); - -#else - /** Stats update over here - */ - { - RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell); - - rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]); - } -#endif /* MAC_SCH_STATS */ - - rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo); -#ifdef LTEMAC_SPS - rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo); -#endif - } - } - else - { - if(raCb) - { - /* SR_RACH_STATS : MSG3 Nack / DTX*/ - if (crcInfo->isDtx == TRUE) - { - rgNumMsg3DtxRcvd++; - } - else - { - rgNumMsg3CrcFailed++; - } - rgSCHRamMsg3FailureInd(raCb); -#ifdef EMTC_ENABLE - rgSCHCmnEmtcHdlCrcFailInd(cell, raCb); -#endif - /* Added Ul TB count for CRC Failure of MSG3 */ -#ifdef LTE_L2_MEAS - ulHqProc = &(raCb->msg3HqProc); - if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1)) - { - cell->dlUlTbCnt.tbTransUlFaulty++; - } -#endif - raCb = NULLP; - } - else - { -#ifdef EMTC_ENABLE - gUlCrcFailCounter++; -#endif -#ifdef CA_DBG - gUlCrcFailCount++; -#endif -#ifndef MAC_SCH_STATS - rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv); -#else - { - RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell); - - rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]); - } -#endif /* MAC_SCH_STATS */ - rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo); -#ifdef LTEMAC_SPS - rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo); -#endif - /* Added Ul TB count for CRC Failure of Uplink data */ -#ifdef LTE_L2_MEAS - rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc); - if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx) - { - cell->dlUlTbCnt.tbTransUlFaulty++; - } -#endif - } - } - } - -/* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here - the codebase across TDD and FDD*/ -#ifdef RG_ULSCHED_AT_CRC - /* Changes to do uplink scheduling at CRC Indication */ - //cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA); - - - rgSCHCmnRlsUlSf(cell,0); - - - /* Allocating memory for CntrlReq as it required for both EMTC and - * Normal UEs */ - if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo, - sizeof(TfuCntrlReqInfo))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo " - "for cell"); - RETVALUE(ret); - } - rgSCHCmnUlSch(cell); -#ifdef LTE_L2_MEAS - rgSCHL2Meas(cell,TRUE); -#endif - /* Also, sending UL DCI and PHICH for just scheduled subframe */ - ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm); - - if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process" - " downlink subframe for cellId %d", crcInd->cellId); - err.errType = RGSCHERR_TOM_TTIIND; - RETVALUE(RFAILED); - } -#endif /* RG_ULSCHED_AT_CRC */ - RETVALUE(ROK); -} /* rgSCHTomCrcInd */ - -/** - * @brief Handler for processing timing Advance indication recieved from - * PHY for a UE. - * - * @details - * - * Function: rgSCHTomTimingAdvInd - * - * Handler for processing timing advance indication recieved from PHY - * for a set of UEs. - * - * Invoked by: RgLiTfuTimingAdvInd - * - * Processing Steps: - * - Get UE. - * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa. - * - * @param[in] TfuTimingAdvIndInfo *timingAdvInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomTimingAdvInd -( -RgSchCellCb *cell, -TfuTimingAdvIndInfo *timingAdvInd - ) -#else -PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd) -RgSchCellCb *cell; -TfuTimingAdvIndInfo *timingAdvInd; -#endif -{ - RgSchUeCb *ue; - CmLList *node; - TfuTimingAdvInfo *timingAdvInfo; - - - TRC2(rgSCHTomTimingAdvInd); - - if(cell->cellId != timingAdvInd->cellId) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" - "=(%d)", timingAdvInd->cellId); - RETVALUE(RFAILED); - } - - - node = timingAdvInd->timingAdvLst.first; - for (;node; node=node->next) - { - timingAdvInfo = (TfuTimingAdvInfo *)node->node; - ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti); - if (ue == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", - timingAdvInfo->rnti); - continue; - } - rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv); - } - RETVALUE(ROK); -} /* rgSCHTomTimingAdvInd */ - -/** - * @brief Handler for processing TTI indication recieved from - * PHY for 'n' cells. - * - * @details - * - * Function: rgSCHTomTtiInd - * - * Handler for processing TTI indication recieved from PHY - * for a cell. This is split into the below Steps. - * - * 1: Complete the Uplink and Common Channel Scheduling for each Cell - * 2: Complete the UE specific Scheduling for each Cell / across Cells. - * 3: Consolidate the subframe allocations and send to each MAC instance - * 4: Fill the Tfu structures for DL and UL Config requests - * 5: Handle the RGR Config messages per Cell - * - * @param[in] TfuTtiIndInfo *ttiInd - * @param[in] Inst schInst - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHTomTtiInd -( -TfuTtiIndInfo *ttiInd, -Inst schInst -) -#else -PUBLIC Void rgSCHTomTtiInd(ttiInd, schInst) -TfuTtiIndInfo *ttiInd; -Inst schInst; -#endif -{ - RgInfSfAlloc *subfrmAlloc; - RgTfuCntrlReqInfo *cntrlInfo = NULLP; - S16 ret = ROK; - U8 i; - U8 nCell = 0; - RgSchCellCb *cell[CM_LTE_MAX_CELLS]; - RgSchCellCb *cellLst[CM_LTE_MAX_CELLS]; - - TRC2(rgSCHTomTtiInd); - -#ifdef LTE_L2_MEAS - glblTtiCnt++; -#endif - - rgSchTomFillCellTtiInfo(ttiInd, schInst, &nCell, &cell[0]); - for (i = 0; i < nCell; i++) - { - /* Perform UL and DL Common Channel scheduling */ - rgSchTomTtiUlAndDlCmnChSch (cell[i]); - } - - /* Perform scheduling in Order of - * 1. SPS - * 2. CEs - * 3. Retx */ - for (i = 0; i < nCell; i++) - { - - if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE)) - { - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]); - /* Perform DL Retx scheduling */ - cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo); - } - } - - rgSchCmnPreDlSch(cell, nCell, cellLst); - for (i = 0; i < nCell; i++) - { - /* Perform DL scheduling */ - rgSchTomTtiDlSch (cellLst[i]); - } - rgSchCmnPstDlSch(cell[0]); - - for (i = 0; i < nCell; i++) - { -#ifdef LTE_TDD -#ifndef RG_ULSCHED_AT_CRC - /* Perform UL scheduling for TDD */ - rgSCHCmnUlSch (cell[i]); -#endif -#endif - } - /* Init SF Alloc info per Cell */ - for (i = 0; i < nCell; i++) - { - subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]); - rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE); - } - for (i = 0; i < nCell; i++) - { - if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE)) - { - subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]); - /* - * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc - * timingInfo which is being calculated here will be used by MAC - */ - RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo, - RG_DL_DELTA - TFU_DLDATA_DLDELTA); - /* Consolidate the Allocations and send response to MAC instances */ - rgSchTomTtiCnsldtSfAlloc (cell[i]); - } - } - - for (i = 0; i < nCell; i++) - { - if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE)) - { - /* Send the consolidated Alloc Info to MAC instances */ - rgSCHCmnSndCnsldtInfo (cell[i]); - } - } - - for (i = 0; i < nCell; i++) - { - /* Fill control data from scheduler to PHY */ - if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo, - sizeof(RgTfuCntrlReqInfo))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo" - " for cell"); - RETVOID; - } - -#ifdef EMTC_ENABLE - /* Fill the TFU structures and send to CL */ - if(TRUE == cell[i]->emtcEnable) - { - ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo); - } -#endif - if((ROK == ret) - && (NULLP != cntrlInfo)) - { - /* Fill the TFU structures and send to CL */ - rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo); - } - } -#ifdef RGR_RRM_TICK - rgSCHTomUtlSendSfnTick(cell[0]); -#endif - - for (i = 0; i < nCell; i++) - { - /* Invoke non critical functions like measurements, etc */ - rgSchTomTtiMiscFunctions (cell[i]); - } - -#ifdef CA_DBG - { - U32 dbgUeIdChngAndDatReqInClCnt = 0; - static U32 gTtiCount = 0; - gTtiCount++; - - if(gTtiCount == 3000) - { -#ifdef XEON_SPECIFIC_CHANGES - printf("SChed:: (P/S)::(%u/%u) \n", - gPrimarySchedCount,gSCellSchedCount); - - printf("\n HQFDBK :: %u\n",gHqFdbkCount); - - long int total; - long int total2 ; - - total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount; - total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount; - - printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n", - gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount, - gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount); - if ((total != 0 ) && total2 != 0) - { - printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n", - (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100, - (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2); - } - - total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount; - total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount; - - - printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n", - gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount, - gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount); - if ((total != 0 ) && total2 != 0) - { - printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n", - (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100, - (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2); - } - - - printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n", - gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount, - gACqiRcvdCount,gCqiReptToAppCount); - - printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n", - gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount); - - printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n" - "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n" - "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n", - gDci0Count, - gUlCrcPassCount, - gUlCrcFailCount, - gPcellZeroBoOcc, - gScellZeroBoOcc, - dbgUeIdChngAndDatReqInClCnt, - dbgDelayedDatReqInMac, - gDropDatReqCnt, gIccPktRcvrMemDropCnt); -#else - printf("SChed:: (P/S)::(%ld/%ld) \n", - gPrimarySchedCount,gSCellSchedCount); - - printf("\n HQFDBK :: %ld\n",gHqFdbkCount); - - printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n", - gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount, - gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount); - - printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n", - gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount, - gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount); - - printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n", - gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount, - gACqiRcvdCount,gCqiReptToAppCount); - printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount); - - printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n", - gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount); - - printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n" - "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n" - "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n", - gDci0Count, - gUlCrcPassCount, - gUlCrcFailCount, - gPcellZeroBoOcc, - gScellZeroBoOcc, - dbgUeIdChngAndDatReqInClCnt, - dbgDelayedDatReqInMac, - gDropDatReqCnt, gIccPktRcvrMemDropCnt); - //printf ("\n delayedApiCnt:%ld",delayedApiCnt); -#endif - - /*LAA STATS*/ - rgSCHLaaPrintStats(); - - gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0; - - gCaDbgCaFrmt = 0; - - gF1bCsCount = 0; - gCqiReqCount = 0; - gACqiRcvdCount = 0; - gRawACqiCount= 0; - gRiReqCount = 0; - gCqiDropCount = 0; - gPucchDropCount= 0; - - gCqiPucchLowSnrDropCount = 0; - gCqiPucchConfMaskDropCount = 0; - gCqiPuschConfMaskDropCount = 0; - gPuschCqiDropCount = 0; - - gDci0Count = 0; - gUlCrcPassCount = 0; - gUlCrcFailCount = 0; - - gCqiRecpCount = 0; - gCqiRecpPuschCount = 0; - gCqiRcvdCount = 0; - - gCqiReptToAppCount = 0; - - gTtiCount = 0; - - gHqFdbkCount = 0; - gPrimarySchedCount = 0; - gSCellSchedCount = 0; - gSCellTb1AckCount = 0; - gSCellTb2AckCount = 0; - gSCellTb2AckCount = 0; - gSCellTb2NackCount = 0; - gPCellTb1AckCount = 0; - gPCellTb1NackCount = 0; - gPCellTb2AckCount = 0; - gPCellTb2NackCount = 0; - gSCellTb1NackCount=0; - - gPCellTb1DtxCount = 0; - gPCellTb2DtxCount = 0; - gSCellTb1DtxCount = 0; - gSCellTb2DtxCount = 0; - gPcellZeroBoOcc = 0; - gScellZeroBoOcc = 0; - - } - - } - -#endif - RETVOID; -} /* rgSCHTomTtiInd */ - -/** @brief This function does the TTI processin for the uplink subframe, - * already populated by the scheduler. - * - * @details - * - * Function: rgSCHTomUtlProcUlSf - * - * Processing steps: - * - Loop through the Uplink allocations present in the uplink subframe. - * - For each allocation Fill a data reception request to be sent to PHY - * - Also fills the harq reception requests for the expected HQ feedbacks. - * - * - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ - -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlProcUlSf -( -RgSchCellCb *cell, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err) -RgSchCellCb *cell; -RgSchErrInfo *err; -#endif -{ - S16 ret; - TfuRecpReqInfo *recpReqInfo; -#ifdef TFU_UPGRADE - U16 validIdx; /* Index computed from recreq's timing info*/ -#endif - Inst inst = cell->instIdx; - - TRC2(rgSCHTomUtlProcUlSf) - - if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo, - sizeof(TfuRecpReqInfo))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo " - "for cell"); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - recpReqInfo->cellId = cell->cellId; - cmLListInit(&recpReqInfo->ueRecpReqLst); - - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, - TFU_RECPREQ_DLDELTA); - - /* Filling data Reception requests */ - ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell, - validIdx, - err); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption " - "requests for cell"); - RGSCH_FREE_MEM(recpReqInfo); - RETVALUE(ret); - } - /* Filling HARQ Reception requests */ - ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback " - "reception requests for cell"); - RGSCH_FREE_MEM(recpReqInfo); - RETVALUE(ret); - } - /* sending the RecpReq to Phy */ - if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell"); - } - RETVALUE(ROK); -} /* end of rgSCHTomUtlProcUlSf */ - -#ifdef LTE_TDD -#ifdef TFU_UPGRADE -/** @brief This function does the TTI processin for the uplink subframe, - * already populated by the scheduler. - * - * @details - * - * Function: rgSCHTomUtlPrcUlTddSpclSf - * - * Processing steps: - * - Fill the SRS Info for the Special Subframe in Reception Req. - * - Send the Reception Req to TFU - * - * - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf -( -RgSchCellCb *cell, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err) -RgSchCellCb *cell; -RgSchErrInfo *err; -#endif -{ - S16 ret; - TfuRecpReqInfo *recpReqInfo; - U16 validIdx; /* Index computed from recreq's timing info*/ - Inst inst = cell->instIdx; - - TRC2(rgSCHTomUtlPrcUlTddSpclSf) - - if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo, - sizeof(TfuRecpReqInfo))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to " - "Allocate TfuRecpReqInfo for cell"); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - recpReqInfo->cellId = cell->cellId; - cmLListInit(&recpReqInfo->ueRecpReqLst); - - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA); - - RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx); - - /*ccpu00130768 */ - if(cell->srsCfg.isSrsCfgPres && - rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.subframe]) - { - recpReqInfo->srsPres = TRUE; - } - else - { - recpReqInfo->srsPres = FALSE; - } - - /* Filling SRS Reception requests */ - ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill" - " SRS recption requests for cell");; - RGSCH_FREE_MEM(recpReqInfo); - RETVALUE(ret); - } - /* sending the RecpReq to Phy */ - if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send " - "Cntrl info for cell"); - } - RETVALUE(ROK); -} /* end of rgSCHTomUtlPrcUlTddSpclSf */ -#endif -#endif -/** @brief This function does all the processing related to a single downlink - * subframe. - * - * @details - * - * Function: rgSCHTomUtlProcDlSf - * - * Processing steps: - * - collate control data for all UEs and send to PHY - * - collate data buffers for all UEs and send to PHY - * - * @param [in] RgSchDlSf *dlSf - * @param [in] RgSchDlSf *ulSf - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlProcDlSf -( -RgSchDlSf *dlSf, -RgSchDlSf *ulSf, -RgSchCellCb *cell, -RgTfuCntrlReqInfo *cntrlInfo, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err) -RgSchDlSf *dlSf; -RgSchDlSf *ulSf; -RgSchCellCb *cell; -RgTfuCntrlReqInfo *cntrlInfo; -RgSchErrInfo *err; -#endif -{ - Inst inst = cell->instIdx; - S16 ret; - U8 sfTyp = 1; /* Dl Subframe */ - - TRC2(rgSCHTomUtlProcDlSf); - - cmLListInit(&cntrlInfo->phichLst); - cmLListInit(&cntrlInfo->dlPdcchLst); - cmLListInit(&cntrlInfo->ulPdcchLst); - -#ifdef TFU_ALLOC_EVENT_NO_INIT - cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0; -#endif - cntrlInfo->dlTiming = cell->dlDciTime; - cntrlInfo->cellId = cell->cellId; - cntrlInfo->ulTiming = cell->hiDci0Time; - if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.subframe)) - { - //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe); - } - /* Fill PCFICH info */ - /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI - *change happens in that SF then UL PDCCH allocation happens with old CFI - *but CFI in control Req goes updated one since it was stored in the CELL - */ - cntrlInfo->cfi = dlSf->pdcchInfo.currCfi; -#ifndef RG_ULSCHED_AT_CRC - U8 Mval = 1; -#ifdef LTE_TDD - Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx] - [cell->hiDci0Time.subframe]; - if(dlSf->sfType == RG_SCH_SPL_SF_DATA) - { - RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi); - } -#endif - if(Mval) - { - /* Fill PHICH info */ - if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info " - "for cellId (%d)\n", cell->cellId)); - RGSCH_FREE_MEM(cntrlInfo); - RETVALUE(ret); - } - if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != - ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info " - "for cellId (%d)\n", cell->cellId)); - RGSCH_FREE_MEM(cntrlInfo); - RETVALUE(ret); - } - } -#ifdef EMTC_ENABLE - if(0 == cntrlInfo->ulMpdcchLst.count) - { - gUlMpdcchBlank++; - } -#endif -#endif -#ifdef LTE_TDD - sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] - [cell->dlDciTime.subframe]; -#endif - if (sfTyp != 2) /* Uplink subframe */ - { - /* Fill PDCCH info */ - if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info " - "for cellId (%d)\n", cell->cellId)); - RGSCH_FREE_MEM(cntrlInfo); - RETVALUE(ret); - } - rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned; - rgBwAlcnt[dlSf->sfNum] ++; - - } -#ifdef LTEMAC_SPS /* SPS_NEW_CHGS */ - cntrlInfo->isSPSOcc = dlSf->isSPSOcc; -#endif - cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */ - dlSf->numDlActvUes = 0; -#ifdef EMTC_ENABLE -if(0 == cntrlInfo->dlMpdcchLst.count) -{ - gDlMpdcchBlank++; -} -#endif - /* Now always sending down a cntrl req */ - /* sending the cntrl data to Phy */ - if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info " - "for cell"); - } - - RETVALUE(ROK); -} - - -/** @brief This function handles sending of the PHICH information for the - * downlink subframe to be sent in the next TTI. - * - * @details - * - * Function: - * - * Processing steps: - * - Loop through the PHICH information present in the downlink - * subframe and fill the information in cntrlInfo. - * - * @param [out] TfuCntrlReqInfo *cntrlInfo - * @param [in] RgSchDlSf *dlSf - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillPhich -( -RgSchCellCb *cell, -TfuCntrlReqInfo *cntrlInfo, -RgSchDlSf *dlSf, -RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err) -RgSchCellCb *cell; -TfuCntrlReqInfo *cntrlInfo; -RgSchDlSf *dlSf; -RgSchErrInfo *err; -#endif -{ - S16 ret; - CmLList *node; - RgSchPhich *phich; - TfuPhichInfo *harqAck; -#ifdef TFU_UPGRADE - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); -#endif - - TRC2(rgSCHTomUtlFillPhich) - ret = ROK; - /* Traversing the list of Phichs */ - node = dlSf->phichInfo.phichs.first; - while (node) - { - phich = (RgSchPhich*)node->node; - if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo), - &(cntrlInfo->memCp))) != ROK) - { - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - harqAck->txPower = 0; -#endif - /* fill in the tfu structure from the information present in the - * phich node */ - harqAck->rbStart = phich->rbStart; - harqAck->nDmrs = phich->nDmrs; - harqAck->isAck = phich->hqFeedBack; - harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */ -#ifdef LTE_TDD - /* Changes for passing iPhich at TFU interface*/ - harqAck->iPhich = phich->iPhich; -#endif - /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/ -#ifdef TFU_UPGRADE - harqAck->txPower = cellDl->phichTxPwrOffset; -#endif - cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk)); - harqAck->lnk.node = (PTR)harqAck; - node = node->next; - } /* end of while */ - RETVALUE(ret); -} /* end of */ - - -#ifdef LTE_ADV -/** @brief This function is a utility function to restart - * deactivation timer. - * - * @details - * - * Function: rgSCHTmrRestartScellDeactTmr - * - * Processing steps: - * - Starts timer at scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteRnti rnti - * @return Void - */ -#ifdef ANSI -PRIVATE Void rgSCHTmrRestartScellDeactTmr -( - RgSchCellCb *cell, - RgSchUeCb *ueCb - ) -#else -PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb) - RgSchCellCb *cell; - RgSchUeCb *ueCb; - -#endif -{ - RgSchUeCellInfo *sCellInfo = NULLP; - - if(NULLP != ueCb) - { - if(RG_SCH_IS_CELL_SEC(ueCb, cell)) - { - sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])]; - - if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo); - } - if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres) - { - /* - rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT, - ueCb->sCellDeactTmrVal.val); - */ - } - } - } -}/*end of rgSCHTmrRestartScellDeactTmr*/ -#endif - -/** @brief This function will send all the PDCCH's for the given downlink - * subframe. - * - * @details - * - * Function: - * - * Processing steps: - * - Loop through all the scheduled HARQ processes and fill - * the PDCCH information in cntrlInfo. - * - * @param [out] TfuCntrlReqInfo *cntrlInfo - * @param [in] RgSchDlSf *dlSf - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -EXTERN U32 numdlSpsRelSentToTf; -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillDlPdcch -( -RgSchCellCb *cell, -TfuCntrlReqInfo *cntrlInfo, -RgSchDlSf *dlSf, -RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err) -RgSchCellCb *cell; -TfuCntrlReqInfo *cntrlInfo; -RgSchDlSf *dlSf; -RgSchErrInfo *err; -#endif -{ - S16 ret; - CmLList *node; - RgSchPdcch *pdcch; - TfuPdcchInfo *tfuPdcch; - U8 isDcivld = FALSE; - U8 numUePerTti = 0; - - TRC2(rgSCHTomUtlFillDlPdcch) - ret = ROK; - /* Traversing the scheduled Harq processes */ - node = dlSf->pdcchInfo.pdcchs.first; - while (node) - { - pdcch = (RgSchPdcch*)node->node; - switch(pdcch->dci.dciFormat) - { - case TFU_DCI_FORMAT_3: - isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE; - break; - - case TFU_DCI_FORMAT_3A: - isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE; - break; - - default: - isDcivld = TRUE; - break; - } - if(!isDcivld) - { - node = node->next; - continue; - } - - /*ccpu00117179 - ADD - Build only non DCI format-0 messages */ - if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) || - (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) || - (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2)) - { - node = node->next; - continue; - } - - -#ifdef RGSCH_SPS_STATS - if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) && - (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) && - (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) && - (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF)) - { - numdlSpsRelSentToTf++; - } -#endif - - if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo), - &(cntrlInfo->memCp))) != ROK) - { - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef LTEMAC_SPS - tfuPdcch->crnti = pdcch->crnti; - tfuPdcch->isSpsRnti = pdcch->isSpsRnti; -#endif - tfuPdcch->rnti = pdcch->rnti; - -#ifdef LTE_ADV - rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue); -#endif - tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits; - - tfuPdcch->nCce = pdcch->nCce; - tfuPdcch->aggrLvl = pdcch->aggrLvl; - tfuPdcch->dci = pdcch->dci; -#ifdef RG_5GTF - //TODO_SID: Need to check these values during INT - tfuPdcch->sectorId = 0; - tfuPdcch->sccIdx = 0; - tfuPdcch->grpId = -#endif - /* SR_RACH_STATS : Reset isTBMsg4 */ - pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE; - /* To be enhanced later for 2.1 */ - cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk)); - tfuPdcch->lnk.node = (PTR)tfuPdcch; - node = node->next; - if((pdcch->rnti > 60) && (pdcch->rnti < 5000)) - { -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.dl5gtfPdcchSend++; -#endif - numUePerTti++; - } - } /* end of while */ - - if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI )) - { - cell->dlNumUeSchedPerTti[numUePerTti-1]++; - { - gDlNumUePerTti[numUePerTti-1]++; - } - } - RETVALUE(ret); -} /* end of rgSCHTomUtlFillDlPdcch*/ - -#ifdef RGSCH_SPS_STATS -extern U32 rgSchSpsRelSentToTf; -extern U32 rgSchSpsRelPdcchAllocd; -#endif -/** @brief This function will send all the UL PDCCH's for the given - * subframe. - * - * @details - * - * Function: - * - * Processing steps: - * - Loop through all the scheduled HARQ processes and fill - * the PDCCH information in cntrlInfo. - * - * @param [out] TfuCntrlReqInfo *cntrlInfo - * @param [in] RgSchDlSf *dlSf - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillUlPdcch -( -RgSchCellCb *cell, -TfuCntrlReqInfo *cntrlInfo, -RgSchDlSf *dlSf, -RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err) -RgSchCellCb *cell; -TfuCntrlReqInfo *cntrlInfo; -RgSchDlSf *dlSf; -RgSchErrInfo *err; -#endif -{ - S16 ret; - CmLList *node; - RgSchPdcch *pdcch; - TfuPdcchInfo *tfuPdcch; - U8 isDcivld = FALSE; - - TRC2(rgSCHTomUtlFillUlPdcch) - ret = ROK; - /* Traversing the scheduled Harq processes */ - node = dlSf->pdcchInfo.pdcchs.first; - while (node) - { - pdcch = (RgSchPdcch*)node->node; - node = node->next; - /*ccpu00116712- Function should pick only UL allocation related control - * info- start */ - switch(pdcch->dci.dciFormat) - { - case TFU_DCI_FORMAT_A1: - isDcivld = TRUE; - break; - - case TFU_DCI_FORMAT_A2: - isDcivld = TRUE; - break; - - case TFU_DCI_FORMAT_3: - isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE; - break; - - case TFU_DCI_FORMAT_3A: - isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE; - break; - - default: - isDcivld = FALSE; - break; - } - if(!isDcivld) - { - continue; - } -#ifdef CA_DBG - gDci0Count++; -#endif - - /*ccpu00116712- Function should pick only UL allocation related control - * info- end */ - if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo), - &(cntrlInfo->memCp))) != ROK) - { - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - tfuPdcch->rnti = pdcch->rnti; -#ifdef LTE_ADV - rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue); -#endif - tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits; - - tfuPdcch->nCce = pdcch->nCce; - tfuPdcch->aggrLvl = pdcch->aggrLvl; - tfuPdcch->dci = pdcch->dci; -#ifdef RG_5GTF - //TODO_SID: Need to check these values during INT - tfuPdcch->sectorId = 0; - tfuPdcch->sccIdx = 0; - tfuPdcch->grpId = -#endif - /* To be enhanced later for 2.1 */ - gUl5gtfPdcchSend++; -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.ul5gtfPdcchSend++; -#endif - cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk)); - tfuPdcch->lnk.node = (PTR)tfuPdcch; - } /* end of while */ - -#ifdef RGSCH_SPS_STATS - if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd) - { - // abort(); - } -#endif - RETVALUE(ret); -} /* end of rgSCHTomUtlFillUlPdcch*/ - -/** @brief This function does the processing for Timing adjustment. - * - * @details - * - * Function: - * - * Processing steps: - * - Loop through the ue present ueTimeLst, decrement the remaining - * frames left. - * - * - * @param [in] RgSchCellCb *cell - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlProcTA -( -RgSchCellCb *cell -) -#else -PRIVATE S16 rgSCHTomUtlProcTA (cell) -RgSchCellCb *cell; -#endif -{ - CmLList *node; - RgSchUeCb *ue; - - TRC2(rgSCHTomUtlProcTA); - - node = cell->taUeLst.first; - while (node) - { - ue = (RgSchUeCb *)node->node; - node = node->next; - if (ue->dl.taCb.numRemSf == 0) - { - ue->dl.taCb.state = RGSCH_TA_IDLE; - /* If Outstanding Ta is present, schedule it */ - if(ue->dl.taCb.outStndngTa == TRUE) - { - rgSCHUtlReTxTa(cell, ue); - } - else - { - /* We need to reset state and also value of TA, - * then we start the timer */ - ue->dl.taCb.ta = RGSCH_NO_TA_RQD; - /* Start the timer only if TA is cfgd as FINITE value */ - if (ue->dl.taCb.cfgTaTmr) - { - rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr); - } - } - /* need to delete from the link list */ - cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk)); - ue->taLnk.node = NULLP; - } - else - { - ue->dl.taCb.numRemSf--; - } - } /* end of taUeLst */ - - RETVALUE(ROK); -} /* end of rgSCHTomUtlProcTA */ - -/** @brief This function handles filling of Hq reception request to - * Per Hq Proc. - * - * @details - * - * Function: - * - * Processing steps: - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchDlHqProcCb *hqCb, - RgSchDlSf *nxtDlsf, - TfuUeRecpReqInfo *pucchRecpInfo, - RgSchDlHqProcCb *prvHqCb, - RgSchErrInfo *err - ) -#else -PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchDlHqProcCb *hqCb; - RgSchDlSf *nxtDlsf; - TfuUeRecpReqInfo *pucchRecpInfo; - RgSchDlHqProcCb *prvHqCb; - RgSchErrInfo *err; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cell, -RgSchDlHqProcCb *hqCb, -RgSchDlSf *nxtDlsf, -TfuUeRecpReqInfo *pucchRecpInfo, -RgSchDlHqProcCb *prvHqCb, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cell; -RgSchDlHqProcCb *hqCb; -RgSchDlSf *nxtDlsf; -TfuUeRecpReqInfo *pucchRecpInfo; -RgSchDlHqProcCb *prvHqCb; -RgSchErrInfo *err; -#endif -#endif -{ - S16 ret; - RgSchDlHqTbCb *tbCb; - U32 idx; - Bool isAddToLst = FALSE; - - for (idx = 0 ;idx < 2; idx++) - { - if (HQ_TB_WAITING == hqCb->tbInfo[idx].state) - { - tbCb = &hqCb->tbInfo[idx]; - - /* FOR ACK NAK REP */ - if ((hqCb->hqE->ue != NULLP) && - (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE)) - { - if ((tbCb->fbkRecpRepCntr) && - (--tbCb->fbkRecpRepCntr)) - { - /* Add to next subfarme */ - /* Add this hqCb to the next dlSf's ackNakRepQ */ - cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), - &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); - tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; - tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; - } -#ifdef TFU_UPGRADE - rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx); -#endif - continue; - } -#ifdef TFU_UPGRADE - if (hqCb->tbCnt) - { - hqCb->tbCnt--; - /* Go to the next node */ - continue; - } -#endif - - - //if (hqCb != prvHqCb) - { - ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for cell"); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; - if ((hqCb->hqE->ue != NULLP) /*&& - ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt == - TRUE))*/ - ) - { - pucchRecpInfo->rnti = hqCb->hqE->ue->ueId; - } - else - { - if (hqCb->hqE->raCb) - { - pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti; - } - } -#ifndef TFU_UPGRADE -#ifndef TFU_TDD -#ifdef LTEMAC_SPS - if (!hqCb->spsN1PucchRes.pres) -#endif - { - pucchRecpInfo->t.pucchRecpReq.hqType = - TFU_HQ_RECP_REQ_NORMAL; - pucchRecpInfo->t.pucchRecpReq.t.nCce = - hqCb->pdcch->nCce; - } -#ifdef LTEMAC_SPS - else - { - pucchRecpInfo->t.pucchRecpReq.hqType = - TFU_HQ_RECP_REQ_N1PUCCH; - pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = - hqCb->spsN1PucchRes.val; - } -#endif -#endif - /* Handling of other types */ - pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; -#else /* TFU_UPGRADE */ - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; - if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) && - (hqCb->tbInfo[1].state == HQ_TB_WAITING)) - { - pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */ - } - else - { - pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */ - } - { -#ifdef LTEMAC_SPS - /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS - * ocassions */ - if (hqCb->spsN1PucchRes.pres) - { - pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - { - pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn); - } -#ifdef EMTC_ENABLE - rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0])); -#endif - } -#endif/*TFU_UPGRADE*/ - -#ifdef TFU_UPGRADE - rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue, - pucchRecpInfo, validIdx,FALSE); -#endif -#ifdef EMTC_ENABLE - /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/ - isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE); -#endif - if(!isAddToLst) - { - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - } - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - - if ((tbCb->fbkRecpRepCntr) && - (--tbCb->fbkRecpRepCntr)) - { - /* Add to next subfarme */ - /* Add this hqCb to the next dlSf's ackNakRepQ */ - cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), - &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); - tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; - tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; - } - break; - } - } - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillHqFdbkInfo */ - -#ifdef RG_5GTF -/** @brief This function handles filling of Hq reception request to - * Per Hq Proc. - * - * @details - * - * Function:rgSCHTomUtlFillHqFdbkFor5gtf - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx, - * @param [in] RgSchDlHqInfo *dlSfHqInfo, - * @param [in] RgSchDlSf *dlSf, - * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, - * @param [out] RgSchErrInfo *err - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchDlHqInfo *dlSfHqInfo, - RgSchDlSf *dlSf, - TfuUeRecpReqInfo *pucchRecpInfo, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchDlHqInfo *dlSfHqInfo; - RgSchDlSf *dlSf; - TfuUeRecpReqInfo *pucchRecpInfo; - RgSchErrInfo *err; -#endif -{ -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - S16 ret; - CmLList *hqPNode; - RgSchDlHqProcCb *hqCb = NULLP; - RgSchUeCb *ue; - TfuUePucchRecpReq *pucchReqInfo = NULLP; - Bool isDatPresOnSecCell = FALSE; - U8 primCellTbCount = 0; - - hqPNode = dlSfHqInfo->hqPLst.first; - ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; - - if (ue == NULLP) - { - RETVALUE(RFAILED); - } - ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if (ret != ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " - "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; - pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI - * instead of SPS-CRNTI */ - - pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); - - pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO; - - /* 5gtf TODO : Hardcoded nPUCCHIdx */ - pucchReqInfo->uciPduInfo.pucchIndex = 0; - - pucchReqInfo->uciPduInfo.numBits = 1; - - /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/ - if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn)) - { - pucchReqInfo->uciPduInfo.numBits += 5; - RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn, - ue->ue5gtfCb.cqiRiPer); - } - - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */ -#endif - -#ifdef LTE_ADV -/** @brief This function handles filling of Hq reception request to - * Per Hq Proc. - * - * @details - * - * Function:rgSCHTomUtlFillHqFdbkForFrmt1B - * - * Processing steps: - * Allocates the N1Pucch Resources based on teh A Value - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx, - * @param [in] RgSchDlHqInfo *dlSfHqInfo, - * @param [in] RgSchDlSf *dlSf, - * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, - * @param [out] RgSchErrInfo *err - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchDlHqInfo *dlSfHqInfo, - RgSchDlSf *dlSf, - TfuUeRecpReqInfo *pucchRecpInfo, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchDlHqInfo *dlSfHqInfo; - RgSchDlSf *dlSf; - TfuUeRecpReqInfo *pucchRecpInfo; - RgSchErrInfo *err; -#endif -#else -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cell, -RgSchDlHqInfo *dlSfHqInfo, -RgSchDlSf *dlSf, -TfuUeRecpReqInfo *pucchRecpInfo, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cell; -RgSchDlHqInfo *dlSfHqInfo; -RgSchDlSf *dlSf; -TfuUeRecpReqInfo *pucchRecpInfo; -RgSchErrInfo *err; -#endif -#endif -{ -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - S16 ret; - CmLList *hqPNode; - RgSchDlHqProcCb *hqCb = NULLP; - RgSchUeCb *ue; - TfuUePucchRecpReq *pucchReqInfo = NULLP; - Bool isDatPresOnSecCell = FALSE; - U8 primCellTbCount = 0; - - hqPNode = dlSfHqInfo->hqPLst.first; - ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; - - if (ue == NULLP) - { - RETVALUE(RFAILED); - } - ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if (ret != ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " - "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; - pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI - * instead of SPS-CRNTI */ - - pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); - -#ifndef TFU_UPGRADE - pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL; - /* Handling of other types */ - pucchReqInfo->type = TFU_UCI_HARQ; -#else /* TFU_UPGRADE */ - pucchReqInfo->uciInfo = TFU_PUCCH_HARQ; - /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */ - pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); - /* Fill HqSz by using totalTbCnt based on the TM mode and - * the number of serv cells configured*/ - - pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal; - pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal; - - cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); -#ifdef LTEMAC_SPS - /* Two Resources needs to be configured if the - * serving cell is in mimo mode else single - * resource */ - if ((dlSf->relPdcch != NULLP) && - (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming))) - {/* Pcell is having sps rel pdcch present */ - if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) - {/* prim cell is in mimo mode, use 0 and 1 */ - pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce + - cell->pucchCfg.n1PucchAn); - pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1; - - - }else - { - pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce + - cell->pucchCfg.n1PucchAn); - } - /* Release the pdcch so that it will not further processed */ - rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch); - dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */ - } -#endif/*LTEMAC_SPS*/ -#endif/*TFU_UPGRADE*/ - while(hqPNode) - { - hqCb = (RgSchDlHqProcCb *)hqPNode->node; - hqPNode = hqPNode->next; - /* In case of CSI + 1BCS , CSI will be - * dropped if scheduling is present on - * seconday cell.36.213 10.1.1 - * */ - if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) - { - isDatPresOnSecCell = TRUE; - }else - { - if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) && - (hqCb->tbInfo[1].state == HQ_TB_WAITING)) - { - primCellTbCount = 2; - }else - { - primCellTbCount = 1; - } - } -#ifndef TFU_UPGRADE - pucchReqInfo->t.nCce = hqCb->pdcch->nCce; -#else - { - switch(ue->f1bCsAVal) - {/* A Value */ - case RG_SCH_A_VAL_2: - /* harq(0) is primary harq(1) is secondary) */ - if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) - { - pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\ - cw1N1Res[hqCb->tpc].n1PucchIdx; - } - else/* primary cell */ - { -#ifdef LTEMAC_SPS - /* Need to consider only sps occasions */ - if (hqCb->spsN1PucchRes.pres) - { - pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - { - - pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn); - } - } - break; - case RG_SCH_A_VAL_3: - /* Serving cell in mimo mode should be - * in 0 and 1 and the serving cell in siso - * mode should be in 2 indices */ - if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) - { - U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)]; - if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1) - {/* Sec cell is in mimo mode, use 0 and 1 */ - pucchReqInfo->hqInfo.hqRes[0] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - - pucchReqInfo->hqInfo.hqRes[1] = - ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; - } - else - {/* Sec cell is in siso mode, use 2 */ - pucchReqInfo->hqInfo.hqRes[2] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - } - } - else - {/* primary cell hq */ - if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) - {/* prim cell is in mimo mode, use 0 and 1 */ -#ifdef LTEMAC_SPS - if (hqCb->spsN1PucchRes.pres) - {/* SPS occasions */ - pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1; - } - else -#endif /* LTEMAC_SPS */ - { - pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn); - pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn + 1); - } - } - else - {/* prim cell is in siso mode use 2 */ -#ifdef LTEMAC_SPS - /* Need to consider only sps occasions */ - if (hqCb->spsN1PucchRes.pres) - { - pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - { - - pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn); - - } - } - } - break; - case RG_SCH_A_VAL_4: - { - if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) - {/* 2 and 3 for sec cell */ - pucchReqInfo->hqInfo.hqRes[2] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - pucchReqInfo->hqInfo.hqRes[3] = - ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; - } - else/* primary cell */ - {/* 0 and 1 are for primary cell */ -#ifdef LTEMAC_SPS - /* Need to consider only sps occasions */ - if (hqCb->spsN1PucchRes.pres) - { - pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1; - } - else -#endif /* LTEMAC_SPS */ - { - - pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn); - pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce + - cell->pucchCfg.n1PucchAn + 1); - } - } - } - - break; - default: - /* TOD:: Add error print */ - break; - } - } -#endif/*TFU_UPGRADE*/ - } -#ifdef TFU_UPGRADE - -#ifdef CA_DBG - { - gF1bCsCount++; - gF1bCsPres = TRUE; - } - -#endif - rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue, - pucchRecpInfo, validIdx,isDatPresOnSecCell); - - /* Channel selection wil not be used in case of - * CQI + HARQ. if the data was present only on - * primary cell */ - if((isDatPresOnSecCell == FALSE) && - (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)) - {/* Data is present only on primary cell */ - - switch(pucchReqInfo->uciInfo) - { - case TFU_PUCCH_HARQ_SRS: - case TFU_PUCCH_HARQ_CQI: - case TFU_PUCCH_HARQ_SR_SRS: - case TFU_PUCCH_HARQ_SR_CQI: - { - dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B; - pucchReqInfo->hqInfo.hqSz = primCellTbCount; - pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); - } - break; - default: - { - break; - } - } - } -#endif/*TFU_UPGRADE*/ - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */ -/** @brief This function handles filling of Hq reception request to - * Per Hq Proc. - * - * @details - * - * Function:rgSCHTomUtlFillHqFdbkForFrmt3 - * - * Processing steps: - * Allocates the N1Pucch Resources based on teh A Value - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx, - * @param [in] RgSchDlHqInfo *dlSfHqInfo, - * @param [in] RgSchDlSf *dlSf, - * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, - * @param [out] RgSchErrInfo *err - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchDlHqInfo *dlSfHqInfo, - RgSchDlSf *dlSf, - TfuUeRecpReqInfo *pucchRecpInfo, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchDlHqInfo *dlSfHqInfo; - RgSchDlSf *dlSf; - TfuUeRecpReqInfo *pucchRecpInfo; - RgSchErrInfo *err; -#endif -#else -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cell, -RgSchDlHqInfo *dlSfHqInfo, -RgSchDlSf *dlSf, -TfuUeRecpReqInfo *pucchRecpInfo, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cell; -RgSchDlHqInfo *dlSfHqInfo; -RgSchDlSf *dlSf; -TfuUeRecpReqInfo *pucchRecpInfo; -RgSchErrInfo *err; -#endif -#endif -{ -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - S16 ret; - //CmLList *hqPNode; - RgSchUeCb *ue; - TfuUePucchRecpReq *pucchReqInfo = NULLP; - - //hqPNode = dlSfHqInfo->hqPLst.first; - ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; - - if (ue == NULLP) - { - RETVALUE(RFAILED); - } - ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if (ret != ROK) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " - "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; - pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI - * instead of SPS-CRNTI */ - - pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); - -#ifndef TFU_UPGRADE - pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL; - /* Handling of other types */ - pucchReqInfo->type = TFU_UCI_HARQ; -#else /* TFU_UPGRADE */ - pucchReqInfo->uciInfo = TFU_PUCCH_HARQ; - /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */ - pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); - /* Fill HqSz by using totalTbCnt based on the TM mode and - * the number of serv cells configured*/ - - pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal; - pucchReqInfo->hqInfo.pucchResCnt = 1; - - cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); -#endif/*TFU_UPGRADE*/ - pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx; -#ifdef TFU_UPGRADE - rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue, - pucchRecpInfo, validIdx,TRUE); -#endif/*TFU_UPGRADE*/ - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */ - -#endif/*LTE_ADV*/ - -/** @brief This function handles filling of HARQ feedback recption request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -#else -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cell, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cell; -RgSchErrInfo *err; -#endif -#endif -{ - CmLList *node; - CmLList *hqPNode; - RgSchDlHqProcCb *hqCb; - CmLteTimingInfo futTime; - RgSchDlSf *dlSf; - RgSchDlSf *nxtDlsf; - TfuUeRecpReqInfo *pucchRecpInfo = NULLP; - S16 ret; -#ifdef DEBUGP - Inst inst = cell->instIdx; -#endif - RgSchUeCb *ue; - RgSchDlHqTbCb *tbCb; - RgSchDlHqProcCb *prvHqCb=NULLP; - - TRC2(rgSCHTomUtlFillHqFdbkRecpReq); - -#ifdef CA_DBG - { - gF1bCsPres = FALSE; - } -#endif - /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output - * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is - * serving the purpose */ - RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL - - TFU_RECPREQ_DLDELTA)); - dlSf = rgSCHUtlSubFrmGet (cell, futTime); - /* Get the next dlsf as well */ - RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1) - nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime); - - prvHqCb = NULLP; - - if (dlSf->ueLst.count != 0) - { - node = dlSf->ueLst.first; - while (node) - { - ue = (RgSchUeCb *)(node->node); - node = node->next; - - if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE) - {/* This UE is already considered for PUSCH - Ignore for PUCCH */ - continue; - } - rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx, - &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err); - } /* end of while */ - } /* If hq is expected */ - - if (dlSf->msg4HqPLst.count != 0) - { - prvHqCb = NULLP; - node = dlSf->msg4HqPLst.first; - while (node) - { - hqCb = (RgSchDlHqProcCb*)(node->node); - node = node->next; - //TODO_SID: need to check validIdx - rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err); - prvHqCb = hqCb; - } /* end of while */ - } - - /* Check with TDD Code */ - /* FOR ACK NACK REP */ - RETVALUE(ROK); -} /* end of rgSCHTomUtlFillHqFdbkRecpReq */ -#ifdef TFU_UPGRADE -/** @brief This function handles filling of SR reception request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSrRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - CmLList *node; - TfuUeRecpReqInfo *pucchRecpInfo; - S16 ret; - - RgSchUeCb *ue; - Bool isAddToLst; -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = NULL; -#endif - - - TRC2(rgSCHTomUtlFillSrRecpReq); - - isAddToLst = FALSE; - - node = cell->pCqiSrsSrLst[validIdx].srLst.first; - while(node) - { - ue = (RgSchUeCb *)(node->node); - /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ - node = node->next; - if(ue == NULLP) - { - continue; - } - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - /*Fill SR params*/ - - -#ifdef LTEMAC_SPS - /* Should we check for Rel8 and above??? - * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is - * active*/ - ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell); - /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/ - if((ue->ul.ulSpsCfg.isLcSRMaskEnab) && - (ulSpsUe->isUlSpsActv)) - { - rgSCHTomUtlMoveSrNxtOccasion(cell, ue); - continue; - } -#endif - - pucchRecpInfo->rnti = ue->ueId; - pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx = - ue->srCb.srCfg.srSetup.srResIdx; - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR; - rgSCHTomUtlMoveSrNxtOccasion(cell, ue); - rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo, - pucchRecpInfo, validIdx); -#ifdef EMTC_ENABLE - isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe); -#endif - if(!isAddToLst) - { - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - } - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillSrRecpReq */ - - -/** @brief This function tells will the UE has a periodic CQI/PMI/RI - * reporting - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [in] RgSchUeCb *ue - * @param [out] Bool *willueRprtCqiRi - * @return S16 - * -# ROK - * -# RFAILED - */ - -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi -( - RgSchUeCb *ue, - Bool *willueRprtCqiRi - ) -#else -PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi) - RgSchUeCb *ue; - Bool *willueRprtCqiRi; -#endif -{ - TRC2(rgSCHTomUtlWillUeRprtCqiRi); - - /* Intialising Reporting probability as TRUE */ - *willueRprtCqiRi = TRUE; - - /* Checking the cases in which UE will not report CQIPMI/RI */ - if(ue->isDrxEnabled && ue->drxCb) - { -#ifdef LTEMAC_R9 - if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP) - {/*cqiMask is setup by upper layers */ - if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) == - RG_SCH_DRX_ONDUR_BITMASK) - {/*onDuration NOT running, do not expect cqi/pmi/ri*/ - *willueRprtCqiRi = FALSE; - } - RETVALUE(ROK); - } -#endif /*end of LTEMAC_R9*/ - /* ccpu00134258: Fix for CQI DRX issue*/ - if(ue->drxCb->onDurTmrLen > 2) - { - if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) ) - {/*UE is not active, do not expect cqi/pmi/ri*/ - *willueRprtCqiRi = FALSE; - } - } - }/*ue->isDrxEnabled*/ - - RETVALUE(ROK); -} /*End of rgSCHTomUtlWillUeRprtCqiRi*/ - -/** @brief This function handles filling of RI reception request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillRiRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - CmLList *node; - TfuUeRecpReqInfo *pucchRecpInfo; - S16 ret; - RgSchUeCb *ue; - Bool willUeRprtCqi; /* Flag set due to CQI Mask - and UE inactive state (DRX) */ - RgSchUePCqiCb *riCb = NULLP; - TRC2(rgSCHTomUtlFillRiRecpReq); - - node = cell->pCqiSrsSrLst[validIdx].riLst.first; - while(node) - { - riCb = (RgSchUePCqiCb *)(node->node); - ue = riCb->servCellInfo->ue; - /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ - node = node->next; - if(riCb->riRecpPrcsd) - { - /*ccpu00140578:: RI Proecssing is already done for this TTI - * as part of PUSCH reception process or HARQ - * Reception processing. Hence skipping this UE - * */ - riCb->riRecpPrcsd = FALSE; - continue; - } - if(riCb->riDist ==0) - { - rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); -#ifdef XEON_SPECIFIC_CHANGES - if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime)) - { - continue; - } -#endif -#ifdef LTE_ADV - if((TRUE == riCb->isRiIgnoByCollsn) - || (willUeRprtCqi == FALSE)) -#else - if(willUeRprtCqi == FALSE) -#endif - { - rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); - continue; - } - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - /*Fill RI params*/ - pucchRecpInfo->rnti = ue->ueId; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - riCb->cqiCfg.cqiSetup.cqiPResIdx; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits; - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI; - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - riCb->servCellInfo->sCellIdx; -#endif - rgSCHTomUtlFillRiBitWidthInfo(ue); - rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); - if (ue->nPCqiCb->nCqiTrIdx == validIdx) - { - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb); - } - if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0)) - { - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - } - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - else - { - riCb->riDist--; - } - } - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillRiRecpReq */ - -#ifdef RG_5GTF -/** @brief This function handles filling of 5GTF CQI-RI reception request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - TfuUeRecpReqInfo *pucchRecpInfo; - RgSchUeCb *ue = NULLP; - U16 ret; - - TRC2(rgSCHTomUtlFillCqiRiRecpReq); - - while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP) - { - if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn)) - { - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - pucchRecpInfo->rnti = ue->ueId; - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO; - pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0; - pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5; - - RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn, - ue->ue5gtfCb.cqiRiPer); - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - } - - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillCqiRiRecpReq */ -#endif - -/** @brief This function handles filling of PCQI reception request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - CmLList *node; - TfuUeRecpReqInfo *pucchRecpInfo; - S16 ret; - - RgSchUeCb *ue; - U8 ri; /*RI value*/ - Bool willUeRprtCqi; /* Flag set due to CQI Mask - and UE Inactive state (DRX)*/ - U8 cqiPmiSz; - RgSchUePCqiCb *cqiCb = NULLP; - Bool isAddToLst = FALSE; - - TRC2(rgSCHTomUtlFillPcqiRecpReq); - - node = cell->pCqiSrsSrLst[validIdx].cqiLst.first; - while(node) - { - cqiCb = (RgSchUePCqiCb*)(node->node); - ue = cqiCb->servCellInfo->ue; - /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ - node = node->next; - rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); -#ifdef LTE_ADV - if ((cqiCb->isCqiIgnoByCollsn == TRUE) || - (willUeRprtCqi == FALSE)) -#else - if(willUeRprtCqi == FALSE) -#endif - { - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - continue; - } - - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - cqiCb->servCellInfo->sCellIdx; -#endif - cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); - if(!cqiPmiSz) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi " - "size", ue->ueId); - continue; - } - - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - - /*Fill PCQI params*/ - pucchRecpInfo->rnti = ue->ueId; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - cqiCb->cqiCfg.cqiSetup.cqiPResIdx; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz; - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI; - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0)) - { - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - } -#ifdef EMTC_ENABLE - isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe); -#endif - if(!isAddToLst) - { - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - } - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillPcqiRecpReq */ - -/** @brief This function handles filling of SRS reception request to - * PHY. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSrsRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - CmLList *node; - TfuUeRecpReqInfo *pucchRecpInfo; - S16 ret; - RgSchUeCb *ue; - - TRC2(rgSCHTomUtlFillSrsRecpReq); - - node = cell->pCqiSrsSrLst[validIdx].srsLst.first; - while(node) - { - ue = (RgSchUeCb *)(node->node); - /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ - node = node->next; - if(ue->srsCb.srsRecpPrcsd) - { - /* ccpu00140578::SRS Proecssing is already done for this TTI - * as part of PUSCH or HARQ reception process and - * hence skipping this UE */ - ue->srsCb.srsRecpPrcsd = FALSE; - continue; - } - - if(ue->srsCb.srsDist ==0) - { - /* We need to add the recp request to be sent on the pucchANRep value. */ - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - -#ifdef TFU_ALLOC_EVENT_NO_INIT - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - - /*Fill SRS params*/ - pucchRecpInfo->rnti = ue->ueId; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = - (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = - ue->srsCb.srsCfg.srsSetup.fDomPosi; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = - (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = - ue->srsCb.srsCfg.srsSetup.txComb; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = - ue->srsCb.srsCfg.srsSetup.srsCfgIdx; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = - (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; - - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS; - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - else - { - ue->srsCb.srsDist--; - } - } - RETVALUE(ROK); -}/* end of rgSCHTomUtlFillSrsRecpReq */ -#endif -#ifndef TFU_UPGRADE -/** @brief This function handles filling of data reception requests for - * PUSCH and MSG3. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillDatRecpReq -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cell, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cell; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - - TRC2(rgSCHTomUtlFillDatRecpReq) - - /* processing steps are - * - Run through the UL allocations going out in this subframe. - * - Run through the UL receptions expected the next subframe. - */ - alloc = rgSCHUtlFirstRcptnReq (cell); - while(alloc) - { - /* FOR ACK NACK REP */ - if (NULLP != alloc->ue) - { - /* If measuring or ackNakRep we shall not send dat RecpReq */ - if ((alloc->ue->measGapCb.isMeasuring == TRUE) || - (alloc->ue->ackNakRepCb.isAckNakRep == TRUE)) - { - alloc = rgSCHUtlNextRcptnReq (cell, alloc); - continue; - } - - } - if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo, - sizeof(TfuUeRecpReqInfo), - &(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - if (!alloc->forMsg3) - { - datRecpInfo->type = TFU_RECP_REQ_PUSCH; - rgSCHUtlAllocRcptInfo (alloc, - &datRecpInfo->rnti, - &datRecpInfo->t.puschRecpReq.mcs, - &datRecpInfo->t.puschRecpReq.rbStart, - &datRecpInfo->t.puschRecpReq.numRb, - &datRecpInfo->t.puschRecpReq.rv, - &datRecpInfo->t.puschRecpReq.size, - &datRecpInfo->t.puschRecpReq.modType, - &datRecpInfo->t.puschRecpReq.isRtx, - &datRecpInfo->t.puschRecpReq.nDmrs, - &datRecpInfo->t.puschRecpReq.ndi, - &datRecpInfo->t.puschRecpReq.harqProcId - ); - } - else - { - datRecpInfo->type = TFU_RECP_REQ_MSG3; - rgSCHUtlAllocRcptInfo (alloc, - &datRecpInfo->rnti, - &datRecpInfo->t.msg3RecpReq.mcs, - &datRecpInfo->t.msg3RecpReq.rbStart, - &datRecpInfo->t.msg3RecpReq.numRb, - /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/ - &datRecpInfo->t.msg3RecpReq.rv, - &datRecpInfo->t.msg3RecpReq.size, - &datRecpInfo->t.msg3RecpReq.modType, - &datRecpInfo->t.msg3RecpReq.isRtx, - &datRecpInfo->t.msg3RecpReq.nDmrs, - &datRecpInfo->t.msg3RecpReq.ndi, - &datRecpInfo->t.msg3RecpReq.harqProcId - ); - - } - /* Other fields of datRecpInfo shall be filled - * here for new features */ - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk)); - datRecpInfo->lnk.node = (PTR)datRecpInfo; - - alloc = rgSCHUtlNextRcptnReq (cell, alloc); - } /* end of while */ - RETVALUE(ROK); -} /* end of rgSCHTomUtlFillDatRecpReq */ - -#else -/** @brief This function handles filling of data reception requests for - * PUSCH and MSG3. - * - * @details - * - * Function: - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [in] U16 validIdx - * @param [out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillDatRecpReq -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cell, - U16 validIdx, - RgSchErrInfo *err - ) -#else -PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cell; - U16 validIdx; - RgSchErrInfo *err; -#endif -{ - CmLteTimingInfo dci0Time; - U8 idx; - Bool recvCtrl = TRUE; - S16 ret; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - - Bool hqPres; /*Set when HARQ Rec Req is present*/ - Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */ - U8 numUePerTti = 0; - - TRC2(rgSCHTomUtlFillDatRecpReq); - - if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.subframe)) - { - //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.subframe); - } - /* processing steps are - * - Run through the UL allocations going out in this subframe. - * - Run through the UL receptions expected the next subframe. - */ - - alloc = rgSCHUtlFirstRcptnReq (cell); - while(alloc) - { - isAperiodic = FALSE; - ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if(ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " - "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } -#ifdef TFU_ALLOC_EVENT_NO_INIT - datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE; - datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE; -#endif - datRecpInfo->type = TFU_RECP_REQ_PUSCH; - /* ccpu00131944 - Intializing hqPres in each iteration*/ - hqPres = FALSE; - /* Check if this if for MSG3 - no scope for feedback along with it. */ - if ((FALSE == alloc->forMsg3)) - { - /* Check if any DL HARQ processes has a feedback coming at the time of - * this reception request. - */ -/* ACC-TDD */ - if(alloc->ue) - { - RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST)); - - idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.subframe)% - RGSCH_ULCTRL_RECP_DIST; - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA; - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - } - } - else /*Enters for Msg3 == TRUE condition*/ - { - /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity - * occur at same time */ - if(NULLP != alloc->ue) - { - - /* Only DATA is expected */ - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA; - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - } - } - if(alloc->ue) - { - if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA && - datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS && - isAperiodic == FALSE) - { - datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE; - datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs; - } - else - { - datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE; - } - } - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk)); - datRecpInfo->lnk.node = (PTR)datRecpInfo; - alloc = rgSCHUtlNextRcptnReq (cell, alloc); - numUePerTti++; - } /* end of while */ - - if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI)) - { - cell->ulNumUeSchedPerTti[numUePerTti-1]++; - gUlNumUePerTti[numUePerTti - 1]++; - } - RETVALUE(ROK); -} /* end of rgSCHTomUtlFillDatRecpReq */ -#endif -/* rg009.201. Added changes of TFU_UPGRADE */ -#ifdef TFU_UPGRADE -/*********************************************************** - * - * Func : rgSCHTomUtlFillRiBitWidthInfo - * - * - * Desc : Fills the RI BitWidth and stores it for decoding. - * - * Ret : S16 - * ROK - Success - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo -( - RgSchUeCb *ueCb - ) -#else -PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb) - RgSchUeCb *ueCb; -#endif -{ - RgSchUePCqiCb *riCb = ueCb->nPRiCb; - TRC2(rgSCHTomUtlFillRiBitWidthInfo); - - if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 && - ueCb->mimoInfo.txMode != RGR_UE_TM_4) - { - RETVALUE(RFAILED); - } - - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode= - (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum; - switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode) - { - case TFU_PUCCH_CQI_MODE10: - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri = - riCb->riNumBits; - break; - case TFU_PUCCH_CQI_MODE11: - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri = - riCb->riNumBits; - break; - case TFU_PUCCH_CQI_MODE20: - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri = - riCb->riNumBits; - break; - case TFU_PUCCH_CQI_MODE21: - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri = - riCb->riNumBits; - break; - default: - break; - } - - RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHTomUtlFetchPcqiBitSz - * - * - * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity. - * - * Ret : U8 - * ROK - Success - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz -( - RgSchUeCb *ueCb, - U8 numTxAnt, - U8 *ri - ) -#else -PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri) - RgSchUeCb *ueCb; - U8 numTxAnt; - U8 *ri; -#endif -{ - U8 confRepMode; - U8 pcqiSz; - TfuCqiPucchMode10 *mode10Info; - TfuCqiPucchMode11 *mode11Info; - TfuCqiPucchMode20 *mode20Info; - TfuCqiPucchMode21 *mode21Info; - RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb; - - TRC3(rgSCHTomUtlFetchPcqiBitSz); - - confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum; - if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) && - (ueCb->mimoInfo.txMode != RGR_UE_TM_4)) - { - *ri =1; - } - else - { - *ri = cqiCb->perRiVal; - } - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode= - (TfuDlCqiPucchMode)confRepMode; - switch(confRepMode) - { - case RGR_PRD_CQI_MOD10: - { - mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info; - pcqiSz = 4; - mode10Info->type = TFU_RPT_CQI; - mode10Info->u.cqi = 4; - } - break; - - case RGR_PRD_CQI_MOD11: - { - mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info; - mode11Info->type = TFU_RPT_CQI; - if(numTxAnt == 2) - { - if (*ri ==1) - { - pcqiSz = 6; - mode11Info->u.cqi.cqi = 4; - mode11Info->u.cqi.wideDiffCqi.pres = FALSE; - mode11Info->u.cqi.pmi = 2; - } - else - { - pcqiSz = 8; - mode11Info->u.cqi.cqi = 4; - mode11Info->u.cqi.wideDiffCqi.pres = TRUE; - mode11Info->u.cqi.wideDiffCqi.val = 3; - mode11Info->u.cqi.pmi = 1; - } - } - else if(numTxAnt == 4) - { - if (*ri ==1) - { - pcqiSz = 8; - mode11Info->u.cqi.cqi = 4; - mode11Info->u.cqi.wideDiffCqi.pres = FALSE; - mode11Info->u.cqi.pmi = 4; - } - else - { - pcqiSz = 11; - mode11Info->u.cqi.cqi = 4; - mode11Info->u.cqi.wideDiffCqi.pres = TRUE; - mode11Info->u.cqi.wideDiffCqi.val = 3; - mode11Info->u.cqi.pmi = 4; - } - } - else - { - /* This is number of antenna case 1. - * This is not applicable for Mode 1-1. - * So setting it to invalid value */ - pcqiSz = 0; - } - } - break; - - case RGR_PRD_CQI_MOD20: - { - mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info; - mode20Info->type = TFU_RPT_CQI; - if(cqiCb->isWb) - { - pcqiSz = 4; - mode20Info->u.cqi.isWideband = TRUE; - mode20Info->u.cqi.u.wideCqi = 4; - } - else - { - pcqiSz = 4 + cqiCb->label; - mode20Info->u.cqi.isWideband = FALSE; - mode20Info->u.cqi.u.subCqi.cqi = 4; - mode20Info->u.cqi.u.subCqi.l = cqiCb->label; - } - } - break; - - case RGR_PRD_CQI_MOD21: - { - mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info; - mode21Info->type = TFU_RPT_CQI; - //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb, - // mode21Info, numTxAnt, ri); - } - break; - default: - pcqiSz = 0; - break; - } - - RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - RETVALUE(pcqiSz); -} - - -/*********************************************************** - * - * Func : rgSCHTomUtlPcqiSbCalcBpIdx - * - * - * Desc : Determines the BP index from the timing info - * - * Ret : S16 - * ROK - Success - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx -( - CmLteTimingInfo crntTimInfo, - RgSchUeCb *ueCb, - RgSchUePCqiCb *cqiCb - ) -#else -PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb) - CmLteTimingInfo crntTimInfo; - RgSchUeCb *ueCb; - RgSchUePCqiCb *cqiCb; -#endif -{ - U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.subframe); - U16 prdNum = tti/cqiCb->cqiPeri; - - TRC2(rgSCHTomUtlPcqiSbCalcBpIdx); - if((prdNum % cqiCb->h) == 0) - { - cqiCb->isWb = TRUE; -#ifdef LTE_ADV - cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1; -#endif - } - else - { - cqiCb->isWb = FALSE; - cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J; -#ifdef LTE_ADV - cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0; -#endif - } - RETVALUE(ROK); -} - - -/** - * @brief Function which moves PCQI, RI, SR and SRS to next periodicity - * Occasions as that needs to be done in case of Ack/Nack repetition - * reception request occasions or during Measurement Gap occasions. - * - * @details - * - * Function: rgSCHTomUtlMoveNxtOccasion - * - * Function which moves PCQI, RI, SR and SRS to next perodicity - * Occasions as that needs to be done in case of Ack/Nack repetition - * reception request occasions or during Measurement Gap occasions. - * - * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Check whether the current Tx Instance matches with the rec req time - * - If true, then move them to their next Tx Instance - * - * @param[in] RgSchCellCb *cell, - * RgSchUeCb *ue, - * U16 validIdx - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlMoveNxtOccasion -( - RgSchCellCb *cell, - RgSchUeCb *ue, - U16 validIdx - ) -#else -PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx) - RgSchCellCb *cell; - RgSchUeCb *ue; - U16 validIdx; -#endif -{ - RgSchUePCqiCb *cqiCb = ue->nPCqiCb; - RgSchUePCqiCb *riCb = ue->nPRiCb; - TRC2(rgSCHTomUtlMoveNxtOccasion); - - /* ccpu00140578::Skip the UE if already RI recpetion - * is processed in the same subframe */ - if ((riCb->nRiTrIdx == validIdx) && - (riCb->riRecpPrcsd == FALSE)) - { - if(riCb->riDist ==0) - { - rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); - } - else - { - riCb->riDist--; - } - /* ccpu00140578:: As this UE is considered for this TTI - * Same UE should not get processed for RI reception - * or for updating th RI distance.*/ - if(riCb->nRiTrIdx == validIdx) - { - riCb->riRecpPrcsd = TRUE; - } - } - if (cqiCb->nCqiTrIdx == validIdx) - { - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - } - - /* ccpu00140578::Skip the UE if SRS recpetion - * is already processed in the same subframe */ - if ((ue->srsCb.nSrsTrIdx == validIdx) && - (ue->srsCb.srsRecpPrcsd == FALSE)) - { - if(ue->srsCb.srsDist ==0) - { - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - } - else - { - ue->srsCb.srsDist--; - } - /* ccpu00140578:: As this UE is considered for this TTI - * Same UE should not get processed for SRS reception - * or for updating th SRS distance.*/ - if(ue->srsCb.nSrsTrIdx == validIdx) - { - ue->srsCb.srsRecpPrcsd = TRUE; - } - } - if (ue->srCb.nSrTrIdx == validIdx) - { - rgSCHTomUtlMoveSrNxtOccasion(cell, ue); - } - RETVALUE(ROK); -} /* rgSCHTomUtlMoveNxtOccasion */ - - -/*********************************************************** - * - * Func : rgSCHTomPrepareAcqiRecp - * - * - * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them - * for decoding. Fill RECP request and prepare the scartchpad - * to aid decoding of Aperiodic CQI. - * - * Ret : Void - * ROK - RETVOID - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHTomPrepareAcqiRecp -( - RgSchUeCb *ueCb, - RgSchCellCb *cell, - TfuUePuschCqiRecpInfo *cqiRecpReqInfo, - U8 ccIdx - ) -#else -PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx) - RgSchUeCb *ueCb; - RgSchCellCb *cell; - TfuUePuschCqiRecpInfo *cqiRecpReqInfo; - U8 ccIdx; -#endif -{ - U8 confRepMode; - RgSchCqiRawPuschMode12 *mode12Info; - RgSchCqiRawPuschMode20 *mode20Info; - RgSchCqiRawPuschMode22 *mode22Info; - RgSchCqiRawPuschMode30 *mode30Info; - RgSchCqiRawPuschMode31 *mode31Info; - U8 numTxAnt = cell->numTxAntPorts; - U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)]; - U8 numOfCells = 0; - RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb; - - TRC2(rgSCHTomPrepareAcqiRecp); - - /* Fill TFU Recp */ - cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */ - if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 || - ueCb->mimoInfo.txMode == RGR_UE_TM_4) - { - cqiRecpReqInfo->riSz[ccIdx].pres = TRUE; - cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits; - } - /* This flag will be rmeoved after making changes in BRDCM CL - * Sachin is doing the change - * */ -#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)) - //LTE_ADV_ACQI_SUPP - cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1; - cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1; -#else - if(ueCb->nPCqiCb->perRiVal == 1) - { - cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1; - } - else - { - cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1; - } -#endif - /* Fill scratchpad to aid decoding of aper CQI upon - * reception */ - confRepMode = acqiCb->aCqiCfg.aprdModeEnum; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH; - - numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells; - - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ - puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode; - - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ - puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres; - - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ - puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val; - - /* Setting the sCellIdx */ - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ - sCellIdx = sCellIdx; - - switch(confRepMode) - { - case RGR_APRD_CQI_MOD12: - { - mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ - cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info; - mode12Info->wideBCqiCw0 = 4; - mode12Info->r1WideBCqiCw1 = 0; - mode12Info->rg1WideBCqiCw1 = 4; - if(numTxAnt == 2) - { - mode12Info->r1TotalPmiBitLen = 2*acqiCb->N; - mode12Info->rg1TotalPmiBitLen = acqiCb->N; - } - else if(numTxAnt == 4) - { - mode12Info->r1TotalPmiBitLen = 4*acqiCb->N; - mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N; - } - } - break; - - case RGR_APRD_CQI_MOD20: - { - mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ - cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info; - mode20Info->wideBCqiCw = 4; - mode20Info->subBandDiffCqi = 2; - mode20Info->posOfM = acqiCb->L; - } - break; - - case RGR_APRD_CQI_MOD22: - { - mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ - cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info; - mode22Info->wideBCqiCw0 = 4; - mode22Info->sBDiffCqiCw0 = 2; - mode22Info->r1WideBCqiCw1 = 0; - mode22Info->r1SbDiffCqiCw1 = 0; - mode22Info->rg1WideBCqiCw1 = 4; - mode22Info->rg1SbDiffCqiCw1 = 2; - mode22Info->posOfM = acqiCb->L; - if(numTxAnt == 2) - { - mode22Info->r1PmiBitLen = 4; - mode22Info->rg1PmiBitLen = 2; - } - else if(numTxAnt == 4) - { - mode22Info->r1PmiBitLen = 8; - mode22Info->rg1PmiBitLen = 8; - } - } - break; - - case RGR_APRD_CQI_MOD30: - { - mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ - cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info; - mode30Info->wideBCqiCw = 4; - mode30Info->totLenSbDiffCqi = 2*acqiCb->N; - } - break; - - case RGR_APRD_CQI_MOD31: - { - mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ - cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info; - mode31Info->wideBCqiCw0 = 4; - mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N; - mode31Info->r1WideBCqiCw1 = 0; - mode31Info->r1TotLenSbDiffCqiCw1 =0; - mode31Info->rg1WideBCqiCw1 = 4; - mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N; - if(numTxAnt == 2) - { - mode31Info->r1PmiBitLen = 2; - mode31Info->rg1PmiBitLen = 1; - } - else if(numTxAnt == 4) - { - mode31Info->r1PmiBitLen = 4; - mode31Info->rg1PmiBitLen = 4; - } - } - break; - default: - break; - } - RETVOID; -} - -/** - * @brief Function which handles the filling of Aperiodic CQI/RI reception - * request values - * - * @details - * - * Function: rgSCHTomUtlFillDatAperRecpReq - * - * Function which handles the filling of Aperiodic CQI/RI reception - * request values - * - * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the data arriving on the ULSCH - * - Fill the reception request information for the Aperiodic CQI/PMI/RI - * - * @param[in] RgSchCellCb *cell, - * RgSchUlAlloc *alloc, - * TfuUeRecpReqInfo *datRecpInfo, - * CmLteTimingInfo *timeInfo, - * Bool hqPres - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq -( - RgSchCellCb *cell, - U8 cqiReq, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - ) -#else -PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx) - RgSchCellCb *cell; - U8 cqiReq; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - CmLteTimingInfo *timeInfo; - Bool hqPres; - U16 validIdx; -#endif -{ - TfuUePuschCqiRecpInfo *cqiRecpReqInfo; - RgSchUeCb *ueCb = alloc->ue; -#ifdef LTE_ADV - U8 triggerSet = 0; - U8 sIdx = 0; -#endif - TRC2(rgSCHTomUtlFillDatAperRecpReq); - - /*Fill RI Reception Params*/ - cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; - cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst; - cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst; - - - cqiRecpReqInfo->cCNum = 0; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0; - -#ifdef LTE_ADV - rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet); - for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++) - { - /* The Aperiodic request for SCell index sIdx */ - if ((triggerSet >> (7 - sIdx)) & 0x01) - { - /* The Aperiodic request for SCell index sIdx */ - rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum); - cqiRecpReqInfo->cCNum++; - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++; - } - } -#else - rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum); - ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++; -#endif - - RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - - if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) - { - rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; - - } - if(hqPres && - (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; - } - else if (hqPres) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; - } - else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; - } - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - RETVALUE(ROK); -} /* rgSCHTomUtlFillDatAperRecpReq */ - - - -/** - * @brief Function which handles the filling of Periodic RI reception - * request values which arrives along with UL Data on ULSCH - * - * @details - * - * Function: rgSCHTomUtlFillDatPriRecpReq - * - * Function which handles the filling of Periodic RI reception - * request values which arrives along with UL Data on ULSCH - * - * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the data arriving on the ULSCH - * - Fill the reception request information for the Periodic RI - * - * @param[in] RgSchCellCb *cell, - * RgSchUlAlloc *alloc, - * TfuUeRecpReqInfo *datRecpInfo, - * CmLteTimingInfo *timeInfo, - * Bool hqPres - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - ) -#else -PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo, -hqPres, validIdx) - RgSchCellCb *cell; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - CmLteTimingInfo *timeInfo; - Bool hqPres; - U16 validIdx; -#endif -{ - TfuUePuschCqiRecpInfo *cqiRecpReqInfo; - TRC2(rgSCHTomUtlFillDatPriRecpReq); - - /*Fill RI Reception Params*/ - cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; -#ifdef TFU_ALLOC_EVENT_NO_INIT - cqiRecpReqInfo->cqiBetaOff = 0; - /* Fill only the first RI index since Periodic can come - * only for 1 CC */ - cqiRecpReqInfo->cqiPmiSzR1[0] = 0; - cqiRecpReqInfo->cqiPmiSzRn1[0] = 0; -#endif - cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */ - cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst; - - /* Fill only the first RI index since Periodic can come - * only for 1 CC */ - cqiRecpReqInfo->cCNum = 1; - cqiRecpReqInfo->riSz[0].pres = TRUE; - cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits; - /*Other params*/ - rgSCHTomUtlFillRiBitWidthInfo(alloc->ue); - if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) - { - rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; - - } - if(hqPres && - (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; - } - else if (hqPres) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; - } - else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; - } - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - RETVALUE(ROK); -} /* rgSCHTomUtlFillDatPriRecpReq */ - - -/** - * @brief Function which handles the filling of Periodic CQI/PMI reception - * request values which arrives along with UL Data on ULSCH - * - * @details - * - * Function: rgSCHTomUtlFillDatPCqiRecpReq - * - * Function which handles the filling of Periodic CQI/PMI reception - * request values which arrives along with UL Data on ULSCH - * - * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the data arriving on the ULSCH - * - Fill the reception request information for the Periodic CQI/PMI - * - * @param[in] RgSchCellCb *cell, - * RgSchUlAlloc *alloc, - * TfuUeRecpReqInfo *datRecpInfo, - * CmLteTimingInfo *timeInfo, - * Bool hqPres - * @return S16 - * -# ROK - * -# RFAILED - **/ - -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres, - U16 validIdx - ) -#else -PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo, - timeInfo, hqPres, validIdx) - RgSchCellCb *cell; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - CmLteTimingInfo *timeInfo; - Bool hqPres; - U16 validIdx; -#endif -{ - TfuUePuschCqiRecpInfo *cqiRecpReqInfo; - U8 cqiPmiSz; /*Raw CQI/PMI Size*/ - U8 ri; - - TRC2(rgSCHTomUtlFillDatPCqiRecpReq); - - - /*Fill CQI Reception Params*/ - cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; -#ifdef TFU_ALLOC_EVENT_NO_INIT - cqiRecpReqInfo->riBetaOff = 0; -#endif - cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst; - cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri); - if(0 == cqiPmiSz) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill " - "CqiPmi size RNTI:%d",alloc->rnti); - RETVALUE(RFAILED); - } - - /* Fill only the first RI index since Periodic can come - * only for 1 CC */ - cqiRecpReqInfo->cCNum = 1; - cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */ - /* This flags will be removed once Sachin does changes - * in BRDCM CL */ -#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)) - cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz; - cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz; -#else - if (ri ==1) - { - cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz; - cqiRecpReqInfo->cqiPmiSzRn1[0] = 0; - } - else - { - cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz; - cqiRecpReqInfo->cqiPmiSzR1[0] = 0; - } -#endif - cqiRecpReqInfo->riSz[0].pres = FALSE; - - if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) - { - rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; - } - if(hqPres && - (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; - } - else if (hqPres) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; - } - else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; - } - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - RETVALUE(ROK); -} /* rgSCHTomUtlFillDatPCqiRecpReq */ - -/** - * @brief Function which handles the filling of SRS reception - * request values which arrives along with UL Data on ULSCH - * - * @details - * - * Function: rgSCHTomUtlFillDatSrsRecpReq - * - * Function which handles the filling of SRS reception - * request values which arrives along with UL Data on ULSCH - * - * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the data arriving on the ULSCH - * - Fill the reception request information for the SRS - * - * @param[in] RgSchCellCb *cell, - * RgSchUlAlloc *alloc, - * TfuUeRecpReqInfo *datRecpInfo, - * CmLteTimingInfo *timeInfo, - * Bool hqPres - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo, - CmLteTimingInfo *timeInfo, - Bool hqPres - ) -#else -PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo, - hqPres) - RgSchCellCb *cell; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; - CmLteTimingInfo *timeInfo; - Bool hqPres; -#endif -{ - TRC2(rgSCHTomUtlFillDatSrsRecpReq); - datRecpInfo->rnti = alloc->rnti; - rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); - if(hqPres) - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS; - } - else - { - datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS; - } - datRecpInfo->rnti = alloc->rnti; - rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, - &datRecpInfo->t.puschRecpReq.ulSchInfo); - RETVALUE(ROK); -} /* rgSCHTomUtlFillDatSrsRecpReq */ - -/** - * @brief Function which handles the filling of only SRS reception - * request values on ULSCH - * - * @details - * - * Function: rgSCHTomFillOnlySrsRecpReq - * - * Function which handles the filling of SRS reception - * request values which arrives along with UL Data on ULSCH - * - * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the data arriving on the ULSCH - * - Fill the reception request information for the SRS - * - * @param[in] RgSchCellCb *cell, - * RgSchUlAlloc *alloc, - * TfuUeRecpReqInfo *datRecpInfo, - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHTomFillOnlySrsRecpReq -( - RgSchCellCb *cell, - RgSchUlAlloc *alloc, - TfuUeRecpReqInfo *datRecpInfo - ) -#else -PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo) - RgSchCellCb *cell; - RgSchUlAlloc *alloc; - TfuUeRecpReqInfo *datRecpInfo; -#endif -{ - TfuUePuschSrsRecpInfo *srsRecpReqInfo; - TRC2(rgSCHTomFillOnlySrsRecpReq); - - srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo; - srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw; - srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi; - srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw; - srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb; - srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx; - srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift; - - /* ccpu00117050 - ADD - nSrs setting - * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/ - datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1; - - RETVALUE(ROK); -} /* rgSCHTomFillOnlySrsRecpReq */ - -/** - * @brief Function which handles the filling of PCQI/RI, SRS and SR - * Reception Request Information along - * with the HARQ reception Request - * - * @details - * - * Function: rgSCHTomUtlFillCqiSrSrsWithHq - * - * Function which handles the filling of PCQI/RI, SRS ans SR - * Reception Request Information along - * with the HARQ reception Request - * - * - * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq & - * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for the Control Info arriving on the PUCCH - * - Fill the reception request information for the SR, RI, CQI, SRS - * - * @param[in] RgSchCellCb *cell, - * TfuRecpReqInfo *recpReqInfo, - * RgSchDlHqProcCb *hqCb, - * @param[out] TfuUeRecpReqInfo *pucchRecpInfo - * @param[in] U16 validIdx - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq -( - RgSchCellCb *cell, - TfuRecpReqInfo *recpReqInfo, - RgSchUeCb *ue, - TfuUeRecpReqInfo *pucchRecpInfo, - U16 validIdx, - Bool isDatPresOnSecCell - ) -#else -PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue, - pucchRecpInfo, validIdx,isDatPresOnSecCell) -RgSchCellCb *cell; -TfuRecpReqInfo *recpReqInfo; -RgSchUeCb *ue; -TfuUeRecpReqInfo *pucchRecpInfo; -U16 validIdx; -Bool isDatPresOnSecCell; -#endif -{ - RgSchUePCqiCb *cqiCb; - RgSchUePCqiCb *riCb; - U8 ri; /*To fetch RI value*/ - Bool willUeRprtCqi; /* Flag set due to CQI Mask and - UE Inactive state (DRX)*/ - Bool willUeRprtSr = TRUE; - TfuAckNackMode hqFdbkMode; - U8 numCqiBit; - U8 totalPucchBits; - Bool dropCqi = FALSE; -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = NULL; -#endif -#ifdef EMTC_ENABLE - RgSchEmtcUeInfo *emtcUe = NULLP; -#endif - - TRC2(rgSCHTomUtlFillCqiSrSrsWithHq); - - if(ue) - { - /*Changes for PUCCH Format3 */ - hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode; - numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts); - totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit; - -#ifdef EMTC_ENABLE - emtcUe = RG_GET_EMTC_UE_CB(ue); -#endif - rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); -#ifdef EMTC_ENABLE /*VINU*/ - if (ue->isEmtcUe) - { - if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1)) - { - willUeRprtCqi = FALSE; - willUeRprtSr = FALSE; - } - } -#endif - if(ue->srCb.nSrTrIdx == validIdx) - { - -#ifdef LTEMAC_SPS - /* Should we check for Rel8 and above??? - * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is - * active*/ - ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell); - /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/ - if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) && - (ulSpsUe->isUlSpsActv))) - { -#endif - - if(willUeRprtSr) - { - /*Fill SR params*/ - pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx = - ue->srCb.srCfg.srSetup.srResIdx; - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; - /* FORMAT3: If SR is present it will be appended after HARQ */ - totalPucchBits = totalPucchBits + 1; - } - -#ifdef LTEMAC_SPS - } -#endif - - rgSCHTomUtlMoveSrNxtOccasion(cell, ue); - } - /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present - * on sec cell(isDatPresOnSecCell)*/ -#ifdef LTE_TDD - if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION) -#else - if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS) -#endif - { - if (isDatPresOnSecCell == TRUE) - { - dropCqi = TRUE; - } - } -#ifdef LTE_ADV -#ifndef LTE_TDD - /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3 - is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped - Spec 36.213 Sec 10.1.1 */ - else if (hqFdbkMode == TFU_UCI_FORMAT_3) - { - if ((isDatPresOnSecCell == TRUE) && - ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22))) - { - dropCqi = TRUE; - } - } -#endif -#endif - riCb = ue->nPRiCb; - cqiCb = ue->nPCqiCb; - if(riCb->nRiTrIdx == validIdx) - { - /*ccpu00140578:: Skip the UE if the RI is already processed - * for PUSCH */ - if(riCb->riRecpPrcsd == FALSE) - { - if(riCb->riDist == 0) - { - if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&& - (isDatPresOnSecCell == FALSE)) - { - /*Fill RI params*/ - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - riCb->cqiCfg.cqiSetup.cqiPResIdx; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = - riCb->riNumBits; - if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR) - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI; - } - else - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI; - } - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - ue->nPRiCb->servCellInfo->sCellIdx; -#endif - rgSCHTomUtlFillRiBitWidthInfo(ue); - if (ue->nPCqiCb->nCqiTrIdx == validIdx) - { - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb); - } -#ifdef CA_DBG - { - if(gF1bCsPres) - { - gRiReqCount++; - } - } - -#endif - - - - } - rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); - } - else - { - riCb->riDist--; - } - /* Skip the UE for RI processing on PUCCH - * in the same subframe as it already processed */ - if(riCb->nRiTrIdx == validIdx) - { - /* As the new idx is same is current idx - * then PUCCH reception processing will consider - * RI also in the same subframe. To block this - * below flag is used*/ - riCb->riRecpPrcsd = TRUE; - } - } - } - else if(cqiCb->nCqiTrIdx == validIdx) - { - if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&& - (isDatPresOnSecCell == FALSE)) - { - /*Fill CQI Params*/ - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - cqiCb->cqiCfg.cqiSetup.cqiPResIdx; - - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - cqiCb->servCellInfo->sCellIdx; -#endif - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = - rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); - if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d " - "Unable to Fill CqiPmi size", ue->ueId); - RETVALUE(RFAILED); - } - if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR) - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI; - } - else - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI; - } - } -#ifdef CA_DBG - { - if(gF1bCsPres) - { - gCqiReqCount++; - } - } - -#endif - - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - } - if(ue->srsCb.nSrsTrIdx == validIdx) - { - /* ccpu00140578::Skip the UE for SRS reception processing - * if already done as part of PUSCH recpetion - * process*/ - if(ue->srsCb.srsRecpPrcsd == FALSE) - { - if(ue->srsCb.srsDist ==0 ) - { - if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI) - && (ue->srsCb.srsCfg.srsSetup.sANSrs) - && (isDatPresOnSecCell == FALSE)) - { - /*Fill SRS params*/ - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = - (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = - ue->srsCb.srsCfg.srsSetup.fDomPosi; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = - (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = - ue->srsCb.srsCfg.srsSetup.txComb; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = - ue->srsCb.srsCfg.srsSetup.srsCfgIdx; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = - (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; - /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */ - switch(pucchRecpInfo->t.pucchRecpReq.uciInfo) - { - case TFU_PUCCH_HARQ_SR: - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS; - break; - case TFU_PUCCH_HARQ_SR_CQI: - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS; - break; - default: - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS; - break; - } - } - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - } - else - { - ue->srsCb.srsDist--; - } - /* Skip the UE for SRS processing on PUCCH - * in the same subframe as it already processed */ - if(ue->srsCb.nSrsTrIdx == validIdx) - { - /* As the new idx is same is current idx - * then PUCCH reception processing will consider - * SRS also in the same subframe. To block this - * below flag is used*/ - ue->srsCb.srsRecpPrcsd = TRUE; - } - - } - } - } - - RETVALUE(ROK); -} /* rgSCHTomUtlFillCqiSrSrsWithHq */ - -/** - * @brief Function which handles the filling of PCQI/RI, SRS - * Reception Request Information along with SR reception - * Request - * - * @details - * - * Function: rgSCHTomUtlFillCqiSrsWithSr - * - * Function which handles the filling of PCQI/RI, SRS - * Reception Request Information along - * with the SR reception Request - * - * - * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c - * - * Processing Steps: - * - Fill the reception request for CQI/RI, SRS if they occur - * in the same instance as of SR. - * - * @param[in] RgSchCellCb *cell, - * RgSchUeCb *ue - * TfuRecpReqInfo *recpReqInfo, - * @param[out] TfuUeRecpReqInfo *pucchRecpInfo - * @param[in] U16 validIdx - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr -( - RgSchCellCb *cell, - RgSchUeCb *ue, - TfuRecpReqInfo *recpReqInfo, - TfuUeRecpReqInfo *pucchRecpInfo, - U16 validIdx - ) -#else -PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo, - pucchRecpInfo, validIdx) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuRecpReqInfo *recpReqInfo; -TfuUeRecpReqInfo *pucchRecpInfo; -U16 validIdx; -#endif -{ - RgSchUePCqiCb *cqiCb; - RgSchUePCqiCb *riCb; - U8 ri; /*To fetch RI value*/ - Bool willUeRprtCqi; /* Flag set due to CQI Mask and - UE Inactive state (DRX)*/ - TRC2(rgSCHTomUtlFillCqiSrsWithSr); - - riCb = ue->nPRiCb; - cqiCb = ue->nPCqiCb; - rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); -#ifdef EMTC_ENABLE - rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi); -#endif - if(riCb->nRiTrIdx == validIdx) - { - /*ccpu00140578:: Skip the UE if the RI is already processed - * for PUSCH */ - if(riCb->riRecpPrcsd == FALSE) - { - if(riCb->riDist == 0) - { - if(willUeRprtCqi == TRUE) - { - /*Fill RI params*/ - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - riCb->cqiCfg.cqiSetup.cqiPResIdx; - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = - riCb->riNumBits; - - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI; - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - ue->nPRiCb->servCellInfo->sCellIdx; -#endif - rgSCHTomUtlFillRiBitWidthInfo(ue); - /* TODO:: syed Shouldn't this be done outside this if condition */ - if (cqiCb->nCqiTrIdx == validIdx) - { - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - } - } - rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); - } - else - { - riCb->riDist--; - } - if(riCb->nRiTrIdx == validIdx) - {/* Need to skip this UE during PUCCH RI recpetion process - in the current subframe */ - riCb->riRecpPrcsd = TRUE; - } - } - } - else if(cqiCb->nCqiTrIdx == validIdx) - { - if(willUeRprtCqi == TRUE) - { - /*Fill CQI Params*/ - pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = - cqiCb->cqiCfg.cqiSetup.cqiPResIdx; - - ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; - -#ifdef LTE_ADV - ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = - cqiCb->servCellInfo->sCellIdx; -#endif - pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = - rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); - if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d" - " Unable to Fill CqiPmi size", ue->ueId); - RETVALUE(RFAILED); - } - - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI; - } - rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); - } - if(ue->srsCb.nSrsTrIdx == validIdx) - { - /* ccpu00140578:: Cnsider the SRS processing - * only if not done in the same TTI - * as part of PUSCH or HARQ reception process*/ - if(ue->srsCb.srsRecpPrcsd == FALSE) - { - if(ue->srsCb.srsDist ==0 ) - { - if(ue->srsCb.srsCfg.srsSetup.sANSrs) - { - /*Fill SRS params*/ - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = - (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = - ue->srsCb.srsCfg.srsSetup.fDomPosi; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = - (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; - pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = - ue->srsCb.srsCfg.srsSetup.txComb; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = - ue->srsCb.srsCfg.srsSetup.srsCfgIdx; - pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = - (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; - /* ccpu00116923 - ADD - New Reception Request types for CQI and - * SRS with SR */ - if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI) - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS; - } - else - { - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS; - } - - } - rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); - } - else - { - ue->srsCb.srsDist--; - } - /* Skip the UE for SRS processing on PUCCH - * in the same subframe as it already processed */ - if(ue->srsCb.nSrsTrIdx == validIdx) - { - /* As the new idx is same is current idx - * then PUCCH reception processing will consider - * SRS also in the same subframe. To block this - * below flag is used*/ - ue->srsCb.srsRecpPrcsd = TRUE; - } - - } - } - RETVALUE(ROK); -} /* rgSCHTomUtlFillCqiSrsWithSr */ - -#endif - - -#ifdef LTE_TDD -/** @brief This function handles filling of HARQ feedback repetition - * recption request for each subframe - * - * @details - * - * Function: rgSCHTomUtlFillSfRepHqFdbk - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @param [in] RgSchDlSf *dlSf - * @param [in] U8 noFdbks - * @param [in] CmMemListCp *memCp - * @param [in] U8 elemIdx - * @param [in] RgSchDlSf *nxtDlsf - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cellCb, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - U16 validIdx - ) -#else -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf, -noFdbks, memCp, elemIdx, nxtDlsf, validIdx) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cellCb; - RgSchErrInfo *err; - RgSchDlSf *dlSf; - U8 noFdbks; - CmMemListCp *memCp; - U8 elemIdx; - RgSchDlSf *nxtDlsf; - U16 validIdx; -#endif -#else -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk -( -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cellCb, -RgSchErrInfo *err, -RgSchDlSf *dlSf, -U8 noFdbks, -CmMemListCp *memCp, -U8 elemIdx, -RgSchDlSf *nxtDlsf -) -#else -PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf, -noFdbks, memCp, elemIdx, nxtDlsf) - TfuRecpReqInfo *recpReqInfo; - RgSchCellCb *cellCb; - RgSchErrInfo *err; - RgSchDlSf *dlSf; - U8 noFdbks; - CmMemListCp *memCp; - U8 elemIdx; - RgSchDlSf *nxtDlsf; -#endif -#endif -{ - RgSchDlHqProcCb *hqCb; - CmLList *node; - S16 ret; - RgSchUeCb *ueCb; - TfuUeRecpReqInfo *pucchRecpInfo; -#ifdef TFU_UPGRADE - TfuUePucchHqRecpInfo *hqRecpReq; -#endif - RgSchDlHqTbCb *tbCb; - RgSchDlHqProcCb *prvHqCb = NULLP; - - TRC2(rgSCHTomUtlFillSfRepHqFdbk) - - node = dlSf->ackNakRepQ.first; - while (node) - { - tbCb = (RgSchDlHqTbCb *)(node->node); - hqCb = tbCb->hqP; - ueCb = hqCb->hqE->ue; - - if (--tbCb->fbkRecpRepCntr) - { - /* Add to next subfarme */ - /* Add this hqCb to the next dlSf's ackNakRepQ */ - cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), - &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); - tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; - tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; - } - -#ifdef TFU_UPGRADE - if (hqCb->tbCnt) - { - hqCb->tbCnt--; - /* Go to the next node */ - node = node->next; - continue; - } -#endif - if ((hqCb->hqE->ue != NULLP) && - (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE) - && (hqCb != prvHqCb) - ) - { - /* We need to add the recp request to be sent on the pucchANRep - * value. - */ - ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to" - "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - pucchRecpInfo->rnti = ueCb->ueId; -#ifndef TFU_UPGRADE - pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; -#else - pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; -#endif - - /* FOR repetition Feedback shall come on n1PucchAnRep Configured per - * UE. - */ -#ifndef TFU_UPGRADE - pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH; - pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes; -#else - pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; - hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo); - /* ACK NACK rep works only in bundling mode . */ - hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL; - if ((hqCb->hqPSfLnk.node != NULLP) && - (hqCb->hqPSfLnk.node != NULLP)) - { - - hqRecpReq->hqSz = 2; - } - else - { - hqRecpReq->hqSz = 1; - } - hqRecpReq->pucchResCnt = 1; - hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes; -#endif - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); - pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; - } - /* In a given dlSf, if there is 2 TBs context - * stored for a given harq, then they are added - * adjacent to each other in the subframe. To avoid - * adding duplicate recpnInfo for each TB, store this - * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then - * do not add reception req info.*/ - prvHqCb = hqCb; -#ifdef TFU_UPGRADE - RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue); - rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx); -#endif - /* Go to the next node */ - node = node->next; - } - - RETVALUE(ROK); -} - -/** @brief This function handles filling of HARQ feedback recption request - * for each subframe - * - * @details - * - * Function: rgSCHTomUtlFillSfHqFdbkInfo - * - * Processing steps: - * - * @param [out] TfuRecpReqInfo *recpReqInfo - * @param [in] RgSchCellCb *cell - * @param [out] RgSchErrInfo *err - * @param [in] RgSchDlSf *dlSf - * @param [in] U8 noFdbks - * @param [in] CmMemListCp *memCp - * @param [in] U8 elemIdx - * @param [in] RgSchDlSf *nxtDlsf -* @param [in] U16 validIdx; - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef TFU_UPGRADE -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cellCb, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - U16 validIdx, - RgSchDlHqProcCb *hqCb, - RgSchUePucchRecpInfo *pucchInfo, - Bool alloc, - RgSchDlHqProcCb *prvHqCb - ) -#else -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf, - noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cellCb; -RgSchErrInfo *err; -RgSchDlSf *dlSf; -U8 noFdbks; -CmMemListCp *memCp; -U8 elemIdx; -RgSchDlSf *nxtDlsf; -U16 validIdx; -RgSchDlHqProcCb *hqCb; -RgSchUePucchRecpInfo *pucchInfo; -Bool alloc; -RgSchDlHqProcCb *prvHqCb; -#endif -#else -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo -( - TfuRecpReqInfo *recpReqInfo, - RgSchCellCb *cellCb, - RgSchErrInfo *err, - RgSchDlSf *dlSf, - U8 noFdbks, - CmMemListCp *memCp, - U8 elemIdx, - RgSchDlSf *nxtDlsf, - RgSchDlHqProcCb *hqCb, - RgSchUePucchRecpInfo *pucchInfo, - Bool alloc, - RgSchDlHqProcCb *prvHqCb - ) -#else -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf, - noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb) -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cellCb; -RgSchErrInfo *err; -RgSchDlSf *dlSf; -U8 noFdbks; -CmMemListCp *memCp; -U8 elemIdx; -RgSchDlSf *nxtDlsf; -RgSchDlHqProcCb *hqCb; -RgSchUePucchRecpInfo *pucchInfo; -Bool alloc; -RgSchDlHqProcCb *prvHqCb; -#endif -#endif -{ - S16 ret; - RgSchUeCb *ueCb = hqCb->hqE->ue; -#ifndef TFU_UPGRADE - CmLteTimingInfo futTime; - RgSchTddANInfo *anInfo; -#else -#endif - RgrTddAckNackMode ackNackMode; - RgSchDlHqTbCb *tbCb; - CmLteRnti rnti; - U8 hqSz = 0; - U32 idx = 0; - - TRC2(rgSCHTomUtlFillSfHqFdbkInfo) - -#ifndef TFU_UPGRADE - RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA); -#endif - - - for (idx = 0 ;idx < 2; idx++) - { - if (HQ_TB_WAITING == hqCb->tbInfo[idx].state) - { - - tbCb = &hqCb->tbInfo[idx]; - if (ueCb) - { - rnti = ueCb->ueId; - ackNackMode = ueCb->dl.ackNackMode; -#ifndef TFU_UPGRADE - if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) - { - anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime); - /* Only the last scheduled TB for the UE is for HARQ - * ACK/NACK reception in Bundling case */ - if((anInfo == NULLP) || - (anInfo->latestMIdx != dlSf->dlFdbkInfo.m)) - { - RETVALUE(ROK); - } - } - else - { - /* Get the TFU reception request pointer, if present */ - cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId, - sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo); - } -#else - /* For upgrade we shall use the existing logic of pending list. */ - cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId, - sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo); -#endif - } - else if(hqCb->hqE->raCb != NULLP) - { - /* For RACH it is set to Bundling */ - ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL; - rnti = hqCb->hqE->raCb->tmpCrnti; - } - else - { - RETVALUE(ROK); - } - - /* Do not proceed if PUSCH - reception req is already filled*/ -#ifdef TFU_UPGRADE - if (hqCb->tbCnt) - { - hqCb->tbCnt--; - /* Go to the next node */ - continue; - } -#endif - if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE)) - &&(hqCb != prvHqCb) - ) - { - TknU16 n1PucchTkn = {FALSE, 0}; - RgSchPdcch *pdcch; - U8 tbIndx; - pdcch = tbCb->hqP->pdcch; -#ifdef LTEMAC_SPS - n1PucchTkn = hqCb->spsN1PucchRes; -#endif - for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++) - { - if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING && - (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime, - recpReqInfo->timingInfo))) - { - hqSz++; - hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai; - } - } - ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks, - memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch, - n1PucchTkn, &alloc, hqSz); - if (ret != ROK) - { - RETVALUE(ret); - } - /* TODO:: In case of F1BCS and CSI in same subframe - * UE shall drop the CSI if there was at least one - * PDSCH transmission in any of the DL subframe - * mapping to this UL subframe - * */ -#ifdef TFU_UPGRADE - rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue, - pucchInfo->pucchRecpInfo, validIdx,FALSE); -#ifdef LTE_ADV - if((hqCb->hqE->ue) && - (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)) - { - - if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell)) - { - switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo) - { - case TFU_PUCCH_HARQ_SR_CQI: - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; - RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - break; - case TFU_PUCCH_HARQ_CQI: - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; - RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - break; - case TFU_PUCCH_HARQ_SR_CQI_SRS: - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS; - RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); - break; - case TFU_PUCCH_HARQ_SR_SRS: - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; - break; - case TFU_PUCCH_HARQ_SRS: - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; - break; - default: - break; - } - } - } -#endif - -#endif - - /* TODO antz - pushing the following code (under TFU_UPGRADE) - * into the above function (...ForOneUe) did not work (caused - * two additional TCs to fail). Don't know why. If this - * is done later, make sure that the code branch - * for relPdcch (later in this func) is also modified appropriately. - */ - /* Now add to the recp request or pending list */ - //if((elemIdx != (noFdbks - 1))) - { - cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo, - (U8 *)&rnti ,(U16) sizeof(CmLteRnti)); - alloc = FALSE; - } - - } /* If measuring */ - /* Go to the next node */ - if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr)) - { - /* Add to next subfarme */ - /* Add this hqCb to the next dlSf's ackNakRepQ */ - cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), - &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); - tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; - tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; - } - /* In a given dlSf, if there is 2 TBs context - * stored for a given harq, then they are added - * adjacent to each other in the subframe. To avoid - * adding duplicate recpnInfo for each TB, store this - * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then - * do not add reception req info.*/ - prvHqCb = hqCb; - } - } - RETVALUE(ROK); -} - -#ifdef LTE_ADV -/** @brief This function calculates the pucch resource idx - * that is to be filled in harq reception request - * - * @details - * - * Function: rgSCHTomUtlGethqRes - * - * Processing steps: - * -Calculate the pucch resource idx - * Harq Reception Request for Format 1B with - * Channel Selection - * - * @param [in] U8 noFdbks - * @param [in] RgSchDlSf *dlSf - * @param [in] RgSchPdcch *pdcch - * @param [in] RgSchCellCb *cellCb - * @param [out]U16 *hqRes - * @return void - */ -#ifdef ANSI -PRIVATE Void rgSCHTomUtlGethqRes -( -U8 noFdbks, -RgSchDlSf *dlSf, -RgSchPdcch *pdcch, -RgSchCellCb *cellCb, -U16 *hqRes -) -#else -PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes) -U8 noFdbks; -RgSchDlSf *dlSf; -RgSchPdcch *pdcch; -RgSchCellCb *cellCb; -U16 *hqRes; -#endif -{ - U8 M; - U8 P; - U8 m; - U8 nP; - U8 nPlusOne; - U8 nCce; - - M = noFdbks; - m = dlSf->dlFdbkInfo.m; - nCce = pdcch->nCce; - P = rgSCHCmnGetPValFrmCCE(cellCb, nCce); - nP = cellCb->rgSchTddNpValTbl[P]; - nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; - *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce + - cellCb->pucchCfg.n1PucchAn; - - RETVOID; -} - -/** @brief This function fills the harq reception request for - * TDD in case of Fomat 1B with CS for M=1 - * - * @details - * - * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 - * - * Processing steps: - * -Fill Harq Reception Request for Format 1B with - * Channel Selection - * - * @param [in] RgSchDlHqProcCb *hqCb - * @param [in] TfuUePucchRecpReq *hqRecpReq - * @param [in] U8 noFdbks - * @param [in] RgSchDlSf *dlSf - * @param [in] RgSchPdcch *pdcch - * @param [in] RgSchCellCb *cellCb - * @return void - */ -#ifdef ANSI -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 -( - RgSchDlHqProcCb *hqCb, - TfuUePucchRecpReq *hqRecpReq, - U8 noFdbks, - RgSchDlSf *dlSf, - RgSchPdcch *pdcch, - RgSchCellCb *cellCb -) -#else -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq, - noFdbks,dlSf,pdcch,cellCb) - RgSchDlHqProcCb *hqCb; - TfuUePucchRecpReq *hqRecpReq; - U8 noFdbks; - RgSchDlSf *dlSf; - RgSchPdcch *pdcch; - RgSchCellCb *cellCb; -#endif -{ - RgSchUeCb *ue = NULLP; - Bool isCellSec = FALSE; - U16 hqRes; - - /*ccpu00147920: UeCb is NULL for SPS activation*/ - if(pdcch && pdcch->ue) - {/* SPS Release pdcch or dynamic data */ - ue = pdcch->ue; - }else - {/* SPS occasion */ -#ifdef ERRCLS_KW - if(hqCb == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - ue = hqCb->hqE->ue; - } - - if((hqCb != NULLP) && - (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) - { - isCellSec = TRUE; - } - - switch(ue->f1bCsAVal) - { - case RG_SCH_A_VAL_2: - /* harq(0) is primary harq(1) is secondary) */ - if(isCellSec) - { - hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb. - cw1N1Res[hqCb->tpc].n1PucchIdx; - } - else/* primary cell */ - { -#ifdef LTEMAC_SPS - /* hqCb will be null in case of sps rel pdcch */ - if ((hqCb) && hqCb->spsN1PucchRes.pres) - {/* SPS occasion or dyn sched*/ - hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - {/* dyn data or sps release */ -#ifdef ERRCLS_KW - if(pdcch == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - - rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); - hqRecpReq->hqInfo.hqRes[0] = hqRes; - } - } - break; - case RG_SCH_A_VAL_3: - { - /* Serving cell in mimo mode should be - * in 0 and 1 and the serving cell in siso - * mode should be in 2 indices */ - if(isCellSec) - { - U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx, - hqCb->hqE->cell->cellId, - hqCb->hqE->ue); - - if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1) - {/* Sec cell is in mimo mode, use 0 and 1 */ - hqRecpReq->hqInfo.hqRes[0] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - hqRecpReq->hqInfo.hqRes[1] = - ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; - } - else - {/* Sec cell is in siso mode, use 2 */ - hqRecpReq->hqInfo.hqRes[2] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - } - } - else - {/* primary cell hq */ - - if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) - {/* prim cell is in mimo mode, use 0 and 1 */ -#ifdef LTEMAC_SPS - if (hqCb && hqCb->spsN1PucchRes.pres) - {/* Not sps release */ - hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - {/* sps rel or dyn */ -#ifdef ERRCLS_KW - if(pdcch == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - - rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); - hqRecpReq->hqInfo.hqRes[0] = hqRes; - hqRecpReq->hqInfo.hqRes[1] = hqRes + 1; - } - } - else - {/* prim cell is in siso mode use 2 */ -#ifdef LTEMAC_SPS - /* Consider sps occasions */ - if (hqCb && hqCb->spsN1PucchRes.pres) - {/* Not sps release */ - hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - { -#ifdef ERRCLS_KW - if(pdcch == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - - rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); - hqRecpReq->hqInfo.hqRes[2] = hqRes; - } - } - } - } - break; - case RG_SCH_A_VAL_4: - {/* Both the serv cells are in mimo mode */ - if(isCellSec) - {/* 2 and 3 for sec cell */ - hqRecpReq->hqInfo.hqRes[2] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - hqRecpReq->hqInfo.hqRes[3] = - ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; - } - else/* primary cell */ - {/* 0 and 1 are for primary cell */ -#ifdef LTEMAC_SPS - if (hqCb && hqCb->spsN1PucchRes.pres) - {/* Not sps release */ - hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; - } - else -#endif /* LTEMAC_SPS */ - { -#ifdef ERRCLS_KW - if(pdcch == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - - rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); - hqRecpReq->hqInfo.hqRes[0] = hqRes; - hqRecpReq->hqInfo.hqRes[1] = hqRes + 1; - } - } - } - break; - default: - break; - } - RETVOID; -} - -/** @brief This function fills the harq reception request for - * TDD in case of Fomat 1B with CS for M>=2 - * - * @details - * - * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 - * - * Processing steps: - * -Fill Harq Reception Request for Format 1B with - * Channel Selection - * - * @param [in] RgSchDlHqProcCb *hqCb - * @param [in] TfuUePucchRecpReq *hqRecpReq - * @param [in] U8 noFdbks - * @param [in] RgSchDlSf *dlSf - * @param [in] RgSchPdcch *pdcch - * @param [in] RgSchCellCb *cellCb - * @param [in] U8 elemIdx - * @return void - */ -#ifdef ANSI -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 -( - RgSchDlHqProcCb *hqCb, - TfuUePucchRecpReq *hqRecpReq, - U8 noFdbks, - RgSchDlSf *dlSf, - RgSchPdcch *pdcch, - RgSchCellCb *cellCb, - U8 elemIdx -) -#else -PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234( - hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx) - RgSchDlHqProcCb *hqCb; - TfuUePucchRecpReq *hqRecpReq; - U8 noFdbks; - RgSchDlSf *dlSf; - RgSchPdcch *pdcch; - RgSchCellCb *cellCb; - U8 elemIdx; -#endif -{ - RgSchUeCb *ue; - Bool isCellSec = FALSE; - U16 hqRes = 0; - U8 servCellIdx; - - if(pdcch) - {/* SPS Release pdcch or dynamic data */ - ue = pdcch->ue; - }else - {/* SPS occasion */ -#ifdef ERRCLS_KW - if(hqCb == NULLP) - { - /* This is not supposed to happen - * Error case. hqCB has to be ter - * when pdcch is present . Adding - * if check bcs of kwork*/ - RETVOID; - } -#endif - ue = hqCb->hqE->ue; - } - - if((hqCb != NULLP) && (ue != NULLP) && - (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) - { - isCellSec = TRUE; - } - - if(isCellSec) - {/* Sec Cell indices are 2 and 3*/ - servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx, - hqCb->hqE->cell->cellId, - hqCb->hqE->ue); - - hqRecpReq->hqInfo.hqRes[2] = - ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; - - if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1) - { - hqRecpReq->hqInfo.hqRes[3] = - ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; - } - } - else - {/* Primary cell indices are 0 and 1 */ - /* SPS occasions - * M > 2 if SPS occasion is present in any of the - * DL subframe in the bundle, the n1Pucch(0) is - * the SPS resource and n1Pucch(1) is the resource - * derived from pdcch with DAI = 1 - * If No SPS Occasion - * Then n1Pucch(0) is from pdcch with DAI =1 - * and n1Pucch(1) is from pdcch with DAI = 2 - * */ - - if(hqCb != NULLP) - {/* this is not sps release pdcch */ - if(hqCb->spsN1PucchRes.pres == TRUE) - {/* SPS occasion*/ - hqRes = hqCb->spsN1PucchRes.val; - } - } - - if(pdcch) - {/*Dynamic scheduling or SPS Release - Derive from pdcch */ - if(pdcch->dlDai < 3) - {/* No need to calcualte from DAI > 2 */ - rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); - } - } - - if(2 == noFdbks) - {/* M == 2 case */ - hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes; - } - else - {/* Pdcch with DAI = 1 and 2 needs to be used - for resource calculation*/ - if(hqCb && hqCb->spsN1PucchRes.pres == TRUE) - {/* dyn or sps occasion */ - /* Shift the hqRes[0] if it was filled - * if there was a pdcch with DAI 1 before to this - * subframe*/ - if(hqCb->ulDai > 1) - {/* SPS occasion happened in the middle - of the bundle */ - /* shifting the non SPS resource to n1Pucch(1) */ - hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0]; - } - - hqRecpReq->hqInfo.hqRes[0] = hqRes; - } -#ifdef ERRCLS_KW - else if(pdcch && pdcch->dlDai < 3) -#else - else if(pdcch->dlDai < 3) -#endif - {/* sps rel or dyn sched */ - /* hqCb wil not be present for sps release pdcch */ - if(hqCb && (pdcch->dlDai != hqCb->ulDai)) - {/* there was a SPS occasion before to this */ - if(pdcch->dlDai == 1) - { - hqRecpReq->hqInfo.hqRes[1] = hqRes; - }/* ignore the DAI 2 in this case */ - }else - {/* There was no SPS occasion before to this */ -#ifdef ERRCLS_KW - if(pdcch->dlDai) -#endif - {/* Added check to ignore kwork warning */ - hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes; - } - } - } - } - } - RETVOID; -} - -/** @brief This function fills the harq reception request for - * TDD in case of Fomat 1B with CS - * - * @details - * - * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS - * - * Processing steps: - * -Fill Harq Reception Request for Format 1B with - * Channel Selection - * - * @param [in] RgSchDlSf *ulSf - * @param [in] RgSchCellCb *cell - * @param [out]TfuUePucchRecpReq *hqRecpReq - * @return S16 - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS -( - RgSchDlHqProcCb *hqCb, - TfuUePucchRecpReq *hqRecpReq, - U8 noFdbks, - RgSchDlSf *dlSf, - RgSchPdcch *pdcch, - U8 elemIdx, - RgSchCellCb *cellCb -) -#else -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch, - n1PucchTkn,elemIdx,cellCb) - RgSchDlHqProcCb *hqCb; - TfuUePucchRecpReq *hqRecpReq; - U8 noFdbks; - RgSchDlSf *dlSf; - RgSchPdcch *pdcch; - U8 elemIdx; - RgSchCellCb *cellCb; -#endif -{ - /* Update teh fdbk mode if something different is present - * in L1 API file for F1BS *//* 1 --> F1BCS */ - hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION; - - switch(noFdbks) - {/* M Value */ - case RG_SCH_M_VAL_1: - { - - rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq, - noFdbks,dlSf,pdcch,cellCb); - break; - } - case RG_SCH_M_VAL_2: - case RG_SCH_M_VAL_3: - case RG_SCH_M_VAL_4: - { - /* Spatial bundling will be applied */ - rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq, - noFdbks,dlSf,pdcch,cellCb,elemIdx); - break; - } - default: - break; - } - RETVALUE(ROK); -} -#endif - -/*********************************************************** - * - * Func : rgSCHTomUtlFillSfHqFdbkForOneUe - * - * Desc : Fill HARQ feedback info for one UE/entry - * - * Ret : ROK/RFAILED - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe -( -RgSchDlHqProcCb *hqCb, -TfuRecpReqInfo *recpReqInfo, -RgSchCellCb *cellCb, -RgSchErrInfo *err, -RgSchDlSf *dlSf, -U8 noFdbks, -CmMemListCp *memCp, -U8 elemIdx, -RgSchDlSf *nxtDlsf, -CmLteRnti rnti, -RgrTddAckNackMode ackNackMode, -RgSchUePucchRecpInfo **pucchInfoRef, -RgSchPdcch *pdcch, -TknU16 n1PucchTkn, -Bool *allocRef, -U8 hqSz -) -#else -PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, - noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef, - pdcch, n1PucchTkn, allocRef, hqSz) -RgSchDlHqProcCb *hqCb; -TfuRecpReqInfo *recpReqInfo; -RgSchCellCb *cellCb; -RgSchErrInfo *err; -RgSchDlSf *dlSf; -U8 noFdbks; -CmMemListCp *memCp; -U8 elemIdx; -RgSchDlSf *nxtDlsf; -CmLteRnti rnti; -RgrTddAckNackMode ackNackMode; -RgSchUePucchRecpInfo **pucchInfoRef; -RgSchPdcch *pdcch; -TknU16 n1PucchTkn; -Bool *allocRef; -U8 hqSz; -#endif -{ - RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef; - Bool alloc = FALSE; - S16 ret; - TfuUePucchRecpReq *hqRecpReq; -#ifdef TFU_UPGRADE - U8 M; - U8 P; - U8 m; - U8 nP; - U8 nPlusOne; - U16 pucchRes; - U8 resIdx; - U8 nCce; - U8 prevHqSize; -#else - U8 multCnt; -#endif -#ifdef LTEMAC_SPS - Bool isFirstFdbk = FALSE; -#endif - if(pucchInfo == NULLP) - { - if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo, - sizeof(RgSchUePucchRecpInfo), memCp)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to " - "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - alloc = TRUE; -#ifdef TFU_ALLOC_EVENT_NO_INIT - pucchInfo->hashLstEnt.hashVal = 0; - pucchInfo->hashLstEnt.keyLen = 0; - pucchInfo->hashLstEnt.key = 0; - pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0; -#endif - if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo), - sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to " - "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti); - err->errCause = RGSCHERR_TOM_MEM_EXHAUST; - RETVALUE(ret); - } - cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); -#ifdef TFU_ALLOC_EVENT_NO_INIT - cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); -#endif - pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; - pucchInfo->pucchRecpInfo->rnti = rnti; -#ifdef TFU_UPGRADE - pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ; -#endif -#ifdef LTEMAC_SPS - isFirstFdbk = TRUE; -#endif - } - /* Fill m, M, P */ - /* Calculation of resources same for both bundling and muxing for M = 1 - * */ -#ifdef LTE_ADV - RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti); - if((ue) && (1 == ue->numSCells)) - { - if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS) - { - hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); - rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq, - noFdbks,dlSf,pdcch,elemIdx,cellCb); - - if(noFdbks == 1) - {/* M = 1 case . size is same as A Value*/ - hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal; - hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz; - }else - {/* M > 1 case */ - hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */ - hqRecpReq->hqInfo.pucchResCnt = 4; - } - hqRecpReq->hqInfo.a = ue->f1bCsAVal; - /* handling for SPS occasions*/ - if(elemIdx == 0) - { - /* set the datPresinFirstSUbframe to TRUE if this - * is for pcell txion*/ -#ifdef ERRCLS_KW - RgSchTddANInfo *anInfo = NULLP; -#endif - /* if this txion is on pcell - * sps occaion, dyn sched or sps release pdcch - * set the sched present in first - * dl subframe of the bundle to TRUE. This - * is required for mapping the feedbak when SPS occasion - * is present in any of the DL subframe in the bundle in - * case of M > 2*/ - - /* SPS will happen only on pcell */ - if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) - { -#ifdef ERRCLS_KW - anInfo = rgSCHUtlGetUeANFdbkInfo(ue, - &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX); - if(anInfo == NULL) - {/* ANInfo must be there. adding block - because of kworks*/ - RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx), - "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId)); - RETVALUE(RFAILED); - - } -#endif - } - } - }else - {/* This needs to be revisited while - adding support for PUCCH format 3 */ - RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured..")); - RETVALUE(RFAILED); - } - } - else -#endif - { - if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) || - ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT))) - { - hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); -#ifdef TFU_UPGRADE - prevHqSize = hqRecpReq->hqInfo.hqSz; -#endif -#ifndef TFU_UPGRADE - /* Only one index for bundling case */ - hqRecpReq->M = noFdbks; - hqRecpReq->hqType = - TFU_HQ_RECP_REQ_NORMAL; - hqRecpReq->multCnt = 1; - hqRecpReq->t.nCce[0] = - pdcch->nCce; - hqRecpReq->m[0] = - dlSf->dlFdbkInfo.m; - hqRecpReq->p[0] = - rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); - - hqRecpReq->type = TFU_UCI_HARQ; - -#else /* TFU_UPGRADE */ - -#ifdef LTEMAC_SPS - if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres)) - { - hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode; - hqRecpReq->hqInfo.pucchResCnt=1; - hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val; - hqRecpReq->hqInfo.hqSz = hqSz; - } - /* ccpu00139413 */ - else if (FALSE == n1PucchTkn.pres) -#endif - { - hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode; - M = noFdbks; - P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); - nP = cellCb->rgSchTddNpValTbl[P]; - nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; - m = dlSf->dlFdbkInfo.m; - /* In case of no UE */ - pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce + - cellCb->pucchCfg.n1PucchAn; - /*ccpu00130164:MOD-Changed to maitain value of - hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/ - /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1 - * and resource should be update at index-0*/ - hqRecpReq->hqInfo.pucchResCnt=1; - hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes; - - if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize)) - hqRecpReq->hqInfo.hqSz = hqSz; - else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT) - hqRecpReq->hqInfo.hqSz = hqSz; - else - hqRecpReq->hqInfo.hqSz = prevHqSize; - } -#endif /* TFU_UPGRADE */ -#ifndef TFU_UPGRADE - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, - &(pucchInfo->pucchRecpInfo->lnk)); - pucchInfo->pucchRecpInfo->lnk.node = - (PTR)pucchInfo->pucchRecpInfo; -#endif - } - else /* Multiplexing */ - { -#ifndef TFU_UPGRADE - pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks; -#ifdef LTEMAC_SPS - if (n1PucchTkn.pres == TRUE) - { - pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType = - TFU_HQ_RECP_REQ_N1PUCCH; - pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val; - } - else -#endif - { - pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType = - TFU_HQ_RECP_REQ_NORMAL; - multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt; - pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] = - pdcch->nCce; - pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] = - dlSf->dlFdbkInfo.m; - pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] = - rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); - - pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++; - } -#else /* TFU_UPGRADE */ - - hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); - hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT; - hqRecpReq->hqInfo.hqSz = noFdbks; - - resIdx = hqRecpReq->hqInfo.pucchResCnt; - hqRecpReq->hqInfo.pucchResCnt++; - -#ifdef LTEMAC_SPS - if (n1PucchTkn.pres == TRUE) - { - hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val; - } - else -#endif - { - M = noFdbks; - m = dlSf->dlFdbkInfo.m; - nCce = pdcch->nCce; - P = rgSCHCmnGetPValFrmCCE(cellCb, nCce); - nP = cellCb->rgSchTddNpValTbl[P]; - nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; - hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP + - (m * nPlusOne) + pdcch->nCce + - cellCb->pucchCfg.n1PucchAn; - } -#endif /* TFU_UPGRADE */ - /* If all the DL subframes are scanned, then - * send TFU request*/ -#ifndef TFU_UPGRADE - if((elemIdx != noFdbks) && alloc) - { - cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo, - (U8 *)&rnti, (U16) sizeof(rnti)); - alloc = FALSE; - } - else - { - pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; - cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, - &(pucchInfo->pucchRecpInfo->lnk)); - pucchInfo->pucchRecpInfo->lnk.node = - (PTR)pucchInfo->pucchRecpInfo; - /* Delete the entry after addition to the list */ - cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo); - } -#endif - } - } - - *pucchInfoRef = pucchInfo; - *allocRef = alloc; - RETVALUE(ROK); -} -#endif - -#ifdef RG_ULSCHED_AT_CRC -/** @brief This function does all the processing related to a single downlink - * subframe. - * - * @details - * - * Function: rgSCHTomUtlProcDlSfAtCrc - * - * Processing steps: - * - collate control data for all UEs and send to PHY - * - collate data buffers for all UEs and send to PHY - * - * @param [in] RgSchDlSf *ulSf - * @param [in] RgSchCellCb *cell - * @param [in] TfuCntrlReqInfo *cntrlInfo - * @param [out] RgSchErrInfo *err - * @return S16 - */ -#ifdef ANSI -PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc -( -RgSchDlSf *ulSf, -CmLteTimingInfo crntUlFrm, -RgSchCellCb *cell, -TfuCntrlReqInfo *cntrlInfo, -RgSchErrInfo *err -) -#else -PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err) -RgSchDlSf *ulSf; -CmLteTimingInfo crntUlFrm; -RgSchCellCb *cell; -TfuCntrlReqInfo *cntrlInfo; -RgSchErrInfo *err; -#endif -{ - Inst inst = cell->instIdx; - S16 ret; - - TRC2(rgSCHTomUtlProcDlSfAtCrc); - - - cntrlInfo->numDlActvUes = 0; - cmLListInit(&cntrlInfo->phichLst); - cmLListInit(&cntrlInfo->dlPdcchLst); - cmLListInit(&cntrlInfo->ulPdcchLst); -#ifdef TFU_ALLOC_EVENT_NO_INIT - cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0; - cntrlInfo->cfi = 0; -#endif - - cntrlInfo->ulTiming = crntUlFrm; - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA); - - cntrlInfo->cellId = cell->cellId; - /* Fill PHICH info */ - if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for " - "cell"); - RGSCH_FREE_MEM(cntrlInfo); - RETVALUE(ret); - } - - /* Fill UL Pdcch */ - if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for " - "cell"); - RGSCH_FREE_MEM(cntrlInfo); - RETVALUE(ret); - } - -#ifdef EMTC_ENABLE - if(0 == cntrlInfo->ulMpdcchLst.count) - { - gUlMpdcchBlank++; - } -#endif - -#ifdef EMTC_ENABLE - if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo)) -#else - if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) -#endif - { - if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) - != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for" - " cell"); - } - } - else - { - RGSCH_FREE_MEM(cntrlInfo); - } - - RETVALUE(ROK); -} /* end of */ -#endif /* #ifdef RG_ULSCHED_AT_CRC*/ - -#ifdef RGR_RRM_TICK -/** @brief This function sends the SFN Tick to L3 - * subframe. - * - * @details - * - * Function: rgSCHTomUtlSendSfnTick - * - * @param [in] RgSchCellCb *cell - */ -#ifdef ANSI -PRIVATE Void rgSCHTomUtlSendSfnTick -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHTomUtlSendSfnTick (cell) -RgSchCellCb *cell; -#endif -{ - RgrTtiIndInfo *rgrTtiInd; - - TRC2(rgSCHTomUtlSendSfnTick); - - /* TTI to be sent to RRM only once per system frame */ - /* Added support for period = 0 to disable tick to RRM */ - if ((cell->rrmTtiIndPrd != 0) && - ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) && - (cell->crntTime.subframe == 0)) - { - /* Allocate a TTI indication structure and send to RRM over RGR interface */ - if (rgSCHUtlAllocSBuf (cell->instIdx, - (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK) - { - RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx), - "Mem alloc failed for RGR TTI ind, cellId (%d))\n", - cell->cellId)); - RETVOID; - } - rgrTtiInd->cellId = cell->cellId; - rgrTtiInd->hSfn = cell->crntTime.hSfn; - rgrTtiInd->sfn = cell->crntTime.sfn; - - if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK) - { - RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx), - "Failed to send RGR TTI ind, cellId (%d))\n", - cell->cellId)); - rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd, - sizeof(RgrTtiIndInfo)); - RETVOID; - } - } - RETVOID; -} -#endif - -#ifdef RG_5GTF - -/* @brief Mark Dyn TDD CrntSfIdx. - * - * @details - * - * Function: rgSCHDynTDDMrkCrntSfIdx - * Purpose: update the dyn tdd sunframe index - * @param[in] Inst schInst - * @RETVALUE None - */ -#ifdef ANSI -PRIVATE Void rgSCHDynTDDMrkCrntSfIdx -( -Inst schInst -) -#else /* ANSI */ -PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst) -Inst schInst; -#endif /* ANSI */ -{ - RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd); - - TRC2(rgSCHDynTDDMrkCrntSfIdx) - - RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx, - RG_SCH_DYNTDD_NOTDEF); - rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) % - RG_SCH_DYNTDD_MAX_SFINFO; - - //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx); - - RETVOID; -} - -#endif -/** @brief This function fills the TTI timinig info for each cell - * - * @details - * - * Function: rgSchTomFillCellTtiInfo - * - * @param [in] TfuTtiIndInfo *ttiInd - * @param [in] Inst schInst - * @param [out] U8 *nCell - * @param [out] RgSchCellCb *cell[] - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomFillCellTtiInfo -( -TfuTtiIndInfo *ttiInd, -Inst schInst, -U8 *nCell, -RgSchCellCb *cells[] -) -#else -PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells) -TfuTtiIndInfo *ttiInd; -Inst schInst; -U8 *nCell; -RgSchCellCb *cells[]; -#endif -{ - U8 i = 0; - U8 strtCellId; - TfuTtiCellInfo *cellInfo; - RgSchCellCb *cell; - U32 Idx1; - - CmLteTimingInfo frm; - - TRC2 (rgSchTomFillCellTtiInfo); - - if (CM_LTE_MAX_CELLS < ttiInd->numCells) - { - RETVOID; - } - -#ifdef RG_5GTF - rgSCHDynTDDMrkCrntSfIdx(schInst); -#endif - - for (i = 0; i < ttiInd->numCells; i++) - { - cellInfo = &ttiInd->cells[i]; - strtCellId = rgSchCb[schInst].genCfg.startCellId; - Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1)); - cell = rgSchCb[schInst].cells[Idx1]; - /* Validate the cell */ - if (cell == NULLP) - { - /* Use SCH inst 0 print buff */ - RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst), - "RgLiTfuTtiInd()No cell exists for cellId %d\n", - cellInfo->cellId)); - continue; - } - *nCell = *nCell + 1; - cells[i] = (RgSchCellCb *)cell; - - /* 4UE_TTI_DELTA */ - if(cell->schTickDelta != cellInfo->schTickDelta) - { - printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n" - "dlblankSf=%d ulblankSf=%d dummyTti=%d \n", - cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf, - cellInfo->isDummyTti); - } - RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta); - cell->schTickDelta = cellInfo->schTickDelta; - /* 4UE_TTI_DELTA */ - - cell->stopSiSch = cellInfo->dlBlankSf; - cell->stopDlSch = cellInfo->dlBlankSf; - cell->stopUlSch = cellInfo->ulBlankSf; - if (cellInfo->isDummyTti) - { - cell->stopDlSch = TRUE; - } - if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.subframe)) - { - //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.subframe); - } -#ifndef EMTC_ENABLE - RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime); - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time, - TFU_ULCNTRL_DLDELTA); - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime, - TFU_DLCNTRL_DLDELTA); - RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime, - TFU_RECPREQ_DLDELTA); - RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime, - TFU_HQFBKIND_ULDELTA); - RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime, - RGSCH_RLS_SF_IDX); -#else - RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime); - RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time, - TFU_ULCNTRL_DLDELTA); - RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime, - TFU_DLCNTRL_DLDELTA); - RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime, - TFU_RECPREQ_DLDELTA); - RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime, - TFU_HQFBKIND_ULDELTA); - RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime, - RGSCH_RLS_SF_IDX); -#endif - rgSCHCmnUpdVars(cell); - cell->isDlDataAllwd = TRUE; -/* Get DownLink SubFrame */ - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - frm = cell->crntTime; -#ifndef EMTC_ENABLE - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); -#else - RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA); -#endif - cellSch->dl.time = frm; - -#ifdef RG_PFS_STATS - cell->totalTime++; -#endif -#ifdef LTE_TDD - U8 idx = (cell->crntTime.subframe + RG_SCH_CMN_DL_DELTA) % - RGSCH_NUM_SUB_FRAMES_5G; - - cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx); - - /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/ - if((cell->crntTime.sfn == 0) && (cell->crntTime.subframe == 0)) - { - /* sfn Cycle used for Tdd UL Harq Proc Determination. - This sfn Cycle will have values from 0 to numUl Harq-1. */ - cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) % - (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]); - } -#endif -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - rgSCHUtlEmtcResPrcTti(cell); - } -#endif - } -} - -/** @brief This function prepares the TTI for scheduling and - * invokes the Common channel scheduler. Uplink scheduler - * is invoked first if UL Scheduling at CRC is not enabled - * - * @details - * - * Function: rgSchTomTtiUlAndDlCmnChSch - * - * @param [out] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomTtiUlAndDlCmnChSch -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell) -RgSchCellCb *cell; -#endif -{ - - TRC2(rgSchTomTtiUlAndDlCmnChSch); - - cell->rlsHqArr[cell->crntHqIdx].numUes = 0; - cell->crntHqIdx++; - cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES; - - cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr); - rgSCHMeasGapANRepTtiHndl (cell); - /* We need to fill the PHICH for the UL Data, first we need to get the UL - * SF from Scheduler, next we fill the dlSf that goes out this TTI. - * This must be performed prior to any other processing of the TTI - * so that we do not wrap around and generate feedback prior to - * reception of UL data. - */ -#ifndef RG_ULSCHED_AT_CRC - { - U8 Mval = 1; - U8 idx; /* Index into Uplink Sf array */ -#ifdef LTE_TDD - Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx] - [cell->hiDci0Time.subframe]; -#endif - if(Mval) - { - for(idx=0; idx < Mval; idx++) - { - rgSCHCmnRlsUlSf(cell, idx); - } - } - } -#endif - - /* DTX processing for those Harq's which did not get feedback from L1 */ - rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime); - /* Re-Init the Downlink subframe */ - rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime); - /* Added handling to retransmit - * release PDCCH in case of DTX - */ - - /*Check for DRX every TTI*/ - rgSCHDrxTtiInd(cell); - - /* For TDD, UL scheduling should happen after DL scheduling */ -#ifndef LTE_TDD -#ifndef RG_ULSCHED_AT_CRC - /* Perform UL scheduling */ - rgSCHCmnUlSch(cell); -#endif -#endif - /* Perform DL scheduling for Common channels */ - rgSCHCmnDlCommonChSch(cell); - - RETVOID; -} - -/** @brief This function invokes the Non critical procedures like measurements, - * and RGR configurations. - * - * @details - * - * Function: rgSchTomTtiMiscFunctions - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomTtiMiscFunctions -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSchTomTtiMiscFunctions (cell) -RgSchCellCb *cell; -#endif -{ - U8 suId = cell->tfuSap->sapCfg.suId; - - TRC2(rgSchTomTtiMiscFunctions); - - /* Invoke RAM Tti Handler */ - rgSCHRamTtiHndlr(cell); - - /* Handle RGR configurations */ - rgSCHGomTtiHndlr(cell, suId); -#ifdef LTE_L2_MEAS - if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld) - && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0))) - { - rgSCHUtlUpdAvgPrbUsage(cell); - } - rgSCHL2Meas(cell,FALSE); -#endif - - /* LTE_ADV_FLAG_REMOVED_START */ - /* Report ABS Load information to application periodically */ - if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) && - (cell->lteAdvCb.absCfg.absLoadPeriodicity)) - { - RgrLoadInfIndInfo *rgrLoadInf; - U8 idx; - - cell->lteAdvCb.absLoadTtiCnt++; - if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity) - { - /* ccpu00134492 */ - if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf, - sizeof(RgrLoadInfIndInfo)) != ROK) - { - RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not " - "allocate memory for sending LoadInfo\n")); - RETVOID; - } - cell->lteAdvCb.absLoadTtiCnt = 0; - rgrLoadInf->cellId = cell->cellId; - rgrLoadInf->bw = cell->bwCfg.dlTotalBw; - rgrLoadInf->type = RGR_ABS; - for(idx= 0; idxu.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx]; - cell->lteAdvCb.absLoadInfo[idx] = 0; - } - rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf); - } - } - -#ifdef LTE_TDD - if(cell->isDlDataAllwd) - { - /* Calling function to update CFI parameters*/ - rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA); - } - else - { - /* Incrementing the ttiCnt in case of UL subframe */ - if(!cell->dynCfiCb.switchOvrInProgress) - { - cell->dynCfiCb.ttiCnt++; - } - } -#else - rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA); -#endif - - /* LTE_ADV_FLAG_REMOVED_END */ - RETVOID; -} - - -/** @brief This function invokes the Downlink scheduler - * - * @details - * - * Function: rgSchTomTtiDlSch - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomTtiDlSch -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSchTomTtiDlSch (cell) -RgSchCellCb *cell; -#endif -{ - TRC2(rgSchTomTtiDlSch); - - if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE)) - { - rgSCHCmnDlSch(cell); - } - - RETVOID; -} - -/** @brief This function invokes Consolidates the allocations - * send the Subframe allocation info to MAC - * - * @details - * - * Function: rgSchTomTtiCnsldtSfAlloc - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomTtiCnsldtSfAlloc -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell) -RgSchCellCb *cell; -#endif -{ - RgSchDlSf *dlSf; - RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); - - dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time); - - TRC2(rgSchTomTtiCnsldtSfAlloc); - - /* Prepare Subframe allocation info and send to MAC */ - rgSCHCmnCnsldtSfAlloc(cell); - - /* Call ACK NACK module to add to dlsf Queue */ - rgSCHAckNakRepAddToQ(cell, dlSf); - - rgSCHTomUtlProcTA(cell); - - RETVOID; -} - -/** @brief This function prepares the DL and UL Config requests - * and sends to CL - * - * @details - * - * Function: rgSchTomTtiL1DlAndUlCfg - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomTtiL1DlAndUlCfg -( -RgSchCellCb *cell, -RgTfuCntrlReqInfo *cntrlInfo -) -#else -PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo) -RgSchCellCb *cell; -RgTfuCntrlReqInfo *cntrlInfo; -#endif -{ - RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime); - RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time); - RgSchErrInfo err; - - TRC2(rgSchTomTtiL1DlAndUlCfg); - - rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err); - /* Mark this frame as sent */ - dlSf->txDone = TRUE; - - rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned; - rgBwAlcnt[dlSf->sfNum] ++; - - -#ifdef LTE_TDD - rgSCHTomUtlProcTddUlSf(cell); -#else - rgSCHTomUtlProcUlSf (cell, &err); -#endif - - RETVOID; -} -#ifdef LTE_TDD -/** @brief This function prepares does the Downlink subframe re-init and - * Harq DTX processing - * - * @details - * - * Function: rgSchTomUtlTddRlsSfAndHarq - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSchTomUtlTddRlsSfAndHarq -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell) -RgSchCellCb *cell; -#endif -{ - TRC2(rgSchTomUtlTddRlsSfAndHarq); - - /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2). - * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper - * UL subframes*/ - /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper - * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() - * as it is serving the purpose */ - if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe]. - numFdbkSubfrms) - { - /* ccpu00132341-MOD- Providing the UL SF timing for avoiding - * calculation inside the function */ - rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime); - rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime); - } - RETVOID; -} - -/** @brief This function processes the UL subframe and fills TFU reception - * request - * - * @details - * - * Function: rgSCHTomUtlProcTddUlSf - * - * @param [in] RgSchCellCb *cell - * - * Returns: Void - * - */ -#ifdef ANSI -PRIVATE Void rgSCHTomUtlProcTddUlSf -( -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHTomUtlProcTddUlSf (cell) -RgSchCellCb *cell; -#endif -{ - RgSchErrInfo err; - - TRC2(rgSCHTomUtlProcTddUlSf); - - if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] - [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME) - { - if (rgSCHTomUtlProcUlSf (cell, &err) != ROK) - { - /* fill in err type and call sta ind */ - RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx), - "Unable to process Uplink subframe for cellId (%d))\n", - cell->cellId)); - } - } - /* TDD Fix , to allow Special SF SRS CFg */ - else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] - [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME) - { - if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK) - { - /* fill in err type and call sta ind */ - RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx), - "Unable to process Sipceial subframe for cellId (%d))\n", - cell->cellId)); - } - } - - RETVOID; -} -#endif - - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_uhm.c b/src/5gnrmac/rg_sch_uhm.c deleted file mode 100755 index f2ad46c31..000000000 --- a/src/5gnrmac/rg_sch_uhm.c +++ /dev/null @@ -1,1089 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch_uhm.c - -**********************************************************************/ - -/** @file rg_sch_uhm.c -@brief This module handles uplink harq related functionality in MAC. -*/ - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ - -#include "gen.h" /* general */ -#include "ssi.h" /* system services */ - -#include "cm_lte.h" /* Common LTE */ -#include "cm_tkns.h" /* Common Token Defines */ -#include "cm_llist.h" /* Common Link List Defines */ -#include "cm_hash.h" /* Common Hash List Defines */ -#include "cm_mblk.h" /* memory management */ - -#include "rg_env.h" /* MAC Environment Defines */ -#include "tfu.h" /* TFU Interface defines */ -#include "rgr.h" /* RGR Interface defines */ -#include "lrg.h" /* LRG Interface defines */ - -#include "rg_sch.h" /* Scheduler defines */ -#include "rg_sch_inf.h" /* Scheduler defines */ -#include "rg_sch_err.h" /* MAC error defines */ - -/* header/extern include files (.x) */ -#include "gen.x" /* general */ -#include "ssi.x" /* system services */ -#include "cm5.x" /* system services */ -#include "cm_lte.x" /* Common LTE */ -#include "cm_tkns.x" /* Common Token Definitions */ -#include "cm_llist.x" /* Common Link List Definitions */ -#include "cm_lib.x" /* Common Library Definitions */ -#include "cm_hash.x" /* Common Hash List Definitions */ -#include "cm_mblk.x" /* memory management */ - -#include "tfu.x" /* TFU Interface defines */ -#include "rgr.x" /* RGR Interface includes */ -#include "lrg.x" /* LRG Interface includes */ -#include "rgm.x" -#include "rg_sch_inf.x" /* Scheduler defines */ -#include "rg_sch.x" /* Scheduler includes */ -#include "rg_sch_cmn.h" -#include "rg_sch_cmn.x" - -/* local defines */ - -/* local typedefs */ - -/* local externs */ - -/* forward references */ - -#ifdef EMTC_ENABLE - U32 gUlRetxPassCntr = 0; - /*EXTERN U32 gUlRetxFailCntr; - EXTERN U32 gUlCrcPassCounter; - EXTERN U32 gUlCrcFailCounter;*/ -#endif -PUBLIC U8 rgRvIdxTable[] = {0, 3, 1, 2}; /* This gives rvIdx for a given rv */ -PUBLIC U8 rgRvTable[] = {0, 2, 3 ,1}; /* This gives rv for a given rvIdx */ - -#ifdef EMTC_ENABLE -PUBLIC Void rgSCHCmnEmtcHdlHarqProcFail -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchUlHqProcCb *hqProc, -CmLteTimingInfo frm -); -PUBLIC Void rgSCHEmtcInitUlUeHqEnt -( -RgSchCellCb *cell, -RgrUeCfg *ueCfg, -RgSchUeCb *ueCb -); - -#endif - -/** - * @brief Handler for HARQ processing on recieving Data indication from PHY. - * - * @details - * - * Function: rgSCHUhmProcDatInd - * - * Invoked by: rgSCHTomTfuDatInd of TOM - * - * Processing Steps: - * - Set rcvdCrcInd variable to TRUE - * - * @param[in] *cell - * @param[in] *ue - * @param[in] frm - * @return Void - **/ -#ifndef MAC_SCH_STATS -#ifdef ANSI -PUBLIC Void rgSCHUhmProcDatInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm -) -#else -PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -#endif -#else /* MAC_SCH_STATS */ -#ifdef ANSI -PUBLIC Void rgSCHUhmProcDatInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm, -U8 cqi -) -#else -PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm, cqi) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -U8 cqi; -#endif -#endif /* MAC_SCH_STATS */ -{ - RgSchUlHqProcCb *hqProc; -#ifdef UL_LA - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - S32 iTbs; - U8 maxiTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend] - [ueUl->maxUlCqi]; -#endif - - TRC2(rgSCHUhmProcDatInd); - - rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc); - if (hqProc == NULLP) - { - printf("UE[%d] failed to find UL HqProc for [%d:%d]\n", - ue->ueId, frm.sfn, frm.subframe); - RETVOID; - } - hqProc->rcvdCrcInd = TRUE; - -#ifdef UL_LA - { - ueUl->ulLaCb.deltaiTbs += UL_LA_STEPUP; - iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; - - if (iTbs > maxiTbs) - { - ueUl->ulLaCb.deltaiTbs = (maxiTbs * 100) - ueUl->ulLaCb.cqiBasediTbs; - } - - } -#endif -#ifdef MAC_SCH_STATS - /** Stats update over here - */ - { - hqFailStats.ulCqiStat[cqi - 1].numOfAcks++; - } -#endif - -#ifdef TENB_STATS - /* UL stats are filled in primary index as of now */ - cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++; - if(hqProc->alloc) - { - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulTpt += (hqProc->alloc->grnt.datSz << 3); - cell->tenbStats->sch.ulTtlTpt +=(hqProc->alloc->grnt.datSz << 3);//pverma - } -#endif - - RETVOID; -} /* rgSCHUhmProcDatInd */ - -/** - * @brief Handler for HARQ processing on recieving Data indication from PHY. - * - * @details - * - * Function: rgSCHUhmProcMsg3DatInd - * - * Invoked by: rgSCHTomTfuDatInd of TOM - * - * Processing Steps: - * - Set rcvdCrcInd variable to TRUE - * - * @param[in,out] *hqProc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmProcMsg3DatInd -( -RgSchUlHqProcCb *hqProc -) -#else -PUBLIC Void rgSCHUhmProcMsg3DatInd(hqProc) -RgSchUlHqProcCb *hqProc; -#endif -{ - TRC2(rgSCHUhmProcMsg3DatInd); - hqProc->rcvdCrcInd = TRUE; - hqProc->remTx = 0; /*Reseting the value of rem Tx*/ - printf("\nrgSCHUhmProcMsg3DatInd,id:%u\n",hqProc->procId); - RETVOID; -} /* rgSCHUhmProcMsg3DatInd */ - -/** - * @brief Handler for HARQ processing on recieving Data indication from PHY. - * - * @details - * - * Function: rgSCHUhmProcMsg3Failure - * - * Invoked by: rgSCHTomTfuDatInd of TOM - * - * Processing Steps: - * - Set rcvdCrcInd variable to TRUE - * - * @param[in,out] *hqProc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmProcMsg3Failure -( -RgSchUlHqProcCb *hqProc -) -#else -PUBLIC Void rgSCHUhmProcMsg3Failure(hqProc) -RgSchUlHqProcCb *hqProc; -#endif -{ - TRC2(rgSCHUhmProcMsg3Failure); -#ifdef EMTC_ENABLE - RG_SCH_EMTC_IS_CRCIND_RCVD_CHK_RACB(hqProc); -#endif - if(hqProc->rcvdCrcInd != TRUE) - { - hqProc->rcvdCrcInd = FALSE; - } - - RETVOID; -} /* rgSCHUhmProcMsg3Failure */ - -/** - * @brief Handler for HARQ processing on recieving Decode failure from PHY. - * - * @details - * - * Function: rgSCHUhmProcHqFailure - * - * Invoked by: rgSCHTomTfuDecFailInd of TOM - * - * Processing Steps: - * - Update NACK information in harq info. - * - Update RV index of received RV from PHY in harq info. - * - Set PhichInfo in DlSf - * - * @param[in] *cell - * @param[in] *ue - * @param[in] frm - * @param[in] rv - * @return Void - **/ -#ifndef MAC_SCH_STATS -#ifdef ANSI -PUBLIC Void rgSCHUhmProcHqFailure -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm, -TknU8 rv -) -#else -PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -TknU8 rv; -#endif -#else /* MAC_SCH_STATS */ -#ifdef ANSI -PUBLIC Void rgSCHUhmProcHqFailure -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm, -TknU8 rv, -U8 cqi -) -#else -PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv, cqi) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -TknU8 rv; -U8 cqi; -#endif -#endif /* MAC_SCH_STATS */ -{ - RgSchUlHqProcCb *hqProc; -#ifdef UL_LA - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); - S32 iTbs; -#endif - TRC2(rgSCHUhmProcHqFailure); - - rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc); - if (hqProc == NULLP) - { - printf("UE[%d] failed to find UL HqProc for [%d:%d]\n", - ue->ueId, frm.sfn, frm.subframe); - RETVOID; - } -#ifdef UL_LA - { - ueUl->ulLaCb.deltaiTbs -= UL_LA_STEPDOWN; - iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; - - if (iTbs < 0) - { - ueUl->ulLaCb.deltaiTbs = -(ueUl->ulLaCb.cqiBasediTbs); - } - - } -#endif -#ifdef MAC_SCH_STATS - /** Stats update over here */ - { - static U32 retxCnt = 0; - ++retxCnt; - hqFailStats.ulCqiStat[cqi - 1].numOfNacks++; - } -#endif /* MAC_SCH_STATS */ - if(hqProc->rcvdCrcInd != TRUE) - { - hqProc->rcvdCrcInd = FALSE; - } -#ifdef TENB_STATS - /* UL stats are filled in primary index as of now */ - cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++; - cell->tenbStats->sch.ulNack[rgRvTable[hqProc->rvIdx]]++; - ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNackCnt++; -#endif - hqProc->rvIdxPhy.pres = rv.pres; - if(rv.pres) - { - hqProc->rvIdxPhy.val = rgRvIdxTable[rv.val]; - } - RETVOID; -} /* rgSCHUhmProcHqFailure */ - -/** - * @brief Handler for identifying the HARQ process cb associated with the - * index. - * - * @details - * - * Function: rgSCHUhmGetUlHqProc - * - * Processing Steps: - * - Return pointer to uplink harq process corresponding to the timing - * information passed. - * - * @param[in] *ue - * @param[in] idx - * @return RgSchUlHqProcCb* - * -# Pointer to harq process corresponding to index - * -# NULL - **/ -#ifdef ANSI -PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 idx -) -#else -PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc(cell, ue, idx) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 idx; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - TRC2(rgSCHUhmGetUlHqProc); - -#if (ERRCLASS & ERRCLS_DEBUG) - if(idx >= ueUl->hqEnt.numHqPrcs) - { - RETVALUE(NULLP); - } -#endif - RETVALUE(&(ueUl->hqEnt.hqProcCb[idx])); -} /* rgSCHUhmGetUlHqProc */ - -/** - * @brief Handler for HARQ processing on recieving new trasmission indication - * from USM. - * - * @details - * - * Function: rgSCHUhmNewTx - * - * Invoked by: USM - * - * Processing Steps: - * - Update harq info with values indicating new HARQ transmission. - * - * @param[in,out] *hqProc - * @param[in] *alloc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmNewTx -( -RgSchUlHqProcCb *hqProc, -U8 maxHqRetx, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUhmNewTx(hqProc, maxHqRetx, alloc) -RgSchUlHqProcCb *hqProc; -U8 maxHqRetx; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUhmNewTx); - - hqProc->ndi ^= 1; - hqProc->alloc = alloc; - hqProc->remTx = maxHqRetx; - hqProc->rcvdCrcInd = FALSE; - hqProc->rvIdx = 0; - hqProc->rvIdxPhy.pres = FALSE; -#ifdef LTE_L2_MEAS - if (hqProc->alloc->ue) - { - ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs++; - } -#endif - RETVOID; -} /* rgSCHUhmNewTx */ - -/** - * @brief Free an uplink HARQ process. - * - * @details - * - * Function: rgSCHUhmFreeProc - * - * Invoked by: USM - * - * Processing Steps: - * - Set alloc pointer to NULLP - * - * @param[in] RgSchUlHqProcCb *hqProc - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmFreeProc -( -RgSchUlHqProcCb *hqProc, -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHUhmFreeProc(hqProc, cell) -RgSchUlHqProcCb *hqProc; -RgSchCellCb *cell; -#endif -{ -#ifdef LTEMAC_SPS - RgSchCmnUlUeSpsInfo *ulSpsUe = NULLP; -#endif -#ifdef LTE_L2_MEAS - RgSchUeCb *ueCb; - U8 qci = 1; -#endif - TRC2(rgSCHUhmFreeProc); - -#ifdef LTE_L2_MEAS - if (hqProc->alloc && hqProc->alloc->ue) - { - ueCb = hqProc->alloc->ue; - if (ueCb && cell) - { - U32 nonLcg0ReportedBs = ((RgSchCmnLcg *)(ueCb->ul.lcgArr[1].sch))->reportedBs + \ - ((RgSchCmnLcg *)(ueCb->ul.lcgArr[2].sch))->reportedBs + \ - ((RgSchCmnLcg *)(ueCb->ul.lcgArr[3].sch))->reportedBs; - ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs--; - if (! ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs && !(nonLcg0ReportedBs)) - { - while (ueCb->ulActiveLCs) - { - if (ueCb->ulActiveLCs & 0x1) - { - cell->qciArray[qci].ulUeCount--; - } - qci++; - ueCb->ulActiveLCs >>= 1; - } - } - } - } -#endif - - - if(hqProc && (RgUeUlHqCb*)hqProc->hqEnt) - { - -#ifdef UL_ADPT_DBG - printf("\n\n########HARQ FREED HARQPROC ID (%d )after rgSCHUhmFreeProc inuse %ld free %ld \n",hqProc->alloc->grnt.hqProcId, (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,(CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count); -#endif - hqProc->alloc = NULLP; - hqProc->ulSfIdx = RGSCH_INVALID_INFO; - /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ - hqProc->isRetx = FALSE; - hqProc->remTx = 0; /*Reseting the remTx value to 0*/ -#ifdef EMTC_ENABLE - RG_SCH_EMTC_SET_ISDTX_TO_FALSE(hqProc); -#endif - cmLListDelFrm(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse,&hqProc->lnk); - cmLListAdd2Tail(&((RgUeUlHqCb*)hqProc->hqEnt)->free, &hqProc->lnk); - - /* - printf("after rgSCHUhmFreeProc inuse %ld free %ld \n", - (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count, - (CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count); - */ - } - else - { - printf("\nhqEnt is NULL\n"); - } - RETVOID; -} /* rgSCHUhmFreeProc */ - -/** - * @brief Handler for HARQ processing on recieving re-trasmission - * indication from USM. - * - * @details - * - * Function: rgSCHUhmRetx - * - * Invoked by: USM - * - * Processing Steps: - * - Update harq info with values corresponding to - * re-transmission. - * - * @param[in,out] *hqProc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmRetx -( -RgSchUlHqProcCb *hqProc, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUhmRetx(hqProc, alloc) -RgSchUlHqProcCb *hqProc; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUhmRetx); - - hqProc->alloc = alloc; - --hqProc->remTx; - hqProc->rvIdx = (hqProc->rvIdx + 1) % 4; - hqProc->rvIdxPhy.pres = FALSE; - RETVOID; -} /* rgSCHUhmRetx */ - - -/** - * @brief Handler for initializing the HARQ entity. - * - * @details - * - * Function: rgSCHUhmRgrUeCfg - * - * Invoked by: RGR - * - * Processing Steps: - * - Initialize maxHqRetx - * - * @param[in] *cellCb - * @param[in,out] *ueCb - * @param[in] *ueCfg - * @param[out] *err - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmRgrUeCfg -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -RgrUeCfg *ueCfg -) -#else -PUBLIC Void rgSCHUhmRgrUeCfg(cellCb, ueCb, ueCfg) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -RgrUeCfg *ueCfg; -#endif -{ - U8 i; - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); - - TRC2(rgSCHUhmRgrUeCfg); - - ueUl->hqEnt.maxHqRetx = ((ueCfg->ueUlHqCfg.maxUlHqTx) - 1); -#ifdef TFU_UPGRADE - /* Storing the delta HARQ offset for HARQ + PUSCH */ - ueCb->ul.betaHqOffst = ueCfg->puschDedCfg.bACKIdx; -#endif - cmLListInit(&ueUl->hqEnt.free); - cmLListInit(&ueUl->hqEnt.inUse); - for(i=0; i < ueUl->hqEnt.numHqPrcs; i++) - { - ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt); - ueUl->hqEnt.hqProcCb[i].procId = i; - ueUl->hqEnt.hqProcCb[i].remTx = 0; - ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO; - ueUl->hqEnt.hqProcCb[i].alloc = NULLP; -#ifdef LTEMAC_SPS - /* ccpu00139513- Initializing SPS flags*/ - ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE; - ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE; -#endif - cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk); - ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i]; - } - -#ifdef EMTC_ENABLE - rgSCHEmtcInitUlUeHqEnt(cellCb, ueCfg, ueCb); -#endif - RETVOID; -} /* rgSCHUhmRgrUeCfg */ - -/** - * @brief Handler for re-initializing the HARQ entity. - * - * @details - * - * Function: rgSCHUhmRgrUeRecfg - * - * Invoked by: RGR - * - * Processing Steps: - * - Re-initialize maxHqRetx - * - * @param[in] *cellCb - * @param[in,out] *ueCb - * @param[in] *ueCfg - * @param[out] *err - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmRgrUeRecfg -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -RgrUeRecfg *ueRecfg -) -#else -PUBLIC Void rgSCHUhmRgrUeRecfg(cellCb, ueCb, ueRecfg) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -RgrUeRecfg *ueRecfg; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); - TRC2(rgSCHUhmRgrUeRecfg); - - /* [ccpu00123958]-ADD- Check for HARQ Reconfig from the bit mask */ - if(RGR_UE_ULHARQ_RECFG & ueRecfg->ueRecfgTypes) - { - ueUl->hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1); - } - - RETVOID; -} /* rgSCHUhmRgrUeRecfg */ - -/** - * @brief Handler for de-initializing the HARQ entity. - * - * @details - * - * Function: rgSCHUhmFreeUe - * - * Invoked by: RGR - * - * Processing Steps: - * - - * - * @param[in,out] *ueCb - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUhmFreeUe -( -RgSchCellCb *cellCb, -RgUeUlHqCb *hqEnt -) -#else -PUBLIC Void rgSCHUhmFreeUe(cellCb, hqEnt) -RgSchCellCb *cellCb; -RgUeUlHqCb *hqEnt; -#endif -{ - TRC2(rgSCHUhmFreeUe); -#ifdef LTE_TDD - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cellCb->instIdx, - (Data **)(&(hqEnt->hqProcCb)), - hqEnt->numHqPrcs * sizeof(RgSchUlHqProcCb)); -#endif - - RETVOID; -} /* rgSCHUhmFreeUe */ - - -/** -* @brief Handler for appending the PHICH information in to the dlSf. -* -* @details -* -* Function: rgSCHUhmAppendPhich -* -* Invoked by: TOM -* -* Processing Steps: -* - Set PhichInfo in DlSf for each Hq -* -* @param[in] *RgSchCellCb -* @param[in] CmLteTimingInfo -* @param[in] idx -* @return Void -*/ -#ifdef ANSI -PUBLIC S16 rgSCHUhmAppendPhich -( -RgSchCellCb *cellCb, -CmLteTimingInfo frm, -U8 idx -) -#else -PUBLIC S16 rgSCHUhmAppendPhich (cellCb, frm, idx) -RgSchCellCb *cellCb; -CmLteTimingInfo frm; -U8 idx; -#endif -{ - U8 nDmrs; - U8 rbStart; -#ifdef LTE_TDD - U8 iPhich; -#endif - RgSchUlAlloc *ulAlloc; -#ifdef LTEMAC_HDFDD - Bool allwNack = TRUE; -#endif /* LTEMAC_HDFDD */ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cellCb); - - TRC2(rgSCHUhmAppendPhich) - -#ifdef RG_5GTF - RETVALUE(ROK); -#endif - if(cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) - { - ulAlloc = rgSCHUtlFirstHqFdbkAlloc (cellCb, idx); - while (ulAlloc) - { - /*ccpu00106104 MOD added check for ACKNACK rep*/ - /*added check for acknack so that adaptive retx considers ue - inactivity due to ack nack repetition*/ - if((ulAlloc->ue != NULLP) && ((TRUE != ulAlloc->forMsg3) && - ((ulAlloc->ue->measGapCb.isMeasuring == TRUE) || - (ulAlloc->ue->ackNakRepCb.isAckNakRep == TRUE)))) - { - /* Mark the UE for retransmission */ - /* If UE is measuring then we should not be sending PHICH unless msg3 */ - /*UE assumes ack, if nack then do adaptive re-transmission*/ - /*ulAlloc->hqProc->rcvdCrcInd = FALSE;--*/ - ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx); - continue; - } -#ifdef LTE_TDD - if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs, &iPhich) != ROK) -#else - if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs) != ROK) -#endif - { - RETVALUE (RFAILED); - } - if(nDmrs != RGSCH_INVALID_NDMRS) - { - if(cellCb->dynCfiCb.switchOvrInProgress) - { - ulAlloc->hqProc->rcvdCrcInd = TRUE; - } - - if(ulAlloc->hqProc->rcvdCrcInd) - { -#ifdef LTE_TDD - rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, iPhich); -#else - rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3); -#endif - } - /* Sending NACK in PHICH for failed UL TX */ - else - { -#ifdef LTE_TDD - rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, iPhich); -#else -#ifdef LTEMAC_HDFDD - if (ulAlloc->ue != NULLP && ulAlloc->ue->hdFddEnbld) - { - rgSCHCmnHdFddChkNackAllow( cellCb, ulAlloc->ue, frm, &allwNack); - /* Present implementaion of non-HDFDD does not send phich req - incase of NACK. So commented this part to maintain same right - now.*/ - - if (allwNack) - { - rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); - } - else - { - rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3); - } - } - else - { - rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); - } -#else - rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); -#endif/* LTEMAC_HDFDD */ -#endif - } - } - ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx); - } - } - RETVALUE(ROK); -} /* rgSCHUhmAppendPhich */ - -/** - * @brief This function initializes the DL HARQ Entity of UE. - * - * @details - * - * Function: rgSCHUhmHqEntInit - * Purpose: This function initializes the UL HARQ Processes of - * UE control block. This is performed at the time - * of creating UE control block. - * - * Invoked by: configuration module - * - * @param[in] RgSchUeCb* ueCb - * @return S16 - * -# ROK - * -# RFAILED - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUhmHqEntInit -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb -) -#else -PUBLIC S16 rgSCHUhmHqEntInit(cellCb, ueCb) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); -#ifdef LTE_TDD - Inst inst = ueCb->cell->instIdx; -#endif - TRC2(rgSCHUhmHqEntInit) - -#ifndef LTE_TDD - /* Init the HARQ processes */ - ueUl->hqEnt.numHqPrcs = RGSCH_NUM_UL_HQ_PROC; -#else - /* Init the HARQ processes */ - ueUl->hqEnt.numHqPrcs = - rgSchTddUlNumHarqProcTbl[ueCb->cell->ulDlCfgIdx]; - if (rgSCHUtlAllocSBuf(inst, (Data **)&ueUl->hqEnt.hqProcCb, - ueUl->hqEnt.numHqPrcs * \ - sizeof(RgSchUlHqProcCb)) != ROK) - { - RETVALUE(RFAILED); - } -#endif - - RETVALUE(ROK); -} /* rgSCHUhmHqEntInit */ - -#ifdef RG_5GTF -/** - * @brief This function gets an available HARQ process. - * - * @details - * - * Function: rgSCHUhmGetAvlHqProc - * Purpose: This function returns an available HARQ process in - * the UL direction. All HARQ processes are maintained - * in queues of free and inuse. - * - * 1. Check if the free queue is empty. If yes, return - * RFAILED - * 2. If not empty, update the proc variable with the - * first process in the queue. Return ROK. - * - * Invoked by: scheduler - * - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo timingInfo - * @param[out] RgSchDlHqProc **hqP - * @return S16 - * -#ROK if successful - * -#RFAILED otherwise - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUhmGetAvlHqProc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchUlHqProcCb **hqP -) -#else -PUBLIC S16 rgSCHUhmGetAvlHqProc (cell, ue, hqP) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchUlHqProcCb **hqP; -#endif -{ - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - RgSchUlHqProcCb *tmpHqProc; - CmLList *tmp; - RgUeUlHqCb *hqE; - - TRC2(rgSCHUhmGetAvlHqProc); - - hqE = &ueUl->hqEnt; - - CM_LLIST_FIRST_NODE(&(hqE->free), tmp); - - if (NULLP == tmp) - { - //RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, - // "rgSCHUhmGetAvlHqProc free %ld inUse %ld ue %d" - // , hqE->free.count, hqE->inUse.count, ue->ueId); - //printf("5GTF_ERROR rgSCHUhmGetAvlHqProc cellId %d %ld inUse %ld ue %d" - //, cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId); - /* No Harq Process available in the free queue. */ - RETVALUE(RFAILED); - } - - tmpHqProc = (RgSchUlHqProcCb *)(tmp->node); - - /* Remove the element from the free Queue */ - cmLListDelFrm(&hqE->free, tmp); - - /* Add the element into the inUse Queue as well */ - cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk); - -#ifdef UL_ADPT_DBG - printf("rgSCHUhmGetAvlHqProc cellId %d free %ld inUse %ld ue %d time (%d %d)\n",cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId,cellUl->schdTime.sfn,cellUl->schdTime.subframe); -#endif - tmpHqProc->schdTime = cellUl->schdTime; - - *hqP = tmpHqProc; - - RETVALUE(ROK); -} /* rgSCHUhmGetAvlHqProc */ - -/** - * @brief Handler for identifying the HARQ process cb associated with the - * TX Time. - * - * @details - * - * Function: rgSCHUhmGetUlProcByTime - * - * Processing Steps: - * - Return pointer to uplink harq process corresponding to the timing - * information passed. - * - * @param[in] *ue - * @param[in] idx - * @return RgSchUlHqProcCb* - * -# Pointer to harq process corresponding to index - * -# NULL - **/ -#ifdef ANSI -PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm -) -#else -PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime(cell, ue, frm) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -#endif -{ - RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); - CmLListCp *lst = &ueUl->hqEnt.inUse; - CmLList *lnk = lst->first; - RgSchUlHqProcCb *proc; - - TRC2(rgSCHUhmGetUlProcByTime); - - while (lnk) - { - proc = (RgSchUlHqProcCb *)(lnk->node); - lnk = lnk->next; - // printf("compare rgSCHUhmGetUlProcByTime time (%d %d) CRC time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe,frm.sfn,frm.subframe ,proc->procId); - if (RGSCH_TIMEINFO_SAME(proc->schdTime, frm)) - { - // printf("Harq timing Matched rgSCHUhmGetUlProcByTime time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe, proc->procId); - RETVALUE(proc); - } - } - - RETVALUE(NULLP); -} /* rgSCHUhmGetUlProcByTime */ -#endif - - -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_utl.c b/src/5gnrmac/rg_sch_utl.c deleted file mode 100755 index c72396837..000000000 --- a/src/5gnrmac/rg_sch_utl.c +++ /dev/null @@ -1,12631 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/************************************************************************ - - Name: LTE-MAC layer - - Type: C source file - - Desc: C source code for Entry point fucntions - - File: rg_sch_utl.c - -**********************************************************************/ - -/** @file rg_sch_utl.c -@brief This file implements the schedulers main access to MAC layer code. -*/ - -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_MODULE_ID=4096; -static int RLOG_FILE_ID=177; - -/* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ -#include "gen.h" /* general layer */ -#include "ssi.h" /* system service interface */ -#include "cm_hash.h" /* common hash list */ -#include "cm_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ -#include "lrg.h" -#include "rgr.h" -#include "tfu.h" -#include "rg_env.h" -#include "rg_sch_err.h" -#include "rg_sch_inf.h" -#include "rg_sch.h" -#include "rg_sch_cmn.h" -#include "rgm.h" -#include "rl_interface.h" -#include "rl_common.h" - -/* header/extern include files (.x) */ -#include "gen.x" /* general layer typedefs */ -#include "ssi.x" /* system services typedefs */ -#include "cm5.x" /* common timers */ -#include "cm_hash.x" /* common hash list */ -#include "cm_lib.x" /* common library */ -#include "cm_llist.x" /* common linked list */ -#include "cm_mblk.x" /* memory management */ -#include "cm_tkns.x" /* common tokens */ -#include "cm_lte.x" /* common tokens */ -#include "tfu.x" /* TFU types */ -#include "lrg.x" /* layer management typedefs for MAC */ -#include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for Scheduler */ -#include "rg_sch_cmn.x" /* typedefs for Scheduler */ -#ifdef EMTC_ENABLE -#include "rg_sch_emtc_ext.x" -#endif - - -/* SR_RACH_STATS */ -U32 rgNumPrachRecvd =0; /* Num of Rach Req received including dedicated preambles */ -U32 rgNumRarSched =0; /* Num of RARs sent */ -U32 rgNumBI =0; /* Num of BackOff Ind sent */ -U32 rgNumMsg3CrcPassed =0; /* Num of CRC success for Msg3 */ -U32 rgNumMsg3CrcFailed =0; /* Num of CRC fail for Msg 3 */ -U32 rgNumMsg3FailMaxRetx =0; /* Num of Msg3 fail after Max Retx attempts */ -U32 rgNumMsg4Ack =0; /* Num of Acks for Msg4 Tx */ -U32 rgNumMsg4Nack =0; - /* Num of Nacks for Msg4 Tx */ -U32 rgNumMsg4FailMaxRetx =0; /* Num of Msg4 Tx failed after Max Retx attempts */ -U32 rgNumSrRecvd =0; /* Num of Sched Req received */ -U32 rgNumSrGrant =0; /* Num of Sched Req Grants sent */ -U32 rgNumMsg3CrntiCE =0; /* Num of Msg 3 CRNTI CE received */ -U32 rgNumDedPream =0; /* Num of Dedicated Preambles recvd */ -U32 rgNumMsg3CCCHSdu =0; /* Num of Msg 3 CCCH Sdus recvd */ -U32 rgNumCCCHSduCrntiNotFound =0; /*UE Ctx not found for CCCH SDU Msg 3 */ -U32 rgNumCrntiCeCrntiNotFound =0; /*UE Ctx not found for CRNTI CE Msg 3 */ -U32 rgNumMsg4WithCCCHSdu =0; /* Num of Msg4 with CCCH Sdu */ -U32 rgNumMsg4WoCCCHSdu =0; /* Num of Msg4 without CCCH Sdu */ -U32 rgNumMsg4Dtx =0; /* Num of DTX received for Msg 4 */ -U32 rgNumMsg3AckSent =0; /* Num of PHICH Ack sent for Msg 3 */ -U32 rgNumMsg3NackSent =0; /* Num of PHICH Nack sent for Msg 3 */ -U32 rgNumMsg4PdcchWithCrnti =0; /* Num of PDCCH for CRNTI based contention resolution */ -U32 rgNumRarFailDuetoRntiExhaustion =0; /* Num of RACH Failures due to RNTI pool exhaution */ -U32 rgNumTAModified =0; /* Num of times TA received is different from prev value */ -U32 rgNumTASent =0; /* Num of TA Command sent */ -U32 rgNumMsg4ToBeTx =0; /* Num of times MSG4 that should be sent */ -U32 rgNumMsg4Txed =0; /* Num of MSG4 actually sent *//* ysNumMsg4ToBeTx -ysNumMsg4Txed == Failed MSG4 TX */ -U32 rgNumMsg3DtxRcvd =0; /* CRC Fail with SINR < 0 */ - -U32 rgNumDedPreamUECtxtFound =0; /* Num of Dedicated Preambles recvd */ - -PRIVATE U8 rgSchDciAmbigSizeTbl[61] = {0,0,0,0,0,0,0,0,0,0,0, - 0,1,0,1,0,1,0,0,0,1, - 0,0,0,1,0,1,0,0,0,0, - 0,1,0,0,0,0,0,0,0,1, - 0,0,0,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,0}; - -/* local defines */ - -EXTERN U32 rgSchCmnBetaCqiOffstTbl[16]; -EXTERN U32 rgSchCmnBetaRiOffstTbl[16]; -EXTERN RgSchdApis rgSchCmnApis; -EXTERN PUBLIC S16 RgUiRgmSendPrbRprtInd ARGS(( -Pst* pst, -SuId suId, -RgmPrbRprtInd *prbRprtInd -)); - -EXTERN PUBLIC S16 RgUiRgmSendTmModeChangeInd ARGS(( -Pst* pst, -SuId suId, -RgmTransModeInd *txModeChngInd -)); -#ifdef EMTC_ENABLE -EXTERN PUBLIC S16 rgSCHEmtcUtlGetSfAlloc ARGS(( -RgSchCellCb *cell -)); -EXTERN PUBLIC S16 rgSCHEmtcUtlPutSfAlloc ARGS(( -RgSchCellCb *cell -)); -EXTERN PUBLIC Void rgSCHEmtcUtlUpdUeDciSize ARGS(( -RgSchCellCb *cell, -RgSchUeCb *ueCb -)); -EXTERN PUBLIC Void rgSCHEmtcGetDciFrmt61ASize ARGS(( -RgSchCellCb *cell -)); -EXTERN PUBLIC Void rgSCHEmtcGetDciFrmt60ASize ARGS(( -RgSchCellCb *cell -)); -EXTERN PUBLIC S16 rgSCHEmtcUtlFillPdschDciInfo ARGS(( -TfuPdschDciInfo *pdsch, -TfuDciInfo *pdcchDci -)); -EXTERN PUBLIC Void rgSCHEmtcUtlRlsRnti ARGS(( -RgSchCellCb *cell, -RgSchRntiLnk *rntiLnk, -U8 *isLegacy -)); -EXTERN PUBLIC S16 rgSCHEmtcPdcchAlloc ARGS(( -RgSchCellCb *cell, -RgSchPdcch *pdcch -)); -EXTERN PUBLIC Void rgSCHEmtcPdcchFree ARGS(( -RgSchCellCb *cell, -RgSchPdcch *pdcch -)); -#endif -/* Functions specific to TM1/TM2/TM6/TM7 for PRB calculation*/ -PUBLIC Void rgSchUtlDlCalc1CwPrb ARGS(( RgSchCellCb *cell, - RgSchUeCb *ue, - U32 bo, - U32 *prbReqrd)); - -/* Functions specific to TM3/TM4 for PRB calculation*/ -PUBLIC Void rgSchUtlDlCalc2CwPrb ARGS(( RgSchCellCb *cell, - RgSchUeCb *ue, - U32 bo, - U32 *prbReqrd)); - -#ifdef LTE_ADV -PUBLIC RgSchCellCb* rgSchUtlGetCellCb ARGS(( Inst inst, - U16 cellId -)); -#endif - -typedef Void (*RgSchUtlDlCalcPrbFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, - U32 bo, U32 *prbRequrd)); -#ifndef LTE_ADV -/* Functions specific to each transmission mode for PRB calculation*/ -RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[7] = {rgSchUtlDlCalc1CwPrb, -rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb, -NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb}; - -#else -/* Functions specific to each transmission mode for PRB calculation*/ -RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[9] = {rgSchUtlDlCalc1CwPrb, -rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb, -NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb, NULLP, NULLP}; - -#endif - -#ifdef LTE_TDD -/* The below table will be used to map the UL SF number in a TDD Cfg 0 - frame to the ul Sf array maintained in cellCb */ -PRIVATE U8 rgSchTddCfg0UlSfTbl[] = {2, 3, 4, 7, 8, 9}; -#endif - -PRIVATE S16 rgSCHUtlUlAllocDbInit ARGS(( - RgSchCellCb *cell, - RgSchUlAllocDb *db, - U8 maxAllocs - )); -PRIVATE Void rgSCHUtlUlAllocDbDeinit ARGS(( - RgSchCellCb *cell, - RgSchUlAllocDb *db - )); -PRIVATE S16 rgSCHUtlUlHoleDbInit ARGS(( - RgSchCellCb *cell, - RgSchUlHoleDb *db, - U8 maxHoles, - U8 start, - U8 num - )); -PRIVATE Void rgSCHUtlUlHoleDbDeinit ARGS(( - RgSchCellCb *cell, - RgSchUlHoleDb *db - )); - -PRIVATE S16 rgSCHChkBoUpdate ARGS(( - RgSchCellCb *cell, - RgInfCmnBoRpt *boUpdt - )); -#ifdef TFU_UPGRADE -PRIVATE U8 rgSCHUtlFetchPcqiBitSz ARGS(( - RgSchCellCb *cell, - RgSchUeCb *ueCb, - U8 numTxAnt - )); -#endif -/* sorted in ascending order of tbSz */ -CONSTANT struct rgSchUtlBcchPcchTbSz -{ - U8 rbIndex; /* RB index {2,3} */ - U16 tbSz; /* one of the Transport block size in bits of - * rbIndex 2 or 3 */ - /* Corrected allocation for common channels */ - U8 mcs; /* imcs */ -} rgSchUtlBcchPcchTbSzTbl[44] = { - { 2, 32, 0 }, { 2, 56, 1 }, { 2, 72, 2 }, { 3, 88, 1 }, - { 2, 104, 3 }, { 2, 120, 4 }, { 2, 144, 5 }, { 2, 176, 6 }, - { 3, 208, 4 }, { 2, 224, 7 }, { 2, 256, 8 }, { 2, 296, 9 }, - { 2, 328, 10 }, { 2, 376, 11 }, { 3, 392, 8 }, { 2, 440, 12 }, - { 3, 456, 9 }, { 2, 488, 13 }, { 3, 504, 10 }, { 2, 552, 14 }, - { 3, 584, 11 }, { 2, 600, 15 }, { 2, 632, 16 }, { 3, 680, 12 }, - { 2, 696, 17 }, { 3, 744, 13 }, { 2, 776, 18 }, { 2, 840, 19 }, - { 2, 904, 20 }, { 3, 968, 16 }, { 2, 1000, 21 }, { 2, 1064, 22 }, - { 2, 1128, 23 }, { 3, 1160, 18 }, { 2, 1192, 24 }, { 2, 1256, 25 }, - { 3, 1288, 19 }, { 3, 1384, 20 }, { 2, 1480, 26 }, { 3, 1608, 22 }, - { 3, 1736, 23 }, { 3, 1800, 24 }, { 3, 1864, 25 }, { 3, 2216, 26 } -}; - -/* local typedefs */ - -/* local externs */ - -/* forward references */ -#ifdef LTE_TDD -PRIVATE Void rgSCHUtlUpdPrachOcc ARGS(( -RgSchCellCb *cell, -RgrTddPrachInfo *cellCfg)); -#endif - -#define RGSCH_NUM_PCFICH_REG 4 -#define RGSCH_NUM_REG_PER_CCE 9 -#define RGSCH_NUM_REG_PER_PHICH_GRP 3 - -#ifdef LTE_TDD -#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _iPhich) {\ - (_phich)->hqFeedBack = _hqFeedBack; \ - (_phich)->rbStart = _rbStart; \ - (_phich)->nDmrs = _nDmrs; \ - (_phich)->iPhich = _iPhich; \ - (_phich)->lnk.next = NULLP; \ - (_phich)->lnk.prev = NULLP; \ - (_phich)->lnk.node = (PTR)(_phich); \ -} -#else -#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _isForMsg3) {\ - (_phich)->hqFeedBack = _hqFeedBack; \ - (_phich)->rbStart = _rbStart; \ - (_phich)->nDmrs = _nDmrs; \ - (_phich)->isForMsg3 = _isForMsg3; \ - (_phich)->lnk.next = NULLP; \ - (_phich)->lnk.prev = NULLP; \ - (_phich)->lnk.node = (PTR)(_phich); \ -} -#endif - -#define RGSCH_PHICH_ALLOC(_inst,_dataPtr, _size, _ret) {\ - _ret = rgSCHUtlAllocSBuf(_inst, (Data **)&_dataPtr, _size); \ -} - -/* ccpu00117052 - MOD - Passing double pointer -for proper NULLP assignment*/ -#define RGSCH_PHICH_FREE(_inst, _dataPtr, _size) {\ - rgSCHUtlFreeSBuf(_inst, (Data **)(&(_dataPtr)), _size); \ -} - -#ifdef TFU_UPGRADE -#define RGSCH_GETBIT(a, b) ((((U8*)a)[(b)>>3] >> ((7-((b)&7)))) & 1) - -/* -* -* Fun: rgSCHUtlPower -* -* Desc: This function finds of the Power of x raised to n -* -* Ret: value of x raised to n -* -* Notes: None -* -* File: rg_sch_utl.c -* -*/ -#ifdef ANSI -PUBLIC F64 rgSCHUtlPower -( -F64 x, -F64 n -) -#else -PUBLIC F64 rgSCHUtlPower(x, n) -F64 x; -F64 n; -#endif -{ - if( n==0 ) - { - RETVALUE( 1 ); - } - else if ( n>0 ) - { - RETVALUE( x * rgSCHUtlPower( x, n-1 ) ); - } - else - { - RETVALUE( (1/x) * rgSCHUtlPower( x, n+1 ) ); - } -} /* end of rgSCHUtlPower*/ - -/* -* -* Fun: rgSCHUtlParse -* -* Desc: This function parses bits x to y of an array and -* returns the integer value out of it. -* -* Ret: integer value of z bits -* -* Notes: None -* -* File: rg_sch_utl.c -* -*/ -#ifdef ANSI -PUBLIC U32 rgSCHUtlParse -( -U8 *buff, -U8 startPos, -U8 endPos, -U8 buffSize -) -#else -PUBLIC U32 rgSCHUtlParse(buff, startPos, endPos, buffSize) -U8 *buff; -U8 startPos; -U8 endPos; -U8 buffSize; -#endif -{ - U8 pointToChar,pointToEnd, loop; - U8 size = endPos - startPos; - F64 result = 0; - TRC2(rgSCHUtlParse); - pointToEnd = (startPos)%8; - for ( loop=0; loopinstIdx; - S16 ret; - U16 offsetStepMask; - - TRC2(rgSCHUtlPdcchAvail); - - /* V5G_213 : 10.1 */ - offset = 0; - byte = &pdcchInfo->map[0]; - initMask = (0xffff >> (16 - aggrLvl)); - currMask = initMask; - /* if N(symbol, xPDCCH) =2, then xPDCCH will be candidates in - * search space of index {0,1,2,3} and {8,9,..14} - */ - if ((cell->cell5gtfCb.cfi == 2) && (aggrLvl == CM_LTE_AGGR_LVL2)) - { - offsetStepMask = 0xc; - } - else - { - offsetStepMask = 0xc0; - } - - /* Loop till the number of bytes available in the CCE map */ - while (offset < ((pdcchInfo->nCce+ 7) >> 3)) - { - byte = &pdcchInfo->map[offset]; - /* Checking for available CCE */ - if ((*byte & currMask) == 0) - { - break; - } - /* if the number of CCEs required are not available, move to next offset */ - if (currMask & offsetStepMask) - { - offset++; - currMask = initMask; - } - else - { - /* Move to the next available CCE index in the current byte(cce map) */ - currMask = currMask << aggrLvl; - } - } - - if ((offset >= ((pdcchInfo->nCce + 7) >> 3)) || - ((aggrLvl == CM_LTE_AGGR_LVL16) && (offset > 0))) - { - RETVALUE(FALSE); - } - - byte = &pdcchInfo->map[offset]; - - if (cell->pdcchLst.first != NULLP) - { - *pdcch = (RgSchPdcch *)(cell->pdcchLst.first->node); - cmLListDelFrm(&cell->pdcchLst, cell->pdcchLst.first); - } - else - { - ret = rgSCHUtlAllocSBuf(inst, (Data **)pdcch, sizeof(RgSchPdcch)); - if(ROK != ret) - { - RETVALUE(FALSE); - } - } - - if (*pdcch) - { - (*byte) |= currMask; - /* ALL CCEs will be used in case of level 16 */ - if (aggrLvl == CM_LTE_AGGR_LVL16) - { - *(byte+1) |= currMask; - } - (*pdcch)->aggrLvl = aggrLvl; - cmLListAdd2Tail(&pdcchInfo->pdcchs, &((*pdcch)->lnk)); - (*pdcch)->lnk.node = (PTR)*pdcch; - (*pdcch)->nCce = aggrLvl; - (*pdcch)->ue = NULLP; - } - RETVALUE(TRUE); -} - - - -/** - * @brief This function releases a PDCCH - * - * @details - * - * Function: rgSCHUtlPdcchPut - * Purpose: This function releases a PDCCH. - * steps: - * 1. Locate the set of bits that represent the PDCCH for - * the provided location. - * 2. Set all of the bits to zero. - * 3. Release the memory of PDCCH to the cell free Q - * - * Invoked by: scheduler - * - * @param[in] RgSchPdcchInfo* pdcchInfo - * @param[in] U8 loc - * @param[in] U8 aggrLvl - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlPdcchPut -( -RgSchCellCb *cell, -RgSchPdcchInfo *pdcchInfo, -RgSchPdcch *pdcch -) -#else -PUBLIC Void rgSCHUtlPdcchPut(cell, pdcchInfo, pdcch) -RgSchCellCb *cell; -RgSchPdcchInfo *pdcchInfo; -RgSchPdcch *pdcch; -#endif -{ - U8 *byte; - U8 offset; - U8 mask; - - TRC2(rgSCHUtlPdcchPut); - - switch(pdcch->aggrLvl) - { - case CM_LTE_AGGR_LVL2: - offset = (pdcch->nCce >> 1) & 3; - mask = 0x3 << (offset * 2); /*ccpu00128826 - Offset Correction */ - break; - case CM_LTE_AGGR_LVL4: - offset = (pdcch->nCce >> 2) & 1; - mask = 0xf << (offset * 4);/*ccpu00128826 - Offset Correction */ - break; - case CM_LTE_AGGR_LVL8: - mask = 0xff; - break; - case CM_LTE_AGGR_LVL16: - mask = 0xffff; - break; - default: - RETVOID; - } - /* Placing common computation of byte from all the cases above here - for optimization */ - byte = &pdcchInfo->map[pdcch->nCce >> 3]; - - cmLListDelFrm(&pdcchInfo->pdcchs, &pdcch->lnk); - cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk); - pdcch->lnk.node = (PTR)pdcch; - pdcch->ue = NULLP; - (*byte) &= ~mask; - - RETVOID; -} - - -/** - * @brief This function initializes PDCCH information for frame - * - * @details - * - * Function: rgSCHUtlPdcchInit - * Purpose: This function initializes PDCCH information for - * a subframe. It removes the list of PDCCHs allocated - * in the prior use of this subframe structure. - * - * Invoked by: rgSCHUtlSubFrmPut - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlPdcchInit -( -RgSchCellCb *cell, -RgSchDlSf *subFrm, -U16 nCce -) -#else -PUBLIC Void rgSCHUtlPdcchInit(cell, subFrm, nCce) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -U16 nCce; -#endif -{ - RgSchPdcchInfo *pdcchInfo; - RgSchPdcch *pdcch; - Inst inst = cell->instIdx; - U8 extraBits; - U32 cceMapSz; - - TRC2(rgSCHUtlPdcchInit); - - pdcchInfo = &subFrm->pdcchInfo; - while(pdcchInfo->pdcchs.first != NULLP) - { - pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node; - cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first); - cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk); - pdcch->ue = NULLP; - } - cmLListInit(&pdcchInfo->pdcchs); - -#ifdef LTEMAC_SPS - subFrm->relPdcch = NULLP; -#endif - - cceMapSz = ((pdcchInfo->nCce + 7) >> 3); - - /* The bitMap array size is the number of ceiling(CCEs/8) */ - /* If nCce received is not the same as the one stored in - * pdcchInfo, free the pdcchInfo map */ - - if(pdcchInfo->nCce != nCce) - { - if(pdcchInfo->nCce) - { - rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)), cceMapSz); - } - pdcchInfo->nCce = nCce; - cceMapSz = ((pdcchInfo->nCce + 7) >> 3); - rgSCHUtlAllocSBuf(inst, (Data **)&pdcchInfo->map, - cceMapSz); - if (pdcchInfo->map == NULLP) - { - /* Generate log error here */ - RETVOID; - } - } - - cmMemset(subFrm->pdcchInfo.map, 0, cceMapSz); - /* If nCce is not exactly same as the bitMap size(no of bits allocated - * to represent the Cce's, then mark the extra bits as unavailable - extra bits = (((pdcchInfo->nCce + 7) >> 3)*8) - pdcchInfo->nCce - The last byte of bit map = subFrm->pdcchInfo.map[((pdcchInfo->nCce + 7) >> 3) - 1] - NOTE : extra bits are most significant of the last byte eg. */ - extraBits = (cceMapSz)*8 - pdcchInfo->nCce; - subFrm->pdcchInfo.map[cceMapSz - 1] |= - ((1 << extraBits) - 1) << (8 - extraBits); - RETVOID; -} - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - * @brief This function frees Pool - * @details - * - * Function: rgSchSFRTotalPoolFree - * - * Invoked by: rgSchSFRTotalPoolInit - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSchSFRTotalPoolFree -( - RgSchSFRTotalPoolInfo *sfrTotalPoolInfo, - RgSchCellCb *cell - ) -#else -PUBLIC Void rgSchSFRTotalPoolFree(sfrTotalPoolInfo, cell) - RgSchSFRTotalPoolInfo *sfrTotalPoolInfo; - RgSchCellCb *cell; -#endif -{ - CmLListCp *l; - CmLList *n; - TRC2(rgSchSFRTotalPoolFree); - - /*Deinitialise if these cc pools and ce pools are already existent*/ - l = &sfrTotalPoolInfo->ccPool; - n = cmLListFirst(l); - while (n != NULL) - { - /*REMOVING Cell Centred POOLS IF ANY*/ - n = cmLListDelFrm(l, n); - - /* Deallocate buffer */ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo)); - - /* Deallocate buffer */ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList)); - n = cmLListNext(l); - } - - /*REMOVING Cell Edged POOLS IF ANY*/ - l = &sfrTotalPoolInfo->cePool; - n = cmLListFirst(l); - while (n != NULL) - { - n = cmLListDelFrm(l, n); - - /* Deallocate buffer */ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo)); - - /* Deallocate buffer */ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList)); - n = cmLListNext(l); - } - -} - -/** - * @brief This function resets temporary variables in Pool - * @details - * - * Function: rgSchSFRResetPoolVariables - * - * Invoked by: rgSCHSFRUtlTotalPoolInit - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSchSFRTotalPoolInit -( - RgSchCellCb *cell, - RgSchDlSf *sf - ) -#else -PRIVATE Void rgSchSFRTotalPoolInit(cell, sf) - RgSchCellCb *cell; - RgSchDlSf *sf; -#endif -{ - /* Initialise the variables */ - RgSchSFRPoolInfo *sfrCCPool; - RgSchSFRPoolInfo *sfrCEPool; - CmLListCp *l; - CmLList *n; - CmLList *temp = NULLP; - S16 ret = 0; - - TRC2(rgSchSFRTotalPoolInit); - - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell); - sf->sfrTotalPoolInfo.CCPool1BwAvlbl = 0; - sf->sfrTotalPoolInfo.CCPool2BwAvlbl = 0; - sf->sfrTotalPoolInfo.CEPoolBwAvlbl = 0; - sf->sfrTotalPoolInfo.CC1 = FALSE; - sf->sfrTotalPoolInfo.CC2 = FALSE; - /*Initialise the CE Pools*/ - cmLListInit (&(sf->sfrTotalPoolInfo.cePool)); - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CE Pool memory allocation FAILED for cell"); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell); - RETVALUE(RFAILED); - } - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CE Pool memory allocation FAILED for cell "); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); - RETVALUE(RFAILED); - } - - l = &sf->sfrTotalPoolInfo.cePool; - cmLListAdd2Tail(l, temp); - - /*Initialise Bandwidth and startRB and endRB for each pool*/ - n = cmLListFirst(l); - - /* Initialise the CE Pools */ - sfrCEPool = (RgSchSFRPoolInfo*)n->node; - - sfrCEPool->poolstartRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb; - sfrCEPool->poolendRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb; - sfrCEPool->bw = sfrCEPool->poolendRB - sfrCEPool->poolstartRB + 1; - sf->sfrTotalPoolInfo.CEPoolBwAvlbl = sfrCEPool->bw; - - sfrCEPool->bwAlloced = 0; - sfrCEPool->type2Start = sfrCEPool->poolstartRB; - sfrCEPool->type2End = RGSCH_CEIL(sfrCEPool->poolstartRB, cell->rbgSize); - sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1; - sfrCEPool->pwrHiCCRange.startRb = 0; - sfrCEPool->pwrHiCCRange.endRb = 0; - - /*Initialise CC Pool*/ - cmLListInit (&(sf->sfrTotalPoolInfo.ccPool)); - - /*Add memory and Update CCPool*/ - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CC Pool memory allocation FAILED for cell "); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); - RETVALUE(RFAILED); - } - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CC Pool memory allocation FAILED for cell "); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); - RETVALUE(RFAILED); - } - - l = &sf->sfrTotalPoolInfo.ccPool; - cmLListAdd2Tail(l, temp); - - /*Initialise Bandwidth and startRB and endRB for each pool*/ - if(sfrCEPool->poolstartRB) - { - n = cmLListFirst(l); - sfrCCPool = (RgSchSFRPoolInfo*)n->node; - - sfrCCPool->poolstartRB = 0; - sfrCCPool->poolendRB = sfrCEPool->poolstartRB - 1; - sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; - sf->sfrTotalPoolInfo.CCPool1BwAvlbl = sfrCCPool->bw; - sfrCCPool->bwAlloced = 0; - sfrCCPool->type2Start = 0; - sfrCCPool->type2End = 0; - sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; - sf->sfrTotalPoolInfo.CC1 = TRUE; - sfrCCPool->pwrHiCCRange.startRb = 0; - sfrCCPool->pwrHiCCRange.endRb = 0; - } - else - { - n = cmLListFirst(l); - sfrCCPool = (RgSchSFRPoolInfo*)n->node; - - sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1; - sfrCCPool->poolendRB = sf->bw - 1; - sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; - sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw; - sfrCCPool->CCPool2Exists = TRUE; - sfrCCPool->bwAlloced = 0; - sfrCCPool->type2Start = sfrCCPool->poolstartRB; - sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize); - sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; - sf->sfrTotalPoolInfo.CC2 = TRUE; - sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */ - sfrCCPool->pwrHiCCRange.startRb = 0; - sfrCCPool->pwrHiCCRange.endRb = 0; - } - - if((sfrCEPool->poolendRB != sf->bw - 1) && (!sfrCCPool->poolstartRB)) - { - /*Add memory and Update CCPool*/ - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CC Pool memory allocation FAILED for cell "); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); - RETVALUE(RFAILED); - } - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, - "CC Pool memory allocation FAILED for cell "); - rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); - RETVALUE(RFAILED); - } - - cmLListAdd2Tail(l, temp); - - n = cmLListCrnt(l); - sfrCCPool = (RgSchSFRPoolInfo*)n->node; - - sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1; - sfrCCPool->poolendRB = sf->bw - 1; - sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; - sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw; - sfrCCPool->CCPool2Exists = TRUE; - sfrCCPool->bwAlloced = 0; - sfrCCPool->type2Start = sfrCCPool->poolstartRB; - sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize); - sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; - sf->sfrTotalPoolInfo.CC2 = TRUE; - sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */ - sfrCCPool->pwrHiCCRange.startRb = 0; - sfrCCPool->pwrHiCCRange.endRb = 0; - } - - sf->sfrTotalPoolInfo.CCRetx = FALSE; - sf->sfrTotalPoolInfo.CERetx = FALSE; - - sf->sfrTotalPoolInfo.ccBwFull = FALSE; - sf->sfrTotalPoolInfo.ceBwFull = FALSE; - sf->sfrTotalPoolInfo.isUeCellEdge = FALSE; - RETVALUE(ROK); -} -/** - * @brief This function resets temporary variables in RNTP Prepration - * @details - * - * Function: rgSchDSFRRntpInfoInit - * - * Invoked by: rgSCHSFRUtlTotalPoolInit - * - * @param[in] TknStrOSXL* rntpPtr - * @param[in] RgSubFrm* subFrm - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSchDSFRRntpInfoInit -( - TknStrOSXL *rntpPtr, - RgSchCellCb *cell, - U16 bw - ) -#else -PRIVATE Void rgSchDSFRRntpInfoInit(rntpPtr, cell, bw) - TknStrOSXL *rntpPtr; - RgSchCellCb *cell; - U16 bw; -#endif -{ - Inst inst = cell->instIdx; - U16 len; - - TRC2(rgSchDSFRRntpInfoInit); - - rntpPtr->pres = PRSNT_NODEF; - - len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1); - - rntpPtr->len = len; - - /* Allocate memory for "scheduled UE" Info */ - if((rgSCHUtlAllocSBuf(inst, (Data**)&(rntpPtr->val), - (len * sizeof(U8)))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for RNTP Alloc"); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} - -/** - * @brief This function release RNTP pattern from subFrame and Cell - * @details - * - * Function: rgSchDSFRRntpInfoFree - * - * Invoked by: rgSCHSFRUtlTotalPoolInit - * - * @param[in] TknStrOSXL* rntpPtr - * @param[in] RgSubFrm* subFrm - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSchDSFRRntpInfoFree -( - TknStrOSXL *rntpPtr, - RgSchCellCb *cell, - U16 bw - ) -#else -PRIVATE Void rgSchDSFRRntpInfoFree(rntpPtr, cell, bw) - TknStrOSXL *rntpPtr; - RgSchCellCb *cell; - U16 bw; -#endif -{ - Inst inst = cell->instIdx; - U16 len; - - TRC2(rgSchDSFRRntpInfoFree); - - len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1); - - if(rntpPtr->pres == PRSNT_NODEF) - { - rgSCHUtlFreeSBuf(inst, (Data **)(&(rntpPtr->val)),(len * sizeof(U8))); - rntpPtr->pres = NOTPRSNT; - rntpPtr->len = 0; - } - - RETVALUE(ROK); -} - -/** - * @brief This function resets temporary variables in Pool - * @details - * - * Function: rgSchSFRResetPoolVariables - * Purpose: Initialise the dynamic variables in each pool. - * Reset bwAlloced, bwAssigned, type2End, type0End, type2Start - * Invoked by: rgSCHSFRUtlTotalPoolReset - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchSFRPoolInfo *pool - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSchSFRResetPoolVariables -( - RgSchCellCb *cell, - RgSchSFRPoolInfo *pool - ) -#else -PRIVATE Void rgSchSFRResetPoolVariables(cell, pool) - RgSchCellCb *cell; - RgSchSFRPoolInfo *pool; -#endif -{ - - TRC2(rgSchSFRResetPoolVariables); - pool->bwAlloced = 0; - - /*type0end will be the last RBG in pool with all available RBs*/ - pool->type0End = (((pool->poolendRB + 1)/cell->rbgSize) - 1); - - /*type2end will be the first RBG in pool with all available RBs*/ - pool->type2End = RGSCH_CEIL(pool->poolstartRB, cell->rbgSize); - pool->type2Start = pool->poolstartRB; - pool->bw = pool->poolendRB - pool->poolstartRB + 1; - - RETVOID; -} -/** - * @brief This function resets SFR Pool information for frame - * - * @details - * - * Function: rgSCHSFRUtlTotalPooReset - * Purpose: Update the dynamic variables in each pool as they will be modified in each subframe. - * Dont modify the static variables like startRB, endRB, BW - * Invoked by: rgSCHUtlSubFrmPut - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlSf* subFrm - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHSFRUtlTotalPoolReset -( - RgSchCellCb *cell, - RgSchDlSf *subFrm - ) -#else -PRIVATE Void rgSCHSFRUtlTotalPoolReset(cell, subFrm) - RgSchCellCb *cell; - RgSchDlSf *subFrm; -#endif -{ - RgSchSFRTotalPoolInfo *totalPoolInfo = &subFrm->sfrTotalPoolInfo; - CmLListCp *ccPool = &totalPoolInfo->ccPool; - CmLListCp *cePool = &totalPoolInfo->cePool; - CmLList *node = NULLP; - RgSchSFRPoolInfo *tempPool = NULLP; - - TRC2(rgSCHSFRUtlTotalPoolReset); - - totalPoolInfo->ccBwFull = FALSE; - totalPoolInfo->ceBwFull = FALSE; - totalPoolInfo->isUeCellEdge = FALSE; - totalPoolInfo->CCPool1BwAvlbl = 0; - totalPoolInfo->CCPool2BwAvlbl = 0; - totalPoolInfo->CEPoolBwAvlbl = 0; - totalPoolInfo->CCRetx = FALSE; - totalPoolInfo->CERetx = FALSE; - - node = ccPool->first; - while(node) - { - tempPool = (RgSchSFRPoolInfo *)(node->node); - node = node->next; - rgSchSFRResetPoolVariables(cell, tempPool); - if(tempPool->poolstartRB == 0) - totalPoolInfo->CCPool1BwAvlbl = tempPool->bw; - else - totalPoolInfo->CCPool2BwAvlbl = tempPool->bw; - } - - node = cePool->first; - while(node) - { - tempPool = (RgSchSFRPoolInfo *)(node->node); - node = node->next; - rgSchSFRResetPoolVariables(cell, tempPool); - totalPoolInfo->CEPoolBwAvlbl = tempPool->bw; - } - - RETVOID; -} -/* LTE_ADV_FLAG_REMOVED_END */ -/** - * @brief This function appends PHICH information for frame - * - * @details - * - * Function: rgSCHUtlAddPhich - * Purpose: This function appends PHICH information for - * a subframe. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @param[in] U8 hqFeedBack - * @param[in] U8 nDmrs - * @param[in] U8 rbStart - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef LTE_TDD -#ifdef ANSI -PUBLIC S16 rgSCHUtlAddPhich -( -RgSchCellCb *cell, -CmLteTimingInfo frm, -U8 hqFeedBack, -U8 nDmrs, -U8 rbStart, -U8 iPhich -) -#else -PUBLIC S16 rgSCHUtlAddPhich(cell, frm, hqFeedBack, nDmrs, rbStart, iPhich) -RgSchCellCb *cell; -CmLteTimingInfo frm; -U8 hqFeedBack; -U8 nDmrs; -U8 rbStart; -U8 iPhich; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHUtlAddPhich -( -RgSchCellCb *cell, -CmLteTimingInfo frm, -U8 hqFeedBack, -U8 nDmrs, -U8 rbStart, -Bool isForMsg3 -) -#else -PUBLIC S16 rgSCHUtlAddPhich(cell, frm, hqFeedBack, nDmrs, rbStart, isForMsg3) -RgSchCellCb *cell; -CmLteTimingInfo frm; -U8 hqFeedBack; -U8 nDmrs; -U8 rbStart; -Bool isForMsg3; -#endif -#endif -{ - S16 ret; - RgSchPhich *phich; - RgSchDlSf *dlSf; - Inst inst = cell->instIdx; - TRC2(rgSCHUtlAddPhich); - - dlSf = rgSCHUtlSubFrmGet(cell, frm); - RGSCH_PHICH_ALLOC(inst, phich,sizeof(RgSchPhich), ret); - - if(ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, " rgSCHUtlAddPhich(): " - "Allocation of RgSchPhich failed"); - RETVALUE(RFAILED); - } -#ifdef LTE_TDD - RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, iPhich); -#else - RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, isForMsg3); /*SR_RACH_STATS */ -#endif - cmLListAdd2Tail(&dlSf->phichInfo.phichs, &phich->lnk); - RETVALUE(ROK); -} /* rgSCHUtlAddPhich */ - -/** - * @brief This function resets PHICH information for frame - * - * @details - * - * Function: rgSCHUtlPhichReset - * Purpose: This function initializes PHICH information for - * a subframe. It removes the list of PHICHs allocated - * in the prior use of this subframe structure. - * - * Invoked by: rgSCHUtlSubFrmPut - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHUtlPhichReset -( -RgSchCellCb *cell, -RgSchDlSf *subFrm -) -#else -PRIVATE Void rgSCHUtlPhichReset(cell, subFrm) -RgSchCellCb *cell; -RgSchDlSf *subFrm; -#endif -{ - RgSchPhichInfo *phichInfo; - RgSchPhich *phich; - - UNUSED(cell); - - TRC2(rgSCHUtlPhichReset); - - phichInfo = &subFrm->phichInfo; - while(phichInfo->phichs.first != NULLP) - { - phich = (RgSchPhich *)phichInfo->phichs.first->node; - cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first); - RGSCH_PHICH_FREE(cell->instIdx, phich, sizeof(RgSchPhich)); - } - cmLListInit(&phichInfo->phichs); - RETVOID; -} /* rgSCHUtlPhichReset */ - - -/** - * @brief This function returns subframe data structure for a cell - * - * @details - * - * Function: rgSCHUtlSubFrmGet - * Purpose: This function resets the subframe data structure - * when the subframe is released - * - * Invoked by: scheduler - * - * @param[in] RgSubFrm subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC RgSchDlSf* rgSCHUtlSubFrmGet -( -RgSchCellCb *cell, -CmLteTimingInfo frm -) -#else -PUBLIC RgSchDlSf* rgSCHUtlSubFrmGet(cell, frm) -RgSchCellCb *cell; -CmLteTimingInfo frm; -#endif -{ - RgSchDlSf *sf; - U8 dlIdx; - - TRC2(rgSCHUtlSubFrmGet); - -#ifdef LTE_TDD - dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm); - //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); - sf = cell->subFrms[dlIdx]; -#else - /* Changing the idexing - so that proper subframe is selected */ - dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.subframe % RGSCH_NUM_SUB_FRAMES)); - RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); - sf = cell->subFrms[dlIdx]; -#endif - /* CA dev Start */ - sf->dlIdx = dlIdx; - /* CA dev End */ - RETVALUE(sf); -} - - -/** - * @brief This function returns subframe data structure for a cell - * - * @details - * - * Function: rgSCHUtlSubFrmPut - * Purpose: This function resets the subframe data structure - * when the subframe is released - * - * Invoked by: scheduler - * - * @param[in] RgSubFrm subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlSubFrmPut -( -RgSchCellCb *cell, -RgSchDlSf *sf -) -#else -PUBLIC Void rgSCHUtlSubFrmPut(cell, sf) -RgSchCellCb *cell; -RgSchDlSf *sf; -#endif -{ - U8 i; - U8 noRaRsps; - - TRC2(rgSCHUtlSubFrmPut); - -#ifdef LTE_TDD - /* Release all the held PDCCH information */ - rgSCHUtlPdcchInit(cell, sf, sf->nCce); -#else - /* Release all the held PDCCH information */ - rgSCHUtlPdcchInit(cell, sf, cell->nCce); -#endif - rgSCHUtlPhichReset(cell, sf); - - /* Reset the bw allocated. */ - sf->bwAssigned = 0; -#ifdef LTEMAC_SPS - /* Setting allocated bandwidth to SPS bandwidth for non-SPS RB allocator */ - sf->bwAlloced = ((cell->spsCellCfg.maxSpsDlBw + - cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize; - if (sf->bwAlloced > sf->bw) - { - sf->bwAlloced = sf->bw; - } - sf->spsAllocdBw = 0; - sf->type2Start = sf->bwAlloced; - cmMemset((U8*) &sf->dlSfAllocInfo, 0, sizeof(RgSchDlSfAllocInfo)); -#else - sf->bwAlloced = 0; - /* Fix for ccpu00123918*/ - sf->type2Start = 0; - /* LTE_ADV_FLAG_REMOVED_START */ - /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ - if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - cmMemset((U8*) sf->rntpInfo.val, 0, len); - } - /* LTE_ADV_FLAG_REMOVED_END */ -#endif - sf->txDone = FALSE; - /*[ccpu00138609]-ADD-Reset the CCCH UE counter */ - sf->schdCcchUe = 0; - - /* Non DLFS scheduling using Type0 RA requires the following - * parameter's tracking */ - /* Type 2 localized allocations start from 0th RBG and onwards */ - /* Type 0 allocations start from last RBG and backwards*/ -#ifndef LTEMAC_SPS - sf->type2End = 0; -#else - sf->type2End = RGSCH_CEIL(sf->bwAlloced,cell->rbgSize); -#endif - sf->type0End = cell->noOfRbgs - 1; - /* If last RBG is of incomplete size then special handling */ - (sf->bw % cell->rbgSize == 0)? (sf->lstRbgDfct = 0) : - (sf->lstRbgDfct = cell->rbgSize - (sf->bw % cell->rbgSize)); - /* This resets the allocation for BCCH and PDCCH */ -#ifdef EMTC_ENABLE - /* TODO we need to move this reset for emtc functions */ - if(!(cell->emtcEnable)) - { - sf->bch.tb = NULLP; - sf->bch.tbSize = 0; - } -#else - sf->bch.tb = NULLP; - sf->bch.tbSize = 0; -#endif - sf->bcch.pdcch = NULLP; - sf->pcch.pdcch = NULLP; -#ifdef LTE_TDD - noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC; -#else - noRaRsps = RGSCH_MAX_RA_RSP_ALLOC; -#endif - for (i = 0; i < noRaRsps; i++) - { - sf->raRsp[i].pdcch = NULLP; - cmLListInit(&(sf->raRsp[i].raRspLst)); - } - /* LTE_ADV_FLAG_REMOVED_START */ - if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) - { - rgSCHSFRUtlTotalPoolReset(cell, sf); - } - /* LTE_ADV_FLAG_REMOVED_END */ -#ifdef LTE_ADV - cmLListInit(&sf->n1PucchResLst); -#endif - - sf->cceCnt = 0; - sf->isCceFailure = FALSE; - sf->dlUlBothCmplt = 0; - RETVOID; -} - - -/** - * @brief This function computes log N (32 bit Unsigned) to the base 2 - * - * @details - * - * Function: rgSCHUtlLog32bitNbase2 - * Purpose: This function computes log N (32 bit Unsigned) to the base 2. - * For n= 0,1 ret = 0. - * - * Invoked by: Scheduler - * - * @param[in] U32 n - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHUtlLog32bitNbase2 -( -U32 n -) -#else -PUBLIC U8 rgSCHUtlLog32bitNbase2(n) -U32 n; -#endif -{ - U32 b[] = {0x2, 0xc, 0xf0, 0xff00, 0xffff0000}; - U32 s[] = {1, 2, 4, 8, 16}; - S16 i; - U8 ret = 0; - - TRC2(rgSCHUtlLog32bitNbase2) - - for (i=4; i >= 0; i--) - { - if (n & b[i]) - { - n >>= s[i]; - ret |= s[i]; - } - } - RETVALUE(ret); -} - -#ifdef LTEMAC_SPS - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlRelPdcchFbk - * Purpose: Calls scheduler's handler for SPS release PDCCH feedback - * information. - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 isAck - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlRelPdcchFbk -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 isAck -) -#else -PUBLIC Void rgSCHUtlDlRelPdcchFbk(cell, ue, isAck) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 isAck; -#endif -{ - TRC2(rgSCHUtlDlRelPdcchFbk); - cell->sc.apis->rgSCHDlRelPdcchFbk(cell, ue, isAck); - RETVOID; -} - - - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlProcAck - * Purpose: Calls scheduler's handler to process Ack - * information. - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlHqProcCb *hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlProcAck -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHUtlDlProcAck(cell, hqP) -RgSchCellCb *cell; -RgSchDlHqProcCb *hqP; -#endif -{ - TRC2(rgSCHUtlDlProcAck); - cell->sc.apis->rgSCHDlProcAck(cell, hqP); - RETVOID; -} - -/** - * @brief CRNTI CE Handler - * - * @details - * - * Function : rgSCHUtlHdlCrntiCE - * - * - Call scheduler common API - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[out] RgSchErrInfo *err - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlHdlCrntiCE -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHUtlHdlCrntiCE(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlHdlCrntiCE); - - cell->sc.apis->rgSCHHdlCrntiCE(cell, ue); - RETVOID; -} /* rgSCHUtlHdlCrntiCE */ -#endif /* LTEMAC_SPS */ - -/*********************************************************** - * - * Func : rgSCHUtlCalcTotalRegs - * - * Desc : Calculate total REGs, given a bandwidth, CFI - * and number of antennas. - * - * Ret : Total REGs (U16) - * - * Notes: Could optimise if bw values are limited - * (taken from RRC spec) by indexing values from - * a table. - * Input values are not validated. CFI is assumed - * to be 1/2/3/4. - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE U16 rgSCHUtlCalcTotalRegs -( -U8 bw, -U8 cfi, -U8 numAntna, -Bool isEcp -) -#else -PRIVATE U16 rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp) -U8 bw; -U8 cfi; -U8 numAntna; -Bool isEcp; -#endif -{ - U16 regs = 0; - TRC2(rgSCHUtlCalcTotalRegs); - - /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ - - if (bw <= 10) - ++cfi; - switch (cfi) - { - /* Refer 36.211 section 6.10.1.2 - * For symbols 2 and 4, the REGs per RB will be based on cyclic prefix - * and number of antenna ports. - * For symbol 1, there are 2 REGs per RB always. Similarly symbol 3 - * will have 3 REGS. - */ - case 4: - /*CR changes [ccpu00124416] - MOD*/ - if(isEcp) - { - regs = bw * RGSCH_NUM_REGS_4TH_SYM_EXT_CP; - } - else - { - regs = bw * RGSCH_NUM_REGS_4TH_SYM_NOR_CP; - } - case 3: - regs += bw * RGSCH_NUM_REGS_3RD_SYM; - case 2: - /*CR changes [ccpu00124416] - MOD using number of antenna ports*/ - regs += (numAntna == RGSCH_NUM_ANT_PORT_FOUR) ? \ - (bw * RGSCH_NUM_REGS_2ND_SYM_FOUR_ANT_PORT) : \ - (bw * RGSCH_NUM_REGS_2ND_SYM_1OR2_ANT_PORT); - default: /* case 1 */ - regs += bw * RGSCH_NUM_REGS_1ST_SYM; - } - RETVALUE(regs); -} - -/*********************************************************** - * - * Func : rgSCHUtlCalcPhichRegs - * - * Desc : Calculates number of PHICH REGs - * - * Ret : Number of PHICH REGs (U8) - * - * Notes: ng6 is Ng multiplied by 6 - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE U16 rgSCHUtlCalcPhichRegs -( -U8 bw, -U8 ng6 -) -#else -PRIVATE U16 rgSCHUtlCalcPhichRegs(bw, ng6) -U8 bw; -U8 ng6; -#endif -{ - TRC2(rgSCHUtlCalcPhichRegs); - /* ccpu00115330: Corrected the calculation for number of PHICH groups*/ - RETVALUE(RGSCH_CEIL((bw * ng6) ,(8 * 6)) * RGSCH_NUM_REG_PER_PHICH_GRP); -} - -#ifdef LTE_TDD -/** - * @brief Calculates total CCEs (N_cce) - * - * @details - * - * Function: rgSCHUtlCalcNCce - * Purpose: This function calculates and returns total CCEs for a - * cell, given the following: bandwidth, Ng configuration - * (multiplied by six), cfi (actual number of control - * symbols), m factor for PHICH and number of antennas. - * - * Invoked by: Scheduler - * - * @param[in] U8 bw - * @param[in] U8 ng6 - * @param[in] U8 cfi - * @param[in] U8 mPhich - * @param[in] U8 numAntna - * @param[in] Bool isEcp - * @return N_cce (U8) - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHUtlCalcNCce -( -U8 bw, -RgrPhichNg ng, -U8 cfi, -U8 mPhich, -U8 numAntna, -Bool isEcp -) -#else -PUBLIC U8 rgSCHUtlCalcNCce(bw, ng, cfi, mPhich, numAntna, isEcp) -U8 bw; -RgrPhichNg ng; -U8 cfi; -U8 mPhich; -U8 numAntna; -Bool isEcp; -#endif -{ - U16 totalRegs; - U16 phichRegs; - U16 cceRegs; - U8 ng6; - TRC2(rgSCHUtlCalcNCce); - - /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ - - switch (ng) - { - case RGR_NG_ONESIXTH: - ng6 = 1; - break; - case RGR_NG_HALF: - ng6 = 3; - break; - case RGR_NG_ONE: - ng6 = 6; - break; - case RGR_NG_TWO: - default: - ng6 = 12; - break; - } - - totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp); - phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6); - cceRegs = totalRegs - mPhich*phichRegs - RGSCH_NUM_PCFICH_REG; - - RETVALUE((U8)(cceRegs/RGSCH_NUM_REG_PER_CCE)); -} - -#else -/** - * @brief Calculates total CCEs (N_cce) - * - * @details - * - * Function: rgSCHUtlCalcNCce - * Purpose: This function calculates and returns total CCEs for a - * cell, given the following: bandwidth, Ng configuration - * (multiplied by six), cfi (actual number of control - * symbols) and number of antennas. - * - * Invoked by: Scheduler - * - * @param[in] U8 bw - * @param[in] U8 ng6 - * @param[in] U8 cfi - * @param[in] U8 numAntna - * @return N_cce (U8) - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHUtlCalcNCce -( -U8 bw, -RgrPhichNg ng, -U8 cfi, -U8 numAntna, -Bool isEcp -) -#else -PUBLIC U8 rgSCHUtlCalcNCce(bw, ng, cfi, numAntna, isEcp) -U8 bw; -RgrPhichNg ng; -U8 cfi; -U8 numAntna; -Bool isEcp; -#endif -{ - U16 totalRegs; - U16 phichRegs; - U16 cceRegs; - U8 ng6; - TRC2(rgSCHUtlCalcNCce); - - /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ - - switch (ng) - { - case RGR_NG_ONESIXTH: - ng6 = 1; - break; - case RGR_NG_HALF: - ng6 = 3; - break; - case RGR_NG_ONE: - ng6 = 6; - break; - case RGR_NG_TWO: - default: - ng6 = 12; - break; - } - - totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp); - phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6); - cceRegs = totalRegs - phichRegs - RGSCH_NUM_PCFICH_REG; - - RETVALUE((U8)(cceRegs/RGSCH_NUM_REG_PER_CCE)); -} -#endif - -/** - * @brief Returns PHICH info associated with an uplink - * HARQ process allocation - * - * @details - * - * Function: rgSCHUtlGetPhichInfo - * Purpose: This function returns PHICH info associated with - * an uplink HARQ process allocation. PHICH info - * comprises RB start and N_dmrs. - * - * @param[in] RgSchUlHqProcCb *hqProc - * @param[out] U8 *rbStartRef - * @param[out] U8 *nDmrsRef - * @return S16 - **/ -#ifdef LTE_TDD -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetPhichInfo -( -RgSchUlHqProcCb *hqProc, -U8 *rbStartRef, -U8 *nDmrsRef, -U8 *iPhich -) -#else -PUBLIC S16 rgSCHUtlGetPhichInfo(hqProc, rbStartRef, nDmrsRef, iPhich) -RgSchUlHqProcCb *hqProc; -U8 *rbStartRef; -U8 *nDmrsRef; -U8 *iPhich; -#endif -#else -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetPhichInfo -( -RgSchUlHqProcCb *hqProc, -U8 *rbStartRef, -U8 *nDmrsRef -) -#else -PUBLIC S16 rgSCHUtlGetPhichInfo(hqProc, rbStartRef, nDmrsRef) -RgSchUlHqProcCb *hqProc; -U8 *rbStartRef; -U8 *nDmrsRef; -#endif -#endif -{ -/* ACC-TDD */ - S16 ret = RFAILED; - - TRC2(rgSCHUtlGetPhichInfo); - - if ((hqProc != NULLP) && (hqProc->alloc != NULLP)) - { - *rbStartRef = hqProc->alloc->grnt.rbStart; - *nDmrsRef = hqProc->alloc->grnt.nDmrs; -#ifdef LTE_TDD - *iPhich = hqProc->iPhich; -#endif - ret = ROK; - } - RETVALUE(ret); -} -#ifndef TFU_UPGRADE -/** - * @brief Returns uplink grant information required to permit - * PHY to receive data - * - * @details - * - * Function: rgSCHUtlAllocRcptInfo - * Purpose: Given an uplink allocation, this function returns - * uplink grant information which is needed by PHY to - * decode data sent from UE. This information includes: - * - RB start - * - Number of RBs - * - RV - * - * @param[in] RgSchUlAlloc *alloc - * @param[out] U8 *rbStartRef - * @param[out] U8 *numRbRef - * @param[out] U8 *rvRef - * @param[out] U16 *size - * @param[out] TfuModScheme *modType - * @param[out] Bool *isRtx - * @param[out] U8 *nDmrs - * @param[out] Bool *ndi - * @param[out] U8 *hqPId - * @return S16 - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAllocRcptInfo -( -RgSchUlAlloc *alloc, -CmLteRnti *rnti, -U8 *iMcsRef, -U8 *rbStartRef, -U8 *numRbRef, -U8 *rvRef, -U16 *size, -TfuModScheme *modType, -Bool *isRtx, -U8 *nDmrs, -Bool *ndi, -U8 *hqPId -) -#else -PUBLIC S16 rgSCHUtlAllocRcptInfo(alloc, rnti, iMcsRef, rbStartRef, numRbRef, - rvRef, size, modType, isRtx, nDmrs, ndi, - hqPId) -RgSchUlAlloc *alloc; -CmLteRnti *rnti; -U8 *iMcsRef; -U8 *rbStartRef; -U8 *numRbRef; -U8 *rvRef; -U16 *size; -TfuModScheme *modType; -Bool *isRtx; -U8 *nDmrs; -Bool *ndi; -U8 *hqPId; -#endif -{ - /* Modulation order for 16qam UEs would be - * min(4,modulation order in grant). Please refer to 36.213-8.6.1*/ - CmLteUeCategory ueCtgy; - - TRC2(rgSCHUtlAllocRcptInfo); -#if (ERRCLASS & ERRCLS_DEBUG) - if ((alloc == NULLP) || (alloc->hqProc == NULLP)) - { - RETVALUE(RFAILED); - } -#endif - - if ( !alloc->forMsg3 ) - { - if ( ((alloc->ue) == NULLP) || (RG_SCH_CMN_GET_UE(alloc->ue, alloc->ue->cell) == NULLP)) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,alloc->ue->cell->cellId, - "Failed: ue->sch is null RNTI:%d,isRetx=%d", - alloc->rnti, alloc->grnt.isRtx); - RETVALUE(RFAILED); - } - ueCtgy = (RG_SCH_CMN_GET_UE_CTGY(alloc->ue)); - } - - *iMcsRef = alloc->grnt.iMcs; - *rbStartRef = alloc->grnt.rbStart; - *numRbRef = alloc->grnt.numRb; - *rvRef = rgRvTable[alloc->hqProc->rvIdx]; - *rnti = alloc->rnti; - *size = alloc->grnt.datSz; - *modType = (alloc->forMsg3)? alloc->grnt.modOdr: - ((ueCtgy == CM_LTE_UE_CAT_5)? - alloc->grnt.modOdr: - (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr))); - *isRtx = alloc->grnt.isRtx; - *nDmrs = alloc->grnt.nDmrs; - *ndi = alloc->hqProc->ndi; - *hqPId = alloc->hqProc->procId; - - RETVALUE(ROK); -} -#else -/** - * @brief Returns uplink grant information required to permit - * PHY to receive data - * - * @details - * - * Function: rgSCHUtlAllocRcptInfo - * Purpose: Given an uplink allocation, this function returns - * uplink grant information which is needed by PHY to - * decode data sent from UE. This information includes: - * - RB start - * - Number of RBs - * - RV - * - * @param[in] RgSchUlAlloc *alloc - * @param[out] U8 *rbStartRef - * @param[out] U8 *numRbRef - * @param[out] U8 *rvRef - * @param[out] U16 *size - * @param[out] TfuModScheme *modType - * @return S16 - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAllocRcptInfo -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc, -CmLteTimingInfo *timeInfo, -TfuUeUlSchRecpInfo *recpReq -) -#else -PUBLIC S16 rgSCHUtlAllocRcptInfo(cell, alloc, timeInfo, recpReq) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -CmLteTimingInfo *timeInfo; -TfuUeUlSchRecpInfo *recpReq; -#endif -{ - TRC2(rgSCHUtlAllocRcptInfo); -#if (ERRCLASS & ERRCLS_DEBUG) - if ((alloc == NULLP) || (alloc->hqProc == NULLP)) - { - RETVALUE(RFAILED); - } -#endif - recpReq->size = alloc->grnt.datSz; - recpReq->rbStart = alloc->grnt.rbStart; - recpReq->numRb = alloc->grnt.numRb; - /* Modulation order min(4,mod in grant) for 16 qam UEs. - * Please refer to 36.213-8.6.1*/ -#ifdef FOUR_TX_ANTENNA - recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr: - (/*(alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)? - alloc->grnt.modOdr: *//* Chandra:TmpFx-TM500 Cat5 with Only16QAM */ - (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr)))); -#else - recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr: - ((alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)? - alloc->grnt.modOdr: - (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr)))); -#endif - recpReq->nDmrs = alloc->grnt.nDmrs; - recpReq->hoppingEnbld = FALSE; - recpReq->hoppingBits = 0; - recpReq->isRtx = alloc->grnt.isRtx; - recpReq->ndi = alloc->hqProc->ndi; - recpReq->rv = rgRvTable[alloc->hqProc->rvIdx]; -#ifndef LTE_TDD - recpReq->harqProcId = alloc->hqProc->procId; -#else - recpReq->harqProcId = rgSCHCmnGetUlHqProcIdx(timeInfo, cell); -#endif - /* Transmission mode is SISO till Uplink MIMO is implemented. */ - recpReq->txMode = 0; - /* This value needs to filled in in the case of frequency hopping. */ - recpReq->crntTxNb = 0; - - recpReq->mcs = alloc->grnt.iMcs; -#ifdef RG_5GTF - recpReq->rbgStart = alloc->grnt.vrbgStart; - recpReq->numRbg = alloc->grnt.numVrbg; - recpReq->xPUSCHRange = alloc->grnt.xPUSCHRange; - //TODO_SID Need to check - recpReq->nAntPortLayer = 0; - recpReq->SCID = alloc->grnt.SCID; - recpReq->PMI = alloc->grnt.PMI; - recpReq->uciWoTBFlag = alloc->grnt.uciOnxPUSCH; - if(alloc->ue) - { - recpReq->beamIndex = alloc->ue->ue5gtfCb.BeamId; - } -#endif - -#ifdef TENB_STATS - if (!alloc->forMsg3) - { - if (alloc->grnt.isRtx) - { - alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulRetxOccns++; - } - else - { - alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulTxOccns++; - alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulSumiTbs += \ - rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); - alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulNumiTbs ++; - cell->tenbStats->sch.ulSumiTbs += \ - rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); - cell->tenbStats->sch.ulNumiTbs ++; - } - alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulPrbUsg += alloc->grnt.numRb; - cell->tenbStats->sch.ulPrbUsage[0] += alloc->grnt.numRb; - } -#endif - /* ccpu00117050 - DEL - nSrs setting at rgSCHUtlAllocRcptInfo */ - RETVALUE(ROK); -} -#endif - -#ifdef LTE_TDD -/** - * @brief This function initialises the PRACH subframe occasions - * - * @details - * - * Function: rgSCHUtlUpdPrachOcc - * Purpose: This function updates the PRACH subframes based on - * RGR configuration. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrTddPrachInfo *cellCfg - * @return Void - * - **/ -#ifdef ANSI -PRIVATE Void rgSCHUtlUpdPrachOcc -( -RgSchCellCb *cell, -RgrTddPrachInfo *cellCfg -) -#else -PRIVATE Void rgSCHUtlUpdPrachOcc(cell, cellCfg) -RgSchCellCb *cell; -RgrTddPrachInfo *cellCfg; -#endif -{ - U8 idx; - U8 count = 0; - U8 size; - U8 startIdx; - U8 endIdx; - - TRC2(rgSCHUtlUpdPrachOcc) - - /* In the 1st half frame */ - if(cellCfg->halfFrm == 0) - { - startIdx = 2; - endIdx = 6; - } - /* In the 2nd half frame */ - else - { - startIdx = 6; - endIdx = 10; - } - for(idx = startIdx; idx < endIdx; idx++) - { - if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] - == RG_SCH_TDD_UL_SUBFRAME) - { - if(cellCfg->ulStartSfIdx == count) - { - size = cell->rachCfg.raOccasion.size; - cell->rachCfg.raOccasion.subFrameNum[size] = idx; - cell->rachCfg.raOccasion.size++; - break; - } - count ++; - } - } - RETVOID; -} - -/** - * @brief This function initialises the PRACH occasions - * - * @details - * - * Function: rgSCHUtlPrachCfgInit - * Purpose: This function initialises the PRACH occasions based on - * RGR configuration. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellCfg *cellCfg - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlPrachCfgInit -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg -) -#else -PUBLIC Void rgSCHUtlPrachCfgInit(cell, cellCfg) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -#endif -{ - U8 idx; - U8 subfrmIdx; - U8 splFrm; - - TRC2(rgSCHUtlPrachCfgInit) - if(cellCfg->prachRscInfo.numRsc <= 0) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid" - "PRACH resources Configuration "); - RETVOID; - } - - /* Update SFN occasions */ - cell->rachCfg.raOccasion.sfnEnum = - cellCfg->prachRscInfo.prachInfo[0].sfn; - - cell->rachCfg.raOccasion.size = 0; - - /* Update subframe occasions */ - for(idx = 0; idx < cellCfg->prachRscInfo.numRsc; idx++) - { - if(cellCfg->prachRscInfo.prachInfo[idx].freqIdx == 0) - { - if(cellCfg->prachRscInfo.prachInfo[idx].halfFrm == 0) - { - splFrm = 1; - } - else - { - splFrm = 6; - } - if(cellCfg->prachRscInfo.prachInfo[idx].ulStartSfIdx == - RGR_TDD_SPL_UL_IDX) - { - subfrmIdx = cell->rachCfg.raOccasion.size; - cell->rachCfg.raOccasion.subFrameNum[subfrmIdx] = splFrm; - cell->rachCfg.raOccasion.size++; - } - else - { - rgSCHUtlUpdPrachOcc(cell, - &cellCfg->prachRscInfo.prachInfo[idx]); - } - } - } - RETVOID; -} - -/** - * @brief This function performs RGR cell initialization - * - * @details - * - * Function: rgSCHUtlRgrCellCfg - * Purpose: This function initialises the cell with RGR configuration - * and subframe related initialization. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellCfg *cellCfg - * @param[in] RgSchErrInfo *errInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -RgSchErrInfo *errInfo; -#endif -{ - U8 i; - U8 sfn=0; - U8 sfNum = 0; - RgSchDlSf *sf; - CmLteTimingInfo frm; - U8 ulDlCfgIdx = cellCfg->ulDlCfgIdx; - U8 maxSubframes ; - U8 maxDlSubframes; - S16 ret = ROK; - U16 bw; /*!< Number of RBs in the cell */ - - TRC2(rgSCHUtlRgrCellCfg); - - cmMemset((U8 *)&frm,0,sizeof(CmLteTimingInfo)); - - /* ccpu00132657-MOD- Determining DLSF array size independent of DELTAS */ - maxDlSubframes = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - maxSubframes = 2 * maxDlSubframes; - cell->numDlSubfrms = maxSubframes; -/* ACC-TDD */ - cell->tddHqSfnCycle = -1; - cell->ulDlCfgIdx = ulDlCfgIdx; - - /* PRACH Occasions Initialization */ - rgSCHUtlPrachCfgInit(cell, cellCfg); - - /* ccpu00132658- Moved out of below for loop since the updating rbgSize and - * bw are independent of sfNum*/ - /* determine the RBG size and no of RBGs for the configured - * DL BW */ - if (cell->bwCfg.dlTotalBw > 63) - { - cell->rbgSize = 4; - } - else if (cell->bwCfg.dlTotalBw > 26) - { - cell->rbgSize = 3; - } - else if (cell->bwCfg.dlTotalBw > 10) - { - cell->rbgSize = 2; - } - else - { - cell->rbgSize = 1; - } - cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize); - - bw = cell->bwCfg.dlTotalBw; - - rgSCHUtlAllocSBuf(cell->instIdx, - (Data **)&cell->subFrms, sizeof(RgSchDlSf *) * maxSubframes); - if (cell->subFrms == NULLP) - { - RETVALUE(RFAILED); - } - - /* Create memory for each frame. */ - for(i = 0; i < maxSubframes; i++) - { - while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] == - RG_SCH_TDD_UL_SUBFRAME) - { - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - - rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf, sizeof(RgSchDlSf)); - if (sf == NULLP) - { - break; - } - cmMemset((U8 *)sf, 0, sizeof(*sf)); - -#ifdef LTE_ADV - if (ROK != rgSCHLaaInitDlSfCb(cell, sf)) - { - break; - } -#endif - sf->sfNum = sfNum; - sf->bw = bw; -#ifdef LTEMAC_SPS - /* Mark SPS bandwidth to be occupied */ - sf->bwAlloced = ((cellCfg->spsCfg.maxSpsDlBw + - cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize; - sf->spsAllocdBw = 0; - sf->type2End = sf->bwAlloced/cell->rbgSize; -#else - sf->bwAlloced = 0; - /* Fix for ccpu00123918*/ - sf->type2Start = 0; -#endif /* LTEMAC_SPS */ - /* Initialize the ackNakRepQ here */ -#ifdef RG_MAC_MEASGAP - cmLListInit (&(sf->ackNakRepQ)); -#endif - cell->subFrms[i] = sf; - sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; - } - if (i != maxSubframes) - { - for (; i > 0; i--) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cell->subFrms[i-1])), sizeof(RgSchDlSf)); -#ifdef LTE_ADV - rgSCHLaaDeInitDlSfCb(cell, sf); -#endif - } - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, - (Data **)(&(cell->subFrms)), sizeof(RgSchDlSf *) * maxSubframes); - - RETVALUE(RFAILED); - } - - if (cell->sc.apis == NULLP) - { - cell->sc.apis = &rgSchCmnApis; - } - ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo); - - if (ret != ROK) - { - /* ccpu00132286- Removed deletion of sf nodes as the deletion will be - * happening during CellDelete. Added return handling to provide negative - * confirm*/ - RETVALUE(ret); - } - - /* Release the subframes and thereby perform the initialization */ - for (i = 0; i < maxSubframes; i++) - { - if((i > 0) && (i%maxDlSubframes == 0)) - { - sfn++; - } - frm.sfn = sfn; - frm.subframe = cell->subFrms[i]->sfNum; - rgSCHUtlDlRlsSubFrm(cell, frm); - } - - RETVALUE(ret); -} - -#else - -/** - * @brief This function performs scheduler related cell creation - * - * @details - * - * Function: rgSCHUtlRgrCellCfg - * Purpose: This function creates the subframes needed for the - * cell. It then peforms init of the scheduler by calling - * scheduler specific cell init function. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellCfg *cellCfg - * @param[in] RgSchErrInfo *errInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrCellCfg -( -RgSchCellCb *cell, -RgrCellCfg *cellCfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo) -RgSchCellCb *cell; -RgrCellCfg *cellCfg; -RgSchErrInfo *errInfo; -#endif -{ - U8 i; - RgSchDlSf *sf; - CmLteTimingInfo frm; - S16 ret; - Inst inst = cell->instIdx; - /* LTE_ADV_FLAG_REMOVED_START */ - U16 len; - len = (U16)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /*KW fix for LTE_ADV */ - /* LTE_ADV_FLAG_REMOVED_END */ - TRC2(rgSCHUtlRgrCellCfg); - - cmMemset((U8 *)&frm,0,sizeof(CmLteTimingInfo)); - - /* determine the RBG size and no of RBGs for the configured - * DL BW */ - if (cell->bwCfg.dlTotalBw > 63) - { - cell->rbgSize = 4; - } - else if (cell->bwCfg.dlTotalBw > 26) - { - cell->rbgSize = 3; - } - else if (cell->bwCfg.dlTotalBw > 10) - { - cell->rbgSize = 2; - } - else - { - cell->rbgSize = 1; - } - cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize); - /* Create memory for each frame. */ - /* Changing loop limit from - RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_SUBFRAMES */ - for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - rgSCHUtlAllocSBuf(inst, (Data **)&sf, sizeof(RgSchDlSf)); - if (sf == NULLP) - { - break; - } - cmMemset((U8 *)sf, 0, sizeof(*sf)); - -#ifdef LTE_ADV - if (ROK != rgSCHLaaInitDlSfCb(cell, sf)) - { - break; - } -#endif - /* Doing MOD operation before assigning value of i */ - sf->sfNum = i % RGSCH_NUM_SUB_FRAMES; - sf->bw = cell->bwCfg.dlTotalBw; - /* Initialize the ackNakRepQ here */ -#ifdef RG_MAC_MEASGAP - cmLListInit (&(sf->ackNakRepQ)); -#endif - cell->subFrms[i] = sf; - /* LTE_ADV_FLAG_REMOVED_START */ - if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - /*initialize the RNTP Buffer*/ - if(rgSchDSFRRntpInfoInit(&sf->rntpInfo, cell, sf->bw)) - { - RETVALUE(RFAILED); - } - } - - if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) - { - /*initialise the pools of CC and CE*/ - if(rgSchSFRTotalPoolInit(cell, sf)) - { - RETVALUE(RFAILED); - } - } - /* LTE_ADV_FLAG_REMOVED_END */ - } - - /* LTE_ADV_FLAG_REMOVED_START */ - /* Allocate memory for "scheduled UE" Info */ - if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) - { - if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val), - (len * sizeof(U8)))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for RNTP Alloc"); - RETVALUE(RFAILED); - } - cell->rntpAggrInfo.pres = PRSNT_NODEF; - cell->rntpAggrInfo.len = len; - } - /* LTE_ADV_FLAG_REMOVED_END */ - - /* Changing loop limit from - RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_SUBFRAMES */ - if (i != RGSCH_NUM_DL_SUBFRAMES) - { - for (; i > 0; i--) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i-1])), - sizeof(RgSchDlSf)); -#ifdef LTE_ADV - rgSCHLaaDeInitDlSfCb(cell, sf); -#endif - } - RETVALUE(RFAILED); - } - - if (cell->sc.apis == NULLP) - { - cell->sc.apis = &rgSchCmnApis; - } - - /* Release the subframes and thereby perform the initialization */ - for (i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) - { - if (i >= RGSCH_NUM_SUB_FRAMES) - { - /* [ccpu00123828]-MOD-The below statement sfn += 1incorrectly modified - * the value of sfn for i>=10 thru 19. Correct way is to assign - it to one */ - frm.sfn = 1; - } - frm.subframe = i % RGSCH_NUM_SUB_FRAMES; - rgSCHUtlDlRlsSubFrm(cell, frm); - } - - ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo); - if (ret != ROK) - { - errInfo->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - /* TODO: Repetition framework in RGR and APP */ - if (rgSCHUtlEmtcResMngmtInit( - cell, - RGSCH_IOT_PDSCH_POOLSZ, RGSCH_IOT_PDSCH_DELTA, cellCfg->bwCfg.dlTotalBw, - RGSCH_IOT_PUSCH_POOLSZ, RGSCH_IOT_PUSCH_DELTA, RGSCH_IOT_PUSCH_MAXFREQSZ, - RGSCH_IOT_PUCCH_POOLSZ, RGSCH_IOT_PUCCH_DELTA, RGSCH_IOT_PUCCH_MAXFREQSZ) != ROK) - { - errInfo->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - } -#endif - - RETVALUE(ret); -} -#endif - - -/** - * @brief This function performs the cell reconfiguration at RGR interface - * - * @details - * - * Function: rgSCHUtlRgrCellRecfg - * Purpose: This function updates the reconfigurable parameters - * on the cell control block for the scheduler. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgrCellCfg *cellCfg - * @param[in] RgSchErrInfo *errInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrCellRecfg -( -RgSchCellCb *cell, -RgrCellRecfg *recfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlRgrCellRecfg(cell, recfg, err) -RgSchCellCb *cell; -RgrCellRecfg *recfg; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlRgrCellRecfg); - RETVALUE(cell->sc.apis->rgSCHRgrCellRecfg(cell, recfg, err)); -} - - - -/** - * @brief This function returns the Y value of UE for a sub frame - * - * @details - * - * Function: rgSCHUtlFreeCell - * Purpose: This function updates the value of Y stored in the - * UE control block. It uses the previously computed - * value for computing for this subframe. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFreeCell -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlFreeCell(cell) -RgSchCellCb *cell; -#endif -{ - U8 i; - CmLListCp *lst; - RgSchPdcch *pdcch; - RgSchPdcchInfo *pdcchInfo; - RgSchPhichInfo *phichInfo; - RgSchPhich *phich; - Inst inst = cell->instIdx; - U8 maxSubframes; -#ifdef LTE_TDD - RgSchRaReqInfo *raReqInfo; - U8 idx; -#endif - TRC2(rgSCHUtlFreeCell); - -#ifdef LTE_TDD - maxSubframes = cell->numDlSubfrms; -#else - maxSubframes = RGSCH_NUM_DL_SUBFRAMES; -#endif - - - /* Invoke the index for scheduler, cell deletion */ - cell->sc.apis->rgSCHFreeCell(cell); - - /* Release the subframes allocated */ - for (i = 0; i < maxSubframes; i++) - { -#ifdef LTE_ADV - rgSCHLaaDeInitDlSfCb(cell, cell->subFrms[i]); -#endif - pdcchInfo = &cell->subFrms[i]->pdcchInfo; - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)), - (pdcchInfo->nCce + 7) >> 3); - while (pdcchInfo->pdcchs.first != NULLP) - { - pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node; - cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)&pdcch, sizeof(RgSchPdcch)); - } - - phichInfo = &cell->subFrms[i]->phichInfo; - while(phichInfo->phichs.first != NULLP) - { - phich = (RgSchPhich *)phichInfo->phichs.first->node; - cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first); - RGSCH_PHICH_FREE(inst, phich, sizeof(RgSchPhich)); - } - - /* LTE_ADV_FLAG_REMOVED_START */ - /*releasing SFR pool entries*/ - rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell); - - /*releasing dsfr rntp pattern info*/ - rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, - cell->bwCfg.dlTotalBw); - /* LTE_ADV_FLAG_REMOVED_END */ - - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i])), sizeof(RgSchDlSf)); - } -#ifdef LTE_TDD - /* Release the subframe pointers */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data **) (&(cell->subFrms)), sizeof(RgSchDlSf *) * maxSubframes); - - for(idx=0; idx < cell->raInfo.lstSize; idx++) - { - lst = &cell->raInfo.raReqLst[idx]; - while (lst->first != NULLP) - { - raReqInfo = (RgSchRaReqInfo *)lst->first->node; - cmLListDelFrm(lst, &raReqInfo->raReqLstEnt); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst,(Data **)&raReqInfo, sizeof(RgSchRaReqInfo)); - } - } - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data **)(&(cell->raInfo.raReqLst)), - sizeof(CmLListCp) * (cell->raInfo.lstSize)); -#endif - - /* Release allocated pdcchs */ - lst = &cell->pdcchLst; - while (lst->first != NULLP) - { - pdcch = (RgSchPdcch *)lst->first->node; - cmLListDelFrm(lst, &pdcch->lnk); -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - rgSCHEmtcPdcchFree(cell, pdcch); - rgSCHUtlEmtcResMngmtDeinit(cell); - } -#endif - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst,(Data **)&pdcch, sizeof(RgSchPdcch)); - } -#ifdef LTE_ADV - rgSCHLaaFreeLists(cell); -#endif - - /* LTE_ADV_FLAG_REMOVED_START */ - /* releasing RNTP Aggregation Info from CellCb*/ - rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); - /* LTE_ADV_FLAG_REMOVED_END */ - - RETVALUE(ROK); -} - - -/** - * @brief This function adds the UE to scheduler - * - * @details - * - * Function: rgSCHUtlRgrUeCfg - * Purpose: This function performs addition of UE to scheduler - * 1. First, it updates the Y table in the UE - * 2. Then, it calls the scheduler's handler for UE addition - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrUeCfg *cfg - * @param[in] RgSchErrInfo *err - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrUeCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeCfg *cfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlRgrUeCfg(cell, ue, cfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeCfg *cfg; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlRgrUeCfg); - - /* Assign TM 1 as UE's default TM */ - ue->mimoInfo.txMode = RGR_UE_TM_1; - ue->txModeTransCmplt = TRUE; - cmInitTimers(&ue->txModeTransTmr, 1); - if (cfg->txMode.pres == PRSNT_NODEF) - { - /* DL MU-MIMO not supported */ - if (cfg->txMode.txModeEnum == RGR_UE_TM_5) - { - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ue->mimoInfo.txMode = cfg->txMode.txModeEnum; - } - ue->ul.ulTxAntSel = cfg->ulTxAntSel; - ue->mimoInfo.cdbkSbstRstrctn = cfg->ueCodeBookRstCfg; -#ifdef TFU_UPGRADE - ue->ueCatEnum = cfg->ueCatEnum; - if ((cfg->puschDedCfg.bACKIdx > 15) || - (cfg->puschDedCfg.bCQIIdx > 15) || - (cfg->puschDedCfg.bRIIdx > 15)) - { - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } - ue->ul.betaHqOffst = cfg->puschDedCfg.bACKIdx; - ue->ul.betaCqiOffst = cfg->puschDedCfg.bCQIIdx; - ue->ul.betaRiOffst = cfg->puschDedCfg.bRIIdx; -#endif - ue->csgMmbrSta = cfg->csgMmbrSta; -#ifdef RG_PFS_STATS - cmMemset((U8 *)&ue->pfsStats, 0, sizeof(RgSchPfsStats)); -#endif - /* Call the handler of the scheduler based on cell configuration */ - RETVALUE(cell->sc.apis->rgSCHRgrUeCfg(cell, ue, cfg, err)); -} -/* Start : LTEMAC_2.1_DEV_CFG */ - -/** - * @brief This function adds a service to scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcCfg - * Purpose: This function performs addition of service to scheduler - * The addition is performed for each direction based - * the direction field of the configuration - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlLcCb *dlLc - * @param[in] RgrLchCfg *cfg - * @param[in] RgSchErrInfo *err - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLcCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc, -RgrLchCfg *cfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHUtlRgrLcCfg(cell, ue, dlLc, cfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -RgrLchCfg *cfg; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHUtlRgrLcCfg); - RETVALUE(cell->sc.apis->rgSCHRgrLchCfg(cell, ue, dlLc, cfg, errInfo)); -} - - -/** - * @brief This function modifies a service to scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcRecfg - * Purpose: This function performs modification of a service in - * scheduler. The modification is performed for each direction - * based the direction field of the configuration - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchDlLcCb *dlLc - * @param[in] RgrLchRecfg *recfg - * @param[in] RgSchErrInfo *err - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLcRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *dlLc, -RgrLchRecfg *recfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlRgrLcRecfg(cell, ue, dlLc, recfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *dlLc; -RgrLchRecfg *recfg; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlRgrLcRecfg); - RETVALUE(cell->sc.apis->rgSCHRgrLchRecfg(cell, ue, dlLc, recfg, err)); -} - -/** - * @brief This function deletes a Lc in scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcDel - * Purpose: This function performs deletion of Lc in scheduler - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteLcId lcId - * @param[in] U8 lcgId - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLcDel -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteLcId lcId, -U8 lcgId -) -#else -PUBLIC S16 rgSCHUtlRgrLcDel(cell, ue, lcId, lcgId) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteLcId lcId; -U8 lcgId; -#endif -{ - TRC2(rgSCHUtlRgrLcDel); - cell->sc.apis->rgSCHRgrLchDel(cell, ue, lcId, lcgId); - - RETVALUE (ROK); -} /* rgSCHUtlRgrLcDel */ - -/** - * @brief This function adds a service to scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcgCfg - * Purpose: This function performs addition of service to scheduler - * The addition is performed for each direction based - * the direction field of the configuration - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrLchCfg *cfg - * @param[in] RgSchErrInfo *err - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLcgCfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrLcgCfg *cfg, -RgSchErrInfo *errInfo -) -#else -PUBLIC S16 rgSCHUtlRgrLcgCfg(cell, ue, cfg, errInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrLcgCfg *cfg; -RgSchErrInfo *errInfo; -#endif -{ - TRC2(rgSCHUtlRgrLcgCfg); - RETVALUE(cell->sc.apis->rgSCHRgrLcgCfg(cell, ue, &(ue->ul.lcgArr[cfg->ulInfo.lcgId]), cfg, errInfo)); -} - - -/** - * @brief This function modifies a service to scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcgRecfg - * Purpose: This function performs modification of a service in - * scheduler. The modification is performed for each direction - * based the direction field of the configuration - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrLcgRecfg *recfg - * @param[in] RgSchErrInfo *err - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLcgRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrLcgRecfg *recfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlRgrLcgRecfg(cell, ue, recfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrLcgRecfg *recfg; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlRgrLcgRecfg); - RETVALUE(cell->sc.apis->rgSCHRgrLcgRecfg(cell, ue, &(ue->ul.lcgArr[recfg->ulRecfg.lcgId]), recfg, err)); -} /* rgSCHUtlRgrLcRecfg */ - -/** - * @brief This function modifies a service to scheduler - * - * @details - * - * Function: rgSCHUtlRgrLcgDel - * Purpose: This function performs modification of a service in - * scheduler. The modification is performed for each direction - * based the direction field of the configuration - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgrDel *lcDelInfo - * @return S16 - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlRgrLcgDel -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 lcgId -) -#else -PUBLIC Void rgSCHUtlRgrLcgDel(cell, ue, lcgId) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 lcgId; -#endif -{ - TRC2(rgSCHUtlRgrLcgDel); - cell->sc.apis->rgSCHFreeLcg(cell, ue, &ue->ul.lcgArr[lcgId]); - - /* Stack Crash problem for TRACE5 changes. added the return below . */ - RETVOID; - -} /* rgSCHUtlRgrLcgDel */ - - -/* End: LTEMAC_2.1_DEV_CFG */ - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDoaInd - * Purpose: Updates the DOA for the UE - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDoaRpt *doaRpt - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDoaInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuDoaRpt *doaRpt -) -#else -PUBLIC Void rgSCHUtlDoaInd(cell, ue, doaRpt) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuDoaRpt *doaRpt; -#endif -{ - TRC2(rgSCHUtlDoaInd); - ue->mimoInfo.doa.pres = PRSNT_NODEF; - ue->mimoInfo.doa.val = doaRpt->doa; - RETVOID; -} - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlCqiInd - * Purpose: Updates the DL CQI for the UE - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuDlCqiRpt *dlCqiRpt - * @param[in] CmLteTimingInfo timingInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlCqiInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuDlCqiRpt *dlCqiRpt, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHUtlDlCqiInd(cell, ue, dlCqiRpt, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuDlCqiRpt *dlCqiRpt; -CmLteTimingInfo timingInfo; -#endif -{ - RgSchCellCb *sCellCb = NULLP; - TRC2(rgSCHUtlDlCqiInd); - if (dlCqiRpt->isPucchInfo) - { - sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pucchCqi.cellIdx]->cell; - sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \ - (Void *)&dlCqiRpt->dlCqiInfo.pucchCqi, timingInfo); - } - else - { - U32 idx; - for (idx = 0; idx < dlCqiRpt->dlCqiInfo.pusch.numOfCells; idx++) - { - sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx].cellIdx]->cell; - sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \ - (Void *)&dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx], timingInfo); - } - } - RETVOID; -} - - -#ifdef TFU_UPGRADE -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlSrsInd - * Purpose: Updates the UL SRS for the UE - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuSrsRpt* srsRpt - * @param[in] CmLteTimingInfo timingInfo - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlSrsInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuSrsRpt *srsRpt, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHUtlSrsInd(cell, ue, srsRpt, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuSrsRpt *srsRpt; -CmLteTimingInfo timingInfo; -#endif -{ - TRC2(rgSCHUtlSrsInd); - cell->sc.apis->rgSCHSrsInd(cell, ue, srsRpt, timingInfo); - RETVOID; -} -#endif - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlTARpt - * Purpose: Reports PHY TA for a UE. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlTARpt -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHUtlDlTARpt(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlDlTARpt); - cell->sc.apis->rgSCHDlTARpt(cell, ue); - RETVOID; -} - - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlRlsSubFrm - * Purpose: Releases scheduler Information from DL SubFrm. - * - * Invoked by: DHM - * - * @param[in] RgSchCellCb *cell - * @param[out] CmLteTimingInfo subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlRlsSubFrm -( -RgSchCellCb *cell, -CmLteTimingInfo subFrm -) -#else -PUBLIC Void rgSCHUtlDlRlsSubFrm(cell, subFrm) -RgSchCellCb *cell; -CmLteTimingInfo subFrm; -#endif -{ - TRC2(rgSCHUtlDlRlsSubFrm); - cell->sc.apis->rgSCHDlRlsSubFrm(cell, subFrm); - RETVOID; -} - -#ifdef TFU_UPGRADE -/** - * @brief This API is invoked to update the AperCQI trigger - * weight. - * - * @details - * - * Function : rgSCHUtlUpdACqiTrigWt - * - If HqFdbk is ACK then add up weight corresponding - * to ACK to the AcqiTrigWt. - * - If HqFdbk is NACK then add up weight corresponding - * to NACK to the AcqiTrigWt. - * - If AcqiTrigWt crosses threshold then trigger - * grant req for APERCQI to SCH. - * - * @param[in] RgSchUeCb *ue - * @param[in] U8 isAck - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUpdACqiTrigWt -( -RgSchUeCb *ue, -RgSchUeCellInfo *cellInfo, -U8 isAck -) -#else -PUBLIC Void rgSCHUtlUpdACqiTrigWt(ue,cellInfo, isAck) -RgSchUeCb *ue; -RgSchUeCellInfo *cellInfo; -U8 isAck; -#endif -{ -#ifdef LTE_ADV - U8 triggerSet = 0; - U8 sIdx = 0; -#endif - - TRC2(rgSCHUtlUpdACqiTrigWt); - - if (isAck == TFU_HQFDB_ACK) - { - cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_ACK_WGT; - } - else - { - cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_NACK_WGT; - } - - if (cellInfo->acqiCb.aCqiTrigWt > RG_APER_CQI_THRESHOLD_WGT) - { - RgSchCellCb *cell = ue->cell; - RgSchErrInfo unUsed; - - if(ue->dl.reqForCqi) - { - /* Already one ACQI trigger procedure is going on - * which is not yet satisfied. Delaying this request till - * the previous is getting satisfied*/ - RETVOID; - } - - ue->dl.reqForCqi = TRUE; -#ifdef LTE_ADV - rgSchCmnSetCqiReqField(cellInfo,ue,&ue->dl.reqForCqi); - //Reset aCqiTrigWt for all the serving cells for which we have triggered ACQI - rgSCHTomUtlGetTrigSet(cell, ue, ue->dl.reqForCqi, &triggerSet); - for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++) - { - /* The Aperiodic requested for SCell index sIdx */ - if ((triggerSet >> (7 - sIdx)) & 0x01) - { - /* The Aperiodic request for SCell index sIdx */ - ue->cellInfo[sIdx]->acqiCb.aCqiTrigWt = 0; - } - } - -#endif - /* Force SCH to send UL grant by indicating fake SR. - * If this UE already in UL SCH Qs this SR Ind will - * be ignored */ - rgSCHUtlSrRcvd(cell, ue, cell->crntTime, &unUsed); - } - - RETVOID; -} -#endif - -/** - * @brief This API is invoked to indicate scheduler of a CRC indication. - * - * @details - * - * Function : rgSCHUtlHdlUlTransInd - * This API is invoked to indicate scheduler of a CRC indication. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo timingInfo - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlHdlUlTransInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHUtlHdlUlTransInd(cell, ue, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo timingInfo; -#endif -{ - TRC2(rgSCHUtlHdlUlTransInd); - cell->sc.apis->rgSCHHdlUlTransInd(cell, ue, timingInfo); - RETVOID; -} -#ifdef LTEMAC_SPS -/** - * @brief This API is invoked to indicate scheduler of a CRC failure. - * - * @details - * - * Function : rgSCHUtlHdlCrcInd - * This API is invoked to indicate CRC to scheduler. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo timingInfo - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlHdlCrcInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHUtlHdlCrcInd(cell, ue, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo timingInfo; -#endif -{ - TRC2(rgSCHUtlHdlCrcFail); - cell->sc.apis->rgSCHUlCrcInd(cell, ue, timingInfo); - RETVOID; -} /* end of rgSCHUtlHdlCrcFailInd */ - -/** - * @brief This API is invoked to indicate scheduler of a CRC failure. - * - * @details - * - * Function : rgSCHUtlHdlCrcFailInd - * This API is invoked to indicate CRC failure to scheduler. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] CmLteTimingInfo timingInfo - * - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlHdlCrcFailInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo timingInfo -) -#else -PUBLIC Void rgSCHUtlHdlCrcFailInd(cell, ue, timingInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo timingInfo; -#endif -{ - TRC2(rgSCHUtlHdlCrcFail); - cell->sc.apis->rgSCHUlCrcFailInd(cell, ue, timingInfo); - RETVOID; -} /* end of rgSCHUtlHdlCrcFailInd */ -#endif /* LTEMAC_SPS */ - - -/** - * @brief This function is a wrapper to call scheduler specific API. - * - * @details - * - * Function: rgSCHUtlDlProcAddToRetx - * Purpose: This function adds a HARQ process to retransmission - * queue. This may be performed when a HARQ ack is - * unsuccessful. - * - * Invoked by: HARQ feedback processing - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchDlHqProc* hqP - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlProcAddToRetx -( -RgSchCellCb *cell, -RgSchDlHqProcCb *hqP -) -#else -PUBLIC Void rgSCHUtlDlProcAddToRetx(cell, hqP) -RgSchCellCb *cell; -RgSchDlHqProcCb *hqP; -#endif -{ - TRC2(rgSCHUtlDlProcAddToRetx); - cell->sc.apis->rgSCHDlProcAddToRetx(cell, hqP); - RETVOID; -} - - -/** - * @brief This function adds a HARQ process TB to transmission - * - * @details - * - * Function: rgSCHUtlDlHqPTbAddToTx - * Purpose: This function a HarqProcess TB to the subframe - * list. - * - * Invoked by: Scheduler - * - * @param[in] RgSubFrm* subFrm - * @param[in] RgDlHqProc* hqP - * @param[in] U8 tbIdx - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlHqPTbAddToTx -( -RgSchDlSf *subFrm, -RgSchDlHqProcCb *hqP, -U8 tbIdx -) -#else -PUBLIC Void rgSCHUtlDlHqPTbAddToTx(subFrm, hqP, tbIdx) -RgSchDlSf *subFrm; -RgSchDlHqProcCb *hqP; -U8 tbIdx; -#endif -{ - RgSchUeCb *ue = NULLP; - RgSchCellCb *cell = hqP->hqE->cell; - /* CA Dev Start */ - /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */ - /* ue->cell will always hold PCell information */ - if (NULLP == hqP->hqPSfLnk.node) - { - if (hqP->hqE->ue) - { - ue = hqP->hqE->ue; - if(NULLP == ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node) - { - ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)ue; - cmLListAdd2Tail(&cell->subFrms[subFrm->dlIdx]->ueLst, - &ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk); - - ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].isPuschHarqRecpPres = FALSE; - - } - - /* Add Hq proc in particular dlIdx List for this UE - This list will be used while processing feedback*/ - hqP->hqPSfLnk.node = (PTR)hqP; - cmLListAdd2Tail(&ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk); -#ifdef CA_DBG - { - extern U32 gSCellSchedCount,gPrimarySchedCount; - if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue,hqP->hqE->cell)) - { - gSCellSchedCount++; - }else - gPrimarySchedCount++; - } -#endif - } - else if (hqP->hqE->msg4Proc == hqP) - { - /* Msg4 will be scheduled on PCELL only hence add directly to subFrm msg4HqpList */ - hqP->hqPSfLnk.node = (PTR)hqP; - cmLListAdd2Tail(&subFrm->msg4HqPLst, &hqP->hqPSfLnk); - } - } - else - { - ue = hqP->hqE->ue; - } - if((ue) && (HQ_TB_WAITING == hqP->tbInfo[tbIdx].state)) - - { - ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt++; - } - /*totalTbCnt will hold the total number of TBs across all harq Proc from all - * cells*/ - - hqP->subFrm = subFrm; - - /* CA Dev End */ - RETVOID; -} - - - -/** - * @brief This function removes a HARQ process TB from transmission - * - * @details - * - * Function: rgSCHUtlDlHqPTbRmvFrmTx - * Purpose: This function removes a HarqProcess TB to the subframe - * list. - * - * Invoked by: Scheduler - * - * @param[in] RgSubFrm* subFrm - * @param[in] RgDlHqProc* hqP - * @param[in] U8 tbIdx - * @param[in] Bool isRepeting - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlHqPTbRmvFrmTx -( -RgSchDlSf *subFrm, -RgSchDlHqProcCb *hqP, -U8 tbIdx, -Bool isRepeting -) -#else -PUBLIC Void rgSCHUtlDlHqPTbRmvFrmTx(subFrm, hqP, tbIdx, isRepeting) -RgSchDlSf *subFrm; -RgSchDlHqProcCb *hqP; -U8 tbIdx; -Bool isRepeting; -#endif -{ - RgSchCellCb *cell = NULLP; - /* Check with TDD */ - if ((isRepeting) && - (hqP->hqE->ue->ackNakRepCb.cfgRepCnt != - hqP->tbInfo[tbIdx].fbkRepCntr)) - { - cmLListDelFrm(&subFrm->ackNakRepQ, - &hqP->tbInfo[tbIdx].anRepLnk[hqP->tbInfo[tbIdx].fbkRepCntr]); - } - else - { - if (NULLP != hqP->hqPSfLnk.node) - { - /* CA dev Start */ - if (hqP->hqE->msg4Proc == hqP) - { - /* Msg4 will be scheduled on PCELL only hence delete directly from subFrm msg4HqpList */ - cmLListDelFrm(&subFrm->msg4HqPLst, &hqP->hqPSfLnk); - } - else - { - cell = hqP->hqE->cell; - /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */ - /* ue->cell will always hold PCell information */ - cmLListDelFrm(&hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk); - if (0 == hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst.count) - { - - cmLListDelFrm(&cell->subFrms[subFrm->dlIdx]->ueLst, - &hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk); - hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)NULLP; - hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt = 0; - } - } - hqP->hqPSfLnk.node = NULLP; - } - hqP->subFrm = NULLP; - } - RETVOID; -} - -#ifdef LTE_ADV -/** - * @brief Handler for accessing the existing SCellCb identified by the key - * SCellId under the CellCb. - * - * @details - * - * Function : rgSchUtlGetCellCb - * - * - * @param[in] *cellCb - * @param[in] ueId - * @return RgSchUeCb* - **/ -#ifdef ANSI -PUBLIC RgSchCellCb* rgSchUtlGetCellCb -( - Inst inst, - U16 cellId -) -#else -PUBLIC RgSchCellCb* rgSchUtlGetCellCb(inst, cellId) - Inst inst; - U16 cellId; -#endif -{ - RgSchCellCb *cellCb = NULLP; - U8 strtCellId; - - TRC2(rgSchUtlGetCellCb); - - strtCellId = rgSchCb[inst].genCfg.startCellId; - cellCb = rgSchCb[inst].cells[cellId - strtCellId]; - - RETVALUE(cellCb); - -} /* rgSchUtlGetCellCb */ - -/** - * @brief Handler for deriving the servCellidx - * - * @details - * - * Function : rgSchUtlGetServCellIdx - * - * - * @param[in] *cellId - * @param[in] RgSchUeCb *ue - * @return U8 servCellIdx - **/ -#ifdef ANSI -PUBLIC U8 rgSchUtlGetServCellIdx -( - Inst inst, - U16 cellId, - RgSchUeCb *ue -) -#else -PUBLIC U8 rgSchUtlGetServCellIdx(inst,cellId,ue) - Inst inst; - U16 cellId; - RgSchUeCb *ue; -#endif -{ - U8 servCellIdx; - U16 strtCellId; - - TRC2(rgSchUtlGetCellCb); - - strtCellId = rgSchCb[inst].genCfg.startCellId; - - servCellIdx = ue->cellIdToCellIdxMap[cellId - strtCellId]; - - RETVALUE(servCellIdx); - -} /* rgSchUtlGetCellCb */ - -/** - * @brief Handler for validating the Cell Id received secondary Cell Addition - * - * @details - * - * Function : rgSchUtlGetCellId - * - * - * @param[in] *cellCb - * @param[in] ueId - * @return RgSchUeCb* - **/ -#ifdef ANSI -PUBLIC S16 rgSchUtlVldtCellId -( - Inst inst, - U16 cellId -) -#else -PUBLIC S16 rgSchUtlVldtCellId(inst, cellId) - Inst inst; - U16 cellId; -#endif -{ - U8 strtCellId; - - TRC2(rgSchUtlVldtCellId); - - strtCellId = rgSchCb[inst].genCfg.startCellId; - if((cellId >= strtCellId) && ((cellId - strtCellId) < CM_LTE_MAX_CELLS)) - { - RETVALUE(ROK); - } - RETVALUE(RFAILED); -} /* rgSchUtlVldtCellId */ - -#endif /* LTE_ADV*/ -/** - * @brief UE reconfiguration for scheduler - * - * @details - * - * Function : rgSCHUtlRgrUeRecfg - * - * This functions updates UE specific scheduler - * information upon UE reconfiguration - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[int] RgrUeRecfg *ueRecfg - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrUeRecfg -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeRecfg *ueRecfg, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlRgrUeRecfg(cell, ue, ueRecfg, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeRecfg *ueRecfg; -RgSchErrInfo *err; -#endif -{ -/* Changes for UE Category Reconfiguration feature addition */ - RgSchCmnUe *ueSch = RG_SCH_CMN_GET_UE(ue, cell); - - TRC2(rgSCHUtlRgrUeRecfg); - - /* Changes for UE Category Reconfiguration feature addition */ - if (ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG) - { - ueSch->cmn.ueCat = ueRecfg->ueCatEnum-1; -#ifdef TFU_UPGRADE - ue->ueCatEnum = ueRecfg->ueCatEnum; -#endif - } - - /* DL MU-MIMO not supported */ - if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) - { - - if (ueRecfg->txMode.pres == PRSNT_NODEF) - { - if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_5) - { - err->errCause = RGSCHERR_SCH_CFG; - RETVALUE(RFAILED); - } -#ifdef LTE_ADV - if(ue->mimoInfo.txMode != ueRecfg->txMode.txModeEnum) - { - /* Decremnt the previos A value for this cell */ - ue->f1bCsAVal -= rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode); - /* Update A value with the new TM Mode */ - ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(ueRecfg->txMode.txModeEnum); - - - RLOG1(L_INFO,"UeReCfg A valie is %d\n",ue->f1bCsAVal); - } -#endif - ue->mimoInfo.txMode = ueRecfg->txMode.txModeEnum; - } - } -#ifdef TFU_UPGRADE - /* [ccpu00123958]-ADD- Check for PUSCH related Reconfig from the bit mask */ - if(ueRecfg->ueRecfgTypes & RGR_UE_PUSCH_RECFG) - { - /* Fix: ccpu00124012 */ - /* TODO:: Need to check if this is - mandatory to be re-configured on UE category re-configuration */ - /* ue->ul.betaHqOffst = ueRecfg->puschDedCfg.bACKIdx; - ue->ul.betaCqiOffst = ueRecfg->puschDedCfg.bCQIIdx; - ue->ul.betaRiOffst = ueRecfg->puschDedCfg.bRIIdx;*/ - } -#endif - if (ueRecfg->ueRecfgTypes & RGR_UE_ULTXANTSEL_RECFG) - { - ue->ul.ulTxAntSel = ueRecfg->ulTxAntSel; - } - if (ueRecfg->ueRecfgTypes & RGR_UE_CDBKSBST_RECFG) - { - ue->mimoInfo.cdbkSbstRstrctn = ueRecfg->ueCodeBookRstRecfg; - } - - /* Commenting here to assign garbage value when it is not set in APP. */ - //ue->accessStratumRls = ueRecfg->accessStratumRls; - RETVALUE(cell->sc.apis->rgSCHRgrUeRecfg(cell, ue, ueRecfg, err)); -} /* rgSCHUtlRgrUeRecfg */ - -/** - * @brief This function deletes a service from scheduler - * - * @details - * - * Function: rgSCHUtlFreeDlLc - * Purpose: This function is made available through a FP for - * making scheduler aware of a service being deleted from UE - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @param[in] RgSchDlLcCb* svc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFreeDlLc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *svc -) -#else -PUBLIC Void rgSCHUtlFreeDlLc(cell, ue, svc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *svc; -#endif -{ - TRC2(rgSCHUtlFreeDlLc); - cell->sc.apis->rgSCHFreeDlLc(cell, ue, svc); - - /* Stack Crash problem for TRACE5 changes. added the return below . */ - RETVOID; - -} - -/** - * @brief UE deletion for scheduler - * - * @details - * - * Function : rgSCHUtlFreeUe - * - * This functions deletes all scheduler information - * pertaining to a UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFreeUe -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHUtlFreeUe(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlFreeUe); -#ifdef LTE_TDD - rgSCHUtlDelUeANFdbkInfo(ue,RGSCH_PCELL_INDEX); -#endif - cell->sc.apis->rgSCHFreeUe(cell, ue); - - /* Stack Crash problem for TRACE5 changes. added the return below . */ - RETVOID; - -} /* rgSCHUtlFreeUe */ - -/** - * @brief This function updates the scheduler with service for a UE - * - * @details - * - * Function: rgSCHUtlDlDedBoUpd - * Purpose: This function should be called whenever there is a - * change BO for a service. - * - * Invoked by: BO and Scheduler - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSchUeCb* ue - * @param[in] RgSchDlLcCb* lc - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDlDedBoUpd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchDlLcCb *lc -) -#else -PUBLIC Void rgSCHUtlDlDedBoUpd(cell, ue, lc) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchDlLcCb *lc; -#endif -{ - TRC2(rgSCHUtlDlDedBoUpd); - cell->sc.apis->rgSCHDlDedBoUpd(cell, ue, lc); - RETVOID; -} -/** - * @brief Record MSG3 allocation into the UE - * - * @details - * - * Function : rgSCHUtlRecMsg3Alloc - * - * This function is invoked to update record msg3 allocation information - * in the UE when UE is detected for RaCb - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] RgSchRaCb *raCb - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlRecMsg3Alloc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchRaCb *raCb -) -#else -PUBLIC Void rgSCHUtlRecMsg3Alloc(cell, ue, raCb) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchRaCb *raCb; -#endif -{ - TRC2(rgSCHUtlRecMsg3Alloc) - cell->sc.apis->rgSCHUlRecMsg3Alloc(cell, ue, raCb); - RETVOID; - -} /* rgSCHRecMsg3Alloc */ - -#ifdef RG_UNUSED -/** - * @brief Update harq process for allocation - * - * @details - * - * Function : rgSCHUtlUpdUlHqProc - * - * This function is invoked when harq process - * control block is now in a new memory location - * thus requiring a pointer/reference update. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUlHqProcCb *curProc - * @param[in] RgSchUlHqProcCb *oldProc - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdUlHqProc -( -RgSchCellCb *cell, -RgSchUlHqProcCb *curProc, -RgSchUlHqProcCb *oldProc -) -#else -PUBLIC S16 rgSCHUtlUpdUlHqProc(cell, curProc, oldProc) -RgSchCellCb *cell; -RgSchUlHqProcCb *curProc; -RgSchUlHqProcCb *oldProc; -#endif -{ - TRC2(rgSCHUtlUpdUlHqProc); - RETVALUE(cell->sc.apis->rgSCHUpdUlHqProc(cell, curProc, oldProc)); -} /* rgSCHUtlUpdUlHqProc */ -#endif -/** - * @brief UL grant for contention resolution - * - * @details - * - * Function : rgSCHUtlContResUlGrant - * - * Add UE to another queue specifically for CRNTI based contention - * resolution - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlContResUlGrant -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlContResUlGrant(cell, ue, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlContResUlGrant); - - - ue->isMsg4PdcchWithCrnti = TRUE; - - RETVALUE(cell->sc.apis->rgSCHContResUlGrant(cell, ue, err)); -} /* rgSCHUtlContResUlGrant */ - -/** - * @brief SR reception handling - * - * @details - * - * Function : rgSCHUtlSrRcvd - * - * - Handles SR reception for UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlSrRcvd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -CmLteTimingInfo frm, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlSrRcvd(cell, ue, frm, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -CmLteTimingInfo frm; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlSrRcvd); - RETVALUE(cell->sc.apis->rgSCHSrRcvd(cell, ue, frm, err)); -} /* rgSCHUtlSrRcvd */ - -/** - * @brief Short BSR update - * - * @details - * - * Function : rgSCHUtlUpdBsrShort - * - * This functions does requisite updates to handle short BSR reporting - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 lcgId - * @param[in] U8 bsr - * @param[out] RgSchErrInfo *err - * @return Void - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUpdBsrShort -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 lcgId, -U8 bsr, -RgSchErrInfo *err -) -#else -PUBLIC Void rgSCHUtlUpdBsrShort(cell, ue, lcgId, bsr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 lcgId; -U8 bsr; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlUpdBsrShort); - cell->sc.apis->rgSCHUpdBsrShort(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err); - RETVOID; -} /* rgSCHUtlUpdBsrShort */ - - -/** - * @brief Truncated BSR update - * - * @details - * - * Function : rgSCHUtlUpdBsrTrunc - * - * This functions does required updates to handle truncated BSR report - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 lcgId - * @param[in] U8 bsr - * @param[out] RgSchErrInfo *err - * @return Void - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUpdBsrTrunc -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 lcgId, -U8 bsr, -RgSchErrInfo *err -) -#else -PUBLIC Void rgSCHUtlUpdBsrTrunc(cell, ue, lcgId, bsr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 lcgId; -U8 bsr; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlUpdBsrTrunc); - cell->sc.apis->rgSCHUpdBsrTrunc(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err); - RETVOID; -} /* rgSCHUtlUpdBsrTrunc */ - - -/** - * @brief Long BSR update - * - * @details - * - * Function : rgSCHUtlUpdBsrLong - * - * - Update BSRs for all configured LCGs - * - Update priority of LCGs if needed - * - Update UE's position within/across uplink scheduling queues - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 bsr0 - * @param[in] U8 bsr1 - * @param[in] U8 bsr2 - * @param[in] U8 bsr3 - * @param[out] RgSchErrInfo *err - * @return Void - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUpdBsrLong -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 bsr0, -U8 bsr1, -U8 bsr2, -U8 bsr3, -RgSchErrInfo *err -) -#else -PUBLIC Void rgSCHUtlUpdBsrLong(cell, ue, bsr0, bsr1, bsr2, bsr3, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 bsr0; -U8 bsr1; -U8 bsr2; -U8 bsr3; -RgSchErrInfo *err; -#endif -{ - U8 bsArr[4]; - TRC2(rgSCHUtlUpdBsrLong); - - bsArr[0] = bsr0; - bsArr[1] = bsr1; - bsArr[2] = bsr2; - bsArr[3] = bsr3; - cell->sc.apis->rgSCHUpdBsrLong(cell, ue, bsArr, err); - RETVOID; -} /* rgSCHUtlUpdBsrLong */ - -/** - * @brief EXT PHR update - * - * @details - * - * Function : rgSCHUtlUpdExtPhr - * - * Updates extended power headroom info for a UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 phr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdExtPhr -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgInfExtPhrCEInfo * extPhr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlUpdExtPhr(cell, ue, extPhr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgInfExtPhrCEInfo * extPhr; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlUpdExtPhr); - RETVALUE(cell->sc.apis->rgSCHUpdExtPhr(cell, ue, extPhr, err)); -} /* rgSCHUtlUpdExtPhr */ - - - -/** - * @brief PHR update - * - * @details - * - * Function : rgSCHUtlUpdPhr - * - * Updates power headroom info for a UE - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 phr - * @param[out] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdPhr -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U8 phr, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlUpdPhr(cell, ue, phr, err) -RgSchCellCb *cell; -RgSchUeCb *ue; -U8 phr; -RgSchErrInfo *err; -#endif -{ - TRC2(rgSCHUtlUpdPhr); - RETVALUE(cell->sc.apis->rgSCHUpdPhr(cell, ue, phr, err)); -} /* rgSCHUtlUpdPhr */ - - -/** - * @brief Indication of UL CQI - * - * @details - * - * Function : rgSCHUtlUlCqiInd - * - * - Updates uplink CQI information for the UE. Computes and - * stores the lowest CQI of CQIs reported in all subbands - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] TfuUlCqiRpt *ulCqiInfo - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlCqiInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -TfuUlCqiRpt *ulCqiInfo -) -#else -PUBLIC Void rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -TfuUlCqiRpt *ulCqiInfo; -#endif -{ - TRC2(rgSCHUtlUlCqiInd); - cell->sc.apis->rgSCHUlCqiInd(cell, ue, ulCqiInfo); - RETVOID; -} /* rgSCHUtlUlCqiInd */ - -/** - * @brief Indication of PUCCH power adjustment - * - * @details - * - * Function : rgSCHUtlPucchDeltaPwrInd - * - * - Updates uplink CQI information for the UE. Computes and - * stores the lowest CQI of CQIs reported in all subbands - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U8 delta - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlPucchDeltaPwrInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -S8 delta -) -#else -PUBLIC Void rgSCHUtlPucchDeltaPwrInd(cell, ue, delta) -RgSchCellCb *cell; -RgSchUeCb *ue; -S8 delta; -#endif -{ - TRC2(rgSCHUtlPucchDeltaPwrInd); - cell->sc.apis->rgSCHPucchDeltaPwrInd(cell, ue, delta); - RETVOID; -} /* rgSCHUtlPucchDeltaPwrInd */ - -/* Start: LTEMAC_2.1_DEV_CFG */ -/** - * @brief Ue Reset Request - * - * @details - * - * Function : rgSCHUtlUeReset - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return S16 - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUeReset -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC Void rgSCHUtlUeReset(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlUeReset); - ue->remBoCnt = 0; - cell->sc.apis->rgSCHUeReset(cell, ue); - RETVOID; -} /* rgSCHUtlUeReset */ -/* End: LTEMAC_2.1_DEV_CFG */ - -/** - * @brief Returns HARQ proc for which data expected now - * - * @details - * - * Function: rgSCHUtlUlHqProcForUe - * Purpose: This function returns the harq process for - * which data is expected in the current subframe. - * It does not validate if the HARQ process - * has an allocation. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteTimingInfo frm - * @param[in] RgSchUeCb *ue - * @param[out] RgSchUlHqProcCb **procRef - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHqProcForUe -( -RgSchCellCb *cell, -CmLteTimingInfo frm, -RgSchUeCb *ue, -RgSchUlHqProcCb **procRef -) -#else -PUBLIC Void rgSCHUtlUlHqProcForUe(cell, frm, ue, procRef) -RgSchCellCb *cell; -CmLteTimingInfo frm; -RgSchUeCb *ue; -RgSchUlHqProcCb **procRef; -#endif -{ - TRC2(rgSCHUtlUlHqProcForUe); - cell->sc.apis->rgSCHUlHqProcForUe(cell, frm, ue, procRef); - - /* Stack Crash problems for TRACE5 changes. added the return below */ - RETVOID; - -} - -/** - * @brief Returns first uplink allocation to send reception - * request to PHY - * - * @details - * - * Function: rgSCHUtlFirstRcptnReq(cell) - * Purpose: This function returns the first uplink allocation - * (or NULLP if there is none) in the subframe - * in which is expected to prepare and send reception - * request to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlFirstRcptnReq -( -RgSchCellCb *cell -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlFirstRcptnReq(cell) -RgSchCellCb *cell; -#endif -{ - TRC2(rgSCHUtlFirstRcptnReq); - RETVALUE(cell->sc.apis->rgSCHFirstRcptnReq(cell)); -} - -/** - * @brief Returns first uplink allocation to send reception - * request to PHY - * - * @details - * - * Function: rgSCHUtlNextRcptnReq(cell) - * Purpose: This function returns the next uplink allocation - * (or NULLP if there is none) in the subframe - * in which is expected to prepare and send reception - * request to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlNextRcptnReq -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlNextRcptnReq(cell, alloc) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlNextRcptnReq); - RETVALUE(cell->sc.apis->rgSCHNextRcptnReq(cell, alloc)); -} - -/** - * @brief Returns first uplink allocation to send HARQ feedback - * request to PHY - * - * @details - * - * Function: rgSCHUtlFirstHqFdbkAlloc - * Purpose: This function returns the first uplink allocation - * (or NULLP if there is none) in the subframe - * in which it is expected to prepare and send HARQ - * feedback to PHY. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @param[in] U8 idx - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc -( -RgSchCellCb *cell, -U8 idx -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc(cell, idx) -RgSchCellCb *cell; -U8 idx; -#endif -{ - TRC2(rgSCHUtlFirstHqFdbkAlloc); - RETVALUE(cell->sc.apis->rgSCHFirstHqFdbkAlloc(cell, idx)); -} - - -/** - * @brief Returns next allocation to send HARQ feedback for - * - * @details - * - * Function: rgSCHUtlNextHqFdbkAlloc(cell) - * Purpose: This function returns the next uplink allocation - * (or NULLP if there is none) in the subframe - * for which HARQ feedback needs to be sent. - * - * Invoked by: TOM - * - * @param[in] RgSchCellCb *cell - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc -( -RgSchCellCb *cell, -RgSchUlAlloc *alloc, -U8 idx -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc(cell, alloc, idx) -RgSchCellCb *cell; -RgSchUlAlloc *alloc; -U8 idx; -#endif -{ - TRC2(rgSCHUtlNextHqFdbkAlloc); - RETVALUE(cell->sc.apis->rgSCHNextHqFdbkAlloc(cell, alloc, idx)); -} - -/*********************************** -***********************************/ -/** - * @brief This API is invoked to send TFU SAP bind request to PHY. - * - * @details - * - * Function : rgSCHUtlTfuBndReq - * - * This API is invoked to send TFU SAP bind request to PHY from scheduler - * isntance. It fills in the Pst structure, spId and suId values and - * invokes bind request primitive at TFU. - * - * @param[in] Inst instId - * @param[in] SuId suId - * @param[in] SpId spId - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlTfuBndReq -( -Inst instId, -SuId suId, -SpId spId -) -#else -PUBLIC S16 rgSCHUtlTfuBndReq(instId, suId, spId) -Inst instId; -SuId suId; -SpId spId; -#endif -{ - S16 ret; - RgSchLowSapCb *tfuSap; - Pst pst; - TRC2(rgSCHUtlTfuBndReq); - - /* Get the lower SAP control block from the layer control block. */ - tfuSap = &(rgSchCb[instId].tfuSap[suId]); - (Void)cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst)); - if((ret = RgLiTfuSchBndReq (&pst, suId, spId)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlTfuBndReq() Call to RgLiTfuBndReq()" - " failed"); - } - RETVALUE(ret); -} /* rgSCHUtlTfuBndReq */ - -/** - * @brief This API is invoked to send TFU SAP unbind request to PHY. - * - * @details - * - * Function : rgSCHUtlTfuUBndReq - * This API is invoked to send TFU SAP unbind request to PHY from Scheduler - * isntance. It fills in the Pst structure and spId value and invokes - * unbind request primitive at TFU. - * - * @param[in] SpId spId - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlTfuUBndReq -( -Inst inst, -RgSchLowSapCfgInfo sapCfg, -Reason reason -) -#else -PUBLIC S16 rgSCHUtlTfuUBndReq(inst, sapCfg, reason) -Inst inst; -RgSchLowSapCfgInfo sapCfg; -Reason reason; -#endif -{ - S16 ret; - Pst pst; - - TRC2(rgSCHUtlTfuUBndReq); - - /* Get the lower SAP control block from the layer control block. */ - cmMemcpy ((U8*)&pst, (U8*)&(sapCfg.sapPst), sizeof(Pst)); - if((ret = RgLiTfuSchUbndReq (&pst, sapCfg.spId, reason)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuUBndReq() Call to" - " RgLiTfuUbndReq() failed"); - } - RETVALUE(ret); - -} /* rgSCHUtlTfuUBndReq */ - -/*********************************************************** - * - * Func : rgSCHUtlResetSfAlloc - * - * Desc : Utility Function to Reset subframe allocation information. - * - * - * Ret : ROK - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlResetSfAlloc -( -RgInfSfAlloc *sfAlloc, -Bool resetCmnLcInfo, -Bool restAlloc -) -#else -PUBLIC S16 rgSCHUtlResetSfAlloc(sfAlloc,resetCmnLcInfo,restAlloc) -RgInfSfAlloc *sfAlloc; -Bool resetCmnLcInfo; -Bool restAlloc; -#endif -{ - TRC2(rgSCHUtlResetSfAlloc); - if(TRUE == restAlloc) - { - if(sfAlloc->ueInfo.numUes) - { - cmMemset((U8 *)sfAlloc->ueInfo.allocInfo,0x00, - (sizeof(RgInfUeAlloc)*sfAlloc->ueInfo.numUes)); - } - sfAlloc->ueInfo.numUes = 0; - sfAlloc->rarInfo.numRaRntis = 0; - sfAlloc->flowCntrlInfo.numUes = 0; - } - if(TRUE == resetCmnLcInfo) - { - sfAlloc->cmnLcInfo.bitMask = 0; - } - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHUtlGetRlsHqAlloc - * - * Desc : Utility Function to Allocate subframe allocation information. - * - * - * Ret : ROK - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetRlsHqAlloc -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlGetRlsHqAlloc(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx = 0; - Inst inst = cell->instIdx; - TRC2(rgSCHUtlGetRlsHqAlloc); - for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) - { - cell->rlsHqArr[idx].cellId = cell->cellId; - - /* Allocating with additional location, to accommodate - TA scheduling along with maximum no of UEs per SF */ - - /* Allocate memory for "scheduled UE" Info */ - if((rgSCHUtlAllocSBuf(inst, - (Data**)&(cell->rlsHqArr[idx].ueHqInfo), - (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " - "UE Alloc"); - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); - -} - -/*********************************************************** - * - * Func : rgSCHUtlPutRlsHqAlloc - * - * Desc : Utility Function to deallocate subframe allocation information. - * - * - * Ret : ROK - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlPutRlsHqAlloc -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlPutRlsHqAlloc(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx = 0; - Inst inst = cell->instIdx; - TRC2(rgSCHUtlPutRlsHqAlloc); - - for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) - { - /* Deallocate memory for "scheduled UE" Info */ - if (cell->rlsHqArr[idx].ueHqInfo != NULLP) - { - /* Freeing with additional location, to accommodate TA - scheduling along with maximum no of UEs per SF */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data **)(&(cell->rlsHqArr[idx].ueHqInfo)), - (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF)); - } - } - - RETVALUE(ROK); - -} - - -/*********************************************************** - * - * Func : rgSCHUtlGetSfAlloc - * - * Desc : Utility Function to Allocate subframe allocation information. - * - * - * Ret : ROK - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetSfAlloc -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlGetSfAlloc(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx; - U8 indx; - Inst inst = cell->instIdx; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - TRC2(rgSCHUtlGetSfAlloc); - -#ifdef LTE_TDD - for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++) -#else - for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) -#endif - { - cell->sfAllocArr[idx].cellId = cell->cellId; - - /* Allocating with additional location, to accommodate - TA scheduling along with maximum no of UEs per SF */ - - /* Allocate memory for "scheduled UE" Info */ - if((rgSCHUtlAllocSBuf(inst, - (Data**)&(cell->sfAllocArr[idx].ueInfo.allocInfo), - (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " - "UE Alloc"); - RETVALUE(RFAILED); - } - - /* Allocate memory for "scheduled RAR" Info */ - if((rgSCHUtlAllocSBuf(inst, - (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo), - (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " - "RARNTI"); - RETVALUE(RFAILED); - } - for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++) - { - if((rgSCHUtlAllocSBuf(inst, - (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo), - (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf)))) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " - "RNTI"); - RETVALUE(RFAILED); - } - } - - } - -#ifdef EMTC_ENABLE - rgSCHEmtcUtlGetSfAlloc(cell); -#endif - - RETVALUE(ROK); - -} - -/*********************************************************** - * - * Func : rgSCHUtlPutSfAlloc - * - * Desc : Utility Function to deallocate subframe allocation information. - * - * - * Ret : ROK - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlPutSfAlloc -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlPutSfAlloc(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx; - U8 indx; - Inst inst = cell->instIdx; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - TRC2(rgSCHUtlPutSfAlloc); - -#ifdef LTE_TDD - for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++) -#else - for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) -#endif - { - if (cell->sfAllocArr[idx].rarInfo.raRntiInfo != NULLP) - { - for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++) - { - if (cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo != NULLP) - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].\ - crntiInfo)), - (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf))); - } - /* Deallocate memory for "scheduled RAR" Info */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo)), - (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF)); - } - /* Deallocate memory for "scheduled UE" Info */ - if (cell->sfAllocArr[idx].ueInfo.allocInfo != NULLP) - { - /* Freeing with additional location, to accommodate TA - scheduling along with maximum no of UEs per SF */ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(inst, - (Data**)(&(cell->sfAllocArr[idx].ueInfo.allocInfo)), - (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF)); - } - } - -#ifdef EMTC_ENABLE - rgSCHEmtcUtlPutSfAlloc(cell); -#endif - RETVALUE(ROK); - -} - -/*********************************************************** - * - * Func : rgSCHUtlAllocSBuf - * - * Desc : Utility Function to Allocate static buffer. - * Memory allocated is assumed contiguous. - * - * - * Ret : ROK - * RFAILED - * - * Notes: Caller doesnt need to raise the alarm in case of memory - * allocation gets failed. - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAllocSBuf -( -Inst inst, /* Instance of the invoking scheduler */ -Data **pData, /* Pointer of the data to be returned */ -Size size /* size */ -) -#else -PUBLIC S16 rgSCHUtlAllocSBuf(inst, pData, size) -Inst inst; /* Instance of the invoking scheduler */ -Data **pData; /* Pointer of the data to be returned */ -Size size; /* size */ -#endif -{ - /* Moving alarm diagnostics to available scope */ - - TRC2(rgSCHUtlAllocSBuf) - - /* Initialize the param to NULLP */ - *pData = NULLP; - - /* May not be necessary for data performance path */ -#ifndef NO_ERRCLS - if (size == 0) - { - RETVALUE(RFAILED); - } -#endif - - /* allocate buffer */ -#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ - MS_BUF_ADD_ALLOC_CALLER(); -#endif /* */ - if (SGetSBuf(rgSchCb[inst].rgSchInit.region, rgSchCb[inst].rgSchInit.pool, - pData, size) != ROK) - { - RgUstaDgn dgn; /* Alarm diagnostics structure */ - dgn.type = LRG_USTA_DGNVAL_MEM; - dgn.u.mem.region = rgSchCb[inst].rgSchInit.region; - dgn.u.mem.pool = rgSchCb[inst].rgSchInit.pool; - /* Send an alarm to Layer Manager */ - rgSCHLmmStaInd(inst, LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL, - LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); - RGSCHLOGERROR(inst, ERRCLS_DEBUG, ERG015, 0, "Unable to Allocate Buffer"); - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Unable to Allocate the Buffer"); - RETVALUE(RFAILED); - } - - - /* zero out the allocated memory */ - cmMemset((U8 *)*pData, 0x00, size); - - RETVALUE(ROK); - -} /* end of rgSCHUtlAllocSBuf */ - - -/* -* -* Fun: rgSCHUtlFreeSBuf -* -* Desc: The argument to rgSCHUtlFreeSBuf() is a pointer to a block -* previously allocated by rgSCHUtlAllocSBuf() and size. It -* deallocates the memory. -* -* Ret: RETVOID -* -* Notes: None -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFreeSBuf -( -Inst inst, /* Instance of the invoking scheduler */ -Data **data, /* pointer to data */ -Size size /* size */ -) -#else -PUBLIC Void rgSCHUtlFreeSBuf(inst, data, size) -Inst inst; /* Instance of the invoking scheduler */ -Data **data; /* pointer to data */ -Size size; /* size */ -#endif -{ - - S16 ret; - - TRC2(rgSCHUtlFreeSBuf) - - if ((data == NULLP) || (*data == NULLP) || (size == 0)) - { - RETVOID; - } - - -#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ - MS_BUF_ADD_CALLER(); -#endif /* */ - /* Deallocate buffer */ - ret = SPutSBuf(rgSchCb[inst].rgSchInit.region, - rgSchCb[inst].rgSchInit.pool, (*data), size); - - if (ret != ROK) - { - RGSCHLOGERROR(inst, ERRCLS_DEBUG, ERG016, (ErrVal) 0, - "rgSCHUtlFreeSBuf failed.\n"); - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHUtlFreeSBuf failed"); - RETVOID; - } - - /* ccpu00117052 - ADD - Assigning the pointer to NULLP */ - *data = NULLP; - - RETVOID; -} /* end of rgSCHUtlFreeSBuf */ - - -#ifdef RGR_SI_SCH -/* -* -* Fun: rgSCHUtlFreeWarningSiSeg -* -* Desc: This is used to deallocate Warning SI Seg. -* -* Ret: RETVOID -* -* Notes: None -* -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFreeWarningSiSeg -( -Region reg, -Pool pool, -CmLListCp *siPduLst -) -#else -PUBLIC Void rgSCHUtlFreeWarningSiSeg(reg, pool, siPduLst) -Region reg; -Pool pool; -CmLListCp *siPduLst; -#endif -{ - CmLList *node; - Buffer *pdu; - - TRC2(rgSCHUtlFreeWarningSiSeg) - - while (siPduLst->first != NULLP) - { - node = siPduLst->first; - pdu = (Buffer *)node->node; - cmLListDelFrm(siPduLst, node); - RGSCH_FREE_MSG(pdu); - SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList)); - node = NULLP; - } - - RETVOID; -} /* end of rgSCHUtlFreeWarningSiSeg */ - - -/* -* -* Fun: rgSCHUtlFreeWarningSiPdu -* -* Desc: This is used to deallocate Warning SI PDU. -* -* Ret: RETVOID -* -* Notes: None -* -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFreeWarningSiPdu -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHUtlFreeWarningSiPdu(cell) -RgSchCellCb *cell; -#endif -{ - CmLList *node; - Buffer *pdu; - RgSchWarningSiInfo *warningSi; - RgSchWarningSiPdu *warningSiPdu; - - TRC2(rgSCHUtlFreeWarningSiPdu) - - warningSi = (RgSchWarningSiInfo *) cell->siCb.\ - siArray[cell->siCb.siCtx.siId-1].si; - /* ccpu00136659: CMAS ETWS design changes */ - CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); - if (node == NULLP) - { - RETVOID; - } - - warningSiPdu = (RgSchWarningSiPdu *)node->node; - pdu = warningSiPdu->pdu; - /* ccpu00136659: CMAS ETWS design changes */ - cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node); - RGSCH_FREE_MSG(pdu); - if(warningSi->warningSiMsg.segLstCp.count == 0) - { - /* ccpu00136659: CMAS ETWS design changes */ - cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP; - rgSCHUtlRgrWarningSiCfgCfm(cell->instIdx, - rgSchCb[cell->instIdx].rgrSap->sapCfg.spId, - cell->siCb.warningSi[warningSi->idx].siId, - warningSi->warningSiMsg.transId, RGR_CFG_CFM_TX_COMPLETE); - } - - RETVOID; - -} /* end of rgSCHUtlFreeWarningSiPdu */ - - -/* -* -* Fun: rgSCHUtlGetWarningSiPdu -* -* Desc: This is used to get Warning SI PDU for Scheduling. -* -* Ret: -* -* Notes: None -* -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC Buffer *rgSCHUtlGetWarningSiPdu -( -RgSchCellCb *cell -) -#else -PUBLIC Buffer *rgSCHUtlGetWarningSiPdu(cell) -RgSchCellCb *cell; -#endif -{ - RgSchWarningSiInfo *warningSi; - RgSchWarningSiPdu *warningSiPdu; - Buffer *pdu; - CmLList *node; - - TRC2(rgSCHUtlGetWarningSiPdu) - - warningSi = (RgSchWarningSiInfo *) cell->siCb. - siArray[cell->siCb.siCtx.siId-1].si; - /* ccpu00136659: CMAS ETWS design changes */ - CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); - if (node != NULLP) - { - warningSiPdu = (RgSchWarningSiPdu *)node->node; - pdu = warningSiPdu->pdu; - RETVALUE(pdu); - } - else - { - RETVALUE(NULLP); - } -} /* rgSCHUtlGetWarningSiPdu */ - - -/* -* -* Fun: rgSCHUtlGetMcsAndNPrb -* -* Desc: This is used to get mcs and nPrb value. -* -* Ret: -* -* Notes: None -* -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetMcsAndNPrb -( -RgSchCellCb *cell, -U8 *nPrb, -U8 *mcs, -MsgLen *msgLen -) -#else -PUBLIC S16 rgSCHUtlGetMcsAndNPrb(cell, nPrb, mcs, msgLen) -RgSchCellCb *cell; -U8 *nPrb; -U8 *mcs; -MsgLen *msgLen; -#endif -{ - RgSchWarningSiInfo *warningSi; - RgSchWarningSiPdu *warningSiPdu; - CmLList *node; - - TRC2(rgSCHUtlGetMcsAndNPrb) - - if(cell->siCb.siCtx.warningSiFlag == FALSE) - { - *mcs = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].mcs; - *nPrb = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].nPrb; - *msgLen = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].msgLen; - } - else - { - warningSi = (RgSchWarningSiInfo *) cell->siCb. - siArray[cell->siCb.siCtx.siId-1].si; - /* ccpu00136659: CMAS ETWS design changes */ - CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); - if (node == NULLP) - { - RETVALUE(RFAILED); - } - - warningSiPdu = (RgSchWarningSiPdu *)node->node; - *mcs = warningSiPdu->mcs; - *nPrb = warningSiPdu->nPrb; - *msgLen = warningSiPdu->msgLen; - RETVALUE(ROK); - - } - RETVALUE(ROK); -} /* rgSCHUtlGetMcsAndNPrb */ - -/* -* -* Fun: rgSCHUtlCalMacAndPrb -* -* Desc: This is used to Calculate mcs and nPrb value for SIB1 and SIs. -* -* Ret: -* -* Notes: None -* -* File: rg_utl.c -*/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlCalMcsAndNPrb -( -RgSchCellCb *cell, -U8 cfgType, -MsgLen msgLen, -U8 siId -) -#else -PUBLIC S16 rgSCHUtlCalMcsAndNPrb(cell, nPrb, mcs, msgLen) -RgSchCellCb *cell; -U8 cfgType; -MsgLen msgLen; -U8 siId; -#endif -{ - U8 mcs = 0; - U8 nPrb = 0; - - TRC2(rgSCHUtlCalMcsAndNPrb) - - /*Get the nPrb and mcs parametr values */ - if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8)) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "msgLen does " - "not match any valid TB Size"); - RETVALUE(RFAILED); - } - - - if(cfgType == RGR_SI_CFG_TYPE_SIB1 || cfgType == RGR_SI_CFG_TYPE_SIB1_PWS) - { - - if(cell->siCb.crntSiInfo.sib1Info.sib1 == NULLP) - { - cell->siCb.crntSiInfo.sib1Info.mcs = mcs; - cell->siCb.crntSiInfo.sib1Info.nPrb = nPrb; - cell->siCb.crntSiInfo.sib1Info.msgLen = msgLen; - } - else - { - cell->siCb.newSiInfo.sib1Info.mcs = mcs; - cell->siCb.newSiInfo.sib1Info.nPrb= nPrb; - cell->siCb.newSiInfo.sib1Info.msgLen = msgLen; - } - } - - - if(cfgType == RGR_SI_CFG_TYPE_SI) - { - if(cell->siCb.crntSiInfo.siInfo[siId-1].si == NULLP && - !(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD)) - { - cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs; - cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb; - cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen; - } - else - { - cell->siCb.newSiInfo.siInfo[siId-1].mcs = mcs; - cell->siCb.newSiInfo.siInfo[siId-1].nPrb= nPrb; - cell->siCb.newSiInfo.siInfo[siId-1].msgLen = msgLen; - } - } - - if(cfgType == RGR_SI_CFG_TYPE_SIB8_CDMA) - { - cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs; - cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb; - cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen; - } - - RETVALUE(ROK); -} -#endif - -/*********************************************************** - * - * Func : rgSCHUtlFillDgnParams - * - * Desc : Utility Function to Fill Diagonostic params. - * - * Ret : None. - * - * Notes: None. - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlFillDgnParams -( -Inst inst, -RgUstaDgn *dgn, -U8 dgnType -) -#else -PUBLIC Void rgSCHUtlFillDgnParams(inst, dgn, dgnType) -Inst inst; -RgUstaDgn *dgn; -U8 dgnType; -#endif -{ - - TRC2(rgSCHUtlFillDgnParams) - - switch(dgnType) - { - case LRG_USTA_DGNVAL_MEM: - dgn->type = (U8) LRG_USTA_DGNVAL_MEM; - dgn->u.mem.region = rgSchCb[inst].rgSchInit.region; - dgn->u.mem.pool = rgSchCb[inst].rgSchInit.pool; - break; - - default: - break; - } - - RETVOID; -} /* end of rgSCHUtlFillDgnParams */ - -/*********************************************************** - * - * Func : rgSCHUtlGetPstToLyr - * - * Desc : Utility Function to get the pst structure to post a message to MAC - * - * - * Ret : ROK - * RFAILED - * - * Notes: This function should be called while sending a msg from - * scheduler instance to MAC - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlGetPstToLyr -( -Pst *pst, -RgSchCb *schCb, -Inst macInst -) -#else -PUBLIC Void rgSCHUtlGetPstToLyr (pst, schCb, macInst) -Pst *pst; -RgSchCb *schCb; -Inst macInst; -#endif -{ - TRC2(rgSCHUtlGetPstToLyr); - - /* Only the needed params are filled */ - pst->region = schCb->rgSchInit.region; - pst->pool = schCb->rgSchInit.pool; - pst->srcInst = schCb->rgSchInit.inst+RGSCH_INST_START; - pst->srcProcId = schCb->rgSchInit.procId; - pst->dstProcId = schCb->rgSchInit.procId; - - pst->dstInst = macInst; - pst->dstEnt = ENTRG; - pst->srcEnt = ENTRG; - pst->selector = 0; - pst->prior = PRIOR0; - pst->intfVer = 0; - pst->route = RTESPEC; - - RETVOID; -} /* end of rgSCHUtlGetPstToLyr */ - -/** @brief This function fills in the common lc information to be sent to MAC - * - * @details - * - * Function: rgSCHUtlFillRgInfCmnLcInfo - * @param RgSchDlSf *sf, - * @param RgInfSfAlloc *sfAlloc, - * @param CmLteLcId lcId, - * @param Bool sendInd - * - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFillRgInfCmnLcInfo -( -RgSchDlSf *sf, -RgInfSfAlloc *sfAlloc, -CmLteLcId lcId, -Bool sendInd -) -#else -PUBLIC S16 rgSCHUtlFillRgInfCmnLcInfo(sf, sfAlloc, lcId, sendInd) -RgSchDlSf *sf; -RgInfSfAlloc *sfAlloc; -CmLteLcId lcId; -Bool sendInd; -#endif -{ - TRC2(rgSCHUtlFillRgInfCmnLcInfo); - - if((sf->bch.tbSize)&& - !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCH_INFO)) - { -#ifndef RGR_SI_SCH - sfAlloc->cmnLcInfo.bchInfo.lcId = lcId; -#endif - sfAlloc->cmnLcInfo.bitMask |= RGINF_BCH_INFO; - } - else if((sf->bcch.pdcch != NULLP)&& - !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCCH_INFO)) - { - sfAlloc->cmnLcInfo.bcchInfo.rnti = RGSCH_SI_RNTI; - rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.bcchInfo.dciInfo), - &(sf->bcch.pdcch->dci)); -#ifndef RGR_SI_SCH - sfAlloc->cmnLcInfo.bcchInfo.lcId = lcId; - sfAlloc->cmnLcInfo.bcchInfo.sndStatInd = sendInd; -#endif - sfAlloc->cmnLcInfo.bitMask |= RGINF_BCCH_INFO; - } - else if((sf->pcch.pdcch != NULLP) && - !(sfAlloc->cmnLcInfo.bitMask & RGINF_PCCH_INFO)) - { - sfAlloc->cmnLcInfo.pcchInfo.rnti = RGSCH_P_RNTI; - rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.pcchInfo.dciInfo), - &(sf->pcch.pdcch->dci)); - sfAlloc->cmnLcInfo.pcchInfo.lcId = lcId; - sfAlloc->cmnLcInfo.bitMask |= RGINF_PCCH_INFO; - } - RETVALUE(ROK); -} - -/** @brief This function fills in the RAR information to be sent to MAC - * - * @details - * - * Function: rgSCHUtlFillRgInfRarInfo - * - * @param RgSchCellCb *cell - * @param RgSchDlSf *sf - * @param RgInfSfAlloc *sfAlloc - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFillRgInfRarInfo -( -RgSchDlSf *sf, -RgInfSfAlloc *sfAlloc, -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlFillRgInfRarInfo(sf, sfAlloc, cell) -RgSchDlSf *sf; -RgInfSfAlloc *sfAlloc; -RgSchCellCb *cell; -#endif -{ - U8 idx; - CmLListCp *lnkLst; - CmLList *tmp; - RgSchRaCb *raCb; - RgSchUeCb *ue; - RgInfRaRntiInfo *raRntiAlloc; - U8 noRaRsps; - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); - - TRC2(rgSCHUtlFillRgInfRarInfo); - -#ifdef LTE_TDD - noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC; -#else - noRaRsps = RGSCH_MAX_RA_RSP_ALLOC; -#endif - - for(idx =0; idx < noRaRsps; idx++) - { - if (sf->raRsp[idx].pdcch == NULLP) - { - /* No further raResp Allocations. */ - break; - } - /* Added Dl TB count for RACH Response transmission*/ -#ifdef LTE_L2_MEAS - cell->dlUlTbCnt.tbTransDlTotalCnt++; -#endif - raRntiAlloc = &(sfAlloc->rarInfo.raRntiInfo[idx]); - raRntiAlloc->raRnti = sf->raRsp[idx].raRnti; - raRntiAlloc->schdTbSz = sf->raRsp[idx].tbSz; - raRntiAlloc->numCrnti = 0; - rgSCHUtlFillPdschDciInfo(&(raRntiAlloc->dciInfo), - &(sf->raRsp[idx].pdcch->dci)); - /* RACHO : fill backoff indicator information */ - raRntiAlloc->backOffInd = sf->raRsp[idx].backOffInd; - - /* Fill for contention free UEs*/ - lnkLst = &(sf->raRsp[idx].contFreeUeLst); - CM_LLIST_FIRST_NODE(lnkLst, tmp); - while (tmp) - { - ue = (RgSchUeCb *)tmp->node; - tmp = tmp->next; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = ue->ueId; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = TRUE; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = ue->ul.rarGrnt.rapId; -#ifndef MAC_5GTF_UPDATE - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop = - ue->ul.rarGrnt.hop; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit = - ue->ul.rarGrnt.cqiReqBit; -#endif - /* SHASHAHNK ADD RIV CALC */ - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart = - ue->ul.rarGrnt.rbStart; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb = - ue->ul.rarGrnt.numRb; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc = - ue->ul.rarGrnt.tpc; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt = - ue->ul.rarGrnt.iMcsCrnt; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta = ue->ul.rarGrnt.ta; - raRntiAlloc->numCrnti++; - cmLListDelFrm(lnkLst, &ue->ul.rarGrnt.raRspLnk); - ue->ul.rarGrnt.raRspLnk.node = (PTR)NULLP; - } - /* Fill for contention based UEs*/ - lnkLst = &(sf->raRsp[idx].raRspLst); - - CM_LLIST_FIRST_NODE(lnkLst, tmp); - - while((NULLP != tmp) && ((RgSchRaCb *)tmp->node != NULLP)) - { - raCb = (RgSchRaCb *)tmp->node; - - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = raCb->tmpCrnti; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = FALSE; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = raCb->rapId; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.pres = TRUE; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.val = raCb->ta.val; -#ifndef MAC_5GTF_UPDATE - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop = - raCb->msg3Grnt.hop; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit = FALSE; -#endif - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart = - raCb->msg3Grnt.rbStart; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb = - raCb->msg3Grnt.numRb; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc = - raCb->msg3Grnt.tpc; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt = - raCb->msg3Grnt.iMcsCrnt; - raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.delayBit = - raCb->msg3Grnt.delayBit; - /* For initial attaching UEs Aperiodic CQI need not be triggered */ - raRntiAlloc->numCrnti++; - /* Search the next node */ - CM_LLIST_NEXT_NODE(lnkLst, tmp); - } - } - sfAlloc->rarInfo.numRaRntis = idx; - /* ccpu00132314-ADD-Update the tx power allocation info - TODO-Need to add a check for max tx power per symbol */ - sfAlloc->rarInfo.txPwrOffset = cellDl->rarTxPwrOffset; - - RETVALUE(ROK); -} /* end of rgSCHUtlFillRgInfRarInfo */ - -/** @brief This function fills in the pdsch data related allocation Info - * from the pdcch DCI info. - * subframe - * - * @details - * - * Function: rgSCHUtlFillPdschDciInfo - * - * Processing steps: - * - Depending upon the DCI Format, fill the appropriate fields. - * - * @param [out] TfuPdschDciInfo *pdschDci - * @param [in] TfuDciInfo *pdcchDci - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFillPdschDciInfo -( -TfuPdschDciInfo *pdsch, -TfuDciInfo *pdcchDci -) -#else -PUBLIC S16 rgSCHUtlFillPdschDciInfo(pdsch, pdcchDci) -TfuPdschDciInfo *pdsch; -TfuDciInfo *pdcchDci; -#endif -{ - TRC2(rgSCHUtlFillPdschDciInfo) - -#ifdef EMTC_ENABLE - S16 ret = ROK; -#endif - pdsch->format = pdcchDci->dciFormat; - switch(pdcchDci->dciFormat) - { - case TFU_DCI_FORMAT_1: - pdsch->u.format1AllocInfo = pdcchDci->u.format1Info.allocInfo; - break; - case TFU_DCI_FORMAT_1A: - if (pdcchDci->u.format1aInfo.isPdcchOrder == FALSE) - { - pdsch->u.format1aAllocInfo = pdcchDci->u.format1aInfo.t.pdschInfo.allocInfo; - } - break; - case TFU_DCI_FORMAT_1B: - pdsch->u.format1bAllocInfo = pdcchDci->u.format1bInfo.allocInfo; - break; - case TFU_DCI_FORMAT_1C: - pdsch->u.format1cAllocInfo = pdcchDci->u.format1cInfo; - break; - case TFU_DCI_FORMAT_1D: - pdsch->u.format1dAllocInfo = pdcchDci->u.format1dInfo.allocInfo; - break; - case TFU_DCI_FORMAT_2: - pdsch->u.format2AllocInfo = pdcchDci->u.format2Info.allocInfo; - break; - case TFU_DCI_FORMAT_2A: - pdsch->u.format2AAllocInfo = pdcchDci->u.format2AInfo.allocInfo; - break; -#ifdef RG_5GTF - case TFU_DCI_FORMAT_B1: - pdsch->u.formatB1Info = pdcchDci->u.formatB1Info; - break; - case TFU_DCI_FORMAT_B2: - pdsch->u.formatB2Info = pdcchDci->u.formatB2Info; - break; -#endif - default: -#ifdef EMTC_ENABLE - ret = rgSCHEmtcUtlFillPdschDciInfo(pdsch, pdcchDci); - if(RFAILED == ret) - { - RETVALUE(RFAILED); - } -#else - RETVALUE(RFAILED); -#endif - } - RETVALUE(ROK); -} - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - * @brief This function resets temporary variables in Pool - * @details - * - * Function: rgSchSFRResetPoolVariables - * - * Invoked by: rgSCHSFRUtlTotalPoolInit - * - * @param[in] RgSchCellCb* cell - * @param[in] RgSubFrm* subFrm - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSchDSFRPwrCheck -( - RgSchDlSf *sf, - Bool *isAllUePwrHigh - ) -#else -PRIVATE Void rgSchDSFRPwrCheck(sf, isAllUePwrHigh) - RgSchDlSf *sf; - Bool *isAllUePwrHigh; - -#endif -{ - RgSchSFRPoolInfo *sfrCCPool; - - CmLListCp *l; - CmLList *n; - - TRC2(rgSchDSFRPwrCheck); - - l = &sf->sfrTotalPoolInfo.ccPool; - n = cmLListFirst(l); - while(n) - { - sfrCCPool = (RgSchSFRPoolInfo*)n->node; - if((sfrCCPool->poolstartRB == sfrCCPool->pwrHiCCRange.startRb) && - (sfrCCPool->poolendRB == sfrCCPool->pwrHiCCRange.endRb)) - { - n = cmLListNext(l); - if(n) - { - continue; - } - *isAllUePwrHigh = TRUE; - break; - } - else - break; - } -} -/* LTE_ADV_FLAG_REMOVED_END */ -/*********************************************************** - * - * Func : rgSCHUtlFillRgInfTbInfo - * - * Desc : Utility Function to fill the allocation info of each Tb - * - * - * Ret : RETVOID - * - * - * Notes: This function should be called while sending a msg from - * scheduler instance to MAC - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHUtlFillRgInfTbInfo -( -RgSchDlHqProcCb *hqP, -RgInfUeAlloc *allocInfo, -RgSchCellCb *cell -) -#else -PRIVATE Void rgSCHUtlFillRgInfTbInfo (hqP, allocInfo, cell) -RgSchDlHqProcCb *hqP; -RgInfUeAlloc *allocInfo; -RgSchCellCb *cell; -#endif -{ - RgSchDlSf *sf; - U8 idx; - RgInfUeTbInfo *tbInfo; - U8 tbCnt; - /* LTE_ADV_FLAG_REMOVED_START */ -#ifdef TFU_UPGRADE - PRIVATE U32 tmpCnt = 0; - Bool isAllUePwrHigh = FALSE; -#endif - /* LTE_ADV_FLAG_REMOVED_END */ - RgSchDlLcCb *dlLcCb = NULLP; - U16 rlcHdrEstmt; - U8 lcId; - /* RRM_RBC_X */ -#ifdef LTE_L2_MEAS - U8 prbUsed = 0; -#endif - /* RRM_RBC_Y */ - - CmLteTimingInfo frm; - - /* Get Downlink Subframe */ - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - sf = rgSCHUtlSubFrmGet(cell, frm); - /* Setting of fillCtrlPdu flag - If both P-cell and S-cell are present, - make TRUE for P-cell and FALSE for all s-cells - For all other cases set TRUE */ -#ifdef LTE_ADV - if ((rgSchCb[cell->instIdx].genCfg.forceCntrlSrbBoOnPCel) && - !RG_SCH_CMN_IS_PCELL_HQP(hqP)) - { - allocInfo->fillCtrlPdu = FALSE; - } - else - { - allocInfo->fillCtrlPdu = TRUE; - } -#endif - - allocInfo->tbStrtIdx = -1; - - -#ifdef LTE_ADV - allocInfo->tbReqInfo.sCellHqPId = 0xff; - rgSCHLaaHndlFillRgInfTbInfo(cell, hqP, allocInfo); -#endif - - /*TODO:REEMA: Check and fill the isRetx */ - for(tbCnt = 0; tbCnt < 2; tbCnt++) - { - RgSchUeCb *ue = NULLP; - /*Changed as a result of CR timer*/ - if ((hqP->hqE->ue != NULLP)/* && - ((hqP->tbInfo[tbCnt].lchSchdData[0].lcId != 0) || \ - (hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF))*/) - { - ue = hqP->hqE->ue; - allocInfo->rnti = ue->ueId; - allocInfo->doa = hqP->hqE->ue->mimoInfo.doa; - allocInfo->txMode = (TfuTxMode)(hqP->hqE->ue->mimoInfo.txMode); - allocInfo->puschRptUsd = hqP->hqE->ue->mimoInfo.puschFdbkVld; - allocInfo->puschPmiInfo = hqP->hqE->ue->mimoInfo.puschPmiInfo; - if(hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF) - { - hqP->tbInfo[tbCnt].taSnt = TRUE; - } -#ifdef TFU_UPGRADE - if (RG_SCH_IS_PAPRSNT(ue,hqP->hqE->cell)) - { - /*update pA value */ - allocInfo->pa = (RG_SCH_CMN_GET_PA(ue,hqP->hqE->cell)).val; - } -#endif - - /* LTE_ADV_FLAG_REMOVED_START */ - /* If ABS is enabled, calculate resource used */ - if((0 == tbCnt) && (RGR_ENABLE == ue->cell->lteAdvCb.absCfg.status)) - { - /* For Macro count number resource used in Non-ABS SF */ - if(RGR_ABS_MUTE == ue->cell->lteAdvCb.absCfg.absPatternType) - { - if(RG_SCH_ABS_ENABLED_NONABS_SF == ue->cell->lteAdvCb.absDlSfInfo) - { - ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+= - hqP->tbInfo[tbCnt].dlGrnt.numRb; - } - } - /* For pico count number resource used in ABS SF for ABS UE */ - else if(RGR_ABS_TRANSMIT == ue->cell->lteAdvCb.absCfg.absPatternType) - { - if(RG_SCH_ABS_ENABLED_ABS_SF == ue->cell->lteAdvCb.absDlSfInfo) - { - if(TRUE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe) - { - ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+= - hqP->tbInfo[tbCnt].dlGrnt.numRb; - } - } - } - } - -#ifdef TFU_UPGRADE - /*if SFR is enabled*/ - allocInfo->isEnbSFR = (U8)RG_SCH_CMN_IS_SFR_ENB(ue->cell); /* KW fix for LTE_ADV */ - if((ue->cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) && - (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == FALSE)) - { - rgSchDSFRPwrCheck(sf, &isAllUePwrHigh); - } - if(isAllUePwrHigh) - { - allocInfo->pa = (U8)ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; /* KW fix for LTE_ADV */ - if(tmpCnt++ == 100000) - { - RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, - "DSFR::ll UEs can go HIGH, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId); - tmpCnt = 0; - } - } - else - { - if (allocInfo->isEnbSFR) - { - /*Update pA to Plow if it is cell-centred ,else pA will be pHigh*/ - if (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == TRUE) - { - allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; - if(tmpCnt++ == 100000) - { - RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, - "SFR::UE is CELL EDGE, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId); - tmpCnt = 0; - } - - } - else - { - if(TRUE == ue->lteAdvUeCb.isCCUePHigh) - { - allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; - ue->lteAdvUeCb.isCCUePHigh = FALSE; - } - else - { - allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pLow; - if(tmpCnt++ == 100000) - { - RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, - "SFR::UE is CELL CENTRE, PLow(%d) for UE(%d)\n",allocInfo->pa, ue->ueId); - tmpCnt = 0; - } - } - } - } - } - /* LTE_ADV_FLAG_REMOVED_END */ -#endif - } - else - { - if (hqP->hqE->raCb) - { -#ifdef TFU_UPGRADE - RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); -#endif -#ifdef LTEMAC_SPS - allocInfo->pdcchRnti = hqP->hqE->raCb->tmpCrnti; -#endif - allocInfo->rnti = hqP->hqE->raCb->tmpCrnti; -#ifdef TFU_UPGRADE - /*ccpu00132314-ADD-Use a default pA value - for msg4 */ - allocInfo->pa = cellDl->msg4pAVal; -#endif - } - } - /* If TB Is scheduled for this SF */ - if(hqP->tbInfo[tbCnt].state == HQ_TB_WAITING) - { - if (allocInfo->tbStrtIdx == -1){ - allocInfo->tbStrtIdx = tbCnt; -#ifndef LTEMAC_SPS - rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), - &(hqP->pdcch->dci)); -#else - if (hqP->pdcch) - { - rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), - &(hqP->pdcch->dci)); - } - else if ((ue) && (ue->dl.spsOccPdcch.rnti == ue->spsRnti)) - { - rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), - &(ue->dl.spsOccPdcch.dci)); - } -#endif /* ifndef LTEMAC_SPS */ - } -#ifdef LTEMAC_SPS - if (hqP->pdcch) - { - allocInfo->pdcchRnti = hqP->pdcch->rnti; - } - else if (ue) - { - allocInfo->pdcchRnti = ue->spsRnti; - } -#endif - tbInfo = &(allocInfo->tbInfo[tbCnt]); - allocInfo->nmbOfTBs++; - allocInfo->hqProcId = hqP->procId; - allocInfo->tbInfo[tbCnt].schdTbSz = hqP->tbInfo[tbCnt].tbSz; - - tbInfo->disTb = FALSE; - if(!(hqP->tbInfo[tbCnt].txCntr)) - { -#ifdef LTE_ADV - if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE == - rgSCHLaaSCellEnabled(cell)))) -#endif - { - hqP->tbInfo[tbCnt].txCntr++; - } - for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++) - { - tbInfo->schdDat[idx].lcId =\ - hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; - tbInfo->schdDat[idx].numBytes =\ - hqP->tbInfo[tbCnt].lchSchdData[idx].schdData; - if(hqP->hqE->ue) - { - lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; - if(lcId != 0) - { - dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1]; - if(dlLcCb != NULLP) - { - RG_SCH_CMN_DL_GET_HDR_EST(dlLcCb, rlcHdrEstmt); - /* Update the totalBo with the scheduled bo */ - (hqP->hqE->ue->totalBo <= tbInfo->schdDat[idx].numBytes - rlcHdrEstmt)?\ - (hqP->hqE->ue->totalBo = 0):\ - (hqP->hqE->ue->totalBo -= tbInfo->schdDat[idx].numBytes-rlcHdrEstmt); - - /* RRM_RBC_X */ -#ifdef LTE_L2_MEAS - prbUsed = ((hqP->tbInfo[tbCnt].\ - lchSchdData[idx].schdData * - hqP->tbInfo[tbCnt].dlGrnt.numRb) / - (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz)); - dlLcCb->qciCb->dlPrbCount += prbUsed; - if(dlLcCb->qciCb->qci > 0) - { - RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed); - } -#endif /* RRM_RBC_Y */ - -#ifdef RG_PFS_STATS - //if(!(hqP->hqE->ue->pfsStats.lcStats[lcId-1].isLcCntSet)) - if(tbCnt == 0) - { - U8 idx = 0; - if (hqP->hqE->ue->cell == hqP->hqE->cell) - { - idx = RGSCH_PCELL_INDEX; - } - else - { - idx = RG_SCH_GET_SCELL_INDEX((hqP->hqE->ue), (hqP->hqE->cell)); - } - hqP->hqE->ue->pfsStats.lcStats[lcId-1].ueSchdOcc[idx]++; - hqP->hqE->ue->pfsStats.lcStats[lcId-1].perRefresh[ue->pfsStats.lcStats[lcId-1].lastIdx].lcSchdOcc++; - } -#endif - } - } - } - } - /* Added Dl TB count for SRB/DRB data transmission*/ -#ifdef LTE_L2_MEAS - cell->dlUlTbCnt.tbTransDlTotalCnt++; -#endif - tbInfo->ta.pres = hqP->tbInfo[tbCnt].schdTa.pres; - tbInfo->ta.val = hqP->tbInfo[tbCnt].schdTa.val; -#ifdef LTE_ADV - tbInfo->sCellActCe = hqP->tbInfo[tbCnt].schdSCellActCe; -#endif - tbInfo->numSchLch = hqP->tbInfo[tbCnt].numLch; - if(!(hqP->tbInfo[tbCnt].numLch)) - { - tbInfo->schdDat[tbInfo->numSchLch].numBytes= hqP->tbInfo[tbCnt].tbSz; - /* Fix: If only TA is scheduled, use some dummy LCID */ - if (tbInfo->ta.pres) - tbInfo->schdDat[tbInfo->numSchLch].lcId = RG_TA_LCID; - } - - tbInfo->contResCe = hqP->tbInfo[tbCnt].contResCe; - tbInfo->isReTx = FALSE; - } - else - { -#ifdef LTE_ADV - if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE == - rgSCHLaaSCellEnabled(cell)))) -#endif - { - hqP->tbInfo[tbCnt].txCntr++; - } - tbInfo->isReTx = TRUE; - /* RRM_RBC_X */ - /* As per 36.314, harq retransmission also considered for - * prb utilization calculation*/ - for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++) - { -#ifdef LTE_L2_MEAS - if(hqP->hqE->ue) - { - lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; - if(lcId != 0) - { - dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1]; - if(dlLcCb != NULLP) - { - prbUsed = ((hqP->tbInfo[tbCnt].\ - lchSchdData[idx].schdData * - hqP->tbInfo[tbCnt].dlGrnt.numRb) / - (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz)); - if(dlLcCb->qciCb->qci > 0) - { - RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed); - } - } - } - } -#endif - } - /* RRM_RBC_Y */ - } - } - } -#ifdef LTE_ADV - rgSCHLaaResetDlHqProcCb(hqP); -#endif - - RETVOID; -} -/*********************************************************** - * - * Func : rgSCHUtlFillRgInfUeInfo - * - * Desc : Utility Function to fill the allocation info of Ue - * : MIMO : Filling 2TB's of each UE - * - * Ret : ROK - * RFAILED - * - * Notes: This function should be called while sending a msg from - * scheduler instance to MAC - * - * File : rg_utl.c - * - **********************************************************/ - /* CA dev Start */ -#ifdef ANSI -PUBLIC Void rgSCHUtlFillRgInfUeInfo -( -RgSchDlSf *sf, -RgSchCellCb *cell, -CmLListCp *dlDrxInactvTmrLst, -CmLListCp *dlInActvLst, -CmLListCp *ulInActvLst -) -#else -PUBLIC Void rgSCHUtlFillRgInfUeInfo (sf,cell, dlDrxInactvTmrLst, dlInActvLst, ulInActvLst) -{ -RgSchDlSf *sf; -RgSchCellCb *cell; -CmLListCp *dlDrxInactvTmrLst; -CmLListCp *dlInActvLst; -CmLListCp *ulInActvLst; -#endif -{ - RgInfSfAlloc *sfAlloc; - CmLListCp *lnkLst; /* lnkLst assignment */ - CmLList *tmp; - CmLList *hqPNode; - RgSchUeCb *ue = NULLP; - RgInfUeInfo *ueInfo = NULLP; - RgInfUeAlloc *ueAlloc = NULLP; - RgSchDlHqProcCb *hqCb = NULLP; - - /* Since Msg4 is sched only on PCELL, use cell arg's sfAllocArr */ - sfAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); - ueInfo = &(sfAlloc->ueInfo); - ueAlloc = sfAlloc->ueInfo.allocInfo; - - lnkLst = &(sf->msg4HqPLst); - CM_LLIST_FIRST_NODE(lnkLst, tmp); - while(NULLP != tmp) - { - printf("5GTF_ERROR MSG4 Consolidation\n"); - hqCb = (RgSchDlHqProcCb *)(tmp->node); - CM_LLIST_NEXT_NODE(lnkLst, tmp); - - rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes], cell); - - ue = hqCb->hqE->ue; - - if(ue != NULLP) - { - if((!(ue->dl.dlInactvMask & RG_HQENT_INACTIVE)) && (ue->isDrxEnabled)) - { - rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes], - dlDrxInactvTmrLst, dlInActvLst, ulInActvLst); - } - } - ueInfo->numUes++; - } - - lnkLst = &(sf->ueLst); - CM_LLIST_FIRST_NODE(lnkLst, tmp); - while(NULLP != tmp) - { -#if defined (TENB_STATS) && defined (RG_5GTF) - cell->tenbStats->sch.dl5gtfPdschCons++; -#endif - ue = (RgSchUeCb *)(tmp->node); - CM_LLIST_NEXT_NODE(lnkLst, tmp); - - hqPNode = ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst.first; - while (hqPNode) - { - hqCb = (RgSchDlHqProcCb *)hqPNode->node; - hqPNode = hqPNode->next; - - sfAlloc = &(hqCb->hqE->cell->sfAllocArr[hqCb->hqE->cell->crntSfIdx]); - ueInfo = &(sfAlloc->ueInfo); - ueAlloc = sfAlloc->ueInfo.allocInfo; - - rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes], - hqCb->hqE->cell); - - if(ue->isDrxEnabled) - { - rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes], - dlDrxInactvTmrLst, dlInActvLst, ulInActvLst); - } - ueInfo->numUes++; - } -#ifdef LTE_ADV - if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE) - { - /*If remaining BO is left then increment the count*/ - if(ue->totalBo > 0) - { - ue->remBoCnt++; - /* Check if trigger for Activation is met or not */ - if(rgSCHIsActvReqd(cell, ue)) - { - ue->remBoCnt = 0; - /*Passing primary cell*/ - rgSCHSCellSelectAndActDeAct(ue->cell, ue, RGR_SCELL_ACT); - } - } - else - { - /*If remaining BO is 0 then reset the count*/ - ue->remBoCnt = 0; - } - } -#endif - } - - RETVOID; -} /* end of rgSCHUtlFillRgInfUeInfo */ - /* CA dev End */ - - -/** @brief This function shall update the scheduler with the CEs and data rcvd - * - * @details - * - * Function: rgSCHUtlUpdSch - * - * Processing steps: - * - Collate the information of all the SDUs received and inform the - * scheduler rgSCHDataRcvd - * - Send Data indication to the higher layer with the dedicated data - * (rgUIMSndDedDatInd) - * - Inform scheduler with any MAC CEs if present. - * - * @param [in] RgCellCb *cellCb - * @param [in] RgUeCb *ueCb - * @param [in] RgMacPdu *pdu - * @param [in] RgSchErrInfo *err - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdSch -( -RgInfSfDatInd *subfrmInfo, -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -RgInfUeDatInd *pdu, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlUpdSch (subfrmInfo, cellCb, ueCb, pdu, err) -RgInfSfDatInd *subfrmInfo; -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -RgInfUeDatInd *pdu; -RgSchErrInfo *err; -#endif -{ - - S16 ret; - TRC2(rgSCHUtlUpdSch); - -#ifdef LTEMAC_SPS - if (RGSCH_UL_SPS_ACT_PRSENT & pdu->ceInfo.bitMask) - { - /* SPS to be activated due to data on SPS LCG ID*/ - rgSCHUtlSpsActInd(cellCb, ueCb, pdu->ceInfo.spsSduSize); - } -#endif - /* TODO : Temp Fix for crash due to UL SDU corruption*/ - if (RGSCH_PHR_CE_PRSNT & pdu->ceInfo.bitMask) - { - /* PHR present */ - RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); - if ((ret = rgSCHUtlUpdPhr(cellCb, ueCb, pdu->ceInfo.ces.phr, err)) != ROK) - RETVALUE(ret); - } - /* Note: Order of indication to Sch now is - * 1st Indicate the DataInd info for each LCG's - * 2nd Update the BSR reports received along with data - * this is to make sure the effBsr is updated to the latest BSR - * received. - */ - cellCb->sc.apis->rgSCHUpdUeDataIndLcg(cellCb, ueCb, pdu); - -#ifndef MAC_5GTF_UPDATE - if (RGSCH_TRUNC_BSR_CE_PRSNT & pdu->ceInfo.bitMask) - { - RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); - /*ccpu00129922 - MOD - Deleted return value - * checking since it returns void*/ - rgSCHUtlUpdBsrTrunc (cellCb, ueCb, - (U8)(pdu->ceInfo.ces.bsr.truncBsr >> 6), - (U8)(pdu->ceInfo.ces.bsr.truncBsr & 0x3F), err); - } - else - { - if (RGSCH_SHORT_BSR_CE_PRSNT & pdu->ceInfo.bitMask) - { - RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); - /*ccpu00129922 - MOD - Deleted return value - checking since it returns void*/ - rgSCHUtlUpdBsrShort (cellCb, ueCb, - (U8)(pdu->ceInfo.ces.bsr.shortBsr >> 6), - (U8)(pdu->ceInfo.ces.bsr.shortBsr & 0x3F), err); - } - else - { - if (RGSCH_LONG_BSR_CE_PRSNT & pdu->ceInfo.bitMask) -#else - if (RGSCH_BSR_CE_PRSNT & pdu->ceInfo.bitMask) -#endif - { - RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); - /*ccpu00129922 - MOD - Deleted return value - checking since it returns void*/ - rgSCHUtlUpdBsrLong (cellCb, ueCb, - pdu->ceInfo.ces.bsr.longBsr.bs1, - pdu->ceInfo.ces.bsr.longBsr.bs2, - pdu->ceInfo.ces.bsr.longBsr.bs3, - pdu->ceInfo.ces.bsr.longBsr.bs4, - err); - } -#ifndef MAC_5GTF_UPDATE - } - - } -#endif - - RETVALUE(ROK); -} /* end of rgSCHUtlUpdSch */ -#ifdef RGR_V1 -/** - * @brief Handler for Updating Bo received in StaRsp - * - * @details - * - * Function : rgSCHUtlAddUeToCcchSduLst - * - * This function shall be invoked once it receives staRsp on CCCH - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAddUeToCcchSduLst -( -RgSchCellCb *cell, -RgSchUeCb *ueCb -) -#else -PUBLIC S16 rgSCHUtlAddUeToCcchSduLst(cell, ueCb) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -#endif -{ - RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb, cell); - RgSchDlHqProcCb *hqP = (RgSchDlHqProcCb *)ueDl->proc; - TRC2(rgSCHUtlAddUeToCcchSduLst); - - /* Temp Guard: For back to back CCCH SDU BO - * twice. Hence an extra guard. If already added to scheduling - * queue or if scheduled and waiting for HQ FDBK, ignore */ - if ((ueCb->ccchSduLnk.node) || - ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) && - ((hqP != NULLP) && (hqP->hqE->ccchSduProc)))) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unexpected CCCH SDU BO", - ueCb->ueId); - RETVALUE(ROK); - } - - ueCb->ccchSduLnk.node = (PTR)(ueCb); - cmLListAdd2Tail(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk)); - - RETVALUE(ROK); -} -/** - * - * @details - * - * Function : rgSCHUtlUpdtBo - * - * This function shall be invoked once it receives staRsp on CCCH - * - * @param[in] RgSchCellCb *cell - * @param[in] RgRguCmnStaRsp *staRsp - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdtBo -( -RgSchCellCb *cell, -RgInfCmnBoRpt *staRsp -) -#else -PUBLIC S16 rgSCHUtlUpdtBo(cell, staRsp) -RgSchCellCb *cell; -RgInfCmnBoRpt *staRsp; -#endif -{ - RgSchUeCb *ueCb; - TRC2(rgSCHUtlUpdtBo) - - - if ((ueCb = rgSCHDbmGetUeCb(cell, staRsp->u.rnti)) == NULLP) - { - /* Handle Ue fetch failure */ - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid UEID:%d",staRsp->u.rnti); - RETVALUE(RFAILED); - } - /* Update Bo in ueCb */ - ueCb->dlCcchInfo.bo = (U32)(staRsp->bo); -#ifdef EMTC_ENABLE - if(ueCb->isEmtcUe) - { - rgSCHUtlAddUeToEmtcCcchSduLst(cell,ueCb); - } - else -#endif - { - rgSCHUtlAddUeToCcchSduLst(cell, ueCb); - } - - RETVALUE(ROK); -} /* rgSCHUtlUpdtBo */ - -#endif -/** - * - * @details - * Function : rgSCHUtlHndlCcchBoUpdt - * - * This function shall fetch the raCb with the given rnti and ask RAM to - * update BO - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgInfCmnBoRpt *boRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlHndlCcchBoUpdt -( -RgSchCellCb *cell, -RgInfCmnBoRpt *boRpt -) -#else -PUBLIC S16 rgSCHUtlHndlCcchBoUpdt(cell, boRpt) -RgSchCellCb *cell; -RgInfCmnBoRpt *boRpt; -#endif -{ - RgSchRaCb *raCb; - RgSchUeCb *ueCb; - - TRC2(rgSCHUtlHndlCcchBoUpdt); - - if ((raCb = rgSCHDbmGetRaCb(cell, boRpt->u.rnti)) == NULLP) - { -#ifdef RGR_V1 - /* CR timer implementation changes*/ - /*If no raCb, schedule ueCb, ueCb is extracted in rgSCHUtlUpdtBo*/ - RETVALUE(rgSCHUtlUpdtBo(cell, boRpt)); -#else - /* Handle RaCb fetch failure */ - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "Invalid RNTI:%d to fetch raCb",boRpt->u.rnti); - RETVALUE(RFAILED); -#endif - } - -#ifdef RGR_V1 - - /*Fix: If RaCb exists, then MSG4 is not completed yet*/ - /*Check if guard timer has expired, if not CR CE + CCCH SDU will be scheduled*/ - if((raCb->contResTmrLnk.node != NULLP) && \ - (raCb->schdLnk.node == NULLP) && (raCb->dlHqE->msg4Proc == NULLP)) - { -#ifdef EMTC_ENABLE - /*if contention resolution timer left ,Stop the Contention Resolution Guard Timer , - add in toBeSchduled list and update the Bo */ - if(TRUE == raCb->isEmtcRaCb) - { - rgSCHRamEmtcUpdtBo(cell, raCb, boRpt); - } - else -#endif - { - cmLListDelFrm(&cell->contResGrdTmrLst, &(raCb->contResTmrLnk)); - raCb->contResTmrLnk.node=NULLP; - rgSCHRamUpdtBo(cell, raCb, boRpt); - } - } - else - { - /*Fix:Guard timer has expired */ - /*Update the BO in UE CB but dont add it to the scheduling list. - *Should be added to the list after MSG4 completion*/ - if ((ueCb = rgSCHDbmGetUeCb(cell, boRpt->u.rnti)) == NULLP) - { - /* Handle Ue fetch failure */ - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RNTI:%d",boRpt->u.rnti); - RETVALUE(RFAILED); - } - /* Update Bo in ueCb */ - ueCb->dlCcchInfo.bo = (U32)(boRpt->bo); - } - -#else - rgSCHRamUpdtBo(cell, raCb, boRpt); -#endif - - RETVALUE(ROK); -} /* rgSCHUtlHndlCcchBoUpdt */ - -/** - * @brief Validates BO received for BCCH or PCCH. - * - * @details - * - * Function : rgSCHUtlGetAllwdCchTbSz - * - * This function shall return the tbSz equal to or - * the nearest greater value for a given bo. - * If no such value found return -1. The nPrb value is - * accordingly set. - * - * - * @param[in] U32 bo - * @param[out] U8 *nPrb - * @return S32 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S32 rgSCHUtlGetAllwdCchTbSz -( -U32 bo, -U8 *nPrb, -U8 *mcs -) -#else -PUBLIC S32 rgSCHUtlGetAllwdCchTbSz(bo, nPrb, mcs) -U32 bo; -U8 *nPrb; -U8 *mcs; -#endif -{ - S32 lt; - S32 cn; - S32 rt; - - TRC2(rgSCHUtlGetAllwdCchTbSz); - - for (lt = 0, rt = 43; lt <= rt;) - { - cn = (lt + rt)/2; - if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz == bo) - { - *nPrb = rgSchUtlBcchPcchTbSzTbl[cn].rbIndex; - *mcs = rgSchUtlBcchPcchTbSzTbl[cn].mcs; - RETVALUE(rgSchUtlBcchPcchTbSzTbl[cn].tbSz); - } - else if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz < bo) - lt = cn + 1; - else - rt = cn - 1; - } - if (lt == 44) - { - RETVALUE(RFAILED); - } - *nPrb = rgSchUtlBcchPcchTbSzTbl[lt].rbIndex; - *mcs = rgSchUtlBcchPcchTbSzTbl[lt].mcs; - RETVALUE(rgSchUtlBcchPcchTbSzTbl[lt].tbSz); -} - -/** - * @brief Handler for BO Updt received for BCCH or PCCH. - * - * @details - * - * Function : rgSCHUtlHndlBcchPcchBoUpdt - * - * This function shall store the buffer and time to transmit in lcCb - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgInfCmnBoRpt *boRpt - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlHndlBcchPcchBoUpdt -( -RgSchCellCb *cell, -RgInfCmnBoRpt *boUpdt -) -#else -PUBLIC S16 rgSCHUtlHndlBcchPcchBoUpdt(cell, boUpdt) -RgSchCellCb *cell; -RgInfCmnBoRpt *boUpdt; -#endif -{ - RgSchClcDlLcCb *dlLc; - RgSchClcBoRpt *boRpt; - Inst inst = cell->instIdx; - U8 nPrb=0; - U8 mcs=0; - - TRC2(rgSCHUtlHndlBcchPcchBoUpdt); - - dlLc = rgSCHDbmGetBcchOnBch(cell); - if (dlLc == NULLP) - { - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "No Logical Channel dlLc is NULLP for RNTI:%d LCID:%d",boUpdt->u.rnti,boUpdt->lcId); - RETVALUE(RFAILED); - } - if (boUpdt->lcId != dlLc->lcId) - { - /* Added for dropping paging Message*/ - /*suman*/ - if ((rgSCHChkBoUpdate(cell,boUpdt))== ROK) /* Checking if received BO falls within the window of 5120 subframes*/ - { - if (rgSCHUtlGetAllwdCchTbSz(boUpdt->bo*8, &nPrb, &mcs) - != (boUpdt->bo*8)) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"[%ld]BO: does not match any " - "valid TB Size RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId); - RETVALUE(RFAILED); - } - }/*end of rgSCHChkBoUpdate*/ - else - { - RETVALUE(ROK); - } - } - if ((dlLc = rgSCHDbmGetCmnLcCb(cell, boUpdt->lcId)) == NULLP) - { - /* Handle lcCb fetch failure */ - RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, - "LCID:%d Invalid for RNTI:%d",boUpdt->lcId,boUpdt->u.rnti); - } - - if (((rgSCHUtlAllocSBuf(inst, (Data **)(&boRpt), sizeof(RgSchClcBoRpt))) ==RFAILED) || - (!boRpt)) - { - RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, "Allocation of common bo %dreport " - "failed RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId); - RETVALUE(RFAILED); - } - - boRpt->bo = boUpdt->bo; - boRpt->mcs = mcs; - boRpt->timeToTx = boUpdt->u.timeToTx; - boRpt->nPrb = nPrb; -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - boRpt->emtcDIReason = boUpdt->emtcDIReason; - boRpt->pnb = boUpdt->pnb; - } -#endif - RG_SCH_ADD_TO_CRNT_TIME(boRpt->timeToTx, - boRpt->maxTimeToTx, cell->siCfg.siWinSize) - if((NULLP != dlLc) && (dlLc->si)) - { - boRpt->retxCnt = cell->siCfg.retxCnt; - } - else - { - boRpt->retxCnt = 0; - } - rgSCHDbmInsCmnLcBoRpt(dlLc, boRpt); - - RETVALUE(ROK); -} /* rgSCHUtlHndlBcchPcchBoUpdt */ - -/** - * @brief API for sending bind confirm from Scheduler instance to RRM - * - * @details - * - * Function: rgSCHUtlRgrBndCfm - * - * This API is invoked to send bind confirm from Scheduler instance to RRM. - * This API fills in Pst structure and SAP Ids and invokes - * bind confirm API towards RRM. - * - * @param[in] SuId suId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrBndCfm -( -Inst instId, -SuId suId, -U8 status -) -#else -PUBLIC S16 rgSCHUtlRgrBndCfm(instId, suId, status) -Inst instId; -SuId suId; -U8 status; -#endif -{ - S16 ret = ROK; - - TRC2(rgSCHUtlRgrBndCfm) - - - ret = RgUiRgrBndCfm(&rgSchCb[instId].rgrSap[suId].sapCfg.sapPst, rgSchCb[instId].rgrSap[suId].sapCfg.suId, status); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrBndCfm: RgUiRgrBndCfm Failed "); - RETVALUE(ret); - } - RETVALUE(ret); -} /* rgSCHUtlRgrBndCfm*/ - -/** - * @brief API for sending bind confirm from Scheduler instance to RRM via RGM - * interface - * - * @details - * - * Function: rgSCHUtlRgmBndCfm - * - * This API is invoked to send bind confirm from Scheduler instance to RRM. - * This API fills in Pst structure and SAP Ids and invokes - * - * @param[in] SuId suId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgmBndCfm -( -Inst instId, -SuId suId, -U8 status -) -#else -PUBLIC S16 rgSCHUtlRgmBndCfm(instId, suId, status) -Inst instId; -SuId suId; -U8 status; -#endif -{ - S16 ret = ROK; - - TRC2(rgSCHUtlRgmBndCfm) - - - ret = RgUiRgmBndCfm(&rgSchCb[instId].rgmSap[suId].sapCfg.sapPst, rgSchCb[instId].rgmSap[suId].sapCfg.suId, status); - if (ret != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgmBndCfm: RgUiRgrBndCfm Failed "); - RETVALUE(ret); - } - RETVALUE(ret); -} /* rgSCHUtlRgmBndCfm*/ - - - -/** - * @brief API for sending configuration confirm from Scheduler to RRM - * - * @details - * - * Function: rgSCHUtlRgrCfgCfm - * - * This API is invoked to send configuration confirm from Scheduler to RRM. - * config confirm API towards RRM. - * - * @param[in] RgrCfgTransId transId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrCfgCfm -( -Inst instId, -SpId spId, -RgrCfgTransId transId, -U8 status -) -#else -PUBLIC S16 rgSCHUtlRgrCfgCfm(instId, spId, transId, status) -Inst instId; -SpId spId; -RgrCfgTransId transId; -U8 status; -#endif -{ - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - - TRC2(rgSCHUtlRgrCfgCfm) - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if(RgUiRgrCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst, - rgSchCb[instId].rgrSap[spId].sapCfg.suId, - transId, status) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrCfgCfm: RgUiRgrCfgCfm Failed "); - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} /* rgSCHUtlRgrCfgCfm */ -#ifdef RGR_RRM_TICK -/** - * @brief API for sending TTI indication from Scheduler to RRM. - * - * @details - * - * Function: rgSCHUtlRgrTtiInd - * - * This API is invoked to send TTI indication from Scheduler instance to RRM. - * This API fills in Pst structure and RgrTtiIndInfo - * - * @param[in] cell RgSchCellCb - * @param[in] CmLteTimingInfo status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrTtiInd -( -RgSchCellCb *cell, -RgrTtiIndInfo *rgrTti -) -#else -PUBLIC S16 rgSCHUtlRgrTtiInd(cell, rgrTti) -RgSchCellCb *cell; -RgrTtiIndInfo *rgrTti; -#endif -{ - S16 ret = ROK; - RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ -#ifdef L2_L3_SPLIT - extern Bool g_usettitmr; - extern Void mtTmrHdlrPublic(void); -#endif - - TRC2(rgSCHUtlRgrTtiInd) - - - rgrSap = cell->rgrSap; - if (rgrSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHUtlRgrTtiInd() Upper SAP not bound (%d) ", - rgrSap->sapSta.sapState); - RETVALUE(RFAILED); - } - RgUiRgrTtiInd(&(cell->rgrSap->sapCfg.sapPst), - cell->rgrSap->sapCfg.suId, rgrTti); -#ifdef L2_L3_SPLIT - { - g_usettitmr = TRUE; - mtTmrHdlrPublic(); - } -#endif - RETVALUE(ret); -} /* rgSCHUtlRgrTtiInd*/ -#endif -/** @brief This function is called by rgMacSchSfRecpInd. This function invokes the - * scheduler with the information of the received Data and any Control Elements - * if present. - * - * @details - * - * Function: - * - * Processing steps: - * - Retrieves the RaCb with the rnti provided, if it doesnt exist - * return failure. - * - If UE exists then update the Schduler with any MAC CEs if present. - * - Invoke RAM module to do Msg3 related processing rgSCHRamProcMsg3 - * - * @param [in] RgSchCellCb *cellCb - * @param [in] RgSchUeCb *ueCb - * @param [in] CmLteRnti rnti - * @param [in] RgMacPdu *pdu - * @param [in] RgSchErrInfo *err - * @param - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlProcMsg3 -( -RgInfSfDatInd *subfrmInfo, -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -CmLteRnti rnti, -RgInfUeDatInd *pdu, -RgSchErrInfo *err - ) -#else -PUBLIC S16 rgSCHUtlProcMsg3 (subfrmInfo, cellCb, ueCb, rnti, pdu, err) -RgInfSfDatInd *subfrmInfo; -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -CmLteRnti rnti; -RgInfUeDatInd *pdu; -RgSchErrInfo *err; -#endif -{ - S16 ret; - RgSchRaCb *raCb; - - TRC2(rgSCHUtlProcMsg3) - - - /* must have an raCb for this case */ - raCb = rgSCHDbmGetRaCb (cellCb, rnti); - if (raCb == NULLP) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, "RNTI:%d Received MSG3, unable to " - "find raCb",rnti); - RETVALUE(RFAILED); - } - - /* ccpu00130982: Processing CRNTI MAC CE before Short BSR, if any, such that - * effBsr of current case only will be considered in scheduling of ContResLst*/ - ret = rgSCHRamProcMsg3 (cellCb, ueCb, raCb, pdu, err); - if (ret != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Processing failed in the RAM " - "RNTI:%d ",rnti); - RETVALUE(ret); - } - /* if ueCb is present */ - if (ueCb != NULLP) - { - rgSCHUtlUpdSch (subfrmInfo, cellCb, ueCb, pdu, err); - } - - RETVALUE(ROK); -} -#ifdef LTEMAC_SPS -/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the - * scheduler with the information of the received Data. - * - * @details - * - * Function: rgSCHUtlSpsRelInd - * - * Processing steps: - * TODO - * - * @param [in] RgSchCellCb *cellCb - * @param [in] RgSchUeCb *ueCb - * @param [in] Bool *isExplRel - * @param - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlSpsRelInd -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -Bool isExplRel -) -#else -PUBLIC S16 rgSCHUtlSpsRelInd (cellCb, ueCb, isExplRel) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -Bool isExplRel; -#endif -{ - TRC2(rgSCHUtlSpsRelInd); - cellCb->sc.apis->rgSCHUlSpsRelInd(cellCb, ueCb, isExplRel); - RETVALUE(ROK); -} /* end of rgSCHUtlSpsRelInd */ - - -/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the - * scheduler with the information of the received Data. - * - * @details - * - * Function: rgSCHUtlSpsActInd - * - * Processing steps: - * TODO - * - * @param [in] RgSchCellCb *cellCb - * @param [in] RgSchUeCb *ueCb - * @param [in] U16 spsSduSize - * @param - * @return S16 - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlSpsActInd -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -U16 spsSduSize -) -#else -PUBLIC S16 rgSCHUtlSpsActInd (cellCb, ueCb, spsSduSize) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -U16 spsSduSize; -#endif -{ - TRC2(rgSCHUtlSpsActInd); - cellCb->sc.apis->rgSCHUlSpsActInd(cellCb, ueCb, spsSduSize); - RETVALUE(ROK); -} /* end of rgSCHUtlSpsActInd */ - - -#endif /* LTEMAC_SPS */ - -#ifdef RG_PHASE_2 -/** - * @brief This API is invoked to send uplink group power control request to PHY. - * - * @details - * - * Function : rgSCHUtlTfuGrpPwrCntrlReq - * - * This API is invoked to send uplink group power control request to PHY. - * It fills in the Pst structure, spId value and invokes group power - * control request primitive at TFU. - * - * @param[in] TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlTfuGrpPwrCntrlReq -( -Inst inst, -S16 sapId, -TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq -) -#else -PUBLIC S16 rgSCHUtlTfuGrpPwrCntrlReq(inst, sapId, grpPwrCntrlReq) -Inst inst; -S16 sapId; -TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq; -#endif -{ - S16 ret; - RgSchLowSapCb *tfuSap; - Pst pst; - - TRC2(rgSCHUtlTfuGrpPwrCntrlReq); - - /* Get the lower SAP control block from the layer control block. */ - tfuSap = &(rgSchCb[inst].tfuSap[sapId]); - if (tfuSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,grpPwrCntrlReq->cellId, - "rgSCHUtlTfuGrpPwrCntrlReq() Lower SAP not bound (%d) ",tfuSap->sapSta.sapState); - RETVALUE(RFAILED); - } - cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst)); - if((ret = RgLiTfuGrpPwrCntrlReq (&pst, tfuSap->sapCfg.spId, grpPwrCntrlReq)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,grpPwrCntrlReq->cellId, - "rgSCHUtlTfuGrpPwrCntrlReq() Call to RgLiTfuGrpPwrCntrlReq() failed"); - } - RETVALUE(ret); -} /* rgSCHUtlTfuGrpPwrCntrlReq */ -#endif - -/** - * @brief This API is invoked to send Control Info to PHY. - * - * @details - * - * Function : rgSCHUtlTfuCntrlReq - * - * This API is invoked to send Control Info to PHY. It - * fills in the Pst structure, spId value and invokes Cntrl - * request primitive at TFU. - * - * @param[in] TfuCntrlReqInfo *cntrlReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlTfuCntrlReq -( -Inst inst, -S16 sapId, -TfuCntrlReqInfo *cntrlReq -) -#else -PUBLIC S16 rgSCHUtlTfuCntrlReq(inst, sapId, cntrlReq) -Inst inst; -S16 sapId; -TfuCntrlReqInfo *cntrlReq; -#endif -{ - S16 ret; - RgSchLowSapCb *tfuSap; - - TRC2(rgSCHUtlTfuCntrlReq) - - /* Get the lower SAP control block from the layer control block. */ - tfuSap = &(rgSchCb[inst].tfuSap[sapId]); - -#ifndef NO_ERRCLS - if (tfuSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuCntrlReq() Lower SAP not bound (%d) ", - tfuSap->sapSta.sapState); - RGSCH_FREE_MEM(cntrlReq); - RETVALUE(RFAILED); - } -#endif - - /* Using local variable for pst is unnecessary - for optimization */ - if((ret = RgLiTfuCntrlReq(&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, - cntrlReq)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuCntrlReq() Call to RgLiTfuCntrlReq() failed"); - } - RETVALUE(ret); -} /* rgSCHUtlTfuCntrlReq*/ - - -/* FOR ACK NACK REP */ - -/** - * @brief This API is invoked to tell the DL Scheduler to add the UE back into - * its scheduling queues. - * - * @details - * - * Function : rgSCHUtlDlActvtUe - * - * This API is invoked from Measurement gap moduled. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlDlActvtUe -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC S16 rgSCHUtlDlActvtUe(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlDlActvtUe); - cell->sc.apis->rgSCHActvtDlUe(cell, ue); - RETVALUE(ROK); -} - -/** - * @brief This API is invoked to tell the UL Scheduler to add the UE back into - * its scheduling queues. - * - * @details - * - * Function : rgSCHUtlUlActvtUe - * - * This API is invoked from Measurement gap moduled. - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUlActvtUe -( -RgSchCellCb *cell, -RgSchUeCb *ue -) -#else -PUBLIC S16 rgSCHUtlUlActvtUe(cell, ue) -RgSchCellCb *cell; -RgSchUeCb *ue; -#endif -{ - TRC2(rgSCHUtlUlActvtUe); - cell->sc.apis->rgSCHActvtUlUe(cell, ue); - RETVALUE(ROK); -} - -/** - * @brief This API is invoked to send Reception Request Info to PHY. - * - * @details - * - * Function : rgSCHUtlTfuRecpReq - * - * This API is invoked to send Reception Request Info to PHY. It - * fills in the Pst structure, spId value and invokes Reception - * request primitive at TFU. - * - * @param[in] TfuRecpReqInfo *recpReq - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlTfuRecpReq -( -Inst inst, -S16 sapId, -TfuRecpReqInfo *recpReq -) -#else -PUBLIC S16 rgSCHUtlTfuRecpReq(inst, sapId, recpReq) -Inst inst; -S16 sapId; -TfuRecpReqInfo *recpReq; -#endif -{ - S16 ret; - RgSchLowSapCb *tfuSap; - - TRC2(rgSCHUtlTfuRecpReq) - - /* Get the lower SAP control block from the layer control block. */ - tfuSap = &(rgSchCb[inst].tfuSap[sapId]); - -#ifndef NO_ERRCLS - if (tfuSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuRecpReq() Lower SAP not bound (%d) ", - tfuSap->sapSta.sapState); - RGSCH_FREE_MEM(recpReq); - RETVALUE(RFAILED); - } -#endif - - /* Using local variable for pst is unnecessary - for optimization */ - if((ret = RgLiTfuRecpReq(&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, - recpReq)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuRecpReq() Call to RgLiTfuRecpReq() failed"); - } - RETVALUE(ret); -} /* rgSCHUtlTfuRecpReq */ - - /** @brief This function Validates the SAP information received along with the - * primitive from the lower layer. - * - * Function: rgSCHUtlValidateTfuSap - * - * Validates SAP information. - * @param suId The SAP Id - * @return - * -# ROK - * -# RFAILED - */ -#ifdef ANSI -PUBLIC S16 rgSCHUtlValidateTfuSap -( -Inst inst, -SuId suId -) -#else -PUBLIC S16 rgSCHUtlValidateTfuSap(inst, suId) -Inst inst; -SuId suId; -#endif -{ - RgSchLowSapCb *tfuSap; - - TRC2(rgSCHUtlValidateTfuSap) - - if(suId >= rgSchCb[inst].numSaps) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Incorrect SuId"); - RETVALUE(RFAILED); - } - tfuSap = &(rgSchCb[inst].tfuSap[suId]); - - /* First lets check the suId */ - if( suId != tfuSap->sapCfg.suId) - { - RLOG_ARG2(L_ERROR,DBG_INSTID,inst,"Incorrect SuId. Configured (%d) Recieved (%d)", - tfuSap->sapCfg.suId, suId); - RETVALUE(RFAILED); - } - if (tfuSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"Lower SAP not enabled SuId (%d)", - tfuSap->sapCfg.suId); - RETVALUE(RFAILED); - } - RETVALUE(ROK); -} /* end of rgSCHUtlValidateTfuSap */ - -/* -* -* Fun: rgSCHUtlAllocEventMem -* -* Desc: This function allocates event memory -* -* Ret: ROK - on success -* RFAILED - on failure -* -* Notes: None -* -* File: rg_utl.c -* -*/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAllocEventMem -( -Inst inst, -Ptr *memPtr, -Size memSize -) -#else -PUBLIC S16 rgSCHUtlAllocEventMem(inst, memPtr, memSize) -Inst inst; -Ptr *memPtr; -Size memSize; -#endif -{ - Mem sMem; - VOLATILE U32 startTime=0; - - TRC2(rgSCHUtlAllocEventMem) - - sMem.region = rgSchCb[inst].rgSchInit.region; - sMem.pool = rgSchCb[inst].rgSchInit.pool; - -#if (ERRCLASS & ERRCLS_DEBUG) - if (memSize<= 0) - { - RGSCHLOGERROR(inst, ERRCLS_INT_PAR, ERG022, memSize, - "rgAllocEventMem(): memSize invalid\n"); - RETVALUE (RFAILED); - } -#endif /* ERRCLASS & ERRCLS_DEBUG */ - /*starting Task*/ - SStartTask(&startTime, PID_SCHUTL_CMALLCEVT); - -#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ - MS_BUF_ADD_ALLOC_CALLER(); -#endif /* */ -#ifdef TFU_ALLOC_EVENT_NO_INIT - if(ROK != cmAllocEvntNoInit(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr)) -#else - if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr)) -#endif /* */ - { - RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"cmAllocEvnt Failed."); - RETVALUE(RFAILED); - } - /*stoping Task*/ - SStopTask(startTime, PID_SCHUTL_CMALLCEVT); - RETVALUE(ROK); -} /* end of rgSCHUtlAllocEventMem*/ - -/* -* -* Fun: rgGetEventMem -* -* Desc: This function allocates event memory -* -* Ret: ROK - on success -* RFAILED - on failure -* -* Notes: None -* -* File: rg_utl.c -* -*/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetEventMem -( -Ptr *ptr, -Size len, -Ptr memCp -) -#else -PUBLIC S16 rgSCHUtlGetEventMem(ptr, len, memCp) -Ptr *ptr; -Size len; -Ptr memCp; -#endif -{ - S16 ret; - - TRC2(rgSCHUtlGetEventMem) -#ifdef TFU_ALLOC_EVENT_NO_INIT - ret = cmGetMemNoInit(memCp, len, (Ptr *)ptr); -#else - ret = cmGetMem(memCp, len, (Ptr *)ptr); -#endif - RETVALUE(ret); -} /* end of rgSCHUtlGetEventMem*/ - -#ifdef LTE_TDD - - -/** - * @brief Handler to allocate memory for ACK/NACk feedback information - * - * @details - * - * Function : rgSCHUtlAllocUeANFdbkInfo - * - * It allocates memory for the UE related ACK NACK information. - * - * @param[in] RgSchUeCb *ue - * @return S16 - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlAllocUeANFdbkInfo -( -RgSchUeCb *ue, -U8 servCellIdx -) -#else -PUBLIC S16 rgSCHUtlAllocUeANFdbkInfo(ue,servCellIdx) -RgSchUeCb *ue; -U8 servCellIdx; -#endif -{ - U8 idx; - - TRC2(rgSCHUtlAllocUeANFdbkInfo); - - if (rgSCHUtlAllocSBuf(ue->cell->instIdx, - (Data **) &(ue->cellInfo[servCellIdx]->anInfo), sizeof(RgSchTddANInfo) * \ - ue->cell->ackNackFdbkArrSize) != ROK) - { - RETVALUE(RFAILED); - } - - for(idx=0; idx < ue->cell->ackNackFdbkArrSize; idx++) - { - rgSCHUtlInitUeANFdbkInfo(&ue->cellInfo[servCellIdx]->anInfo[idx]); - } - - /* Set it to the first index */ - ue->cellInfo[servCellIdx]->nextFreeANIdx = 0; - RETVALUE(ROK); -} /* rgSCHUtlAllocUeANFdbkInfo */ - -/** - * @brief Handler to release memory for ACK/NACk feedback information - * - * @details - * - * Function : rgSCHUtlDelUeANFdbkInfo - * - * It releases memory for the UE related ACK NACK information. - * - * @param[in] RgSchUeCb *ue - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlDelUeANFdbkInfo -( -RgSchUeCb *ue, -U8 servCellIdx -) -#else -PUBLIC Void rgSCHUtlDelUeANFdbkInfo(ue,servCellIdx) -RgSchUeCb *ue; -U8 servCellIdx; -#endif -{ - TRC2(rgSCHUtlDelUeANFdbkInfo); - - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(ue->cell->instIdx, - (Data **)(&( ue->cellInfo[servCellIdx]->anInfo)), sizeof(RgSchTddANInfo) * \ - ue->cell->ackNackFdbkArrSize); - - RETVOID; -} /* rgSCHUtlDelUeANFdbkInfo */ - -/** - * @brief Handler to initialise UE ACK/NACk feedback information - * - * @details - * - * Function : rgSCHUtlInitUeANFdbkInfo - * - * It initialises UE related ACK NACK information. - * - * @param[in] RgSchTddANInfo *anFdInfo - * @return S16 - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlInitUeANFdbkInfo -( -RgSchTddANInfo *anFdInfo -) -#else -PUBLIC S16 rgSCHUtlInitUeANFdbkInfo(anFdInfo) -RgSchTddANInfo *anFdInfo; -#endif -{ - TRC2(rgSCHUtlInitUeANFdbkInfo); - - anFdInfo->sfn = RGSCH_MAX_SFN+1; /* defensively setting invalid sfn */ - anFdInfo->subframe = 0; - anFdInfo->ulDai = RG_SCH_INVALID_DAI_VAL; - anFdInfo->dlDai = RG_SCH_INVALID_DAI_VAL; - anFdInfo->latestMIdx = RG_SCH_INVALID_M_VAL; - - RETVALUE(ROK); -} /* rgSCHUtlInitUeANFdbkInfo */ - -/** - * @brief Handler to get UE related ACK NACK feedback information - * - * @details - * - * Function : rgSCHUtlGetUeANFdbkInfo - * - * It gets the UE related ACK NACK information based on - * SFN and subframe number. - * - * @param[in] RgSchUeCb *ueCb - * @param[in] CmLteTimingInfo *time - * @return RgSchTddANInfo* - **/ -#ifdef ANSI -PUBLIC RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo -( -RgSchUeCb *ueCb, -CmLteTimingInfo *timeInfo, -U8 servCellIdx -) -#else -PUBLIC RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo(ueCb, timeInfo,servCellIdx) -RgSchUeCb *ueCb; -CmLteTimingInfo *timeInfo; -U8 servCellIdx; -#endif -{ - U8 idx; - - TRC2(rgSCHUtlGetUeANFdbkInfo); - - for (idx = 0; idx < ueCb->cell->ackNackFdbkArrSize; ++idx) - { - if( (timeInfo->sfn == ueCb->cellInfo[servCellIdx]->anInfo[idx].sfn) && - (timeInfo->subframe == ueCb->cellInfo[servCellIdx]->anInfo[idx].subframe)) - { - RETVALUE(&ueCb->cellInfo[servCellIdx]->anInfo[idx]); - } - } - - RETVALUE(NULLP); -} /* rgSCHUtlGetUeANFdbkInfo */ - -/** - * @brief To get downlink subframe index - * - * @details - * - * Function: rgSCHUtlGetDlSfIdx - * Purpose: Gets downlink subframe index based on SFN and subframe no - * - * @param[in] CmLteTimingInfo *timeInfo - * @param[in] RgSchCellCb *cell - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC U8 rgSCHUtlGetDlSfIdx -( -RgSchCellCb *cell, -CmLteTimingInfo *timeInfo -) -#else -PUBLIC U8 rgSCHUtlGetDlSfIdx(cell, timeInfo) -RgSchCellCb *cell; -CmLteTimingInfo *timeInfo; -#endif -{ - U16 idx = 0; - TRC2(rgSCHUtlGetDlSfIdx); - - idx = RGSCH_NUM_SUB_FRAMES - \ - rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; - idx = ((idx * timeInfo->sfn) + \ - rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][timeInfo->subframe]) - 1; - idx = idx % cell->numDlSubfrms; - - RETVALUE((U8)idx); -} - -/** - * @brief To get the next downlink subframe - * - * @details - * - * Function: rgSCHUtlGetNxtDlSfInfo - * Purpose: Gets next downlink subframe based on current DL subframe - * - * @param[in] CmLteTimingInfo curDlTime - * @param[in] RgSchCellCb *cell - * @param[in] RgSchDlSf *dlSf - * @param[in] RgSchDlSf **nxtDlsf - * @param[in] CmLteTimingInfo *nxtDlTime - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlGetNxtDlSfInfo -( -CmLteTimingInfo curDlTime, -RgSchCellCb *cell, -RgSchDlSf *dlSf, -RgSchDlSf **nxtDlsf, -CmLteTimingInfo *nxtDlTime -) -#else -PUBLIC Void rgSCHUtlGetNxtDlSfInfo(curDlTime, cell, dlSf, nxtDlsf, nxtDlTime) -CmLteTimingInfo curDlTime; -RgSchCellCb *cell; -RgSchDlSf *dlSf; -RgSchDlSf **nxtDlsf; -CmLteTimingInfo *nxtDlTime; -#endif -{ - U16 idx = curDlTime.subframe; - U8 count = 0; - TRC2(rgSCHUtlGetNxtDlSfInfo); - - while(TRUE) - { - do - { - idx = (idx + 1) % RGSCH_NUM_SUB_FRAMES; - count++; - }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] - != RG_SCH_TDD_DL_SUBFRAME); - RG_SCH_ADD_TO_CRNT_TIME(curDlTime, (*nxtDlTime), count); - *nxtDlsf = rgSCHUtlSubFrmGet(cell, *nxtDlTime); - if(dlSf->dlFdbkInfo.subframe != (*nxtDlsf)->dlFdbkInfo.subframe) - { - break; - } - } - RETVOID; -} - -/** - * @brief To get the previous downlink subframe - * - * @details - * - * Function: rgSCHUtlGetPrevDlSfInfo - * Purpose: Gets previous downlink subframe based on current DL subframe - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteTimingInfo curDlTime - * @param[in] CmLteTimingInfo *prevDlTime - * @param[in] U8 *numSubfrm - * @return U8 - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlGetPrevDlSfInfo -( -RgSchCellCb *cell, -CmLteTimingInfo curDlTime, -CmLteTimingInfo *prevDlTime, -U8 *numSubfrm -) -#else -PUBLIC Void rgSCHUtlGetPrevDlSfInfo(cell, curDlTime, prevDlTime, numSubfrm) -RgSchCellCb *cell; -CmLteTimingInfo curDlTime; -CmLteTimingInfo *prevDlTime; -U8 *numSubfrm; -#endif -{ - S16 idx = curDlTime.subframe; - U8 count = 0; - TRC2(rgSCHUtlGetPrevDlSfInfo); - - do - { - idx--; - if(idx < 0) - { - idx = RGSCH_NUM_SUB_FRAMES-1; - } - count++; - }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] - != RG_SCH_TDD_DL_SUBFRAME); - *numSubfrm = count; - RGSCHDECRFRMCRNTTIME(curDlTime, (*prevDlTime), count); - RETVOID; -} - -#endif -/* Added Holes Management functions for Adaptive Re transmission */ -/******* : START *****/ -/*********************************************************** - * - * Func : rgSCHUtlUlSfInit - * - * Desc : UL subframe init. - * - * Ret : S16 - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUlSfInit -( -RgSchCellCb *cell, -RgSchUlSf *sf, -U8 idx, -U8 maxUePerSf -) -#else -PUBLIC S16 rgSCHUtlUlSfInit(cell, sf, idx, maxUePerSf) -RgSchCellCb *cell; -RgSchUlSf *sf; -U8 idx; -U8 maxUePerSf; -#endif -{ - S16 ret=ROK; - TRC2(rgSCHUtlUlSfInit); - - sf->idx = idx; -#ifdef RG_5GTF - U8 index; -#endif - -#ifdef LTE_TDD - if(cell->ulDlCfgIdx == 0) - { - /* Store the Uplink subframe number corresponding to the idx */ - sf->ulSfIdx = rgSchTddCfg0UlSfTbl[idx%6]; - } -#endif - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->allocDb, - sizeof(RgSchUlAllocDb)); - if (ret != ROK) - { - RETVALUE(ret); - } - ret = rgSCHUtlUlAllocDbInit(cell, sf->allocDb, maxUePerSf); - if (ret != ROK) - { - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), - sizeof(RgSchUlAllocDb)); - RETVALUE(ret); - } - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->holeDb, - sizeof(RgSchUlHoleDb)); - if (ret != ROK) - { - rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), - sizeof(RgSchUlAllocDb)); - RETVALUE(ret); - } - /* Initialize the hole with CFI 1 Pusch Bw Info */ - ret = rgSCHUtlUlHoleDbInit(cell, sf->holeDb, (U8)(maxUePerSf + 2), \ - 0, cell->dynCfiCb.bwInfo[1].numSb); - - if (ret != ROK) - { - rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), - sizeof(RgSchUlAllocDb)); - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)), - sizeof(RgSchUlHoleDb)); - RETVALUE(ret); - } - cmLListInit(&sf->reTxLst); - - /* Fix ccpu00120610*/ - sf->allocCountRef = &sf->allocDb->count; - - /* initialize UL available subbands for current sub-frame */ - sf->availSubbands = cell->dynCfiCb.bwInfo[1].numSb; -#ifdef RG_5GTF - sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; - sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; - for(index = 0; index < MAX_5GTF_BEAMS; index++) - { - sf->sfBeamInfo[index].totVrbgAllocated = 0; - sf->sfBeamInfo[index].totVrbgRequired = 0; - sf->sfBeamInfo[index].vrbgStart = 0; - } -#endif - - RETVALUE(ret); -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlSfDeinit - * - * Desc : Deinitialises a subframe - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlSfDeinit -( -RgSchCellCb *cell, -RgSchUlSf *sf -) -#else -PUBLIC Void rgSCHUtlUlSfDeinit(cell, sf) -RgSchCellCb *cell; -RgSchUlSf *sf; -#endif -{ - TRC2(rgSCHUtlUlSfDeinit); - if (sf->allocDb) - { - rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), - sizeof(RgSchUlAllocDb)); - } - if (sf->holeDb) - { - rgSCHUtlUlHoleDbDeinit(cell, sf->holeDb); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)), - sizeof(RgSchUlHoleDb)); - } - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocDbInit - * - * Desc : Initialise allocation DB - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHUtlUlAllocDbInit -( -RgSchCellCb *cell, -RgSchUlAllocDb *allocDb, -U8 maxAllocs -) -#else -PRIVATE S16 rgSCHUtlUlAllocDbInit(cell, allocDb, maxAllocs) -RgSchCellCb *cell; -RgSchUlAllocDb *allocDb; -U8 maxAllocs; -#endif -{ - S16 ret = rgSCHUtlUlAllocMemInit(cell, &allocDb->mem, maxAllocs); - TRC2(rgSCHUtlUlAllocDbInit); - if (ret != ROK) - { - RETVALUE(ret); - } - allocDb->count = 0; - allocDb->first = NULLP; - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocDbDeinit - * - * Desc : Deinitialises allocation DB - * sent to UE, for a UE with accumulation disabled - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHUtlUlAllocDbDeinit -( -RgSchCellCb *cell, -RgSchUlAllocDb *allocDb -) -#else -PRIVATE Void rgSCHUtlUlAllocDbDeinit(cell, allocDb) -RgSchCellCb *cell; -RgSchUlAllocDb *allocDb; -#endif -{ - TRC2(rgSCHUtlUlAllocDbDeinit); - rgSCHUtlUlAllocMemDeinit(cell, &allocDb->mem); - allocDb->count = 0; - allocDb->first = NULLP; - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleDbInit - * - * Desc : Initialise hole DB - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE S16 rgSCHUtlUlHoleDbInit -( -RgSchCellCb *cell, -RgSchUlHoleDb *holeDb, -U8 maxHoles, -U8 start, -U8 num -) -#else -PRIVATE S16 rgSCHUtlUlHoleDbInit(cell, holeDb, maxHoles, start, num) -RgSchCellCb *cell; -RgSchUlHoleDb *holeDb; -U8 maxHoles; -U8 start; -U8 num; -#endif -{ - S16 ret; - RgSchUlHole *hole = NULLP; - TRC2(rgSCHUtlUlHoleDbInit); - - ret = rgSCHUtlUlHoleMemInit(cell, &holeDb->mem, maxHoles, &hole); - if (ret != ROK) - { - RETVALUE(ret); - } - holeDb->count = 1; - holeDb->first = hole; - hole->start = start; - hole->num = num; - hole->prv = hole->nxt = NULLP; - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleDbDeinit - * - * Desc : Deinitialises hole DB - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE Void rgSCHUtlUlHoleDbDeinit -( -RgSchCellCb *cell, -RgSchUlHoleDb *holeDb -) -#else -PRIVATE Void rgSCHUtlUlHoleDbDeinit(cell, holeDb) -RgSchCellCb *cell; -RgSchUlHoleDb *holeDb; -#endif -{ - TRC2(rgSCHUtlUlHoleDbDeinit); - rgSCHUtlUlHoleMemDeinit(cell, &holeDb->mem); - holeDb->count = 0; - holeDb->first = NULLP; - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocGetHole - * - * Desc : Get allocation from hole - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetHole -( -RgSchUlSf *sf, -U8 numSb, -RgSchUlHole *hole -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetHole(sf, numSb, hole) -RgSchUlSf *sf; -U8 numSb; -RgSchUlHole *hole; -#endif -{ - TRC2(rgSCHUtlUlAllocGetHole); - if (numSb < hole->num) - { - RETVALUE(rgSCHUtlUlAllocGetPartHole(sf, numSb, hole)); - } - else - { - RETVALUE(rgSCHUtlUlAllocGetCompHole(sf, hole)); - } -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocGetCompHole - * - * Desc : Get an allocation corresponding to an entire hole - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole -( -RgSchUlSf *sf, -RgSchUlHole *hole -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole(sf, hole) -RgSchUlSf *sf; -RgSchUlHole *hole; -#endif -{ - RgSchUlAlloc *alloc; - /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */ - /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole - * updated, causing another check for prv */ - RgSchUlAlloc *prv = hole->prvAlloc; - RgSchUlAlloc *nxt = hole->nxtAlloc; - TRC2(rgSCHUtlUlAllocGetCompHole); - - if (prv) - { - if (hole->start == prv->nxtHole->start) - { - prv->nxtHole = NULLP; - } - alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv); - } - else - { - alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb); - } - - RGSCH_NULL_CHECK( 0, alloc); - alloc->prvHole = NULLP; - alloc->nxtHole = NULLP; - - alloc->sbStart = hole->start; - alloc->numSb = hole->num; - - if (nxt) - { - nxt->prvHole = NULLP; - } - - rgSCHUtlUlHoleRls(sf->holeDb, hole); - - /* UL_ALLOC_CHANGES*/ - alloc->allocDbRef = (void*)sf->allocDb; - alloc->holeDbRef = (void*)sf->holeDb; - RETVALUE(alloc); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocGetPartHole - * - * Desc : Get an allocation corresponding to a part of a hole. - * The initial 'numSb' part of the hole shall be taken - * away for this alloc. - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole -( -RgSchUlSf *sf, -U8 numSb, -RgSchUlHole *hole -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole(sf, numSb, hole) -RgSchUlSf *sf; -U8 numSb; -RgSchUlHole *hole; -#endif -{ - RgSchUlAlloc *alloc; - /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */ - /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole - * updated, causing another check for prv */ - RgSchUlAlloc *prv = hole->prvAlloc; - TRC2(rgSCHUtlUlAllocGetPartHole); - - if (prv) - { - if (hole->start == prv->nxtHole->start) - { - prv->nxtHole = NULLP; - } - alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv); - } - else - { - alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb); - } - - RGSCH_NULL_CHECK( 0, alloc); - alloc->prvHole = NULLP; - alloc->nxtHole = hole; - hole->prvAlloc = alloc; - - alloc->sbStart = hole->start; - alloc->numSb = numSb; - hole->start += numSb; - hole->num -= numSb; - - rgSCHUtlUlHoleDecr(sf->holeDb, hole); - - /* UL_ALLOC_CHANGES*/ - alloc->allocDbRef = (void*)sf->allocDb; - alloc->holeDbRef = (void*)sf->holeDb; - - RETVALUE(alloc); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocFirst - * - * Desc : Get first alloc in subframe - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocFirst -( -RgSchUlSf *sf -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocFirst(sf) -RgSchUlSf *sf; -#endif -{ - TRC2(rgSCHUtlUlAllocFirst); - RETVALUE(sf->allocDb->first); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocNxt - * - * Desc : Get next alloc - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocNxt -( -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocNxt(sf, alloc) -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlUlAllocNxt); - UNUSED(sf); - RETVALUE(alloc->nxt); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocGetAdjNxt - * - * Desc : Get alloc which is immediately after the passed one. - * 1. Gets alloc from mem. - * 2. Inserts alloc into list (between prv and - * prv->nxt, prv is not NULLP). - * 3. Increments alloc count. - * Note 1: Holes are not dealt with here. - * Note 2: Assumes prv to be NULL. - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt -( -RgSchUlAllocDb *db, -RgSchUlAlloc *prv -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt(db, prv) -RgSchUlAllocDb *db; -RgSchUlAlloc *prv; -#endif -{ - RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem); - RgSchUlAlloc *nxt = prv->nxt; - TRC2(rgSCHUtlUlAllocGetAdjNxt); - -#if (ERRCLASS & ERRCLS_DEBUG) - if ( alloc == NULLP ) - { - RETVALUE ( NULLP ); - } -#endif - alloc->prv = prv; - alloc->nxt = nxt; - prv->nxt = alloc; - if (nxt) - { - nxt->prv = alloc; - } - - ++db->count; - - RETVALUE(alloc); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocGetFirst - * - * Desc : Get alloc which is to be the first one in the alloc list - * 1. Gets alloc from mem. - * 2. Inserts alloc as first element into list. - * 3. Increments alloc count. - * Note 1: Holes are not dealt with here. - * Note 2: prv to necessarily NULLP. - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetFirst -( -RgSchUlAllocDb *db -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetFirst(db) -RgSchUlAllocDb *db; -#endif -{ - RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem); - RgSchUlAlloc *nxt = db->first; - TRC2(rgSCHUtlUlAllocGetFirst); - -#if (ERRCLASS & ERRCLS_DEBUG) - if ( alloc == NULLP ) - { - RETVALUE ( NULLP ); - } -#endif - - alloc->prv = NULLP; - alloc->nxt = nxt; - if (nxt) - { - nxt->prv = alloc; - } - db->first = alloc; - - ++db->count; - - RETVALUE(alloc); -} - -/* UL_ALLOC_ENHANCEMENT */ -/*********************************************************** - * - * Func : rgSCHUtlUlHoleAddAllocation - * - * Desc : On freeing an alloc, add to hole - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleAddAllocation -( -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleAddAllocation(alloc) -RgSchUlAlloc *alloc; -#endif -{ - /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as - * one, if such excessive branching is done (AllocNone, AllocNoPrv etc). - * The excessive branching is meant to utilise the knowledge of whether prv - * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt, - * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as - * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */ - RgSchUlHoleDb *db = alloc->holeDbRef; - RgSchUlHole *prv = alloc->prvHole; - RgSchUlHole *nxt = alloc->nxtHole; - TRC2(rgSCHUtlUlHoleAddAllocation); - - if (prv) - { - if (nxt) - { - rgSCHUtlUlHoleJoin(db, prv, nxt, alloc); - } - else - rgSCHUtlUlHoleExtndRight(db, prv, alloc); - } - else - { - if (nxt) - { - rgSCHUtlUlHoleExtndLeft(db, nxt, alloc); - } - else - rgSCHUtlUlHoleNew(db, alloc); - } - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocRelease - * - * Desc : Releases an uplink allocation, only take alloc ptr - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlAllocRelease -( -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlAllocRelease(alloc) -RgSchUlAlloc *alloc; -#endif -{ - RgSchUlAllocDb *allocDb = alloc->allocDbRef; - RgSchUlAlloc *prv = alloc->prv; - RgSchUlAlloc *nxt = alloc->nxt; - TRC2(rgSCHUtlUlAllocRelease); - - alloc->ue = NULLP; - alloc->raCb = NULLP; - alloc->isAdaptive = FALSE; - - if (prv) - { - prv->nxt = nxt; - if (nxt) /* general case: this allocation lies btw two */ - { - nxt->prv = prv; - } - } - else - { - allocDb->first = nxt; - if (nxt) - { - nxt->prv = NULLP; - } - } - --allocDb->count; - rgSCHUtlUlHoleAddAllocation(alloc); - rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc); - - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocRls - * - * Desc : Releases an uplink allocation - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlAllocRls -( -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlAllocRls(sf, alloc) -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - RgSchUlAllocDb *allocDb = sf->allocDb; - RgSchUlAlloc *prv = alloc->prv; - RgSchUlAlloc *nxt = alloc->nxt; - TRC2(rgSCHUtlUlAllocRls); - - alloc->ue = NULLP; - alloc->raCb = NULLP; - alloc->isAdaptive = FALSE; - - if(allocDb->count) - { - if (prv) - { - prv->nxt = nxt; - if (nxt) /* general case: this allocation lies btw two */ - { - nxt->prv = prv; - } - } - else - { - allocDb->first = nxt; - if (nxt) - { - nxt->prv = NULLP; - } - } - --allocDb->count; - rgSCHUtlUlHoleAddAlloc(sf, alloc); - rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc); - } - else - { - - printf("\nError: allocDb->count is ZERO ====\n"); - } - - //printf("\nallocDb->count:%u\n",allocDb->count); - - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleFirst - * - * Desc : Get first (largest) hole - * - * Ret : RgSchUlHole * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlHole *rgSCHUtlUlHoleFirst -( -RgSchUlSf *sf -) -#else -PUBLIC RgSchUlHole *rgSCHUtlUlHoleFirst(sf) -RgSchUlSf *sf; -#endif -{ - TRC2(rgSCHUtlUlHoleFirst); - RETVALUE(sf->holeDb->first); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleNxt - * - * Desc : Get next largest hole - * - * Ret : RgSchUlHole * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlHole *rgSCHUtlUlHoleNxt -( -RgSchUlSf *sf, -RgSchUlHole *hole -) -#else -PUBLIC RgSchUlHole *rgSCHUtlUlHoleNxt(sf, hole) -RgSchUlSf *sf; -RgSchUlHole *hole; -#endif -{ - TRC2(rgSCHUtlUlHoleNxt); - UNUSED(sf); - RETVALUE(hole->nxt); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleAddAlloc - * - * Desc : On freeing an alloc, add to hole - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleAddAlloc -( -RgSchUlSf *sf, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleAddAlloc(sf, alloc) -RgSchUlSf *sf; -RgSchUlAlloc *alloc; -#endif -{ - /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as - * one, if such excessive branching is done (AllocNone, AllocNoPrv etc). - * The excessive branching is meant to utilise the knowledge of whether prv - * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt, - * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as - * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */ - RgSchUlHoleDb *db = sf->holeDb; - RgSchUlHole *prv = alloc->prvHole; - RgSchUlHole *nxt = alloc->nxtHole; - TRC2(rgSCHUtlUlHoleAddAlloc); - - if (prv) - { - if (nxt) - { - rgSCHUtlUlHoleJoin(db, prv, nxt, alloc); - } - else - rgSCHUtlUlHoleExtndRight(db, prv, alloc); - } - else - { - if (nxt) - { - rgSCHUtlUlHoleExtndLeft(db, nxt, alloc); - } - else - rgSCHUtlUlHoleNew(db, alloc); - } - - /* increment the number of subbands getting freed to total available list */ - sf->availSubbands += alloc->numSb; - - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleJoin - * - * Desc : Join two holes (due to alloc being deleted) - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleJoin -( -RgSchUlHoleDb *db, -RgSchUlHole *prv, -RgSchUlHole *nxt, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleJoin(db, prv, nxt, alloc) -RgSchUlHoleDb *db; -RgSchUlHole *prv; -RgSchUlHole *nxt; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlUlHoleJoin); - prv->num += alloc->numSb + nxt->num; - rgSCHUtlUlHoleRls(db, nxt); - rgSCHUtlUlHoleIncr(db, prv); - rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt); - - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleExtndRight - * - * Desc : Extend hole due to alloc coming 'after' the hole - * being deleted - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleExtndRight -( -RgSchUlHoleDb *db, -RgSchUlHole *prv, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleExtndRight(db, prv, alloc) -RgSchUlHoleDb *db; -RgSchUlHole *prv; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlUlHoleExtndRight); - prv->num += alloc->numSb; - rgSCHUtlUlHoleIncr(db, prv); - rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt); - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleExtndLeft - * - * Desc : Extend hole due to alloc coming 'before' the hole - * being deleted - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleExtndLeft -( -RgSchUlHoleDb *db, -RgSchUlHole *nxt, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleExtndLeft(db, nxt, alloc) -RgSchUlHoleDb *db; -RgSchUlHole *nxt; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlUlHoleExtndLeft); - nxt->num += alloc->numSb; - nxt->start = alloc->sbStart; - rgSCHUtlUlHoleIncr(db, nxt); - rgSCHUtlUlHoleUpdAllocLnks(nxt, alloc->prv, alloc->nxt); - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleNew - * - * Desc : Create new hole due to alloc being deleted - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleNew -( -RgSchUlHoleDb *db, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlHoleNew(db, alloc) -RgSchUlHoleDb *db; -RgSchUlAlloc *alloc; -#endif -{ - RgSchUlHole *hole = rgSCHUtlUlHoleMemGet(&db->mem); -#if (ERRCLASS & ERRCLS_DEBUG) - if ( hole == NULLP ) - { - RETVOID; - } -#endif - TRC2(rgSCHUtlUlHoleNew); - hole->start = alloc->sbStart; - hole->num = alloc->numSb; - ++db->count; - rgSCHUtlUlHoleIns(db, hole); - rgSCHUtlUlHoleUpdAllocLnks(hole, alloc->prv, alloc->nxt); - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleUpdAllocLnks - * - * Desc : Update alloc links in hole - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleUpdAllocLnks -( -RgSchUlHole *hole, -RgSchUlAlloc *prvAlloc, -RgSchUlAlloc *nxtAlloc -) -#else -PUBLIC Void rgSCHUtlUlHoleUpdAllocLnks(hole, prvAlloc, nxtAlloc) -RgSchUlHole *hole; -RgSchUlAlloc *prvAlloc; -RgSchUlAlloc *nxtAlloc; -#endif -{ - TRC2(rgSCHUtlUlHoleUpdAllocLnks); - if (prvAlloc) - { - prvAlloc->nxtHole = hole; - } - if (nxtAlloc) - { - nxtAlloc->prvHole = hole; - } - hole->prvAlloc = prvAlloc; - hole->nxtAlloc = nxtAlloc; - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleIns - * - * Desc : Insert (newly created) hole in sorted list of holes. - * Searches linearly, beginning with the largest hole. - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleIns -( -RgSchUlHoleDb *db, -RgSchUlHole *hole -) -#else -PUBLIC Void rgSCHUtlUlHoleIns(db, hole) -RgSchUlHoleDb *db; -RgSchUlHole *hole; -#endif -{ - RgSchUlHole *cur; - TRC2(rgSCHUtlUlHoleIns); - - if ((cur = db->first) != NULLP) - { - RgSchUlHole *nxt; - if (cur->num < hole->num) - { - /* Add at front */ - hole->nxt = cur; - cur->prv = hole; - db->first = hole; - hole->prv = NULLP; - RETVOID; - } - - for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt) - { - if (nxt->num < hole->num) - { - /* Insert hole: cur <-> hole <-> nxt */ - cur->nxt = hole; - hole->prv = cur; - hole->nxt = nxt; - nxt->prv = hole; - RETVOID; - } - } - - /* Add at end */ - cur->nxt = hole; - hole->prv = cur; - hole->nxt = NULLP; - RETVOID; - } - - /* This is the first hole */ - db->first = hole; - hole->prv = NULLP; /* may not be needed */ - hole->nxt = NULLP; - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleIncr - * - * Desc : hole->num has increeased, reposition in sorted - * list if needed - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleIncr -( -RgSchUlHoleDb *db, -RgSchUlHole *hole -) -#else -PUBLIC Void rgSCHUtlUlHoleIncr(db, hole) -RgSchUlHoleDb *db; -RgSchUlHole *hole; -#endif -{ - RgSchUlHole *cur; - TRC2(rgSCHUtlUlHoleIncr); - - if ((cur = hole->prv) != NULLP) - { - RgSchUlHole *prv; - - if (cur->num > hole->num) - { - RETVOID; - } - - /* Remove hole from current position */ - cur->nxt = hole->nxt; - if (hole->nxt) - { - hole->nxt->prv = cur; - } - - for (prv = cur->prv; prv; cur = prv, prv = prv->prv) - { - if (prv->num > hole->num) - { - /* Insert hole: prv <-> hole <-> cur */ - prv->nxt = hole; - hole->prv = prv; - hole->nxt = cur; - cur->prv = hole; - RETVOID; - } - } - - /* Add at front */ - hole->nxt = cur; - cur->prv = hole; - db->first = hole; - hole->prv = NULLP; - RETVOID; - } - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleDecr - * - * Desc : hole->num has decreeased, reposition in sorted - * list if needed - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleDecr -( -RgSchUlHoleDb *db, -RgSchUlHole *hole -) -#else -PUBLIC Void rgSCHUtlUlHoleDecr(db, hole) -RgSchUlHoleDb *db; -RgSchUlHole *hole; -#endif -{ - RgSchUlHole *cur; - TRC2(rgSCHUtlUlHoleDecr); - - if ((cur = hole->nxt) != NULLP) - { - RgSchUlHole *nxt; - - if (cur->num < hole->num) - { - RETVOID; - } - - /* Remove hole from current position */ - cur->prv = hole->prv; - if (hole->prv) - { - hole->prv->nxt = cur; - } - else /* no prv, so cur to replace hole as first in list */ - { - db->first = cur; - } - - for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt) - { - if (nxt->num < hole->num) - { - /* Insert hole: cur <-> hole <-> nxt */ - cur->nxt = hole; - hole->prv = cur; - hole->nxt = nxt; - nxt->prv = hole; - RETVOID; - } - } - - /* Add at end */ - cur->nxt = hole; - hole->prv = cur; - hole->nxt = NULLP; - RETVOID; - } - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleRls - * - * Desc : Releases hole. - * 1. Decrements hole count. - * 2. Deletes hole from list. - * 3. Frees hole (hole memory release). - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleRls -( -RgSchUlHoleDb *db, -RgSchUlHole *hole -) -#else -PUBLIC Void rgSCHUtlUlHoleRls(db, hole) -RgSchUlHoleDb *db; -RgSchUlHole *hole; -#endif -{ - RgSchUlHole *prv = hole->prv; - RgSchUlHole *nxt = hole->nxt; - TRC2(rgSCHUtlUlHoleRls); - - --db->count; - if (prv) - { - prv->nxt = nxt; - if (nxt) - { - nxt->prv = prv; - } - } - else - { - db->first = nxt; - if (nxt) - { - nxt->prv = NULLP; - } - } - - rgSCHUtlUlHoleMemRls(&db->mem, hole); - RETVOID; -} - - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocMemInit - * - * Desc : Initialises alloc free pool - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUlAllocMemInit -( -RgSchCellCb *cell, -RgSchUlAllocMem *mem, -U8 maxAllocs -) -#else -PUBLIC S16 rgSCHUtlUlAllocMemInit(cell, mem, maxAllocs) -RgSchCellCb *cell; -RgSchUlAllocMem *mem; -U8 maxAllocs; -#endif -{ - S16 ret; - RgSchUlAlloc *allocs; - TRC2(rgSCHUtlUlAllocMemInit); - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&allocs, - maxAllocs * sizeof(*allocs)); - if (ret != ROK) - { - RETVALUE(ret); - } - mem->allocs = allocs; - mem->maxAllocs = maxAllocs; - if (mem->maxAllocs == 1) - { - allocs[0].prv = NULLP; - allocs[0].nxt = NULLP; - } - else - { - U8 i; - allocs[0].prv = NULLP; - allocs[0].nxt = &allocs[1]; - for (i = 1; i < mem->maxAllocs - 1; ++i) - { - allocs[i].prv = &allocs[i-1]; - allocs[i].nxt = &allocs[i+1]; - } - allocs[i].prv = &allocs[i-1]; - allocs[i].nxt = NULLP; - } - mem->firstFree = &allocs[0]; - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocMemDeinit - * - * Desc : Deinitialises alloc free pool - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlAllocMemDeinit -( -RgSchCellCb *cell, -RgSchUlAllocMem *mem -) -#else -PUBLIC Void rgSCHUtlUlAllocMemDeinit(cell, mem) -RgSchCellCb *cell; -RgSchUlAllocMem *mem; -#endif -{ - TRC2(rgSCHUtlUlAllocMemDeinit); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->allocs)), - mem->maxAllocs * sizeof(*mem->allocs)); - mem->maxAllocs = 0; - mem->firstFree = NULLP; - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleMemInit - * - * Desc : Initialises hole free pool. Assumes maxHoles - * to be at least 2. - * - * Ret : S16 (ROK/RFAILED) - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUlHoleMemInit -( -RgSchCellCb *cell, -RgSchUlHoleMem *mem, -U8 maxHoles, -RgSchUlHole **holeRef -) -#else -PUBLIC S16 rgSCHUtlUlHoleMemInit(cell, mem, maxHoles, holeRef) -RgSchCellCb *cell; -RgSchUlHoleMem *mem; -U8 maxHoles; -RgSchUlHole **holeRef; -#endif -{ - S16 ret; - RgSchUlHole *holes; - TRC2(rgSCHUtlUlHoleMemInit); - - ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&holes, - maxHoles * sizeof(*holes)); - if (ret != ROK) - { - RETVALUE(ret); - } - - mem->holes = holes; - mem->maxHoles = maxHoles; - - /* first hole is taken up */ - holes[0].prv = NULLP; /* not needed */ - holes[0].nxt = NULLP; /* not needed */ - *holeRef = &holes[0]; - - if (mem->maxHoles == 2) - { - holes[1].prv = NULLP; /* may not be needed */ - holes[1].nxt = NULLP; /* may not be needed */ - } - else - { - U8 i; - holes[1].prv = NULLP; - holes[0].nxt = &holes[1]; - for (i = 1; i < mem->maxHoles - 1; ++i) - { - holes[i].prv = &holes[i-1]; - holes[i].nxt = &holes[i+1]; - } - holes[i].prv = &holes[i-1]; - holes[i].nxt = NULLP; - } - mem->firstFree = &holes[1]; - - RETVALUE(ROK); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleMemDeinit - * - * Desc : Deinitialises hole free pool - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleMemDeinit -( -RgSchCellCb *cell, -RgSchUlHoleMem *mem -) -#else -PUBLIC Void rgSCHUtlUlHoleMemDeinit(cell, mem) -RgSchCellCb *cell; -RgSchUlHoleMem *mem; -#endif -{ - TRC2(rgSCHUtlUlHoleMemDeinit); - /* ccpu00117052 - MOD - Passing double pointer - for proper NULLP assignment*/ - rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->holes)), - mem->maxHoles * sizeof(*mem->holes)); - mem->maxHoles = 0; - mem->firstFree = NULLP; - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocMemGet - * - * Desc : Gets an 'alloc' from the free pool - * - * Ret : RgSchUlAlloc * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocMemGet -( -RgSchUlAllocMem *mem -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocMemGet(mem) -RgSchUlAllocMem *mem; -#endif -{ - RgSchUlAlloc *alloc; - TRC2(rgSCHUtlUlAllocMemGet); - -#if (ERRCLASS & ERRCLS_DEBUG) - if (mem->firstFree == NULLP) - { - RETVALUE(NULLP); - } -#endif - - alloc = mem->firstFree; - mem->firstFree = alloc->nxt; - alloc->nxt = NULLP; /* probably not needed */ - /* alloc->prv might already be NULLP, in case was needed to set it to NULLP */ - - RETVALUE(alloc); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlAllocMemRls - * - * Desc : Returns an 'alloc' to the free pool - * - * Ret : - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlAllocMemRls -( -RgSchUlAllocMem *mem, -RgSchUlAlloc *alloc -) -#else -PUBLIC Void rgSCHUtlUlAllocMemRls(mem, alloc) -RgSchUlAllocMem *mem; -RgSchUlAlloc *alloc; -#endif -{ - TRC2(rgSCHUtlUlAllocMemRls); - alloc->prv = NULLP; - - alloc->nxt = mem->firstFree; - if (mem->firstFree != NULLP) - { - mem->firstFree->prv = alloc; - } - mem->firstFree = alloc; - RETVOID; -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleMemGet - * - * Desc : Gets a 'hole' from the free pool - * - * Ret : RgSchUlHole * - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC RgSchUlHole *rgSCHUtlUlHoleMemGet -( -RgSchUlHoleMem *mem -) -#else -PUBLIC RgSchUlHole *rgSCHUtlUlHoleMemGet(mem) -RgSchUlHoleMem *mem; -#endif -{ - RgSchUlHole *hole; - TRC2(rgSCHUtlUlHoleMemGet); - -#if (ERRCLASS & ERRCLS_DEBUG) - if (mem->firstFree == NULLP) - { - RETVALUE(NULLP); - } -#endif - - hole = mem->firstFree; - mem->firstFree = hole->nxt; - mem->firstFree->prv = NULLP; /* may not be needed, under error class */ - hole->nxt = NULLP; /* probably not needed */ - /* hole->prv is might already be NULLP, in case was needed to set it to NULLP */ - - RETVALUE(hole); -} - -/*********************************************************** - * - * Func : rgSCHUtlUlHoleMemRls - * - * Desc : Returns a 'hole' to the free pool - * - * Ret : Void - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUlHoleMemRls -( -RgSchUlHoleMem *mem, -RgSchUlHole *hole -) -#else -PUBLIC Void rgSCHUtlUlHoleMemRls(mem, hole) -RgSchUlHoleMem *mem; -RgSchUlHole *hole; -#endif -{ - TRC2(rgSCHUtlUlHoleMemRls); - hole->prv = NULLP; - - hole->nxt = mem->firstFree; - if (mem->firstFree != NULLP) - { - mem->firstFree->prv = hole; - } - mem->firstFree = hole; - RETVOID; -} - -/** - * @brief Get an alloc from the specified position in the BW. - * - * @details - * - * Function : rgSCHUtlUlGetSpfcAlloc - * - * - Return an alloc from the specified position in the BW. - * Note: This function assumes there is always a hole - * Existing which completely has the specified - * allocation. The reason for such an assumption is - * the function's usage as of now guarantees that there - * will always be such hole. And also for efficiency. - * - * @param[in] RgSchUlSf *sf - * @param[in] U8 startSb - * @param[in] U8 numSb - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc -( -RgSchUlSf *sf, -U8 startSb, -U8 numSb -) -#else -PUBLIC RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc(sf, startSb, numSb) -RgSchUlSf *sf; -U8 startSb; -U8 numSb; -#endif -{ - RgSchUlHole *hole, *nxtHole; - RgSchUlAlloc *alloc = NULLP; - TRC2(rgSCHUtlUlGetSpfcAlloc); - - if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) - { - RETVALUE(NULLP); - } - do - { - nxtHole = rgSCHUtlUlHoleNxt(sf, hole); - if ((startSb >= hole->start) && - (startSb+numSb <= hole->start+hole->num)) - { - if (startSb != hole->start) - { - /* Create a new hole to accomodate Subbands between - * hole start and req alloc start */ - RgSchUlHole *newHole = rgSCHUtlUlHoleMemGet(&(sf->holeDb->mem)); - -#if (ERRCLASS & ERRCLS_DEBUG) - if ( newHole == NULLP ) - { - RETVALUE( NULLP ); - } -#endif - newHole->start = hole->start; - newHole->num = startSb - hole->start; - hole->start = startSb; - /* [ccpu00122847]-MOD- Correctly updating the hole->num */ - hole->num -= newHole->num; - ++(sf->holeDb->count); - rgSCHUtlUlHoleIns(sf->holeDb, newHole); - newHole->prvAlloc = hole->prvAlloc; - if (newHole->prvAlloc) - { - newHole->prvAlloc->nxtHole = newHole; - } - if (numSb == hole->num) - { - alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); - } - else - { - alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); - } - alloc->prvHole = newHole; - newHole->nxtAlloc = alloc; - } - else /* Hole start and req alloc start are same */ - { - if (numSb == hole->num) - { - alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); - } - else - { - alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); - } - } - break; - } - } while ((hole = nxtHole) != NULLP); - RETVALUE(alloc); -} -#ifdef LTE_L2_MEAS -/** - * @brief Validates the qci values - * - * @details - * - * Function :rgSCHUtlValidateQci - * - * @param[in] RgSchCellCb *cellCb - * @param[in] U8 numQci - * @param[out] U8 *qci - * @return S16 - * ROK - * RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHUtlValidateQci -( -RgSchCellCb *cellCb, -U8 numQci, -U8 *qci -) -#else -PRIVATE S16 rgSCHUtlValidateQci(cellCb, numQci, qci) -RgSchCellCb *cellCb; -U8 numQci; -U8 *qci; -#endif -{ - U8 qciIdx; - U8 qciVal; - - TRC3(rgSCHUtlValidateQci) - - for(qciIdx = 0; qciIdx < numQci; qciIdx++) - { - qciVal = qci[qciIdx]; - if(qciVal == 0 || qciVal > 9) - { - RETVALUE(RFAILED); - } - if(qciVal != cellCb->qciArray[qciVal].qci) - { - RETVALUE(RFAILED); - } - } - - RETVALUE(ROK); -}/* rgSCHUtlValidateQci */ -/** - * @brief Validates the measurement request parameters. - * - * @details - * - * Function :rgSCHUtlValidateMeasReq - * - * @param[in] RgSchCellCb *cellCb - * @param[in] LrgSchMeasReqInfo *schL2MeasInfo - * @param[out] RgSchErrInfo *err - * @return RgSchUlAlloc* - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlValidateMeasReq -( -RgSchCellCb *cellCb, -LrgSchMeasReqInfo *schL2MeasInfo, -RgSchErrInfo *err -) -#else -PUBLIC S16 rgSCHUtlValidateMeasReq(cellCb, schL2MeasInfo, err) -RgSchCellCb *cellCb; -LrgSchMeasReqInfo *schL2MeasInfo; -RgSchErrInfo *err; -#endif -{ - U16 measType; - S16 ret; - - TRC3(rgSCHUtlValidateMeasReq) - - measType = schL2MeasInfo->measType; - - if((measType == 0) || - measType > 2047) - { - err->errType = RGSCHERR_SCH_INVALID_MEAS_TYPE; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - if((schL2MeasInfo->timePrd !=0) && - (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) && - ((schL2MeasInfo->avgPrbQciDl.numQci > LRG_MAX_QCI_PER_REQ)|| - (schL2MeasInfo->avgPrbQciDl.numQci == 0))) - { - err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - if((schL2MeasInfo->timePrd !=0) && - (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) && - (schL2MeasInfo->avgPrbQciUl.numQci > LRG_MAX_QCI_PER_REQ)) - { - err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL) && - ((schL2MeasInfo->nmbActvUeQciDl.numQci > LRG_MAX_QCI_PER_REQ) || - (schL2MeasInfo->nmbActvUeQciDl.sampPrd == 0)|| - ((schL2MeasInfo->timePrd !=0)&& - (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciDl.sampPrd)) || - (schL2MeasInfo->nmbActvUeQciDl.sampPrd > LRG_MAX_SAMP_PRD))) - { - err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL) && - ((schL2MeasInfo->nmbActvUeQciUl.numQci > LRG_MAX_QCI_PER_REQ) || - (schL2MeasInfo->nmbActvUeQciUl.sampPrd == 0)|| - ((schL2MeasInfo->timePrd !=0) && - (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciUl.sampPrd)) || - (schL2MeasInfo->nmbActvUeQciUl.sampPrd > LRG_MAX_SAMP_PRD))) - { - err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - if((schL2MeasInfo->timePrd !=0) && - (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)) - { - RGSCH_ARRAY_BOUND_CHECK(cellCb->instIdx, schL2MeasInfo->avgPrbQciDl.qci, \ - (schL2MeasInfo->avgPrbQciDl.numQci)); - ret = rgSCHUtlValidateQci(cellCb, schL2MeasInfo->avgPrbQciDl.numQci, - schL2MeasInfo->avgPrbQciDl.qci); - if(ret != ROK) - { - err->errType = RGSCHERR_SCH_INVALID_QCI_VAL; - err->errCause = RGSCHERR_SCH_L2MEAS; - RETVALUE(RFAILED); - } - } - RETVALUE(ROK); -}/* rgSCHUtlValidateMeasReq */ -#endif /* LTE_L2_MEAS */ -/******* : END *****/ -#ifdef RGR_SI_SCH -/** - * @brief API for sending SI configuration confirm from Scheduler to RRM - * - * @details - * - * Function: rgSCHUtlRgrSiCfgCfm - * - * This API is invoked to send SI configuration confirm from Scheduler - * to RRM. - * This API fills in Pst structure and SAP Ids and invokes - * config confirm API towards RRM. - * - * @param[in] RgrCfgTransId transId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrSiCfgCfm -( -Inst instId, -SpId spId, -RgrCfgTransId transId, -U8 status -) -#else -PUBLIC S16 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, status) -Inst instId; -SpId spId; -RgrCfgTransId transId; -U8 status; -#endif -{ - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - - TRC2(rgSCHUtlRgrSiCfgCfm) - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if(RgUiRgrSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst, - rgSchCb[instId].rgrSap[spId].sapCfg.suId, - transId, status) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrSiCfgCfm: " - "RgUiRgrSiCfgCfm Failed "); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHUtlRgrSiCfgCfm */ - - -/** - * @brief API for sending Warning SI configuration confirm from - * Scheduler to RRM - * - * @details - * - * - * This API is invoked to send Warning SI configuration confirm - * from Scheduler to RRM. - * This API fills in Pst structure and SAP Ids and invokes - * config confirm API towards RRM. - * - * @param[in] RgrCfgTransId transId - * @param[in] U8 status - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrWarningSiCfgCfm -( -Inst instId, -SpId spId, -U8 siId, -RgrCfgTransId transId, -U8 status -) -#else -PUBLIC S16 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, siId, transId, status) -Inst instId; -SpId spId; -U8 siId; -RgrCfgTransId transId; -U8 status; -#endif -{ - U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; - - TRC2(rgSCHUtlRgrWarningSiCfgCfm) - - cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); - prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; - - - if(RgUiRgrWarningSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst, - rgSchCb[instId].rgrSap[spId].sapCfg.suId, - transId, siId, status) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrSiCfgCfm: " - "RgUiRgrSiCfgCfm Failed "); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); -} /* rgSCHUtlRgrWarningSiCfgCfm */ - -/*********************************************************** - * - * Func : rgSCHUtlPutSiInfo - * - * Desc : Utility Function to deallocate SI information - * - * - * RFAILED - * - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC Void rgSCHUtlPutSiInfo -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHUtlPutSiInfo(cell) -RgSchCellCb *cell; -#endif -{ - U8 idx = 0; - U32 sizeOfSiInfo = 0; - TRC2(rgSCHUtlPutSiInfo) - /*Free the buffers in crntSiInfo*/ - RGSCH_FREE_MSG(cell->siCb.crntSiInfo.mib) - RGSCH_FREE_MSG(cell->siCb.crntSiInfo.sib1Info.sib1) - - sizeOfSiInfo = sizeof(cell->siCb.crntSiInfo.siInfo)/sizeof(cell->siCb.crntSiInfo.siInfo[0]); - - for(idx=0; idx < sizeOfSiInfo; idx++) - { - RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si) - } - - /*Free the buffers in newSiInfo */ - RGSCH_FREE_MSG(cell->siCb.newSiInfo.mib) - RGSCH_FREE_MSG(cell->siCb.newSiInfo.sib1Info.sib1) - - sizeOfSiInfo = sizeof(cell->siCb.newSiInfo.siInfo)/sizeof(cell->siCb.newSiInfo.siInfo[0]); - - for(idx=0; idx < sizeOfSiInfo; idx++) - { - RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[idx].si) - } - - RETVOID; -} -#endif /*RGR_SI_SCH */ - - - -/*********************************************************** - * - * Func : rgSCHUtlGetDrxSchdUesInDl - * - * Desc : Utility Function to fill the get the list of - * scheduled UEs. On these UE's, drx-inactivity - * timer will be started/restarted. - * - * Ret : ROK - * RFAILED - * - * Notes: - * - * File : rg_utl.c - * - **********************************************************/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlGetDrxSchdUesInDl -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb, -RgSchDlHqProcCb *dlHq, -RgInfUeAlloc *allocInfo, -CmLListCp *dlDrxInactvTmrLst, -CmLListCp *dlInActvLst, -CmLListCp *ulInActvLst -) -#else -PUBLIC S16 rgSCHUtlGetDrxSchdUesInDl(cellCb, ueCb, dlHq, allocInfo, dlDrxInactvTmrLst, dlInActvLst, ulInActvLst) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -RgSchDlHqProcCb *dlHq; -RgInfUeAlloc *allocInfo; -CmLListCp *dlDrxInactvTmrLst; -CmLListCp *dlInActvLst; -CmLListCp *ulInActvLst; -#endif -{ - Bool isNewTx = FALSE; - U8 idx; - RgSchDrxDlHqProcCb *drxHq; - RgSchDRXCellCb *drxCell = cellCb->drxCb; - RgSchDrxUeCb *drxUe; -#ifdef DEBUGP - Inst inst = cellCb->instIdx; -#endif - U8 cellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)]; - U32 dlInactvMask; - U32 ulInactvMask; - - for(idx = 0; idx < allocInfo->nmbOfTBs; idx++) - { - if(allocInfo->tbInfo[idx].isReTx == FALSE) - { - isNewTx = TRUE; - /* Removing break here, since in 2 TB case if 2nd TB is proceeding with - retx then drxretx timer should be stopped.*/ - } - else - { - /*Stop the DRX retransmission timer as UE scheduled for retx. Here - * we stop the timer and inactivate the UE for both UL and DL. - * This may result in loss of one subframe for UL but this trade - * off is taken to avoid the overhead of maintaining a list of UEs - * to be inactivated in the next subframe.*/ - drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq); - drxUe = RG_SCH_DRX_GET_UE(ueCb); - if(drxHq->reTxIndx != DRX_INVALID) - { - /* This condition should never occur */ - if(drxHq->reTxIndx >= RG_SCH_MAX_DRXQ_SIZE) - { - RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"[%d]UE:DRXUE RETX IDX[%d]" - "is out of bound,dlInactvMask %d,procId %d\n", ueCb->ueId, - drxHq->reTxIndx,ueCb->dl.dlInactvMask, dlHq->procId)); - } - - drxUe->drxDlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId); - drxUe->drxUlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId); - - dlInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId; - ulInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId; - - for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) - { - dlInactvMask &= drxUe->drxDlInactvMaskPerCell[cellIdx]; - ulInactvMask &= drxUe->drxUlInactvMaskPerCell[cellIdx]; - } - - drxUe->drxDlInactvMask |= dlInactvMask; - drxUe->drxUlInactvMask |= ulInactvMask; - - /* if no other condition is keeping ue active, - * inactivate the Ue - */ - if(!RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe)) - { - /* BUG 2 : HARQ_RTT, changed for consistency */ - ueCb->dl.dlInactvMask |= (RG_DRX_INACTIVE); - - /* Add to DL inactive list */ - cmLListAdd2Tail(dlInActvLst,&(ueCb->dlDrxInactvLnk)); - ueCb->dlDrxInactvLnk.node = (PTR)ueCb; - } - - if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe)) - { - /*BUG 2: HARQ_RTT changed for consistency */ - ueCb->ul.ulInactvMask |= (RG_DRX_INACTIVE); - - cmLListAdd2Tail(ulInActvLst,&(ueCb->ulDrxInactvLnk)); - ueCb->ulDrxInactvLnk.node = (PTR)ueCb; - } - - /* Deleting entry from HARQ RTT queue for the same HARQ proc, - * if exist. This is the special case which can happen iF UL - * scheduling is done later. */ - if(drxHq->rttIndx != DRX_INVALID) - { - cmLListDelFrm (&(cellCb->drxCb->drxQ[drxHq->rttIndx].harqRTTQ), - &(drxHq->harqRTTEnt)); - - drxHq->rttIndx = DRX_INVALID; - } - - cmLListDelFrm (&(drxCell->drxQ[drxHq->reTxIndx].harqRetxQ), - &(drxHq->harqRetxEnt)); - drxHq->reTxIndx = DRX_INVALID; - } - } - } - - if(isNewTx == TRUE) - { - if(ueCb->drxCb->raRcvd == TRUE) - { - ueCb->drxCb->raRcvd = FALSE; - - /* mark the ra bit */ - ueCb->drxCb->drxUlInactvMask |= RG_SCH_DRX_RA_BITMASK; - ueCb->drxCb->drxDlInactvMask |= RG_SCH_DRX_RA_BITMASK; - - }/*if(ra->rcvd) == TRUE */ - - if(ueCb->dlDrxInactvTmrLnk.node == NULLP) - { - cmLListAdd2Tail(dlDrxInactvTmrLst,&(ueCb->dlDrxInactvTmrLnk)); - ueCb->dlDrxInactvTmrLnk.node = (PTR)ueCb; - } - }/*if(isNewTx == TRUE) */ - - RETVALUE(ROK); -}/* rgSCHUtlGetSchdUes*/ - -/* ccpu00117452 - MOD - Changed macro name from - RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ -#ifdef RGR_CQI_REPT -/** - * @brief This function fills StaInd struct - * - * @details - * - * Function: rgSCHUtlFillSndStaInd - * Purpose: Fills StaInd struct and sends the - * StaInd to RRM - * - * @param[in] RgSchCellCb *cell pointer to Cell Control block - * @param[in] RgSchUeCb *ue pointer to Ue Control block - * @param[in] RgrStaIndInfo *staInfo Sta Ind struct to be filled - * @param[in] U8 numCqiRept NUmber of reports to be filled - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFillSndStaInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrStaIndInfo *staInfo, -U8 numCqiRept -) -#else -PUBLIC S16 rgSCHUtlFillSndStaInd(cell, ue, staInfo, numCqiRept) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrStaIndInfo *staInfo; -U8 numCqiRept; -#endif -{ - U8 idxStart; - - /* Fill StaInd for sending collated Latest N CQI rpeorts */ - /* Find index in the array from where Latest N - reports needs to be fetched. Use this value to index in the array - and copy the reports into staInfo */ - - /* Fill the Cell Id of PCC of the UE */ - staInfo->cellId = ue->cell->cellId; - staInfo->crnti = ue->ueId; - - idxStart = ue->schCqiInfo.cqiCount - numCqiRept; - - cmMemcpy ((U8*)&(staInfo->ueCqiInfo.cqiRept), - (U8*)&(ue->schCqiInfo.cqiRept[idxStart]), - numCqiRept * sizeof(RgrUeCqiRept)); - - staInfo->ueCqiInfo.numCqiRept = numCqiRept; - - ue->schCqiInfo.cqiCount = 0; - - /* Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM */ - if(rgSCHUtlRgrStaInd(cell, staInfo) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Could not send " - "CQI reports for RNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); - -}/* End of rgSCHUtlFillSndStaInd */ - - - -/** - * @brief API for sending STA indication from Scheduler to RRM. - * - * @details - * - * Function: rgSCHUtlRgrStaInd - * - * This API is invoked to send STA indication from Scheduler instance to RRM. - * This API fills in Pst structure and RgrStaIndInfo - * and calls the Sta primitive API towards RRM. - * - * @param[in] cell RgSchCellCb - * @param[in] RgrStsIndInfo *rgrSta - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrStaInd -( -RgSchCellCb *cell, -RgrStaIndInfo *rgrSta -) -#else -PUBLIC S16 rgSCHUtlRgrStaInd(cell, rgrSta) -RgSchCellCb *cell; -RgrStaIndInfo *rgrSta; -#endif -{ - S16 ret = ROK; - RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ - - TRC2(rgSCHUtlRgrStaInd) - - - rgrSap = cell->rgrSap; - if (rgrSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHUtlRgrStaInd() Upper SAP not bound (%d) ", - rgrSap->sapSta.sapState); - RETVALUE(RFAILED); - } - RgUiRgrStaInd(&(cell->rgrSap->sapCfg.sapPst), - cell->rgrSap->sapCfg.suId, rgrSta); - RETVALUE(ret); -} /* rgSCHUtlRgrStaInd*/ -#endif /* End of RGR_CQI_REPT */ - -/* Fix : syed HO UE does not have a valid ue->rntiLnk */ -/** - * @brief Indicates MAC to release any rnti context it has. - * - * @details - * Function : rgSCHUtlIndRntiRls2Mac - * This function indicates MAC for this rnti release. - * In case of ueId change it will indicate MAC - * about the new rnti to be updated. - * It will post a release RNTI indication to MAC. - * - * - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteRnti rnti - * @param[in] Bool ueIdChng - * @param[in] CmLteRnti newRnti - * @return Void - * -# ROK - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlIndRntiRls2Mac -( -RgSchCellCb *cell, -CmLteRnti rnti, -Bool ueIdChng, -CmLteRnti newRnti -) -#else -PUBLIC Void rgSCHUtlIndRntiRls2Mac(cell, rnti, ueIdChng, newRnti) -RgSchCellCb *cell; -CmLteRnti rnti; -Bool ueIdChng; -CmLteRnti newRnti; -#endif -{ - Pst pst; - Inst inst = cell->instIdx; - RgInfRlsRnti rntiInfo; - - TRC2(rgSCHUtlIndRntiRls2Mac) - - /* Copy the info to rntiInfo */ - rntiInfo.cellId = cell->cellId; - rntiInfo.rnti = rnti; - /* Fix : syed ueId change as part of reestablishment. - * Now SCH to trigger this. CRG ueRecfg for ueId change - * is dummy */ - rntiInfo.ueIdChng = ueIdChng; - rntiInfo.newRnti = newRnti; -#ifdef LTE_ADV - rntiInfo.isUeSCellDel = FALSE; -#endif - /* Invoke MAC to release the rnti */ - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst); - RgSchMacRlsRnti(&pst, &rntiInfo); - RETVOID; -} - -/* LTE_ADV_FLAG_REMOVED_START */ -/** - * @brief API for sending LOAD INF indication from Scheduler to RRM. - * @details - * - * Function: rgSCHUtlRgrLoadInfInd - * - * This API is invoked to send LOAD INF indication from Scheduler instance to RRM. - * This API fills in Pst structure and RgrLoadInfIndInfo - * and calls the Sta primitive API towards RRM. - * - * @param[in] cell RgSchCellCb - * @param[in] RgrLoadInfIndInfo *rgrLoadInf - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrLoadInfInd -( - RgSchCellCb *cell, - RgrLoadInfIndInfo *rgrLoadInf - ) -#else -PUBLIC S16 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf) - RgSchCellCb *cell; - RgrLoadInfIndInfo *rgrLoadInf; -#endif -{ - S16 ret = ROK; - RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ - - TRC2(rgSCHUtlRgrLoadInfInd) - - - rgrSap = cell->rgrSap; - if (rgrSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHUtlRgrLoadInfInd() Upper SAP not bound (%d) ", - rgrSap->sapSta.sapState); - RETVALUE(RFAILED); - } - RgUiRgrLoadInfInd(&(cell->rgrSap->sapCfg.sapPst), - cell->rgrSap->sapCfg.suId, rgrLoadInf); - RETVALUE(ret); -} /* rgSCHUtlRgrLoadInfInd*/ -/* LTE_ADV_FLAG_REMOVED_END */ - -/* MS_FIX : syed SCH to act as MASTER in maintaining - * rnti related context. Trigger to rnti del/Chng at SCH - * will result in a Indication to MAC to release its - * RNTI context. MAC inturn indicates the context cleared - * indication to SCH, upon which SCH would set this -/** - * @brief API for sending STA indication from Scheduler to RRM. - * - * @details - * - * Function: rgSCHUtlRlsRnti - * - * This API is invoked to indicate MAC to release rnti - * - * @param[in] RgSchCellCb *cellCb - * @param[in] RgSchRntiLnk *rntiLnk, - * @param[in] Bool ueIdChngd, - * @param[in] CmLteRnti newRnti - * @return Void - **/ - -#ifdef ANSI -PUBLIC Void rgSCHUtlRlsRnti -( -RgSchCellCb *cell, -RgSchRntiLnk *rntiLnk, -Bool ueIdChngd, -CmLteRnti newRnti -) -#else -PUBLIC Void rgSCHUtlRlsRnti(cell, rntiLnk, ueIdChngd, newRnti) -RgSchCellCb *cell; -RgSchRntiLnk *rntiLnk; -Bool ueIdChngd; -CmLteRnti newRnti; -#endif -{ - - TRC2(rgSCHUtlRlsRnti) - U8 isLegacy = 0; -#ifdef EMTC_ENABLE - if(cell->emtcEnable) - { - rgSCHEmtcUtlRlsRnti(cell, rntiLnk, &isLegacy); - } -#endif - if(!isLegacy) - { - /*Add to Guard Pool*/ - cmLListAdd2Tail(&cell->rntiDb.rntiGuardPool, &rntiLnk->rntiGrdPoolLnk); - rntiLnk->rntiGrdPoolLnk.node = (PTR)rntiLnk; - } - /* Fix: syed Explicitly Inidcate MAC to release RNTI */ - rgSCHUtlIndRntiRls2Mac(cell, rntiLnk->rnti, ueIdChngd, newRnti); - - RETVOID; -} - - -/** - * @brief This function fills StaInd struct - * - * @details - * - * Function: rgSCHUtlFillSndUeStaInd - * Purpose: Fills StaInd struct and sends the - * StaInd to RRM - * - * @param[in] RgSchCellCb *cell pointer to Cell Control block - * @param[in] RgSchUeCb *ue pointer to Ue Control block - * @param[in] U8 numCqiRept NUmber of reports to be filled - * @return Void - * - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlFillSndUeStaInd -( -RgSchCellCb *cell, -RgSchUeCb *ue, -RgrUeStaIndInfo *ueStaInfo -) -#else -PUBLIC S16 rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInfo) -RgSchCellCb *cell; -RgSchUeCb *ue; -RgrUeStaIndInfo *ueStaInfo; -#endif -{ - - ueStaInfo->cellId = cell->cellId; - ueStaInfo->crnti = ue->ueId; - - /* Call utility function (rgSCHUtlRgrUeStaInd) to send rpts to RRM */ - if(rgSCHUtlRgrUeStaInd(cell, ueStaInfo) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Could not send " - "UE Sta reports CRNTI:%d",ue->ueId); - RETVALUE(RFAILED); - } - - RETVALUE(ROK); - -}/* End of rgSCHUtlFillSndStaInd */ - - - -/** - * @brief API for sending STA indication from Scheduler to RRM. - * - * @details - * - * Function: rgSCHUtlRgrStaInd - * - * This API is invoked to send STA indication from Scheduler instance to RRM. - * This API fills in Pst structure and RgrStaIndInfo - * and calls the Sta primitive API towards RRM. - * - * @param[in] cell RgSchCellCb - * @param[in] RgrStsIndInfo *rgrSta - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlRgrUeStaInd -( -RgSchCellCb *cell, -RgrUeStaIndInfo *rgrUeSta -) -#else -PUBLIC S16 rgSCHUtlRgrUeStaInd(cell, rgrUeSta) -RgSchCellCb *cell; -RgrUeStaIndInfo *rgrUeSta; -#endif -{ - S16 ret = ROK; - RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ - - TRC2(rgSCHUtlRgrStaInd) - - - rgrSap = cell->rgrSap; - if (rgrSap->sapSta.sapState != LRG_BND) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, - "rgSCHUtlRgrUeStaInd() Upper SAP not bound (%d) ", - rgrSap->sapSta.sapState); - RETVALUE(RFAILED); - } - RgUiRgrUeStaInd(&(cell->rgrSap->sapCfg.sapPst), - cell->rgrSap->sapCfg.suId, rgrUeSta); - RETVALUE(ret); -} /* rgSCHUtlRgrStaInd*/ - -/* RRM_RBC_X */ -/** - * @brief function to report DL and UL PRB usage to RRM. - * - * - * Function: rgSCHUtlUpdAvgPrbUsage - * This function sends the PRB usage report to - * RRM with the interval configured by RRM. - * - * @param[in] cell *RgSchCellCb - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlUpdAvgPrbUsage -( -RgSchCellCb *cell -) -#else -PUBLIC S16 rgSCHUtlUpdAvgPrbUsage(cell) -RgSchCellCb *cell; -#endif -{ - CmLteTimingInfo frm; - RgmPrbRprtInd *prbRprtInd; - S16 ret = ROK; - U32 idx; -#ifdef DBG_MAC_RRM_PRB_PRINT - static U32 count = 0; - const U32 reprotForEvery20Sec = 20000/cell->prbUsage.rprtPeriod; - - count++; -#endif - - TRC2(rgSCHUtlUpdAvgPrbUsage); - - frm = cell->crntTime; - RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); - - U16 numDlSf; - U16 numUlSf; -#ifdef LTE_TDD - - if(cell->prbUsage.rprtPeriod >= RGSCH_NUM_SUB_FRAMES) - { - /* Get the total number of DL and UL subframes within the reporting period*/ - numDlSf = (cell->prbUsage.rprtPeriod * - rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]) - / RGSCH_NUM_SUB_FRAMES; - numUlSf = (cell->prbUsage.rprtPeriod * - rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]) - / RGSCH_NUM_SUB_FRAMES; - } - else - { - /* Get the total number of DL and UL subframes < 10 ms interval */ - numDlSf = rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][frm.subframe]; - numUlSf = rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][frm.subframe]; - } -#else - numDlSf = cell->prbUsage.rprtPeriod; - numUlSf = cell->prbUsage.rprtPeriod; -#endif - - if(SGetSBuf(cell->rgmSap->sapCfg.sapPst.region, - cell->rgmSap->sapCfg.sapPst.pool, (Data**)&prbRprtInd, - sizeof(RgmPrbRprtInd)) != ROK) - { - RETVALUE(RFAILED); - } - - cmMemset((U8 *) &prbRprtInd->stQciPrbRpts[0], - 0, - (RGM_MAX_QCI_REPORTS * sizeof(RgmPrbRptPerQci))); - - prbRprtInd->bCellId = cell->cellId; - - if(numDlSf > 0) - { - prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_DL; - for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ ) - { - prbRprtInd->stQciPrbRpts[idx].bAvgPrbDlUsage = - RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed*100), - (numDlSf * cell->bwCfg.dlTotalBw)); - prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci; - cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed = 0; - } - } - - if(numUlSf > 0) - { - prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_UL; - for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ ) - { - prbRprtInd->stQciPrbRpts[idx].bAvgPrbUlUsage = - RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed*100), - (numUlSf * cell->ulAvailBw)); - prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci; - cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed = 0; - } - } - -#ifdef DBG_MAC_RRM_PRB_PRINT - if((count % reprotForEvery20Sec) == 0 ) - { - printf("\n===================================================================="); - printf("\nMAC: QCI-1[DL:UL] | QCI-2[DL:UL] | QCI-3[DL:UL] | QCI-4[DL:UL] \n"); - printf("======================================================================\n"); - printf(" [%d: %d]\t | [%d: %d]\t | [%d: %d]\t| [%d: %d]\t\n", - prbRprtInd->stQciPrbRpts[0].bAvgPrbDlUsage, - prbRprtInd->stQciPrbRpts[0].bAvgPrbUlUsage, - prbRprtInd->stQciPrbRpts[1].bAvgPrbDlUsage, - prbRprtInd->stQciPrbRpts[1].bAvgPrbUlUsage, - prbRprtInd->stQciPrbRpts[2].bAvgPrbDlUsage, - prbRprtInd->stQciPrbRpts[2].bAvgPrbUlUsage, - prbRprtInd->stQciPrbRpts[3].bAvgPrbDlUsage, - prbRprtInd->stQciPrbRpts[3].bAvgPrbUlUsage); - } -#endif - RgUiRgmSendPrbRprtInd(&(cell->rgmSap->sapCfg.sapPst), - cell->rgmSap->sapCfg.suId, prbRprtInd); - - - RETVALUE(ret); -} -/* RRM_RBC_Y */ - -/** - * @brief This function resends the Ta in case of - * max retx failure or DTX for the Ta transmitted - * - * @details - * - * Function: rgSCHUtlReTxTa - * Purpose: - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlReTxTa -( -RgSchCellCb *cellCb, -RgSchUeCb *ueCb -) -#else -PUBLIC Void rgSCHUtlReTxTa(cellCb, ueCb) -RgSchCellCb *cellCb; -RgSchUeCb *ueCb; -#endif -{ - TRC2(rgSCHUtlReTxTa) - - /* If TA Timer is running. Stop it */ - if (ueCb->taTmr.tmrEvnt != TMR_NONE) - { - rgSCHTmrStopTmr(cellCb, ueCb->taTmr.tmrEvnt, ueCb); - } - /*[ccpu00121813]-ADD-If maxretx is reached then - * use outstanding TA val for scheduling again */ - if(ueCb->dl.taCb.outStndngTa == TRUE) - { - ueCb->dl.taCb.ta = ueCb->dl.taCb.outStndngTaval; - ueCb->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD; - ueCb->dl.taCb.outStndngTa = FALSE; - - } - /* Fix : syed TA state updation missing */ - ueCb->dl.taCb.state = RGSCH_TA_TOBE_SCHEDULED; - rgSCHUtlDlTARpt(cellCb, ueCb); - - RETVOID; -} - -/* Added function for dropping Paging Message*/ -/** - * @brief Handler for BO Updt received for BCCH or PCCH. - * - * @details - * - * Function : rgSCHChkBoUpdate - * - * This function shall check for BO received falls within the scheduling window or not - * - * - * @param[in] RgSchCellCb *cell - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PRIVATE S16 rgSCHChkBoUpdate -( -RgSchCellCb *cell, -RgInfCmnBoRpt *boUpdt -) -#else -PRIVATE S16 rgSCHChkBoUpdate (cell, boUpdt) -RgSchCellCb *cell; -RgInfCmnBoRpt *boUpdt; -#endif -{ - - U32 crntTimeInSubFrms = 0; - U32 boUpdTimeInSubFrms = 0; - U32 distance = 0; - TRC2(rgSCHChkBoUpdate); - - crntTimeInSubFrms = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + cell->crntTime.subframe + - RG_SCH_CMN_DL_DELTA + 2; /* As bo received will scheduled in next TTI - so incrementing with +1 more */ - boUpdTimeInSubFrms = (boUpdt->u.timeToTx.sfn * RGSCH_NUM_SUB_FRAMES_5G)+ boUpdt->u.timeToTx.subframe; - - - distance = boUpdTimeInSubFrms > crntTimeInSubFrms ? \ - boUpdTimeInSubFrms - crntTimeInSubFrms : \ - (RGSCH_MAX_SUBFRM_5G - crntTimeInSubFrms + boUpdTimeInSubFrms); - - if (distance > RGSCH_PCCHBCCH_WIN) - { - RETVALUE(RFAILED); - } - RETVALUE(ROK); - -}/*rgSCHChkBoUpdate*/ - - -#ifdef LTE_TDD -/** - * @brief Utility function to calculate the UL reTxIdx in TDD cfg0 - * - * @details - * - * Function : rgSchUtlCfg0ReTxIdx - * - * Update the reTxIdx according to the rules mentioned - * in 3GPP TS 36.213 section 8 for TDD Cfg0 - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteTimingInfo phichTime - * @param[in] U8 hqFdbkIdx - * @return U8 - **/ -#ifdef ANSI -PUBLIC U8 rgSchUtlCfg0ReTxIdx -( -RgSchCellCb *cell, -CmLteTimingInfo phichTime, -U8 hqFdbkIdx -) -#else -PUBLIC U8 rgSchUtlCfg0ReTxIdx (cell, phichTime, hqFdbkIdx) -RgSchCellCb *cell; -CmLteTimingInfo phichTime; -U8 hqFdbkIdx; -#endif -{ - U8 reTxIdx = RGSCH_INVALID_INFO; - U8 iPhich = 0; - RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); - RgSchUlSf *ulSf; - U8 ulSF; /* UL SF in the TDD frame */ - - TRC2(rgSchUtlCfg0ReTxIdx); - - ulSf = &cellUl->ulSfArr[hqFdbkIdx]; - ulSF = ulSf->ulSfIdx; - - /* Check for the UL SF 4 or 9 */ - if(ulSF == 9 || ulSF == 4) - { - iPhich = 1; - } - if(phichTime.subframe == 0 || phichTime.subframe == 5) - { - if(iPhich == 0) - { - /* Retx will happen according to the Pusch k table */ - reTxIdx = cellUl->schdIdx; - } - if(iPhich == 1) - { - /* Retx will happen at n+7 */ - RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7); - /* Fetch the corresponding UL subframe Idx in UL sf array */ - reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell); - } - } - else if(phichTime.subframe == 1 || phichTime.subframe == 6) - { - /* Retx will happen at n+7 */ - RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7); - /* Fetch the corresponding UL subframe Idx in UL sf array */ - reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell); - } - RETVALUE(reTxIdx); -} -#endif - -/** - * @brief Utility function to calculate total num of PRBs required to - * satisfy DL BO for TM1/TM2/TM6/TM7 - * - * @details - * - * Function : rgSchUtlDlCalc1CwPrb - * - * Calculate PRBs required for UE to satisfy BO in DL - * - * Note : Total calculated PRBs will be assigned to *prbReqrd - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *prbReqrd - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSchUtlDlCalc1CwPrb -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 bo, -U32 *prbReqrd -) -#else -PUBLIC Void rgSchUtlDlCalc1CwPrb(cell, ue, bo, prbReqrd) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 bo; -U32 *prbReqrd; -#endif -{ - RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); - U32 eff; - U32 noRes; - U8 iTbs; - U8 cfi = dlCell->currCfi; - - TRC2(rgSchUtlDlCalc1CwPrb); - - iTbs = dlUe->mimoInfo.cwInfo[0].iTbs[0]; - eff = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs]; - - /* Optimization to convert totalBo (which is in-terms of bytes) to bits - * i.e, << 3 and multiply with 1024 i.e, << 10 */ - noRes = ((U64)((bo << 3) << 10)) / (eff); - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); - - RETVOID; -} /* rgSchUtlDlCalc1CwPrb*/ - -/** - * @brief Utility function to calculate total num of PRBs required to - * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO) - * for TM3/TM4 - * - * @details - * - * Function : rgSchUtlDlCalc2CwPrb - * - * Calculate PRBs required for UE to satisfy BO in DL - * - * Note : Total calculated PRBs will be assigned to *prbReqrd - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *prbReqrd - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSchUtlDlCalc2CwPrb -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 bo, -U32 *prbReqrd -) -#else -PUBLIC Void rgSchUtlDlCalc2CwPrb(cell, ue, bo, prbReqrd) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 bo; -U32 *prbReqrd; -#endif -{ - RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell); - RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); - U32 eff1, eff2; - U32 noRes; - U8 noLyr1, noLyr2; - U8 iTbs1, iTbs2; - U8 cfi = dlCell->currCfi; - - TRC2(rgSchUtlDlCalc2CwPrb); - - if ((dlUe->mimoInfo.forceTD) ||/* Transmit Diversity (TD) */ - (dlUe->mimoInfo.ri < 2))/* 1 layer precoding */ - { - iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[0]; - eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs1]; - - /* Optimization to convert totalBo (which is in-terms of bytes) to bits - * i.e, << 3 and multiply with 1024 i.e, << 10 */ - noRes = ((U64)((bo << 3) << 10)) / (eff1); - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); - } - else - { - noLyr1 = dlUe->mimoInfo.cwInfo[0].noLyr; - noLyr2 = dlUe->mimoInfo.cwInfo[1].noLyr; - iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1]; - iTbs2 = dlUe->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1]; - eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1]; - eff2 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2]; - - /* Optimization to convert totalBo (which is in-terms of bytes) to bits - * i.e, << 3 and multiply with 1024 i.e, << 10 */ - noRes = ((U64)((bo << 3) << 10)) / (eff1 + eff2); - /* Get the number of RBs needed for this transmission */ - /* Number of RBs = No of REs / No of REs per RB */ - *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); - } - RETVOID; -} /* rgSchUtlDlCalc2CwPrb */ - -/** - * @brief Utility function to calculate total num of PRBs required to - * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO) - * - * @details - * - * Function : rgSchUtlCalcTotalPrbReq - * - * This function calls TM specific routine to calculate PRB - * - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 bo - * @param[out] U32 *prbReqrd - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSchUtlCalcTotalPrbReq -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 bo, -U32 *prbReqrd -) -#else -PUBLIC Void rgSchUtlCalcTotalPrbReq(cell, ue, bo, prbReqrd) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 bo; -U32 *prbReqrd; -#endif -{ - TRC2(rgSchUtlCalcTotalPrbReq); - - /* Call TM specific Prb calculation routine */ - (dlCalcPrbFunc[ue->mimoInfo.txMode - 1])(cell, ue, bo, prbReqrd); - - RETVOID; -} /* rgSchUtlCalcTotalPrbReq */ -#ifdef TFU_UPGRADE -/*********************************************************** - * - * Func : rgSCHUtlFetchPcqiBitSz - * - * - * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity. - * - * Ret : U8 - * ROK - Success - * - * Notes: - * - * File : - * - **********************************************************/ -#ifdef ANSI -PRIVATE U8 rgSCHUtlFetchPcqiBitSz -( - RgSchCellCb *cell, - RgSchUeCb *ueCb, - U8 numTxAnt - ) -#else -PRIVATE U8 rgSCHUtlFetchPcqiBitSz (cell, ueCb, numTxAnt) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -U8 numTxAnt; -#endif -{ - U8 confRepMode; - U8 pcqiSz; - U8 ri; - RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cell); - - TRC3(rgSCHUtlFetchPcqiBitSz); - confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum; - if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) && - (ueCb->mimoInfo.txMode != RGR_UE_TM_4)) - { - ri =1; - } - else - { - ri = cqiCb->perRiVal; - } - switch(confRepMode) - { - case RGR_PRD_CQI_MOD10: - { - pcqiSz = 4; - } - break; - - case RGR_PRD_CQI_MOD11: - { - if(numTxAnt == 2) - { - if (ri ==1) - { - pcqiSz = 6; - } - else - { - pcqiSz = 8; - } - } - else if(numTxAnt == 4) - { - if (ri ==1) - { - pcqiSz = 8; - } - else - { - pcqiSz = 11; - } - } - else - { - /* This is number of antenna case 1. - * This is not applicable for Mode 1-1. - * So setting it to invalid value */ - pcqiSz = 0; - } - } - break; - - case RGR_PRD_CQI_MOD20: - { - if(cqiCb->isWb) - { - pcqiSz = 4; - } - else - { - pcqiSz = 4 + cqiCb->label; - } - } - break; - - case RGR_PRD_CQI_MOD21: - { - if(cqiCb->isWb) - { - if(numTxAnt == 2) - { - if (ri ==1) - { - pcqiSz = 6; - } - else - { - pcqiSz = 8; - } - } - else if(numTxAnt == 4) - { - if (ri ==1) - { - pcqiSz = 8; - } - else - { - pcqiSz = 11; - } - } - else - { - /* This might be number of antenna case 1. - * For mode 2-1 wideband case only antenna port 2 or 4 is supported. - * So setting invalid value.*/ - pcqiSz = 0; - } - } - else - { - if (ri ==1) - { - pcqiSz = 4 + cqiCb->label; - } - else - { - pcqiSz = 7 + cqiCb->label; - } - } - } - break; - - default: - pcqiSz = 0; - break; - } - - RETVALUE(pcqiSz); -} -#endif -/** - * @brief Utility function to returns the number of subbands based on the - * requested bytes. - * - * @details - * - * Function : rgSchUtlGetNumSbs - * - * Calculate the number of PRBs - * Update the subbandRequired based on the nPrbs and subband size - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @param[in] U32 *numSbs - * @return U8 - **/ -#ifdef ANSI -PUBLIC U8 rgSchUtlGetNumSbs -( -RgSchCellCb *cell, -RgSchUeCb *ue, -U32 *numSbs -) -#else -PUBLIC U8 rgSchUtlGetNumSbs (cell, ue, numSbs) -RgSchCellCb *cell; -RgSchUeCb *ue; -U32 *numSbs; -#endif -{ - U32 nPrb; - //Currently hardcoding MAX prb for each UE - nPrb = ue->ue5gtfCb.maxPrb; - (*numSbs) = RGSCH_CEIL(nPrb, MAX_5GTF_VRBG_SIZE); - RETVALUE(ROK); -} - -/** - * @brief Utility function to insert the UE node into UE Lst based on the - * number of subbands allocated for the UE for the current TTI. - * - * @details - * - * Function : rgSchUtlSortInsUeLst - * - * If subbandRequired < Min, then insert at head - * Else If subbandRequired > Max, then insert at tail - * Else, traverse the list and place the node at the appropriate place - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ue - * @return U8 - **/ -#ifdef ANSI -PUBLIC U8 rgSchUtlSortInsUeLst -( -RgSchCellCb *cell, -CmLListCp *ueLst, -CmLList *node, -U8 vrbgRequired -) -#else -PUBLIC U8 rgSchUtlSortInsUeLst (cell, ueLst, node, vrbgRequired) -RgSchCellCb *cell; -CmLListCp *ueLst; -CmLList *node; -U8 vrbgRequired; -#endif -{ - CmLList *ueInLst; - CmLList *firstUeInLst; - CmLList *lastUeInLst; - RgSchUeCb *tempUe; - RgSchCmnUlUe *ueUl; - - //firstUeInLst = cmLListFirst(ueLst); - CM_LLIST_FIRST_NODE(ueLst,firstUeInLst); - if(NULLP == firstUeInLst) - { - /* first node to be added to the list */ - cmLListAdd2Tail(ueLst, node); - } - else - { - /* Sb Required for the UE is less than the first node in the list */ - tempUe = (RgSchUeCb *)(firstUeInLst->node); - ueUl = RG_SCH_CMN_GET_UL_UE(tempUe, cell); - - if(vrbgRequired <= ueUl->vrbgRequired) - { - cmLListInsCrnt(ueLst, (node)); - } - else - { - /* Sb Required for this UE is higher than the UEs in the list */ - lastUeInLst = cmLListLast(ueLst); - tempUe = (RgSchUeCb *)(lastUeInLst->node); - if(vrbgRequired >= ueUl->vrbgRequired) - { - cmLListAdd2Tail(ueLst, (node)); - } - else - { - /* This UE needs to be in the middle. Search and insert the UE */ - ueInLst = cmLListFirst(ueLst); - do - { - tempUe = (RgSchUeCb *)(ueInLst->node); - - if(vrbgRequired <= ueUl->vrbgRequired) - { - cmLListInsCrnt(ueLst, (node)); - break; - } - - ueInLst = cmLListNext(ueLst); - - } while(NULLP != ueInLst && ueInLst != firstUeInLst); - } - } - } - - RETVALUE(ROK); -} - -/** - * @brief Function to Send LCG GBR register to MAC - * - * @details - * - * Function: rgSCHUtlBuildNSendLcgReg - * - * Handler for sending LCG GBR registration - * - * Invoked by: - * SCHD - * - * Processing Steps: - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteRnti crnti - * @param[in] U8 lcgId - * @param[in] Bool isGbr - * @return S16 - * -# ROK - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlBuildNSendLcgReg -( -RgSchCellCb *cell, -CmLteRnti crnti, -U8 lcgId, -Bool isGbr -) -#else -PUBLIC S16 rgSCHUtlBuildNSendLcgReg(cell, crnti, lcgId, isGbr) -RgSchCellCb *cell; -CmLteRnti crnti; -U8 lcgId; -Bool isGbr; -#endif -{ - Pst pst; - RgInfLcgRegReq lcgRegReq; - - TRC3(rgSCHUtlBuildNSendLcgReg); - - cmMemset((U8*)&pst, (U8)0, sizeof(Pst)); - lcgRegReq.isGbr = isGbr; - lcgRegReq.cellId = cell->cellId; - lcgRegReq.crnti = crnti; - lcgRegReq.lcgId = lcgId; - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); - /* code Coverage portion of the test case */ - RgSchMacLcgReg(&pst, &lcgRegReq); - - RETVALUE(ROK); -} - -#ifdef TFU_UPGRADE -#ifdef LTE_ADV -#ifndef TFU_TDD -/** - * @brief Function to map RGR pucch type to TFU type - * - * @details - * - * Function: rgSchUtlGetFdbkMode - * - * - * Invoked by: - * SCHD - * - * Processing Steps: - * - * @param[in] RgrSchFrmt1b3TypEnum - * @return TfuAckNackMode - * -# ROK - **/ -#ifdef ANSI -PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode -( -RgrSchFrmt1b3TypEnum fdbkType -) -#else -PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode(fdbkType) -RgrSchFrmt1b3TypEnum fdbkType; -#endif -{ - - TfuAckNackMode mode = TFU_UCI_FORMAT_1A_1B; - - TRC2(rgSchUtlGetFdbkMode); - - switch(fdbkType) - { - case RG_SCH_UCI_FORMAT_NON_CA: - case RG_SCH_UCI_FORMAT1A_1B: - { - mode = TFU_UCI_FORMAT_1A_1B; - } - break; - case RG_SCH_UCI_FORMAT1B_CS: - { - mode = TFU_UCI_FORMAT_1B_CS; - } - break; - case RG_SCH_UCI_FORMAT3: - { - mode = TFU_UCI_FORMAT_3; - } - break; - } - RETVALUE(mode); -} -#endif /* TFU_TDD */ -#endif /* LTE_ADV */ -#endif /*TFU_UPGRADE */ - -#ifdef LTE_ADV -/** - * @brief Send Ue SCell delete to SMAC. - * - * @details - * - * Function : rgSCHUtlSndUeSCellDel2Mac - * This function populates the struct RgInfRlsRnti and - * get the pst for SMac and mark field isUeSCellDel to TRUE which - * indicates that it is a Ue SCell delete. - * - * - * - * @param[in] RgSchCellCb *cell - * @param[in] CmLteRnti rnti - * @return Void - * -# ROK - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlSndUeSCellDel2Mac -( -RgSchCellCb *cell, -CmLteRnti rnti -) -#else -PUBLIC Void rgSCHUtlSndUeSCellDel2Mac(cell, rnti) -RgSchCellCb *cell; -CmLteRnti rnti; -#endif -{ - Pst pst; - Inst inst = cell->instIdx; - RgInfRlsRnti rntiInfo; - - TRC2(rgSCHUtlSndUeSCellDel2Mac) - - RGSCHDBGINFONEW(inst,(rgSchPBuf(inst),"RNTI Release IND for UE(%d)\n", rnti)); - /* Copy the info to rntiInfo */ - rntiInfo.cellId = cell->cellId; - rntiInfo.rnti = rnti; - /* Fix : syed ueId change as part of reestablishment. - * Now SCH to trigger this. CRG ueRecfg for ueId change - * is dummy */ - rntiInfo.ueIdChng = FALSE; - rntiInfo.newRnti = rnti; - rntiInfo.isUeSCellDel = TRUE; - /* Invoke MAC to release the rnti */ - rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst); - RgSchMacRlsRnti(&pst, &rntiInfo); - RETVOID; -} - -/** - * @brief Returns max TB supported by a given txMode - * - * @details - * - * Function : rgSCHUtlGetMaxTbSupp - * Max TB supported for TM Modes (1,2,5,6 and 7) is 1 - * and 2 for others - * - * - * @param[in] RgrTxMode txMode - * @return U8 maxTbCount; - * -# ROK - **/ -#ifdef ANSI -PUBLIC U8 rgSCHUtlGetMaxTbSupp -( -RgrTxMode txMode -) -#else -PUBLIC U8 rgSCHUtlGetMaxTbSupp(txMode) -RgrTxMode txMode -#endif -{ - U8 maxTbCount; - - TRC2(rgSCHUtlGetMaxTbSupp); - - /* Primary Cell */ - - switch(txMode) - { - case RGR_UE_TM_1: - case RGR_UE_TM_2: - case RGR_UE_TM_5: - case RGR_UE_TM_6: - case RGR_UE_TM_7: - maxTbCount = 1; - break; - case RGR_UE_TM_3: - case RGR_UE_TM_4: - case RGR_UE_TM_8: - case RGR_UE_TM_9: - maxTbCount = 2; - break; - default: - maxTbCount = 0; - break; - } - - RETVALUE(maxTbCount); -} - -/** - * @brief Send Ue SCell delete to SMAC. - * - * @details - * - * Function : rgSCHTomUtlGetTrigSet - * This function gets the triggerset based on cqiReq - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb ueCb - * @param[in] U8 cqiReq, - * @param[out] U8 *triggerSet - * - * @return Void - * -# ROK - **/ -#ifdef ANSI -PUBLIC Void rgSCHTomUtlGetTrigSet -( - RgSchCellCb *cell, - RgSchUeCb *ueCb, - U8 cqiReq, - U8 *triggerSet - ) -#else -PRIVATE S16 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, triggerSet) - RgSchCellCb *cell; - RgSchUeCb *ueCb; - U8 cqiReq; - U8 *triggerSet; -#endif -{ - RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ueCb); - switch(cqiReq) - { - case RG_SCH_APCQI_SERVING_CC: - { - /* APeriodic CQI request for Current Carrier.*/ - U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)]; - *triggerSet = 1 << (7 - sCellIdx); - break; - } - case RG_SCH_APCQI_1ST_SERVING_CCS_SET: - { - *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet1; - break; - } - case RG_SCH_APCQI_2ND_SERVING_CCS_SET: - { - *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet2; - break; - } - default: - { - /* BUG */ - break; - } - } - RETVOID; -} -#endif -/** - * @brief This function updates the value of UE specific DCI sizes - * - * @details - * - * Function: rgSCHUtlUpdUeDciSize - * Purpose: This function calculates and updates DCI Sizes in bits. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @param[in] RgSchUeCb *ueCb - * @param[in] isCsi2Bit *isCsi2Bit: is 1 bit or 2 bit CSI - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlUpdUeDciSize -( -RgSchCellCb *cell, -RgSchUeCb *ueCb, -Bool isCsi2Bit -) -#else -PUBLIC Void rgSCHUtlUpdUeDciSize(cell, ueCb, isCsi2Bit) -RgSchCellCb *cell; -RgSchUeCb *ueCb; -Bool isCsi2Bit; -#endif -{ - U8 dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0]; - U8 dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0]; - if ((ueCb->accessStratumRls >= RGR_REL_10) && (cell->bwCfg.dlTotalBw >= cell->bwCfg.ulTotalBw)) - { - dci01aCmnSize += 1; /* Resource Allocation Type DCI 0 */ - dci01aDedSize += 1; /* Resource Allocation Type DCI 0 */ - } - if (isCsi2Bit == TRUE) - { - dci01aDedSize += 2; /* 2 bit CSI DCI 0 */ - } - else - { - dci01aDedSize += 1; /* 1 bit CSI DCI 0 */ - } - - /* Common CSI is always 1 bit DCI 0 */ - dci01aCmnSize += 1; /* 1 bit CSI DCI 0 */ - - /* Compare the sizes of DCI 0 with DCI 1A and consider the greater */ - if (dci01aCmnSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) - { - dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; - } - if (dci01aDedSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) - { - dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; - } - - /* Remove the Ambiguous Sizes as mentioned in table Table 5.3.3.1.2-1 Spec 36.212-a80 Sec 5.3.3.1.3 */ - dci01aCmnSize += rgSchDciAmbigSizeTbl[dci01aCmnSize]; - dci01aDedSize += rgSchDciAmbigSizeTbl[dci01aDedSize]; - - ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_0] = dci01aCmnSize; - ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_1A] = dci01aCmnSize; - - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_0] = dci01aDedSize; - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A] = dci01aDedSize; - - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1]; - do { - /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled - * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A - * for scheduling the same serving cell and mapped onto the UE specific search space given by the - * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */ - if (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A]) - { - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += 1; - } - - /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs - * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended - * to format 1 until the payload size of format 1 does not belong to one of the sizes in - * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */ - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1]]; - } while (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A]); - - /* Just copying the value of 2/2A to avoid multiple checks at PDCCH allocations. This values never change.*/ - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2]; - ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A]; - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2]; - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A]; - - /* Spec 36.212-a80 Sec 5.3.3.1.3: except when format 1A assigns downlink resource - * on a secondary cell without an uplink configuration associated with the secondary cell */ - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]]; - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1]; - do { - /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled - * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A - * for scheduling the same serving cell and mapped onto the UE specific search space given by the - * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */ - if (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]) - { - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += 1; - } - - /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs - * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended - * to format 1 until the payload size of format 1 does not belong to one of the sizes in - * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */ - ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1]]; - } while (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]); -#ifdef EMTC_ENABLE - rgSCHEmtcUtlUpdUeDciSize(cell, ueCb); -#endif -} - -/** - * @brief This function initialises the DCI Size table - * - * @details - * - * Function: rgSCHUtlCalcDciSizes - * Purpose: This function calculates and initialises DCI Sizes in bits. - * - * Invoked by: Scheduler - * - * @param[in] RgSchCellCb *cell - * @return Void - * - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlCalcDciSizes -( -RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHUtlCalcDciSizes(cell) -RgSchCellCb *cell; -#endif -{ - U8 dciSize = 0; - U8 dci01aSize = 0; - U32 bits = 0, idx = 0; - - switch(TFU_DCI_FORMAT_0) /* Switch case for the purpose of readability */ - { - case TFU_DCI_FORMAT_0: - { - /* DCI 0: Spec 36.212 Section 5.3.3.1.1 */ - dciSize = 0; - /*-- Calculate resource block assignment bits need to be set - Which is ln(N(N+1)/2) 36.212 5.3.3.1 --*/ - bits = (cell->bwCfg.ulTotalBw * (cell->bwCfg.ulTotalBw + 1) / 2); - while ((bits & 0x8000) == 0) - { - bits <<= 1; - idx++; - } - bits = 16 - idx; - - dciSize = 1 /* DCI 0 bit indicator */ + \ - 1 /* Frequency hoping enable bit field */ + \ - (U8)bits /* For frequency Hopping */ + \ - 5 /* MCS */ + \ - 1 /* NDI */ + \ - 2 /* TPC */ + \ - 3 /* DMRS */ -#ifdef TFU_TDD - + \ - 2 /* UL Index Config 0 or DAI Config 1-6 */ -#endif - ; - - cell->dciSize.baseSize[TFU_DCI_FORMAT_0] = dciSize; - - /* If hoping flag is enabled */ - if (cell->bwCfg.ulTotalBw <= 49) /* Spec 36.213 Table 8.4-1, N UL_hop, if hopping is enabled */ - { - cell->dciSize.dci0HopSize = 1; - } - else - { - cell->dciSize.dci0HopSize = 2; - } - - /* Update common non-CRNTI scrambled DCI 0/1A flag */ - dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0] + 1; /* 1 bit CSI */ - } - case TFU_DCI_FORMAT_1A: - { - /* DCI 1A: Spec 36.212 Section 5.3.3.1.3 */ - dciSize = 0; - idx = 0; - /* Calculate resource block assignment bits need to be set - Which is ln(N(N+1)/2) */ - bits = (cell->bwCfg.dlTotalBw * (cell->bwCfg.dlTotalBw + 1) / 2); - while ((bits & 0x8000) == 0) - { - bits <<= 1; - idx++; - } - bits = 16 - idx; - - dciSize += 1 /* Format 1A */ + \ - 1 /* Local or Distributed */ + \ - (U8)bits /* Resource block Assignment */ + \ - 5 /* MCS */ + -#ifdef TFU_TDD - 4 /* HARQ Proc Id */ + -#else - 3 /* HARQ Proc Id */ + -#endif - 1 /* NDI */ + \ - 2 /* RV */ + \ - 2 /* TPC CMD */ -#ifdef TFU_TDD - + \ - 2 /* DAI */ -#endif - ; - cell->dciSize.baseSize[TFU_DCI_FORMAT_1A] = dciSize; - - /* If the UE is not configured to decode PDCCH with CRC scrambled by the C-RNTI, - * and the number of information bits in format 1A is less than that of format 0, - * zeros shall be appended to format 1A until the payload size equals that of format 0. */ - /* Compare the size with DCI 1A and DCI 0 and consider the greater one */ - if (dci01aSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) - { - dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; - } - /* If the number of information bits in format 1A belongs to one of the sizes in - * Table 5.3.3.1.2-1, one zero bit shall be appended to format 1A. */ - dci01aSize += rgSchDciAmbigSizeTbl[dci01aSize]; - cell->dciSize.size[TFU_DCI_FORMAT_1A] = cell->dciSize.size[TFU_DCI_FORMAT_0] = dci01aSize; - } - case TFU_DCI_FORMAT_1: - { - /* DCI 1: Spec 36.212 Section 5.3.3.1.2 */ - dciSize = 0; - if (cell->bwCfg.dlTotalBw > 10) - { - dciSize = 1; /* Resource Allocation header bit */ - } - - /* Resouce allocation bits Type 0 and Type 1 */ - bits = (cell->bwCfg.dlTotalBw/cell->rbgSize); - if ((cell->bwCfg.dlTotalBw % cell->rbgSize) != 0) - { - bits++; - } - - dciSize += (U8)bits /* Resource Allocation bits */ + \ - 5 /* MCS */ + -#ifdef TFU_TDD - 4 /* HARQ TDD */ + -#else - 3 /* HARQ FDD */ + -#endif - 1 /* NDI */ + \ - 2 /* Redunancy Version */ + \ - 2 /* TPC Cmd */ -#ifdef TFU_TDD - + \ - 2 /* DAI */ -#endif - ; - - - cell->dciSize.baseSize[TFU_DCI_FORMAT_1] = dciSize; - - cell->dciSize.size[TFU_DCI_FORMAT_1] = dciSize; - - do { - /* If the UE is not configured to decode PDCCH with CRC - * scrambled by the C-RNTI and the number of information bits in format 1 - * is equal to that for format 0/1A, one bit of value zero shall be appended - * to format 1. */ - if (dci01aSize == cell->dciSize.size[TFU_DCI_FORMAT_1]) - { - cell->dciSize.size[TFU_DCI_FORMAT_1] += 1; - } - - /* If the number of information bits in format 1 belongs to one of the sizes in - * Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended to format 1 until - * the payload size of format 1 does not belong to one of the sizes in Table 5.3.3.1.2-1 - * and is not equal to that of format 0/1A mapped onto the same search space. */ - cell->dciSize.size[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_1]]; - } while (cell->dciSize.size[TFU_DCI_FORMAT_1] == dci01aSize); - } - case TFU_DCI_FORMAT_2: - { - /* DCI 2: Spec 36.212 Section 5.3.3.1.5 */ - dciSize = 0; - if (cell->bwCfg.dlTotalBw > 10) - { - dciSize = 1; /* Resource Allocation bit */ - } - - dciSize += (U8)bits /* Resource Allocation bits */ + \ - 2 /* TPC */ + -#ifdef TFU_TDD - 2 /* DAI */ + \ - 4 /* HARQ */ + -#else - 3 /* HARQ */ + -#endif - 1 /* CW Swap Flag */ + \ - 5 /* MCS for TB1 */+ \ - 1 /* NDI for TB1 */+ \ - 2 /* RV for TB1 */ + \ - 5 /* MCS for TB2 */+ \ - 1 /* NDI for TB2 */+ \ - 2 /* RV for TB2 */; - if (cell->numTxAntPorts == 2) - { - dciSize += 3; - } - else if (cell->numTxAntPorts == 4) - { - dciSize += 6; - } - cell->dciSize.size[TFU_DCI_FORMAT_2] = dciSize; - cell->dciSize.size[TFU_DCI_FORMAT_2] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2]]; - } - case TFU_DCI_FORMAT_2A: - { - /* DCI 2A: Spec 36.212 Section 5.3.3.1.5A */ - dciSize = 0; - if (cell->bwCfg.dlTotalBw > 10) - { - dciSize = 1; /* Resource Allocation bit */ - } - - dciSize += (U8)bits /* Resource Allocation bits */ + \ - 2 /* TPC */ + -#ifdef TFU_TDD - 2 /* DAI */ + \ - 4 /* HARQ */ + -#else - 3 /* HARQ */ + -#endif - 1 /* CW Swap Flag */ + \ - 5 /* MCS for TB1 */+ \ - 1 /* NDI for TB1 */+ \ - 2 /* RV for TB1 */ + \ - 5 /* MCS for TB2 */+ \ - 1 /* NDI for TB2 */+ \ - 2 /* RV for TB2 */; - if (cell->numTxAntPorts == 4) - { - dciSize += 2; - } - cell->dciSize.size[TFU_DCI_FORMAT_2A] = dciSize; - cell->dciSize.size[TFU_DCI_FORMAT_2A] += \ - rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2A]]; /* Spec 39.212 Table 5.3.3.1.2-1 */ - } - case TFU_DCI_FORMAT_3: - { - /* DCI 3: Spec 36.212 Section 5.3.3.1.6 */ - cell->dciSize.size[TFU_DCI_FORMAT_3] = cell->dciSize.size[TFU_DCI_FORMAT_1A] / 2; - if (cell->dciSize.size[TFU_DCI_FORMAT_3] % 2) - { - cell->dciSize.size[TFU_DCI_FORMAT_3]++; - } - } - case TFU_DCI_FORMAT_3A: - { - /* DCI 3A: Spec 36.212 Section 5.3.3.1.7 */ - cell->dciSize.size[TFU_DCI_FORMAT_3A] = cell->dciSize.size[TFU_DCI_FORMAT_1A]; - } -#ifdef EMTC_ENABLE - case TFU_DCI_FORMAT_6_0A: - { - rgSCHEmtcGetDciFrmt60ASize(cell); - } - case TFU_DCI_FORMAT_6_1A: - { - rgSCHEmtcGetDciFrmt61ASize(cell); - } -#endif - default: - { - /* DCI format not supported */ - break; - } - } -} - -/** - * @brief Handler for the CPU OvrLd related state adjustment. - * - * @details - * - * Function : rgSCHUtlCpuOvrLdAdjItbsCap - * - * Processing Steps: - * - Record dl/ulTpts - * - Adjust maxItbs to acheive target throughputs - * - * @param[in] RgSchCellCb *cell - * @return Void - **/ -#ifdef ANSI -PUBLIC Void rgSCHUtlCpuOvrLdAdjItbsCap -( - RgSchCellCb *cell -) -#else -PUBLIC Void rgSCHUtlCpuOvrLdAdjItbsCap(cell) - RgSchCellCb *cell -#endif -{ - U32 tptDelta; - - TRC3(rgSCHUtlCpuOvrLdAdjItbsCap) - - if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_DL_TPT_UP | - RGR_CPU_OVRLD_DL_TPT_DOWN)) - { - /* Regulate DL Tpt for CPU overload */ - if (cell->measurements.dlTpt > cell->cpuOvrLdCntrl.tgtDlTpt) - { - tptDelta = cell->measurements.dlTpt - cell->cpuOvrLdCntrl.tgtDlTpt; - /* Upto 0.5% drift in measured vs target tpt is ignored */ - if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5) - { - cell->thresholds.maxDlItbs = RGSCH_MAX((cell->thresholds.maxDlItbs-1), 1); - } - } - else - { - tptDelta = cell->cpuOvrLdCntrl.tgtDlTpt - cell->measurements.dlTpt; - /* Upto 0.5% drift in measured vs target tpt is ignored */ - if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5) - { - cell->thresholds.maxDlItbs = RGSCH_MIN((cell->thresholds.maxDlItbs+1), RG_SCH_DL_MAX_ITBS); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("\n DL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.dlTpt, cell->cpuOvrLdCntrl.tgtDlTpt, - cell->thresholds.maxDlItbs); -#endif - } - - if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_UL_TPT_UP | - RGR_CPU_OVRLD_UL_TPT_DOWN)) - { - /* Regualte DL Tpt for CPU overload */ - if (cell->measurements.ulTpt > cell->cpuOvrLdCntrl.tgtUlTpt) - { - tptDelta = cell->measurements.ulTpt - cell->cpuOvrLdCntrl.tgtUlTpt; - /* Upto 1% drift in measured vs target tpt is ignored */ - if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10) - { - cell->thresholds.maxUlItbs = RGSCH_MAX((cell->thresholds.maxUlItbs-1), 1); - } - } - else - { - tptDelta = cell->cpuOvrLdCntrl.tgtUlTpt - cell->measurements.ulTpt; - /* Upto 1% drift in measured vs target tpt is ignored */ - if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10) - { - cell->thresholds.maxUlItbs = RGSCH_MIN((cell->thresholds.maxUlItbs+1), RG_SCH_UL_MAX_ITBS); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("\n UL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.ulTpt, cell->cpuOvrLdCntrl.tgtUlTpt, - cell->thresholds.maxUlItbs); -#endif - } - - RETVOID; -} -/** - * @brief Handler for the num UE per TTI based CPU OvrLd instr updating - * - * @details - * - * Function : rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr - * - * Processing Steps: - * - Validate the config params. - * - Update numUEperTTi CPU OL related information. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] U8 cnrtCpuOvrLdIns - * @return Void - **/ -#ifdef ANSI -PRIVATE Void rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr -( - RgSchCellCb *cell, - U8 crntCpuOvrLdIns -) -#else -PRIVATE S16 rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(cell, crntCpuOvrLdIns) - RgSchCellCb *cell; - U8 crntCpuOvrLdIns; -#endif -{ - RgSchCpuOvrLdCntrlCb *cpuInstr = &(cell->cpuOvrLdCntrl); - RgSchCmnCell *cellSch; - U8 maxUeNewDlTxPerTti; - U8 maxUeNewUlTxPerTti; - U8 tmpSubFrame = 0; -#ifdef CPU_OL_DBG_PRINTS - U8 idx = 0; -#endif - U8 maxDlDecCnt; - U8 maxUlDecCnt; - - cellSch = RG_SCH_CMN_GET_CELL(cell); - - maxUeNewDlTxPerTti = cellSch->dl.maxUeNewTxPerTti; - maxUeNewUlTxPerTti = cellSch->ul.maxUeNewTxPerTti; - - /* Calculate Maximum Decremen */ - maxDlDecCnt = (10*(maxUeNewDlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED); - maxUlDecCnt = (10*(maxUeNewUlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED); - - /* Check for DL CPU Commands */ - if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_DEC_NUM_UE_PER_TTI ) - { - /* Decrement till 90% of maxUeNewDlTxPerTti */ - if ( cpuInstr->dlNxtIndxDecNumUeTti < maxDlDecCnt ) - { - tmpSubFrame = (cpuInstr->dlNxtIndxDecNumUeTti) % 10; - cpuInstr->dlNxtIndxDecNumUeTti++; - if ( cpuInstr->maxUeNewTxPerTti[tmpSubFrame] > 1 ) - { - cpuInstr->maxUeNewTxPerTti[tmpSubFrame]--; - } - else - { -#ifdef CPU_OL_DBG_PRINTS - printf("CPU_OL_TTI__ERROR\n"); -#endif - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti); -#endif - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", - cpuInstr->dlNxtIndxDecNumUeTti); - } - else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_INC_NUM_UE_PER_TTI ) - { - if ( cpuInstr->dlNxtIndxDecNumUeTti > 0) - { - cpuInstr->dlNxtIndxDecNumUeTti--; - tmpSubFrame = (cpuInstr->dlNxtIndxDecNumUeTti) % 10; - if ( cpuInstr->maxUeNewTxPerTti[tmpSubFrame] < maxUeNewDlTxPerTti ) - { - cpuInstr->maxUeNewTxPerTti[tmpSubFrame]++; - } - else - { -#ifdef CPU_OL_DBG_PRINTS - printf("CPU_OL_TTI__ERROR\n"); -#endif - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti); -#endif - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", - cpuInstr->dlNxtIndxDecNumUeTti); - } - /* Check for UL CPU commands */ - if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_DEC_NUM_UE_PER_TTI ) - { - /* Decrement till 90% of maxUeNewDlTxPerTti */ - if ( cpuInstr->ulNxtIndxDecNumUeTti < maxUlDecCnt ) - { - tmpSubFrame = (cpuInstr->ulNxtIndxDecNumUeTti) % 10; - cpuInstr->ulNxtIndxDecNumUeTti++; - if ( cpuInstr->maxUeNewRxPerTti[tmpSubFrame] > 1 ) - { - cpuInstr->maxUeNewRxPerTti[tmpSubFrame]--; - } - else - { -#ifdef CPU_OL_DBG_PRINTS - printf("CPU_OL_TTI__ERROR\n"); -#endif - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti); -#endif - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", - cpuInstr->dlNxtIndxDecNumUeTti); - } - else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_INC_NUM_UE_PER_TTI ) - { - if ( cpuInstr->ulNxtIndxDecNumUeTti > 0) - { - cpuInstr->ulNxtIndxDecNumUeTti--; - tmpSubFrame = (cpuInstr->ulNxtIndxDecNumUeTti) % 10; - if ( cpuInstr->maxUeNewRxPerTti[tmpSubFrame] < maxUeNewUlTxPerTti ) - { - cpuInstr->maxUeNewRxPerTti[tmpSubFrame]++; - } - else - { -#ifdef CPU_OL_DBG_PRINTS - printf("CPU_OL_TTI__ERROR\n"); -#endif - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); - } - } -#ifdef CPU_OL_DBG_PRINTS - printf("ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti); -#endif - RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", - cpuInstr->dlNxtIndxDecNumUeTti); - } -#ifdef CPU_OL_DBG_PRINTS - /* TODO: Debug Information - Shall be moved under CPU_OL_DBG_PRINTS */ - printf("maxUeNewDlTxPerTti = %d, maxUeNewUlTxPerTti = %d\n", maxUeNewDlTxPerTti, maxUeNewUlTxPerTti); - printf("DL Sf numUePerTti:"); - for ( idx = 0; idx < 10 ; idx ++ ) - { - printf(" %d", cpuInstr->maxUeNewTxPerTti[idx]); - } - printf("\nUL Sf numUePerTti:"); - for ( idx = 0; idx < 10 ; idx ++ ) - { - printf(" %d", cpuInstr->maxUeNewRxPerTti[idx]); - } - printf("\n"); -#endif - - RETVOID; -} /* rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr */ - -/** - * @brief Handler for the CPU OvrLd related cell Recfg. - * - * @details - * - * Function : rgSCHUtlResetCpuOvrLdState - * - * Processing Steps: - * - Validate the config params. - * - Update CPU OL related state information. - * - If successful, return ROK else RFAILED. - * - * @param[in] RgSchCellCb *cell - * @param[in] U8 cnrtCpuOvrLdIns - * @return S16 - * -# ROK - * -# RFAILED - **/ -#ifdef ANSI -PUBLIC S16 rgSCHUtlResetCpuOvrLdState -( - RgSchCellCb *cell, - U8 crntCpuOvrLdIns -) -#else -PUBLIC S16 rgSCHUtlResetCpuOvrLdState(cell, crntCpuOvrLdIns) - RgSchCellCb *cell; - U8 crntCpuOvrLdIns; -#endif -{ - U8 crntDlCpuOL=0; - U8 crntUlCpuOL=0; - RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); - U8 idx; - - TRC3(rgSCHUtlResetCpuOvrLdState) - -#ifdef CPU_OL_DBG_PRINTS - printf("\n CPU OVR LD Ins Rcvd = %d\n", (int)crntCpuOvrLdIns); -#endif - RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"CPU OVR LD Ins Rcvd"); - - if ( RGR_CPU_OVRLD_RESET == crntCpuOvrLdIns ) - { - /* The CPU OL instruction received with RESET (0), hence reset it */ -#ifdef CPU_OL_DBG_PRINTS - printf("rgSCHUtlResetCpuOvrLdState: RESET CPU OL instr\n"); -#endif - RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"RESET CPU OVR LD"); - cell->cpuOvrLdCntrl.cpuOvrLdIns = 0; - /* Reset the max UL and DL itbs to 26 */ - cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS; - cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS; - /* Reset the num UE per TTI intructions */ - cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0; - cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0; - for ( idx = 0; idx < 10; idx++ ) - { - cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] = - schCmnCell->dl.maxUeNewTxPerTti; - cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] = - schCmnCell->ul.maxUeNewTxPerTti; - } - - RETVALUE(ROK); - } - /* Check and Update numUEPer TTI based CPU overload instruction before - * going for TP based CPU OL - * TTI based intrcuctions shall be > 0xF */ - if ( crntCpuOvrLdIns > 0xF ) - { - rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(cell, crntCpuOvrLdIns); - /* If need to have both TP and numUePerTti instrcution together in - * one command then dont return from here */ - RETVALUE(ROK); - } - - crntDlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_UP) +\ - (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_DOWN); - if ((crntDlCpuOL) && (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_UP) && - (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_DOWN)) - { - /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ - RETVALUE(RFAILED); - } - crntUlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_UP) +\ - (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_DOWN); - if ((crntUlCpuOL) && (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_UP) && - (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_DOWN)) - { - /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ - RETVALUE(RFAILED); - } - if ((crntDlCpuOL == 0) && (crntUlCpuOL == 0)) - { - /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ - RETVALUE(RFAILED); - } - - cell->cpuOvrLdCntrl.cpuOvrLdIns = crntCpuOvrLdIns; - - if (crntUlCpuOL) - { - if (crntUlCpuOL == RGR_CPU_OVRLD_UL_TPT_DOWN) - { - cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt - \ - (cell->measurements.ulTpt * 3 )/100; - } - else - { - cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt + \ - (cell->measurements.ulTpt * 2 )/100; - } - RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,"CPU OVR LD UL Reset to " - "%d, %lu, %lu", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt,cell->measurements.ulTpt); -#ifdef CPU_OL_DBG_PRINTS - printf("\n CPU OVR LD UL Reset to= %d, %lu, %lu\n", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt, - cell->measurements.ulTpt); -#endif - } - - if (crntDlCpuOL) - { - if (crntDlCpuOL == RGR_CPU_OVRLD_DL_TPT_DOWN) - { - cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt - \ - (cell->measurements.dlTpt * 1 )/100; - } - else - { - cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt + \ - (cell->measurements.dlTpt * 1 )/100; - } - RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,"CPU OVR LD DL Reset to " - "%d, %lu, %lu", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt,cell->measurements.dlTpt); - -#ifdef CPU_OL_DBG_PRINTS - printf("\n CPU OVR LD DL Reset to= %d, %lu, %lu\n", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt, - cell->measurements.dlTpt); -#endif - } - rgSCHUtlCpuOvrLdAdjItbsCap(cell); - RETVALUE(ROK); -} -#ifdef EMTC_ENABLE -PUBLIC S16 rgSCHUtlAddToResLst -( - CmLListCp *cp, - RgSchIotRes *iotRes - ) -{ - cmLListAdd2Tail(cp, &iotRes->resLnk); - iotRes->resLnk.node = (PTR)iotRes; - RETVALUE(ROK); -} -PUBLIC S16 rgSCHUtlDelFrmResLst -( -RgSchUeCb *ue, -RgSchIotRes *iotRes -) -{ - CmLListCp *cp = NULLP; - RgSchEmtcUeInfo *emtcUe = NULLP; - emtcUe = RG_GET_EMTC_UE_CB(ue); - if(iotRes->resType == RG_SCH_EMTC_PUCCH_RES) - { - cp = &emtcUe->ulResLst; - }else if(iotRes->resType == RG_SCH_EMTC_PDSCH_RES) - { - cp = &emtcUe->dlResLst; - }else - { - RLOG0(L_INFO, "*****restype mismatch"); - } - if(cp != NULLP ) - { - if(cp->count == 0) - { - RLOG0(L_INFO,"****error count*****\n"); - RETVALUE(ROK); - } - } - cmLListDelFrm(cp, &iotRes->resLnk); - iotRes->resLnk.node = NULLP; - RETVALUE(ROK); -} -#endif -/********************************************************************** - - End of file -**********************************************************************/ diff --git a/src/5gnrrlc/kw_lmm.c b/src/5gnrrlc/kw_lmm.c index 0e4976345..c0a8f7909 100755 --- a/src/5gnrrlc/kw_lmm.c +++ b/src/5gnrrlc/kw_lmm.c @@ -2621,9 +2621,7 @@ Inst inst; RETVALUE (RFAILED); } gCb = KW_GET_KWCB(inst); -#if 0 cmPrcTmr(&(gCb->kwTqCp), gCb->kwTq, (PFV) kwTmrExpiry); -#endif RETVALUE(ROK); } /* end of kwActvTmr */ diff --git a/src/5gnrsch/rg_sch.c b/src/5gnrsch/rg_sch.c new file mode 100755 index 000000000..5cf8f4653 --- /dev/null +++ b/src/5gnrsch/rg_sch.c @@ -0,0 +1,3083 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch.c + +**********************************************************************/ + +/** @file rg_sch.c +@brief This file implements the schedulers main access to MAC layer code. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_FILE_ID=185; +static int RLOG_MODULE_ID=4096; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" +#include "rgr.h" +#include "tfu.h" +#include "rgm.h" +#include "rg_env.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_err.h" +#include "rg_sch_cmn.h" +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for Scheduler */ +#include "rg_sch_cmn.x" + +#ifdef EMTC_ENABLE +EXTERN S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd)); +EXTERN S16 rgSCHGomEmtcHndlSiCfg ARGS(( +Region reg, +Pool pool, +RgSchCb *instCb, +SpId spId, +RgrCfgTransId transId, +RgrSiCfgReqInfo *cfgReqInfo +)); +EXTERN S16 rgSCHGomEmtcHndlWarningSiCfg ARGS(( +Region reg, +Pool pool, +RgSchCb *instCb, +SpId spId, +RgrCfgTransId transId, +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo +)); +#endif +/* local defines */ +/************** LRG Interface ****************/ +/** + * @brief Layer Manager Configuration request handler. + * + * @details + * + * Function : HandleSchGenCfgReq + * + * This function handles the configuration + * request received at scheduler instance from the Layer Manager. + * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the + * functions rgHdlGenCfg() or rgHdlSapCfg(). + * -# Invokes RgMiLrgSchCfgCfm() to send back the confirmation to the LM. + * + * @param[in] Pst *pst, the post structure + * @param[in] RgMngmt *cfg, the configuration parameter's structure + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 HandleSchGenCfgReq +( +Pst *pst, /* post structure */ +RgMngmt *cfg /* config structure */ +) +#else +PUBLIC S16 HandleSchGenCfgReq(pst, cfg) +Pst *pst; /* post structure */ +RgMngmt *cfg; /* config structure */ +#endif +{ + U16 ret = LCM_PRIM_OK; + U16 reason = LCM_REASON_NOT_APPL; + RgMngmt cfm; + Pst cfmPst; +#ifdef DEBUGP + Inst inst = (pst->dstInst - SCH_INST_START); +#endif + + TRC3(HandleSchGenCfgReq) + + + if(pst->dstInst < SCH_INST_START) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Invalid inst ID"); + RLOG_ARG2(L_DEBUG,DBG_INSTID,inst, "HandleSchGenCfgReq(): " + "pst->dstInst=%d SCH_INST_START=%d", pst->dstInst,SCH_INST_START); + RETVALUE(ROK); + } + printf("\nReceived scheduler gen config"); + /* Fill the post structure for sending the confirmation */ + SchFillCfmPst(pst, &cfmPst, cfg); + + /* Initialize the cfg cfm structure + if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt)) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation"); + RETVALUE(ROK); + } */ + cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt)); + +#ifdef LMINT3 + cfm.hdr.transId = + cfg->hdr.transId; +#endif + + cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt; + switch(cfg->hdr.elmId.elmnt) + { + case STSCHINST: + reason = SchInstCfg(&cfg->t.cfg,pst->dstInst ); + break; + default: + ret = LCM_PRIM_NOK; + reason = LCM_REASON_INVALID_ELMNT; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid Elmnt=%d", cfg->hdr.elmId.elmnt); + break; + } + + if (reason != LCM_REASON_NOT_APPL) + { + ret = LCM_PRIM_NOK; + } + + cfm.cfm.status = ret; + cfm.cfm.reason = reason; + + SchSendCfgCfm(&cfmPst, &cfm); + /* SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */ + + RETVALUE(ROK); +}/*-- HandleSchGenCfgReq --*/ + + +/** + * @brief Layer Manager Control request handler. + * + * @details + * + * Function : RgMiLrgSchCntrlReq + * + * This function handles the control + * request received from the Layer Manager. + * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action + * and cntrl->t.cntrl.subAction, it performs the appropriate control action + * of SAP (enable/disable) and layer shutdown. + * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM. + * + * @param[in] Pst *pst, the post structure + * @param[in] RgMngmt *cntrl, the control parameter's structure + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMiLrgSchCntrlReq +( +Pst *pst, /* post structure */ +RgMngmt *cntrl /* control structure */ +) +#else +PUBLIC S16 RgMiLrgSchCntrlReq(pst, cntrl) +Pst *pst; /* post structure */ +RgMngmt *cntrl; /* control structure */ +#endif +{ + S16 ret = ROK; /* return value */ + Pst cfmPst; + RgMngmt cfm; + + Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */ + TRC3(RgMiLrgSchCntrlReq) + + + /* Fill the post structure for sending the confirmation */ + SchFillCfmPst(pst, &cfmPst, cntrl); + + /* Initialize the cfg cfm structure + if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt)) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation"); + SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); + RETVALUE(ROK); + } */ + cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt)); + +#ifdef LMINT3 + cfm.hdr.transId = + cntrl->hdr.transId; +#endif + + cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt; + cfm.t.cntrl.action = cntrl->t.cntrl.action; + cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction; + + /* Check if General Config Done*/ + if(rgSchCb[inst].rgSchInit.cfgDone != TRUE) + { + cfm.cfm.status = LCM_PRIM_NOK; + cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE; + cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt; + RgMiLrgSchCntrlCfm(&cfmPst, &cfm); + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done."); + /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */ + RETVALUE(ROK); + } + + /* General Config done, process the Control request */ + switch(cntrl->hdr.elmId.elmnt) + { + case STGEN: + rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst); + break; + case STTFUSAP: + case STRGRSAP: + rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst); + break; + default: + cfm.cfm.status = LCM_PRIM_NOK; + cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RgMiLrgSchCntrlCfm(&cfmPst, &cfm); + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d", + cntrl->hdr.elmId.elmnt); + break; + } + /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */ + RETVALUE(ret); +}/*-- RgMiLrgSchCntrlReq --*/ + +#ifdef LTE_L2_MEAS +/** + * @brief Layer Manager L2 Measurement request handler. + * + * @details + * + * Function : RgMiLrgSchL2MeasReq + * + * This function handles the control + * measurement request received from the Layer Manager. + * + * @param[in] Pst *pst, the post structure + * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMiLrgSchL2MeasReq +( +Pst *pst, /* post structure */ +LrgSchMeasReqInfo *measInfo /* Meas Req Info */ +) +#else +PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo) + Pst *pst; /* post structure */ + LrgSchMeasReqInfo *measInfo; /* Meas Req Info */ +#endif +{ + Pst cfmPst; + RgSchCellCb *cell; + RgSchErrInfo err; + S16 ret = ROK; + RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)]; +#if (ERRCLASS & ERRCLS_ADD_RES) + CmLList *lnk; +#endif + U32 idx; + RgSchL2MeasCb *measCb = NULLP; +#ifdef DEBUGP + Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */ +#endif + + err.errType = 0; + err.errCause = 0; + + TRC3(RgMiLrgSchL2MeasReq) + + + /* Find the cellCb using cellId in measInfo. Iterate through all cells + * in rgrsapCb in RgschCb */ + cell = NULLP; + for (idx = 0; idx < instCb->numSaps; idx++) + { + if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) + { + /* got the cell break the loop */ + cell = instCb->rgrSap[idx].cell; + break; + } + } + /* If no cellCb return Err with Invalid Cell Id */ + if (cell == NULLP) + { + rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); + RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID); + rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE); + RLOG_ARG2(L_ERROR,DBG_INSTID,inst, + "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)", + err.errType, err.errCause); + RETVALUE(RFAILED); + } + /* Validate for Meas Types */ + if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK) + { + rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); + RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE); + rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE); + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "Meas req Failed.Invalid Measurement Type" + "errCasue(%d) errType(%d)", err.errType, err.errCause); + RETVALUE(RFAILED); + } + /* Iterate through all meas requests in l2mList in cellCb */ +#if (ERRCLASS & ERRCLS_ADD_RES) + lnk = cell->l2mList.first; + while(lnk != NULLP) + { + /* Get the MeasCb : RgSchL2MeasCb */ + measCb = (RgSchL2MeasCb *)lnk->node; + lnk = lnk->next; + if (measCb->measReq.hdr.transId == measInfo->hdr.transId) + { + rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); + RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID); + rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE); + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "Meas req Failed.Dublicate TransId" + "errType(%d) errCause(%d)", err.errType, err.errCause); + RETVALUE(RFAILED); + } + } +#endif + /* Call L2M Function to store Meas req */ + ret = rgSchL2mMeasReq(cell, measInfo, err); + if (ret != ROK) + { + rgSchL2mFillCfmPst(pst, &cfmPst, measInfo); + RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED); + rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE); + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "Meas req Failed.errType(%d) errCause(%d)", + err.errType, err.errCause); + RETVALUE(RFAILED); + } + RETVALUE(ret); +} /* -- RRgMiLrgSchL2MeasReq-- */ + +/** + * @brief Layer Manager L2 Measurement Stop request handler. + * + * @details + * + * Function : RgMiLrgSchL2MeasStopReq + * + * This function handles the control + * measurement stop request received from the Layer Manager. + * + * @param[in] Pst *pst, the post structure + * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMiLrgSchL2MeasStopReq +( +Pst *pst, /* post structure */ +LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */ +) +#else +PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo) + Pst *pst; /* post structure */ + LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */ +#endif +{ + S16 ret = ROK; + RgSchCellCb *cell = NULLP; + RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)]; + CmLList *node = NULLP; + RgSchL2MeasCb *measCb = NULLP; + LrgSchMeasCfmInfo measCfm; + U8 idx; + + + TRC3(RgMiLrgSchL2MeasStopReq) + + + for (idx = 0; idx < instCb->numSaps; idx++) + { + if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) + { + /* got the cell break the loop */ + cell = instCb->rgrSap[idx].cell; + break; + } + } + if (cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, + "Stop req Failed.Invalid Cell Id "); + RETVALUE(RFAILED); + } + cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo)); + node = cell->l2mList.first; + while(node != NULLP) + { + measCb = (RgSchL2MeasCb *)(node)->node; + + node = (node)->next; + cmLListDelFrm(&cell->l2mList, &measCb->measLnk); + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, + sizeof(RgSchL2MeasCb)); + } + + if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) + { + RgInfL2MeasStopReq measStopReq; + Pst pstMac; + cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq)); + measStopReq.transId = measInfo->hdr.transId; + measStopReq.measType = measInfo->measType; + /* measReq.timePrd = measInfo->timePrd; */ + measStopReq.cellId = measInfo->cellId; + rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst); + RgSchMacL2MeasStop(&pstMac,&measStopReq); + } + else + { + RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst), + &measCfm); + } + RETVALUE(ret); +}/*RgMiLrgSchL2MeasStopReq*/ +/** + * @brief Layer Manager L2 Measurement request handler. + * for Send l2 measurement req + * @details + * + * Function : RgMiLrgSchL2MeasSendReq + * + * This function handles the control + * measurement send request received from the Layer Manager. + * + * @param[in] Pst *pst, the post structure + * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMiLrgSchL2MeasSendReq +( +Pst *pst, /* post structure */ +LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */ +) +#else +PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo) + Pst *pst; /* post structure */ + LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */ +#endif +{ + S16 ret = ROK; + RgSchCellCb *cell; + RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)]; + U8 idx; + + TRC3(RgMiLrgSchL2MeasSendReq) + + + + cell = NULLP; + for (idx = 0; idx < instCb->numSaps; idx++) + { + if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId) + { + /* got the cell break the loop */ + cell = instCb->rgrSap[idx].cell; + break; + } + } + if (cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, + "Send req Failed.Invalid Cell Id"); + RETVALUE(RFAILED); + } + + if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) + { + RgInfL2MeasSndReq measSndReq; + Pst pstMac; + cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq)); + measSndReq.transId = measInfo->hdr.transId; + measSndReq.measType = measInfo->measType; + measSndReq.timePrd = measInfo->timePrd; + measSndReq.cellId = measInfo->cellId; + rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst); + RgSchMacL2MeasSend(&pstMac, &measSndReq); + } + else + { + cell->sndL2Meas = TRUE; + } + + RETVALUE(ret); +}/*RgMiLrgSchL2MeasSendReq*/ +#endif /* LTE_L2_MEAS */ + + + + +/************* RGR Interface ****************/ +/** + * @brief API for bind request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrBndReq + * + * This API is invoked by RRM towards MAC to bind RGR SAP. + * These API validates the Pst, spId, suId and sends the bind confirm to + * RRM. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] SpId spId + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrBndReq +( + Pst *pst, + SuId suId, + SpId spId + ) +#else +PUBLIC S16 RgUiRgrBndReq(pst, suId, spId) + Pst *pst; + SuId suId; + SpId spId; +#endif +{ + S16 ret = ROK; + Pst tmpPst; /* Temporary Post Structure */ + Inst instId = pst->dstInst-SCH_INST_START; + RgUstaDgn dgn; /* Alarm diagnostics structure */ + + TRC3(RgUiRgrBndReq) + + + tmpPst.prior = pst->prior; + tmpPst.route = pst->route; + tmpPst.selector = pst->selector; + tmpPst.region = rgSchCb[instId].rgSchInit.region; + tmpPst.pool = rgSchCb[instId].rgSchInit.pool; + tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId; + tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent; + tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START; + tmpPst.event = EVTNONE; + tmpPst.dstProcId = pst->srcProcId; + tmpPst.dstEnt = pst->srcEnt; + tmpPst.dstInst = pst->srcInst; + + if(spId < rgSchCb[instId].numSaps) + { + /* Check the state of the SAP */ + switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { + /* This case might not be needed if SAP not configured then it will go + * to else of above if condition */ + case LRG_UNBND: /* SAP is not bound */ + RLOG0(L_DEBUG,"SAP Not yet bound"); + rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND; + rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId; + /* Send Bind Confirm with status as SUCCESS */ + ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK); + /*Indicate to Layer manager */ + rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM); + ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE, + LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn); + break; + case LRG_BND: /* SAP is already bound*/ + RLOG0(L_DEBUG,"SAP is already bound"); + ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK); + break; + default: /* Should Never Enter here */ +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State:RgUiRrgBndReq failed\n"); +#endif + ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK); + break; + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state + to spId to avoid seg fault due to invalid sapID */ + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002, + (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n"); +#endif + ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK); + } + RETVALUE(ret); +} /* RgUiRgrBndReq */ + +/** + * @brief API for unbind request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrUbndReq + * + * This API is invoked by RRM towards MAC to unbind RGR SAP. + * These API validates the Pst, spId, suId and transfers the unbind request + * specific information to corresponding ownership module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] Reason reason + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrUbndReq +( + Pst *pst, + SpId spId, + Reason reason + ) +#else +PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason) + Pst *pst; + SpId spId; + Reason reason; +#endif +{ + Inst instId = pst->dstInst-SCH_INST_START; + TRC3(RgUiRgrUbndReq) + + + /* SAP Id validation */ + if (spId < rgSchCb[instId].numSaps) + { + switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { + case LRG_BND: /* SAP is already bound*/ + RLOG0(L_DEBUG,"SAP is already bound"); + /* setting SAP state to UN BOUND */ + rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND; + break; + default: +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: RgUiRgrUbndReq failed\n"); +#endif + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP Id:RgUiRgrUbndReq failed\n"); +#endif + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} /* RgUiRgrUbndReq */ + +/** + * @brief API for configuration request from RRM towards MAC. + * + * @details + * + * Function: HandleSchCfgReq + * + * This API is invoked by RRM towards MAC to configure MAC. + * These API validates the Pst, spId, suId and transfers the config request + * specific information to corresponding ownership module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] RgrCfgTransId transId + * @param[in] RgrCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 HandleSchCfgReq +( + Pst *pst, + RgrCfgTransId transId, + RgrCfgReqInfo *cfgReqInfo + ) +#else +PUBLIC S16 HandleSchCfgReq(pst, transId, cfgReqInfo) + Pst *pst; + RgrCfgTransId transId; + RgrCfgReqInfo *cfgReqInfo; +#endif +{ + + SpId spId = 0; + S16 ret = ROK; + U8 cfmStatus = 0x00ff; + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + Inst instId = pst->dstInst-SCH_INST_START; + + TRC3(HandleSchCfgReq); + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + if (cfgReqInfo == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer is NULL"); + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } +#if 0 + if (spId < rgSchCb[instId].numSaps) + { + switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { + case LRG_BND: /* SAP is already bound */ + RLOG0(L_DEBUG,"SAP is already bound"); + break; + default: /* Should never reach here */ +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG005, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: HandleSchCfgReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG006, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, + "Invalid SAP Id:HandleSchCfgReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } +#endif + /* Handle configuration */ + ret = rgSCHGomHndlCfg(pst, &rgSchCb[instId], + transId, cfgReqInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Configuration Request Handling Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* HandleSchCfgReq */ + +#ifdef RGR_SI_SCH +/** + * @brief API for SI configuration request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrSiCfgReq + * + * This API is invoked by RRM towards MAC to configure SI at MAC. + * These API validates the Pst, spId, suId and transfers the + * config request specific information to corresponding ownership + * module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SpId spId + * @param[in] RgrCfgTransId transId + * @param[in] RgrSiCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrSiCfgReq +( +Pst *pst, +SpId spId, +RgrCfgTransId transId, +RgrSiCfgReqInfo *cfgReqInfo +) +#else +PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo) +Pst *pst; +SpId spId; +RgrCfgTransId transId; +RgrSiCfgReqInfo *cfgReqInfo; +#endif +{ + S16 ret = ROK; + U8 cfmStatus = RGR_CFG_CFM_NOK; + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + Inst instId = pst->dstInst-SCH_INST_START; + + TRC2(RgUiRgrSiCfgReq); + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + if (cfgReqInfo == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " + "is NULL"); + rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + + if (spId < rgSchCb[instId].numSaps) + { + if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: RgUiRgrSiCfgReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, + "Invalid SAP Id:RgUiRgrSiCfgReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + + /* Handle configuration */ +#ifdef EMTC_ENABLE +if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable) +{ + ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, + cfgReqInfo); +} +else +{ + ret = rgSCHGomHndlSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, + cfgReqInfo); +} + #else + ret = rgSCHGomHndlSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, + cfgReqInfo); + #endif + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:" + "Configuration Request Handling Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* RgUiRgrSiCfgReq */ + + +/** + * @brief API for Warning SI configuration request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrWarningSiCfgReq + * + * This API is invoked by RRM towards MAC to configure SI at MAC. + * These API validates the Pst, spId, suId and transfers the + * config request specific information to corresponding ownership + * module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SpId spId + * @param[in] RgrCfgTransId transId + * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrWarningSiCfgReq +( +Pst *pst, +SpId spId, +RgrCfgTransId transId, +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo +) +#else +PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo) +Pst *pst; +SpId spId; +RgrCfgTransId transId; +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo; +#endif +{ + Inst instId = pst->dstInst-SCH_INST_START; + S16 ret = ROK; + U8 cfmStatus = RGR_CFG_CFM_NOK; + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + + TRC2(RgUiRgrWarningSiCfgReq); + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + + if (warningSiCfgReqInfo == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " + "is NULL"); + rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus); + RETVALUE(RFAILED); + } + + if (spId < rgSchCb[instId].numSaps) + { + if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: warningSiCfgReqInfo failed\n"); +#endif + rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, + &warningSiCfgReqInfo->siPduLst); + SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, + transId, cfmStatus); + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, + "Invalid SAP Id:warningSiCfgReqInfo failed\n"); +#endif + rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, + &warningSiCfgReqInfo->siPduLst); + SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, + transId, cfmStatus); + RETVALUE(RFAILED); + } + + /* Handle configuration */ +#ifdef EMTC_ENABLE +if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable) +{ + ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); +} +else +{ + ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); +} +#else + ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool, + &rgSchCb[instId], spId, transId, warningSiCfgReqInfo); +#endif + if(ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId, + "Configuration Request Handling Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} + + +/** + * @brief API for Warning SI Stop request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrWarningSiStopReq + * + * This API is invoked by RRM towards MAC to Stop warning SI at MAC. + * These API validates the Pst, spId, suId and transfers the + * stop request specific information to corresponding ownership + * module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SpId spId + * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrWarningSiStopReq +( +Pst *pst, +SpId spId, +RgrCfgTransId transId, +U8 siId +) +#else +PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId) +Pst *pst; +SpId spId; +RgrCfgTransId transId; +U8 siId; +#endif +{ + Inst instId = pst->dstInst-SCH_INST_START; + + TRC3(RgUiRgrWarningSiStopReq) + + + + if (spId < rgSchCb[instId].numSaps) + { + if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n"); +#endif + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, + "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n"); +#endif + RETVALUE(RFAILED); + } + + rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool, + &rgSchCb[instId], siId, transId, spId); + + RETVALUE(ROK); +} +#endif /*RGR_SI_SCH */ + +/* LTE_ADV_FLAG_REMOVED_START */ + +/** + * @brief API for LOAD INF request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgrLoadInfReq + * + * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC. + * These API validates the Pst, spId, suId and transfers the + * LOAD INF request to corresponding ownership + * module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SpId spId + * @param[in] RgrCfgTransId transId + * @param[in] RgrLoadInfReqInfo *loadInfReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgrLoadInfReq +( + Pst *pst, + SpId spId, + RgrCfgTransId transId, + RgrLoadInfReqInfo *loadInfReq + ) +#else +PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq) + Pst *pst; + SpId spId; + RgrCfgTransId transId; + RgrLoadInfReqInfo *loadInfReq; +#endif +{ + S16 ret = ROK; + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + Inst instId = pst->dstInst-SCH_INST_START; + + TRC2(RgUiRgrLoadInfReq); + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + if (loadInfReq == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer " + "is NULL"); + RETVALUE(RFAILED); + } + + if (spId < rgSchCb[instId].numSaps) + { + if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState) + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState, + "Invalid SAP State: RgUiRgrLoadInfReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq, + (Size)sizeof(*loadInfReq)); + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008, + (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId, + "Invalid SAP Id:RgUiRgrLoadInfReq failed\n"); +#endif + SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq, + (Size)sizeof(*loadInfReq)); + RETVALUE(RFAILED); + } + + /* Handle configuration */ + ret = rgSCHGomHndlLoadInf(pst->region, pst->pool, + &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId, + loadInfReq); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId, + "Configuration Request Handling Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* RgUiRgrLoadInfReq */ +/* LTE_ADV_FLAG_REMOVED_END */ + +/************** MAC SCH Interface **************/ +/** + * @brief Function for updating dedicated channel BO at scheduler from MAC. + * + * @details + * + * Function : rgMacSchDedBoUpdtReq + * + * This function shall be invoked whenever MAC gets staRsp from RLC + * Scheduler shall update BO in its dedicated logical channel control block. + * + * @param[in] Pst* pst + * @param[in] S16 cellSapId + * @param[in] RgInfDedBoRpt *boRpt + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchDedBoUpdtReq +( +Pst* pst, +RgInfDedBoRpt *boRpt +) +#else +PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt) +Pst* pst; +RgInfDedBoRpt *boRpt; +#endif +{ + RgSchCellCb *cell; + RgSchUeCb *ue; +#ifdef SCH_STATS + RgSchCmnDlUe *dlUe; +#endif + + + Inst inst = (pst->dstInst - SCH_INST_START); + S16 cellSapId = boRpt->cellSapId; + + TRC3(RgMacSchDedBoUpdtReq) +/* + RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():" + " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId); +*/ + /* No need to chk for cell being NULL as MAC wouldn't have found instance if + * it doesnt exist */ + cell = rgSchCb[inst].rgrSap[cellSapId].cell; + +#ifndef NO_ERRCLS + if (cell->cellId != boRpt->cellId) + { + /* Handle Cell fetch failure */ + RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId, + "rgMacSchDedBoUpdtReq(): Invalid cell Id"); + RETVALUE(RFAILED); + } +#endif + + /* Update Bo in the given logical channel of the UE */ + if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP) + { + RgSchDlLcCb *dlLc; + /* Honor BO Reports only from PCELL */ +#ifdef LTE_ADV + if (cell != ue->cell) + { + RETVALUE(RFAILED); + } +#endif + if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP) + { +#ifdef LTE_L2_MEAS + if(dlLc->lcType == CM_LTE_LCH_DTCH) + { + if((dlLc->bo == 0) &&(boRpt->bo != 0)) + { + /* UE is active */ + if(!(ue->qciActiveLCs[dlLc->qciCb->qci])) + { + dlLc->qciCb->dlUeCount++; + } + ue->qciActiveLCs[dlLc->qciCb->qci]++; + } + else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount)) + { + /* UE is inactive */ + if (ue->qciActiveLCs[dlLc->qciCb->qci]) + { + ue->qciActiveLCs[dlLc->qciCb->qci]--; + if (!(ue->qciActiveLCs[dlLc->qciCb->qci])) + { + dlLc->qciCb->dlUeCount--; + } + } + } + } +#endif +#ifdef SCH_STATS + dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); + if (boRpt->bo > dlLc->bo) + { + dlUe->boReported += (boRpt->bo - dlLc->bo); + } +#endif +#ifdef TENB_STATS + if (boRpt->bo > dlLc->bo) + { + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3); + } +#endif + /* RLC provides cumulative BO for each LC. + * Reduce the left out unscheduled bo from total bo and + * update the new BO to the total bo */ + if(ue->totalBo >= dlLc->bo) + { + ue->totalBo -= dlLc->bo; + } + else + { + ue->totalBo = 0; /* this case should not arise + * Resetting for safety */ + } + + ue->totalBo += boRpt->bo; + dlLc->bo = boRpt->bo; + dlLc->oldestSduArrTime = boRpt->oldestSduArrTime; + dlLc->staPduBo = boRpt->staPduBo; + + dlLc->setMaxUlPrio = boRpt->setMaxUlPrio; + dlLc->setMaxDlPrio = boRpt->setMaxDlPrio; + /* Update the scheduler */ + rgSCHUtlDlDedBoUpd(cell, ue, dlLc); + RETVALUE(ROK); + } + } + RETVALUE(RFAILED); + +} /* end of rgMacSchDedBoUpdtReq */ + + +/** + * @brief Function for updating common channel BO at scheduler from MAC. + * + * @details + * + * Function : RgMacSchCmnBoUpdtReq + * + * This function shall be invoked whenever MAC gets staRsp from RLC + * Scheduler shall update BO in its common logical channel control block. + * + * @param[in] Pst* pst + * @param[in] S16 cellSapId + * @param[in] RgInfCmnBoRpt *boRpt + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchCmnBoUpdtReq +( +Pst* pst, +RgInfCmnBoRpt *boRpt +) +#else +PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt) +Pst* pst; +RgInfCmnBoRpt *boRpt; +#endif +{ + RgSchCellCb *cell; + Inst inst = (pst->dstInst - SCH_INST_START); + S16 cellSapId = boRpt->cellSapId; + + TRC3(RgMacSchCmnBoUpdtReq) + + /* No need to chk for cell being NULL as MAC would not have found instance if + * it doesnt exist */ + cell = rgSchCb[inst].rgrSap[cellSapId].cell; + if (cell->cellId != boRpt->cellId) + { + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():" + "Invalid boRpt cell Id:%d",boRpt->cellId); + RETVALUE(RFAILED); + } + + /* handle status response on CCCH */ + if(boRpt->lcId == cell->dlCcchId) + { + RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():" + " BO update for CCCH"); + rgSCHUtlHndlCcchBoUpdt(cell, boRpt); + } + else + { + rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt); + } + + RETVALUE(ROK); +} /* end of RgMacSchCmnBoUpdtReq */ +/*Fix: start: Inform UE delete to scheduler*/ +/** + * @brief This API is used to send data indication to Scheduler instance from MAC. + * + * @details + * + * Function : rgMacSchUeDelInd + * + * This function shall be invoked whenever MAC gets Ue delete request. + * + * + * @param[in] Pst* pst + * @param[in] RgInfUeDelInd *ueDelInd + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchUeDelInd +( +Pst* pst, +RgInfUeDelInd *ueDelInd +) +#else +PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd) +Pst* pst; +RgInfUeDelInd *ueDelInd; +#endif +{ + RgSchCellCb *cell; + Inst inst = (pst->dstInst - SCH_INST_START); + S16 cellSapId = ueDelInd->cellSapId; + CmLList *tmp; + RgSchRntiLnk *rntiLnk=NULL; + + TRC3(RgMacSchUeDelInd) + + if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured"); + RETVALUE(ROK); + } + cell = rgSchCb[inst].rgrSap[cellSapId].cell; +#ifndef NO_ERRCLS + if (cell->cellId != ueDelInd->cellId) + { + /* Handle Cell fetch failure */ + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d", + ueDelInd->cellId); + RETVALUE(ROK); + } +#endif + + CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp); + + while(tmp) + { + rntiLnk = (RgSchRntiLnk *)(tmp->node); + if(rntiLnk->rnti == ueDelInd->rnti) + { + cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp); + tmp->node = NULLP; + rgSCHDbmRlsRnti(cell, rntiLnk); + RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, + "RNTI:%d Released from the Guard pool(%ld)", + ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count); + + break; + } + CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp); + } + +#ifdef EMTC_ENABLE + rgEmtcMacSchUeDelInd(cell,ueDelInd); +#endif + + if(tmp == NULLP) + { + /* Fix : syed HO UE does not have a valid ue->rntiLnk */ + RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the" + "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count); + } + + RETVALUE(ROK); +} /* rgMacSchUeDelInd */ +/*Fix: end: Inform UE delete to scheduler*/ +/** + * @brief This API is used to send data indication to Scheduler instance from MAC. + * + * @details + * + * Function : rgMacSchSfRecpInd + * + * This function shall be invoked whenever MAC gets datInd on TFU + * Scheduler shall act on the CEs and data that are received as part of + * datInd. + * + * @param[in] Pst* pst + * @param[in] S16 cellSapId + * @param[in] CmLteRnti rnti + * @param[in] DatIndInfo *datInd + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchSfRecpInd +( +Pst* pst, +RgInfSfDatInd *subfrmInfo +) +#else +PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo) +Pst* pst; +RgInfSfDatInd *subfrmInfo; +#endif +{ + S16 ret = RFAILED; + RgSchErrInfo err; + RgSchUeCb *ue; + RgInfUeDatInd *datInd; + RgSchCellCb *cell; + Inst inst = (pst->dstInst - SCH_INST_START); + CmLteRnti rnti; + CmLListCp *lnkLst; + CmLList *tmp; + S16 cellSapId = subfrmInfo->cellSapId; + RgrUeStaIndInfo *ueStaInd; +#ifdef RG_UNUSED +//#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe ; +#endif + /* RRM_RBC_X */ + U32 idx; + /* RRM_RBC_Y */ + +#ifdef LTE_L2_MEAS + U8 qci; + U16 datIndActQci = 0; + U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */ + U16 tempUeActQci = 0; /* UE specific Active QCIs */ + U16 diffBits = 0; + U8 lcCount; +#endif + TRC3(RgMacSchSfRecpInd) + + /* No need to chk for cell being NULL as MAC wouldn't have found instance if + * it doesnt exist */ + cell = rgSchCb[inst].rgrSap[cellSapId].cell; + + /* lnkLst assignment */ + lnkLst = &(subfrmInfo->ueLst); + + CM_LLIST_FIRST_NODE(lnkLst, tmp); + + while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP)) + { + ue = NULLP; +#ifdef LTE_L2_MEAS + qci = 0; +#endif + datInd = (RgInfUeDatInd *)tmp->node; + rnti = datInd->rnti; + + /* We shall try and find + * out the RaCb based on the following - + * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3. + * 2. If the incoming PDU contained a CRNTI control element, i.e. we should + * have a ueCb also for this + */ + + /* It could be that a non-msg3 pdu contains a CRNTI Control element. We + * should check for CRNTI CE and if it exists the UECb must exist, also an + * if the CRNTI in the CE and the one with which the message came in are + * different we shall look for an raCb as well. + */ + if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT) + { + /* SR_RACH_STATS : CRNTI CE*/ + rgNumMsg3CrntiCE++; + + if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT) + { + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Received MSG3 with CRNTI:%d and also CCCH ", + datInd->ceInfo.ces.cRnti); + RETVALUE(RFAILED); + } + ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti); + if (ue == NULLP) + { + /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/ + rgNumCrntiCeCrntiNotFound++; + /* ccpu00141318 - Removed condition for SPS rnti checking*/ + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 " + "with CRNTI:%d unable to find ueCb", + datInd->ceInfo.ces.cRnti); + RETVALUE(RFAILED); + } + + if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, + rnti, datInd, &err)) != ROK) + { + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d", + datInd->rnti); + RETVALUE(RFAILED); + } + +#ifdef LTEMAC_SPS + rgSCHUtlHdlCrntiCE (cell, ue); +#endif + ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd, + sizeof(RgrUeStaIndInfo)); + if(ret == ROK) + { + ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD; +#ifdef RG_UNUSED +//#ifdef LTEMAC_SPS + ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue); + if(ulSpsUe->isUlSpsActv) + { + ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE; + ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE; + } +#endif + ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd); + if(ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Could not Send Ue Sta Ind UEID:%d",ue->ueId); + } + } + CM_LLIST_NEXT_NODE(lnkLst, tmp); + continue; + } /* end of CRNTI based message */ + else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT) + { + /* SR_RACH_STATS : CCCH SDU */ + rgNumMsg3CCCHSdu++; + /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/ + if (NULLP == rgSCHDbmGetRaCb (cell, rnti)) + { + rgNumCCCHSduCrntiNotFound++; + } + + if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, + rnti, datInd, &err)) != ROK) + { + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d", + datInd->rnti); + RETVALUE(RFAILED); + } + /* fix */ + CM_LLIST_NEXT_NODE(lnkLst, tmp); + continue; + } /* end of Msg3 processing */ + + if (ue == NULLP) + { + ue = rgSCHDbmGetUeCb (cell, datInd->rnti); + if (ue == NULLP) + { +#ifdef LTEMAC_SPS + if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP) +#endif + { + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d", + datInd->rnti); + RETVALUE(RFAILED); + } + } + } +/* L2_COUNTERS */ +#ifdef LTE_L2_MEAS + /* The LCs for which data is received at MAC is provided to SCH. + This information is used to estimate the Active LCs at UE + since estimates based on only BSR is not accurate */ + if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT) + { + + /* Compose a Bitmask with for the QCI's for which Data + is received */ + for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++) + { + if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid)) + { + datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1)); + } + } + if (ue->ulActiveLCs && ue->lastDatIndLCs) + { + /* Combine previous Dat Ind and current Dat Ind to + estimate active LCs at UE */ + combDatIndActQci = ue->lastDatIndLCs | datIndActQci; + tempUeActQci = ue->ulActiveLCs; + ue->ulActiveLCs = combDatIndActQci; + diffBits = combDatIndActQci ^ tempUeActQci; + while (diffBits) + { + qci++; + if (0x1 & diffBits) + { + if (0x1 & tempUeActQci) + { + /* An active QCI has become inactive */ + cell->qciArray[qci].ulUeCount--; + } + else + { + /* An Inactive QCI has become active */ + cell->qciArray[qci].ulUeCount++; + } + } + diffBits >>= 1; + tempUeActQci >>= 1; + } + } + ue->lastDatIndLCs = datIndActQci; + + } + +#endif /* LTE_L2_MEAS */ + /* Just copy the timing information from the dat indication into the one + * stored in the UE CB, will be later utilized to handle Timing advance + */ + + if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK) + { + RGSCH_FREE_MEM(subfrmInfo); + err.errType = RGSCHERR_TOM_DATIND; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data" + " Indication for UEID:%d",ue->ueId); + RETVALUE(RFAILED); + } + + CM_LLIST_NEXT_NODE(lnkLst, tmp); + } + /* RRM_RBC_X */ + /* update the UL PRB usage for all GBR QCIs*/ + for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++) + { + cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx]; + } + /* RRM_RBC_Y */ + + /* chk if Sch needs to dealloc datInd after unpk */ + RGSCH_FREE_MEM(subfrmInfo); + RETVALUE(ret); +} /* rgMacSchSfRecpInd */ + +#ifdef LTEMAC_SPS +/** + * @brief Function to handle relInd from MAC for a UE + * + * @details + * + * Function: RgMacSchSpsRelInd + * + * Handler for processing relInd for UL SPS of a UE + * + * Invoked by: + * MAC + * + * Processing Steps: + * + * @param[in] Pst *pst + * @param[in] RgInfSpsRelInfo *relInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchSpsRelInd +( +Pst *pst, +RgInfSpsRelInfo *relInfo +) +#else +PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo) +Pst *pst; +RgInfSpsRelInfo *relInfo; +#endif +{ + RgSchUeCb *ue; + RgSchCellCb *cell; + Inst inst = (pst->dstInst - SCH_INST_START); + + TRC2(RgMacSchSpsRelInd); + + /* No need to chk for cell being NULL as MAC wouldn't have found instance if + * it doesnt exist */ + cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell; + + if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "No Ue exists with CRNTI:%d",relInfo->cRnti); + RETVALUE(RFAILED); + } + + if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "RelInd processing for CRNTI:%d failed",relInfo->cRnti); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} /* end of RgMacSchSpsRelInd */ +#endif /* LTEMAC_SPS */ + +#ifdef LTE_L2_MEAS + +/** + * @brief Function to handle L2MeasCfm from MAC + * + * @details + * + * Function: RgMacSchL2MeasCfm + * + * Handler for processing L2 measurement confirm + * + * Invoked by: + * MAC + * + * Processing Steps: + * + * @param[in] Pst *pst + * @param[in] RgInfL2MeasCfm *measCfm + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchL2MeasCfm +( +Pst *pst, +RgInfL2MeasCfm *measCfm +) +#else +PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm) +Pst *pst; +RgInfL2MeasCfm *measCfm; +#endif +{ + RgSchCellCb *cell = NULLP; + Inst inst = (pst->dstInst - SCH_INST_START); + CmLList *lnk; + RgSchL2MeasCb *measCb = NULLP; + RgSchCb *instCb = &rgSchCb[inst]; + U32 idx; + LrgSchMeasCfmInfo schMeasCfm; + U8 qciVal; + U8 idx1; /*LTE_L2_MEAS_PHASE2*/ + U8 qciVal1; + TRC2(RgMacSchL2MeasCfm); + + /* Find the cellCb using cellId in measInfo. Iterate through all cells + * in rgrsapCb in RgschCb */ + for (idx = 0; idx < instCb->numSaps; idx++) + { + if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId) + { + /* got the cell break the loop */ + cell = instCb->rgrSap[idx].cell; + break; + } + } + /* If no cellCb return Err with Invalid Cell Id */ + if (cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId, + "Meas Cfm Failed.Invalid Cell Id"); + RETVALUE(RFAILED); + } + + + /* Iterate through all meas requests in l2mList in cellCb */ + lnk = cell->l2mList.first; + while(lnk != NULLP) + { + /* Get the MeasCb : RgSchL2MeasCb */ + measCb = (RgSchL2MeasCb *)lnk->node; + lnk = lnk->next; + if (measCb->measReq.hdr.transId == measCfm->transId) + { + break; + } + } + if ( measCb == NULLP ) + { + RETVALUE( RFAILED ); + } + + + if(measCfm->cfm.status != LCM_PRIM_OK) + { + for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++) + { + qciVal = measCb->measReq.avgPrbQciUl.qci[idx]; + cell->qciArray[qciVal].qci = 0; + } + /* Delete this measCb, send the negative confirmation to + * stack manager */ + cmLListDelFrm(&cell->l2mList, &measCb->measLnk); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb)); + cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo)); + schMeasCfm.measType = measCfm->measType; + schMeasCfm.cfm = measCfm->cfm; + schMeasCfm.hdr.transId = measCfm->transId; + schMeasCfm.cellId = measCfm->cellId; + RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm); + RETVALUE(ROK); + } + for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++) + { + measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage; + measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue; + /*LTE_L2_MEAS_PHASE2*/ + qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue; + for(idx1=0;idx1measReq.avgPrbQciUl.numQci;idx1++) + { + if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1) + { + break; + } + } + if(idx1 == measCb->measReq.avgPrbQciUl.numQci) + { + measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1; + } + } + measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci; + measCb->cfmRcvd = TRUE; + cell->sndL2Meas = TRUE; + RETVALUE(ROK); +} /* end of RgMacSchL2MeasCfm */ + +/** + * @brief Function to handle L2MeasStopCfm from MAC + * + * @details + * + * Function: RgMacSchL2MeasStopCfm + * + * Handler for processing L2 measurement confirm + * + * Invoked by: + * MAC + * + * Processing Steps: + * + * @param[in] Pst *pst + * @param[in] RgInfL2MeasCfm *measCfm + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgMacSchL2MeasStopCfm +( +Pst *pst, +RgInfL2MeasCfm *measCfm +) +#else +PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm) +Pst *pst; +RgInfL2MeasCfm *measCfm; +#endif +{ + LrgSchMeasCfmInfo schMeasCfm; + Inst inst = (pst->dstInst - SCH_INST_START); + RgSchCb *instCb = &rgSchCb[inst]; + + TRC2(RgMacSchL2MeasStopCfm); + + cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo)); + schMeasCfm.measType = measCfm->measType; + schMeasCfm.cfm = measCfm->cfm; + schMeasCfm.hdr.transId = measCfm->transId; + schMeasCfm.cellId = measCfm->cellId; + RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm); + RETVALUE(ROK); +} +#endif + +/************** TFU Interface *************/ + +/** + * @brief Bind confirm API for TFU SAP on scheduler instance. + * + * @details + * + * Function : RgLiTfuSchBndCfm + * + * This API is invoked by PHY to confirm TFU SAP bind. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuSchBndCfm +( +Pst *pst, +SuId suId, +U8 status +) +#else +PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status) +Pst *pst; +SuId suId; +U8 status; +#endif +{ + S16 ret; + RgSchLowSapCb *tfuSap; + Inst instId = pst->dstInst - SCH_INST_START; + + TRC3(RgLiTfuSchBndCfm); + + + if(suId >= rgSchCb[instId].numSaps) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId"); + RETVALUE(RFAILED); + } + /* Lets validate suId first */ + tfuSap = &(rgSchCb[instId].tfuSap[suId]); + + if (suId != tfuSap->sapCfg.suId) + { + RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)" + "Recieved (%d)", tfuSap->sapCfg.suId, suId); + RETVALUE(RFAILED); + } + ret = rgSCHLmmBndCfm (pst, suId, status); + RETVALUE(ret); +} /* RgLiTfuSchBndCfm */ + +/** + * @brief Random Access Request indication from PHY. + * + * @details + * + * Function : RgLiTfuRaReqInd + * + * This API is invoked by PHY to send Random Access Request to Scheduler. + * This API contains information for Random Access Request including + * raRnti, list of associated RAPIDs and related information. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuRaReqIndInfo *raReqInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuRaReqInd +( +Pst *pst, +SuId suId, +TfuRaReqIndInfo *raReqInd +) +#else +PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd) +Pst *pst; +SuId suId; +TfuRaReqIndInfo *raReqInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuRaReqInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(raReqInd); + RETVALUE(ret); + } + + if(raReqInd == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed"); + RETVALUE(RFAILED); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists"); + RETVALUE(RFAILED); + } + + ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(raReqInd); + /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd, + sizeof(TfuRaReqIndInfo)); */ + RETVALUE(ret); +} /* RgLiTfuRaReqInd */ + +/** + * @brief Uplink CQI indication from PHY. + * + * @details + * + * Function : RgLiTfuUlCqiInd + * + * This API is invoked by PHY to send Uplink CQI to Scheduler. + * This API contains Uplink CQI information reported per UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuUlCqiIndInfo *ulCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuUlCqiInd +( +Pst *pst, +SuId suId, +TfuUlCqiIndInfo *ulCqiInd +) +#else +PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd) +Pst *pst; +SuId suId; +TfuUlCqiIndInfo *ulCqiInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuUlCqiInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(ulCqiInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(ulCqiInd); + RETVALUE(RFAILED); + } + ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(ulCqiInd); + RETVALUE(ret); +} /* RgLiTfuUlCqiInd */ + +/** + * @brief PUCCH power adjustment indication. + * + * @details + * + * Function : RgLiTfuPucchDeltaPwrInd + * + * This API is invoked by PHY to send PUCCH power adjustment + * indication. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuPucchDeltaPwrInd +( +Pst *pst, +SuId suId, +TfuPucchDeltaPwrIndInfo *pucchDeltaPwr +) +#else +PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr) +Pst *pst; +SuId suId; +TfuPucchDeltaPwrIndInfo *pucchDeltaPwr; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuPucchDeltaPwrInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(pucchDeltaPwr); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } + ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(pucchDeltaPwr); + RETVALUE(ret); +} /* RgLiTfuPucchDeltaPwrInd */ + + +/** + * @brief HARQ ACK indication from PHY for Downlink transmissions. + * + * @details + * + * Function : RgLiTfuHqInd + * + * This API is invoked by PHY to send HARQ ACK information to Scheduler + * on recieving HARQ ACK/NACK from UEs. + * This API contains HARQ ACK information recieved by PHY for downlink + * transmissions. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuHqIndInfo *harqAckInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuHqInd +( +Pst *pst, +SuId suId, +TfuHqIndInfo *harqAckInd +) +#else +PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd) +Pst *pst; +SuId suId; +TfuHqIndInfo *harqAckInd; +#endif +{ + S16 ret; + Inst inst = (pst->dstInst - SCH_INST_START); + + TRC3(RgLiTfuHqInd); + +#ifndef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + RGSCH_FREE_MEM(harqAckInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } +#endif + + /* Now call the TOM (Tfu ownership module) primitive to process further */ + ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(harqAckInd); + RETVALUE(ret); +} /* RgLiTfuHqInd */ + + +/** + * @brief Scheduling request(SR) indication from PHY for an UE. + * + * @details + * + * Function : RgLiTfuSrInd + * + * This API is invoked by PHY to send Scheduling request information to + * Scheduler on recieving SR from a list of UEs. + * This API contains scheduling request information recieved by PHY for UEs. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuSrIndInfo *srInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuSrInd +( +Pst *pst, +SuId suId, +TfuSrIndInfo *srInd +) +#else +PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd) +Pst *pst; +SuId suId; +TfuSrIndInfo *srInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuSrInd); + +#ifndef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed"); + RGSCH_FREE_MEM(srInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists"); + RETVALUE(RFAILED); + } +#endif + /* Now call the TOM (Tfu ownership module) primitive to process further */ + ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(srInd); + RETVALUE(ret); +} /* RgLiTfuSrInd */ + + +/** + * @brief Downlink CQI indication from PHY for an UE. + * + * @details + * + * Function : RgLiTfuDlCqiInd + * + * This API is invoked by PHY to send Downlink CQI indication to Scheduler + * on recieving downlink CQI from UE. + * This API contains downlink CQI information recieved by PHY for an UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuDlCqiIndInfo *dlCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuDlCqiInd +( +Pst *pst, +SuId suId, +TfuDlCqiIndInfo *dlCqiInd +) +#else +PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd) +Pst *pst; +SuId suId; +TfuDlCqiIndInfo *dlCqiInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuDlCqiInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(dlCqiInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } + ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(dlCqiInd); + RETVALUE(ret); +} /* RgLiTfuDlCqiInd */ +#ifdef TFU_UPGRADE + +/** + * @brief Raw CQI indication from PHY for an UE. + * + * @details + * + * Function : RgLiTfuRawCqiInd + * + * This API is invoked by PHY to send Raw CQI indication to Scheduler + * on receiving Raw CQI from UE. + * This API contains Raw CQI information recieved by PHY for an UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuRawCqiIndInfo *rawCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuRawCqiInd +( +Pst *pst, +SuId suId, +TfuRawCqiIndInfo *rawCqiInd +) +#else +PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd) +Pst *pst; +SuId suId; +TfuRawCqiIndInfo *rawCqiInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuRawCqiInd); + +#ifdef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(rawCqiInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists"); + RETVALUE(RFAILED); + } +#endif + ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(rawCqiInd); + RETVALUE(ret); +} /* RgLiTfuRawCqiInd */ + +/** + * @brief SRS indication from PHY for an UE. + * + * @details + * + * Function : RgLiTfuSrsInd + * + * This API is invoked by PHY to send UL SRS indication to Scheduler + * on receiving a SRS from UE. + * This API contains SRS information recieved by PHY for an UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuSrsIndInfo *srsInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuSrsInd +( +Pst *pst, +SuId suId, +TfuSrsIndInfo *srsInd +) +#else +PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd) +Pst *pst; +SuId suId; +TfuSrsIndInfo *srsInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuSrsInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(srsInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } + ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(srsInd); + RETVALUE(ret); +} /* RgLiTfuSrsInd */ + +#endif + +/** + * @brief DOA indication from PHY for an UE. + * + * @details + * + * Function : RgLiTfuDoaInd + * + * This API is invoked by PHY to send Direction Of Arrival to Scheduler + * on calculating DOA at PHYSICAL LAYER for an UE. + * This API contains DOA information calculated by PHY for an UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuDoaIndInfo *doaInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuDoaInd +( +Pst *pst, +SuId suId, +TfuDoaIndInfo *doaInd +) +#else +PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd) +Pst *pst; +SuId suId; +TfuDoaIndInfo *doaInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC2(RgLiTfuDoaInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(doaInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } + ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(doaInd); + RETVALUE(ret); +} /* RgLiTfuDlCqiInd */ + +/** + * @brief CRC indication from PHY. + * + * @details + * + * Function : RgLiTfuCrcInd + * + * This API is invoked by PHY to give CRC indication to scheduler. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuCrcIndInfo *crcInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuCrcInd +( +Pst *pst, +SuId suId, +TfuCrcIndInfo *crcInd +) +#else +PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd) +Pst *pst; +SuId suId; +TfuCrcIndInfo *crcInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuCrcInd); +#ifdef XEON_SPECIFIC_CHANGES +struct timeval start6, end6; +gettimeofday(&start6, NULL); +#endif +#ifndef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + RGSCH_FREE_MEM(crcInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } +#endif + + /* Now call the TOM (Tfu ownership module) primitive to process further */ + ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(crcInd); +#ifdef XEON_SPECIFIC_CHANGES +gettimeofday(&end6, NULL); +#endif + RETVALUE(ret); +} /* RgLiTfuCrcInd */ + +/** + * @brief Timing Advance indication from PHY. + * + * @details + * + * Function : RgLiTfuTimingAdvInd + * + * This API is invoked by PHY to indicate timing advance to Scheduler for + * an UE. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuTimingAdvIndInfo *timingAdvInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuTimingAdvInd +( +Pst *pst, +SuId suId, +TfuTimingAdvIndInfo *timingAdvInd +) +#else +PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd) +Pst *pst; +SuId suId; +TfuTimingAdvIndInfo *timingAdvInd; +#endif +{ + S16 ret; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuTimingAdvInd); + + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(timingAdvInd); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } + /* Now call the TOM (Tfu ownership module) primitive to process further */ + ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd); + /* Free up the memory for the request structure */ + RGSCH_FREE_MEM(timingAdvInd); + RETVALUE(ret); +} /* RgLiTfuTimingAdvInd */ + + +/** + * @brief Transmission time interval indication from PHY. + * + * @details + * + * Function : RgLiTfuSchTtiInd + * + * This API is invoked by PHY to indicate TTI indication to Scheduler for + * a cell. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuTtiIndInfo *ttiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuSchTtiInd +( +Pst *pst, +SuId suId, +TfuTtiIndInfo *ttiInd +) +#else +PUBLIC S16 RgLiTfuSchTtiInd(pst, suId, ttiInd) +Pst *pst; +SuId suId; +TfuTtiIndInfo *ttiInd; +#endif +{ + S16 ret = ROK; + Inst inst = pst->dstInst-SCH_INST_START; + + TRC3(RgLiTfuSchTtiInd); + + + /* Removing the validation with every TTI - for optimization */ +#ifndef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + RETVALUE(ret); + } +#endif + /* Moved check for cell outside ERRCLS*/ + + /* Now call the TOM (Tfu ownership module) primitive to process further */ + rgSCHTomTtiInd(ttiInd, inst); + + RETVALUE(ret); +} /* RgLiTfuSchTtiInd */ + +/************* RGM Interface ****************/ +/** + * @brief API for bind request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgmBndReq + * + * This API is invoked by RRM towards MAC to bind RGM SAP. + * These API validates the Pst, spId, suId and sends the bind confirm to + * RRM. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] SpId spId + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgmBndReq +( +Pst *pst, +SuId suId, +SpId spId +) +#else +PUBLIC S16 RgUiRgmBndReq(pst, suId, spId) +Pst *pst; +SuId suId; +SpId spId; +#endif +{ + S16 ret = ROK; + Pst tmpPst; /* Temporary Post Structure */ + Inst instId = pst->dstInst-SCH_INST_START; + + TRC3(RgUiRgmBndReq) + + + tmpPst.prior = pst->prior; + tmpPst.route = pst->route; + tmpPst.selector = pst->selector; + tmpPst.region = rgSchCb[instId].rgSchInit.region; + tmpPst.pool = rgSchCb[instId].rgSchInit.pool; + + tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId; + tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent; + tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START; + + tmpPst.event = EVTNONE; + + tmpPst.dstProcId = pst->srcProcId; + tmpPst.dstEnt = pst->srcEnt; + tmpPst.dstInst = pst->srcInst; + + /*TODO remove follo statement*/ + rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND; + + if(spId < rgSchCb[instId].numSaps) + { + /* Check the state of the SAP */ + switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState) + { + /* This case might not be needed if SAP not configured then it will go + * to else of above if condition */ + case LRG_UNBND: /* SAP is not bound */ + RLOG0(L_DEBUG,"SAP is not yet bound"); + rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND; + rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId; + /* Send Bind Confirm with status as SUCCESS */ + ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK); + /*Indicate to Layer manager */ + break; + case LRG_BND: /* SAP is already bound*/ + RLOG0(L_DEBUG,"SAP is already bound"); + ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK); + break; + default: /* Should Never Enter here */ +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, + (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, + "Invalid SAP State:RgUiRgmBndReq failed\n"); +#endif + ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK); + break; + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) +/* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state + to spId to avoid seg fault due to invalid sapID */ + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002, + (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n"); +#endif + ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK); + } + RETVALUE(ret); +} /* RgUiRgmBndReq */ + +/** + * @brief API for unbind request from RRM towards MAC. + * + * @details + * + * Function: RgUiRgmUbndReq + * + * This API is invoked by RRM towards MAC to unbind RGM SAP. + * These API validates the Pst, spId, suId and transfers the unbind request + * specific information to corresponding ownership module (GOM) API. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] Reason reason + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgmUbndReq +( +Pst *pst, +SpId spId, +Reason reason +) +#else +PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason) +Pst *pst; +SpId spId; +Reason reason; +#endif +{ + Inst instId = pst->dstInst-SCH_INST_START; + TRC3(RgUiRgmUbndReq) + + + /* SAP Id validation */ + if (spId < rgSchCb[instId].numSaps) + { + switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState) + { + case LRG_BND: /* SAP is already bound*/ + /* setting SAP state to UN BOUND */ + RLOG0(L_DEBUG,"SAP is already bound"); + rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND; + break; + default: +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003, + (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, + "Invalid SAP State: RgUiRgmUbndReq failed\n"); +#endif + RETVALUE(RFAILED); + } + } + else + { +#if (ERRCLASS & ERRCLS_ADD_RES) + RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, + (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState, + "Invalid SAP Id:RgUiRgmUbndReq failed\n"); +#endif + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} /* RgUiRgmUbndReq */ + + +/** + * @brief API for start or stop PRB reporting from RRM towards MAC. + * + * @details + * + * Function: RgUiRgmCfgPrbRprt + * + * This API is invoked by RRM towards MAC to start or stop calculating + * Average PRB usage in downlink and uplink. The average PRB usage will + * be reported to RRM based on confiured periodicity. + * + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] SpId spId + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgUiRgmCfgPrbRprt +( +Pst *pst, +SpId spId, +RgmPrbRprtCfg *prbRprtCfg +) +#else +PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg) +Pst *pst; +SpId spId; +RgmPrbRprtCfg *prbRprtCfg; +#endif +{ +/* Initalize*/ + RgSchCellCb *cell; + RgSchPrbUsage *prbUsage; + Inst inst = (pst->dstInst - SCH_INST_START); + + TRC2(RgUiRgmCfgPrbRprt); + cell = rgSchCb[inst].rgmSap[spId].cell; + prbUsage = &cell->prbUsage; + prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType; + prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty; + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1); + + /* clear the qciPrbRpts for all GBR QCIs */ + cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0, + (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage))); + + RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, + "RgUiRgmCfgPrbRprt config type %d with the report period %d", + prbUsage->prbRprtEnabld,prbUsage->rprtPeriod); + + /* ccpu00134393 : mem leak fix */ + SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg)); + + RETVALUE(ROK); +} +/** + * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission. + * + * @details + * + * Function : RgLiTfuErrInd + * + * This API is invoked by PHY to send ERROR INDICATION to scheduler + * Currently invoked in the cases when the Unlicensed SCell transmission + * fails. + * This API contains the Cell and subframe information for which the + * transmission failed. + * + * @param[in] Pst *pst + * @param[in] SuId suId + * @param[in] TfuErrIndInfo *errIndInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 RgLiTfuErrInd +( +Pst *pst, +SuId suId, +TfuErrIndInfo *errInd +) +#else +PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd) +Pst *pst; +SuId suId; +TfuErrIndInfo *errInd; +#endif +{ + S16 ret = ROK; +#ifdef LTE_ADV + Inst inst = (pst->dstInst - SCH_INST_START); +#endif + + TRC3(RgLiTfuErrInd); + +#ifndef NO_ERRCLS + if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK) + { + + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed"); + RETVALUE(ret); + } + + if (rgSchCb[inst].tfuSap[suId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists"); + RETVALUE(RFAILED); + } +#endif + +#ifdef LTE_ADV + /* Now call the TOM (Tfu ownership module) primitive to process further */ + ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd); +#endif + RETVALUE(ret); +} /* RgLiTfuErrInd */ + + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch.h b/src/5gnrsch/rg_sch.h similarity index 100% rename from src/5gnrmac/rg_sch.h rename to src/5gnrsch/rg_sch.h diff --git a/src/5gnrsch/rg_sch.x b/src/5gnrsch/rg_sch.x new file mode 100755 index 000000000..c1c8388b0 --- /dev/null +++ b/src/5gnrsch/rg_sch.x @@ -0,0 +1,5563 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/********************************************************************** + + Name: LTE MAC layer + + Type: C include file + + Desc: Defines required by LTE MAC + + File: rg_sch.x + +**********************************************************************/ +/** @file rg_sch.x +@brief This file contains basic data structures for the scheuler. +*/ + +#ifdef TENB_STATS +#include "pj_tenb_stats.x" +#endif + +#ifndef __SCH__ +#define __SCH__ + +#ifdef TENB_STATS +#include "l2_tenb_stats.x" +#endif + +#ifdef EMTC_ENABLE +#include "rg_sch_emtc.x" +#endif + +typedef struct rgSchHistNode +{ + U32 line; + S8* file; + const S8* func; + Void * dbgVal; /* This is specific to the data struct being debug + for example if the debugging is done fo list + then this should contain the node address */ + U32 action; +}RgSchHistNode; + +#define MAX_HIST_NODES 50 + +#define RGSCH_ACTION_ADD 11 +#define RGSCH_ACTION_DEL 12 + +typedef struct rgSchHistInfo +{ + U32 histCount; + RgSchHistNode hist[MAX_HIST_NODES]; +}RgSchHistInfo; + +#define RG_SCH_RECORD(_histInfo,_action,_dbgVal)\ +{\ + (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].file = __FILE__;\ + (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].func = __FUNCTION__;\ + (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].line = __LINE__;\ + (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].action = _action;\ + (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].dbgVal = _dbgVal;\ + (_histInfo)->histCount++;\ +} + + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef TfuDciFormat1aInfo RgDciFmt1AInfo; +typedef TfuRaReqInfo RgTfuRaReqInfo; +typedef TfuSubbandCqiInfo RgSchSubbandCqiInfo; +typedef TfuHqIndInfo RgTfuHqIndInfo; +typedef TfuHqInfo RgTfuHqInfo; +typedef TfuCntrlReqInfo RgTfuCntrlReqInfo; + +/* Forward declarations for some structures */ +#ifdef LTE_L2_MEAS +typedef struct rgSchL2MeasCb RgSchL2MeasCb; +#endif /* LTE_L2_MEAS */ +typedef struct rgSchQciCb RgSchQciCb; +typedef struct rgSchUeCb RgSchUeCb; +typedef struct rgSchCellCb RgSchCellCb; +typedef struct rgSchErrInfo RgSchErrInfo; +typedef struct rgSchUlAlloc RgSchUlAlloc; +typedef struct rgSchUlRetxAlloc RgSchUlRetxAlloc; +typedef struct rgSchUlHqProcCb RgSchUlHqProcCb; +typedef struct rgSchDlHqProcCb RgSchDlHqProcCb; +/* Changes for MIMO feature addition */ +/* Removed dependency on MIMO compile-time flag */ +typedef struct rgSchDlHqTbCb RgSchDlHqTbCb; +typedef struct rgSchLcgCb RgSchLcgCb; +typedef struct rgSchDlHqEnt RgSchDlHqEnt; +typedef struct rgSchRaCb RgSchRaCb; +typedef struct _rgSchCb RgSchCb; +typedef struct rgSchUlLcCb RgSchUlLcCb; +typedef struct rgSchDlLcCb RgSchDlLcCb; +typedef struct _rgSchdApis RgSchdApis; +#ifdef LTE_TDD +typedef struct rgSchTddPhichOffInfo RgSchTddPhichOffInfo; +typedef U8 RgSchTddNpValTbl[RGSCH_TDD_MAX_P_PLUS_ONE_VAL]; +#endif +/* Added support for SPS*/ +#ifdef LTEMAC_SPS +typedef struct rgSchDlSfAllocInfo RgSchDlSfAllocInfo; +#endif + +typedef struct rgSchUeCellInfo RgSchUeCellInfo; +/** + * @brief + * Scheduler APIs + */ +struct _rgSchdApis +{ + S16 (*rgSCHRgrUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg, + RgSchErrInfo *err)); + S16 (*rgSCHRgrUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg, + RgSchErrInfo *err)); + Void (*rgSCHFreeUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); + S16 (*rgSCHRgrCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg, + RgSchErrInfo *err)); + S16 (*rgSCHRgrCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg, + RgSchErrInfo *err)); + Void (*rgSCHFreeCell) ARGS((RgSchCellCb *cell)); + S16 (*rgSCHRgrLchCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *dl, RgrLchCfg *cfg, RgSchErrInfo *errInfo)); + S16 (*rgSCHRgrLcgCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchLcgCb *lcg, RgrLcgCfg *cfg, RgSchErrInfo *errInfo)); + S16 (*rgSCHRgrLchRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *dl, RgrLchRecfg *recfg, + RgSchErrInfo *errInfo)); + S16 (*rgSCHRgrLcgRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchLcgCb *lcg, RgrLcgRecfg *recfg, RgSchErrInfo *errInfo)); + Void (*rgSCHFreeDlLc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *dlLc)); + Void (*rgSCHFreeLcg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *lcg)); + S16 (*rgSCHRgrLchDel) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,CmLteLcId lcId, \ + U8 lcgId)); + Void (*rgSCHActvtUlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); + Void (*rgSCHActvtDlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); + Void (*rgSCHHdlUlTransInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + CmLteTimingInfo timingInfo)); + Void (*rgSCHUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); + S16 (*rgSCHUpdBsrShort) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, U8 bsr, RgSchErrInfo *err)); + S16 (*rgSCHUpdBsrTrunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, U8 bsr, RgSchErrInfo *err)); + S16 (*rgSCHUpdBsrLong) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 bsArr[], RgSchErrInfo *err)); + S16 (*rgSCHUpdPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 phr, RgSchErrInfo *err)); + S16 (*rgSCHUpdExtPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err)); +#ifdef RG_UNUSED + S16 (*rgSCHUpdUlHqProc) ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc, + RgSchUlHqProcCb *oldProc)); +#endif + S16 (*rgSCHContResUlGrant) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchErrInfo *err)); + S16 (*rgSCHSrRcvd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo, RgSchErrInfo *err)); + S16 (*rgSCHTti) ARGS((RgSchCellCb *cell, RgSchErrInfo *err)); + Void (*rgSCHUlCqiInd) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, TfuUlCqiRpt *ulCqiInfo)); + Void (*rgSCHPucchDeltaPwrInd) ARGS(( RgSchCellCb *cell, + RgSchUeCb *ue, S8 delta)); + S16 (*rgSCHlUeReset) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue)); + Void (*rgSCHDlDedBoUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc)); + /* ccpu00105914: PHR handling for MSG3 */ + Void (*rgSCHUlRecMsg3Alloc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchRaCb *raCb)); + Void (*rgSCHUlHqProcForUe) ARGS((RgSchCellCb *cell, CmLteTimingInfo frm, + RgSchUeCb *ue, RgSchUlHqProcCb **procRef)); + RgSchUlAlloc *(*rgSCHFirstRcptnReq) ARGS((RgSchCellCb *cell)); + RgSchUlAlloc *(*rgSCHNextRcptnReq) ARGS((RgSchCellCb *cell, + RgSchUlAlloc *alloc)); + RgSchUlAlloc *(*rgSCHFirstHqFdbkAlloc) ARGS((RgSchCellCb *cell, U8 idx)); + RgSchUlAlloc *(*rgSCHNextHqFdbkAlloc) ARGS((RgSchCellCb *cell, + RgSchUlAlloc *alloc,U8 idx)); + Void (*rgSCHDlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchDlHqProcCb *hqP)); + Void (*rgSCHDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + Bool isPucchInfo, Void *dlCqi, CmLteTimingInfo timingInfo)); +/* Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE +Void (*rgSCHSrsInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + TfuSrsRpt* srsInd, CmLteTimingInfo timingInfo)); +#endif + + Void (*rgSCHDlTARpt) ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); + /* Changes for MIMO feature addition */ + /* Removed dependency on MIMO compile-time flag */ + Void (*rgSCHDlRlsSubFrm) ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm)); + /* Added support for SPS*/ +#ifdef LTEMAC_SPS + Void (*rgSCHHdlCrntiCE) ARGS((RgSchCellCb *cell, RgSchUeCb * ue)); + Void (*rgSCHDlProcAck) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); + Void (*rgSCHDlProcDtx) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); + Void (*rgSCHDlRelPdcchFbk) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, + U8 isAck)); + Void (*rgSCHUlSpsRelInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, + Bool isExplRel)); + + Void (*rgSCHUlSpsActInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, + U16 sduSuze)); + + Void (*rgSCHUlCrcFailInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, + CmLteTimingInfo crcTime)); + Void (*rgSCHUlCrcInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, + CmLteTimingInfo crcTime)); +#endif /* LTEMAC_SPS */ + Void (*rgSCHDrxStrtInActvTmrInUl) ARGS((RgSchCellCb *cell)); + Void (*rgSCHUpdUeDataIndLcg) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, RgInfUeDatInd *datInd)); +#ifdef LTE_ADV + S16 (*rgSCHRgrSCellUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue ,RgrUeSecCellCfg *sCellInfoCfg, + RgSchErrInfo *err)); + S16 (*rgSCHRgrSCellUeDel) ARGS((RgSchUeCellInfo *sCellInfo, RgSchUeCb *ue)); +#endif +#ifdef EMTC_ENABLE + Void (*rgSCHUlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchUlHqProcCb *hqP)); +#endif +}; + +/* Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE + +/** +* @brief Periodic CQI/PMI/RI configuration parameters information +*/ +typedef RgrUePrdDlCqiCfg RgSchUeDlPCqiCfg; + +/** +* @brief Periodic CQI Setup configuration parameters information +*/ +/* Reference: 36.313: CQI-ReportPeriodic */ +typedef RgrUeDlPCqiSetup RgSchUeDlPCqiSetup; + +/** +* @brief SRS configuration parameters information +*/ +/* Reference 36.313 SoundingRS-UL-Config */ + +typedef RgrUeUlSrsCfg RgSchUeUlSrsCfg; + + +/** +* @brief SRS configuration setup parameters information +*/ +/* Reference 36.313 SoundingRS-UL-Config */ + +typedef RgrUeUlSrsSetupCfg RgSchUeSrsUlSetupCfg; + +/** +* @brief SR configuration parameters information +*/ + +typedef RgrUeSrCfg RgSchUeSrCfg; + +/** +* @brief SR Setup configuration parameters information +*/ + +typedef RgrUeSrSetupCfg RgSchUeSrSetupCfg; + +#define IOT_INVALID_FREQSTART 0xffffffff +#define IOT_INFINITE_SIZE 0xffffffff +#define RGSCH_IOT_PDCCH_POOLSZ 100 +#define RGSCH_IOT_PDSCH_POOLSZ 100 +#define RGSCH_IOT_PUSCH_POOLSZ 100 +#define RGSCH_IOT_PUCCH_POOLSZ 100 +#define RGSCH_IOT_SCHED_POOLSZ 100 +/* TODO: Minimum Delta between CRNT Time and TX time */ +#define RGSCH_IOT_PDCCH_DELTA RG_SCH_CMN_DL_DELTA +#define RGSCH_IOT_PDSCH_DELTA RG_SCH_CMN_DL_DELTA - 1 /* UL_CNTRL_DELTA value is 2*/ +#define RGSCH_IOT_PUCCH_DELTA 6 +#define RGSCH_IOT_PUSCH_DELTA 6 +#define RGSCH_IOT_PDCCH_MAXFREQSZ 24 /* MAX num of eCCEs per SF */ +#define RGSCH_IOT_PDSCH_MAXFREQSZ 100 /* MAX num of PDSCH RB per SF */ +#define RGSCH_IOT_PUCCH_MAXFREQSZ 2048 /* MAx num of PUCCH resource per SF */ +#define RGSCH_IOT_PUSCH_MAXFREQSZ 100 /* MAx num of PUSCh RB per SF */ +#define RGSCH_IOT_SCHED_MAXFREQSZ 1 /*Resource only in Time domain */ +#define RGSCH_IOT_PUCCH_INVALID_FREQ 2049 +/** + * @brief + * IoT PDCCH/PDSCH/PUSCH/PUCCH resource definition. + * For Iot Devices resource can span multiple subframes + * Hence resource is defined as a set of freq resources + * over a set of consecutive valid subframes + */ +typedef struct rgSchIotRes +{ + U32 resType; + PTR allctdBy; + CmLteTimingInfo timeStart; + CmLteTimingInfo timeEnd; + U32 tSize; + U8 freqStart; + U8 freqEnd; + U32 fSize; + CmLList lnk; /*!< Link to other Fragments or Allocs in resMngmt */ + CmLList cbLnk; /*!< Link to other allocs in a given control block (ueCb) */ + CmLList resLnk;/*! 1*/ + U32 aCqiTrigWt; /* Metric to track Aperiodic CQI Trigger occassion */ + RgSchCqiReqField cqiReqField; /* Cqi Request field. This Value can be 00 01 10 11, based upon + the cell present in which trigger list form App */ +}RgSchUeACqiCb; + +typedef enum +{ + RG_SCH_FDD_PCQI_TBL = 0, + RG_SCH_TDD_PCQI_TBL, + RG_SCH_RI_TBL, + RG_SCH_FDD_SRS_TBL, + RG_SCH_TDD_SRS_TBL, + RG_SCH_SR_TBL +} RgSchPerTbl; + +/*ccpu00116923 - ADD - SRS present support*/ +#ifdef LTE_TDD +typedef U8 RgSchTddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES]; +#else +typedef U8 RgSchFddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES]; +#endif + + +#endif + + + +#ifdef LTE_TDD +/** + * @brief + * Enum to define the type of Downlink subframe. + */ +typedef enum +{ + RG_SCH_SPL_SF_NO_DATA = 0, + RG_SCH_SPL_SF_DATA, + RG_SCH_DL_SF_0, + RG_SCH_DL_SF +}RgSchTddSfType; +/** + * @brief + * TDD UE specific PUCCH recpetion information. + */ +typedef struct rgSchUePucchRecpInfo +{ + CmHashListEnt hashLstEnt; /*!< List of PUCCH for receiving + ACK/NACK feedback information */ + TfuUeRecpReqInfo *pucchRecpInfo; /*!< UE PUCCH Reception information */ +} RgSchUePucchRecpInfo; + +/** + * @brief + * TDD switch point information. + */ +typedef struct rgSchTddSubfrmInfo +{ + U8 switchPoints; /*!< Number of DL-UL switch points */ + U8 numFrmHf1; /*!< Number of subframes for half frame 1 + Present for both 5ms and 10ms periodicity */ + U8 numFrmHf2; /*!< Number of subframes for half frame 2 + Present only for 5ms periodicity */ +} RgSchTddSubfrmInfo; + +/** + * @brief + * TDD DL Association Set information. + */ +typedef struct rgSchTddDlAscSetIdxK +{ + U8 numFdbkSubfrms; /*!< Number of Feedbacks for DL Subframes */ + U8 subfrmNum[RGSCH_NUM_SUB_FRAMES-1]; /*!< List of Subframe Number */ +} RgSchTddDlAscSetIdxK; + +/** @brief PRACH Information for a frequency resource. */ +typedef struct rgrSchTddPrachInfo +{ + U8 freqIdx; /*!< Frequency Index */ + U8 sfn; /*!< Even/Odd/All Radio Frames */ + U8 halfFrm; /*!< First/Second Half Frame */ + U8 ulStartSfIdx; /*!< Uplink Start Subframe Index*/ +} RgSchTddPrachInfo; + +/** @brief PRACH resource Information for each of the + * frequency resources. */ +typedef struct rgrSchTddPrachRscInfo +{ + U8 numRsc; /*!< Number of frequency resources*/ + RgSchTddPrachInfo prachInfo[RGSCH_TDD_MAX_FREQ_RSRC]; /*!< PRACH Information */ +} RgSchTddPrachRscInfo; + +/** + * @brief + * TDD Special subframe configuration information. + */ +struct rgSchTddSplSubfrmInfo +{ + U8 norDlDwPts; /*!< DL Normal CP: DwPTS in Ts */ + U8 norDlNorUpPts; /*!< DL Normal CP: UL Normal CP:UpPTS in Ts */ + U8 norDlExtUpPts; /*!< DL Normal CP: UL Extended CP: UpPTS in Ts */ + U8 extDlDwPts; /*!< DL Extended CP: DwPTS in Ts */ + U8 extDlNorUpPts; /*!< DL Extended CP: UL Normal CP:UpPTS in Ts */ + U8 extDlExtUpPts; /*!< DL Extended CP: UL Extended CP: UpPTS in Ts */ +}; + +/** + * @brief + * RACH response awaiting scheduling from the current time is + * identified with sfn offset and subframe. + */ +typedef struct rgSchTddRachRspInfo +{ + U8 sfnOffset; /*!< SFN offset with respect to + expected RACH available for + scheduling */ + U8 numSubfrms; /* Number of subframes present */ + U8 subframe[RGSCH_NUM_SUB_FRAMES]; /*!< List of Subframe numbers */ +} RgSchTddRachRspInfo; + +typedef RgSchTddRachRspInfo RgSchTddRachDelInfo; + +/** + * @brief + * List of awaiting RACH responses for scheduling across radio frames. + * + */ +typedef struct rgSchTddRachRspLst +{ + U8 numRadiofrms; /*!< Number of radio frames */ + RgSchTddRachRspInfo rachRsp[2]; /*!< RACH Occasions for which response + can be sent */ + RgSchTddRachDelInfo delInfo; /*!< Previous RACH responses for + which the scheduling deadline + has expired. So those responses + can be deleted */ +} RgSchTddRachRspLst; + +/** + * @brief + * Uplink association index information indicates the SFN offset and + * subframe in which DL HARQ ACK/NACK is expected. + */ +typedef struct rgSchTddUlAscInfo +{ + U8 subframe; /*!< Subframe number */ + U8 sfnOffset; /*!< SFN offset with respect to expected + UL data reception time */ +} RgSchTddUlAscInfo; + +/** + * @brief + * PUSCH information indicates the SFN offset and + * subframe in which UL data is scheduled. + */ +typedef struct rgSchTddPuschOffInfo +{ + U8 subframe; /*!< Subframe number */ + U8 sfnOffset; /*!< SFN offset with respect to expected + UL data reception time */ +} RgSchTddPuschOffInfo; + +/** + * @brief + * PHICH information indicates the SFN offset and + * subframe for which PHICH should be sent. + */ +struct rgSchTddPhichOffInfo +{ + U8 numSubfrms; /*!< Number of subframes */ +/* ACC-TDD */ + U8 subframe; /*!< The Uplink Subframe number corresponding + to the phich */ + U8 sfnOffset; /*!< SFN offset with respect to expected + UL data reception time */ +}; + +/** + * @brief + * DL feedback reception information indicates the SFN offset + * and subframe at which feedback is expected. + */ +typedef struct rgSchTddDlFdbkInfo +{ + U8 subframe; /*!< Subframe number */ + U8 sfnOffset; /*!< SFN offset with respect to current + scheduled time */ + U8 m; /*!< m factor used in Downlink Association + Set Index */ +#ifdef LTE_ADV /*Naw:: This is not correct */ + CmLListCp n1PucchResLst; /*!< List for storing the used N1 resource */ +#endif +} RgSchTddDlFdbkInfo; + + +/** + * @brief + * Special subframe configuration index. + */ +typedef struct rgSchTddSplSubfrmCfg +{ + U16 dwPts; /*!< DwPTS in OFDM Symbol Duration */ + U16 upPts; /*!< UpPTS in OFDM Symbol Duration */ + Bool isDlDataAllowed; /*!< To allow scheduling of DL data on + special subframe */ +} RgSchTddSplSubfrmCfg; + +/** + * @brief + * ACK/NACK information to be used for ACK/NACK bundling mode. + */ +typedef struct rgSchTddANInfo +{ + U16 sfn; /*!< ACK/NACK is sent for PDU in this SFN */ + U8 subframe; /*!< ACK/NACK is sent for PDU in this subframe */ + U8 dlDai; /*!< Downlink Assignment Index for + UL-DL Configuration 1-6 */ + U8 ulDai; /*!< DAI for uplink */ + U8 latestMIdx; /*!< Last transmitted DL subframe 'm' index */ + U8 n1ResTpcIdx; /*!< N1 Res idx for scell assigned in TPC command */ + Bool isSpsOccasion; /*!< To indicate the presence of SPS occasion */ +#ifdef LTE_ADV + U8 wUlDai; /*!< Max Ul dai in all the cells */ +#endif +} RgSchTddANInfo; +#endif + +/** + * @brief + * Information about one MCS entry. + */ +typedef struct rgSchUlIMcsInfo +{ + U8 qm; + U8 iTbs; +} RgSchUlIMcsTbl[29]; +EXTERN RgSchUlIMcsTbl rgUlIMcsTbl; + +typedef struct rgSchUeCatTbl +{ + U32 maxUlBits;/*Maximum number of + bits of an UL-SCH + transport block + transmitted within a + TTI*/ + U32 maxDlBits[4];/*Maximum number of + bits of a DLSCH + transport block + received within a TTI*/ +/* correcting DL harq softbuffer limitation logic */ + U32 maxSftChBits;/*Total number of soft channel bits*/ + Bool ul64qamSup;/*Support for 64QAM in UL*/ +/* Changes for MIMO feature addition */ +/* Removed dependency on MIMO compile-time flag */ + U32 maxDlTbBits;/*Maximum number of DL-SCH + transport block bits + received within a TTI*/ + U8 maxTxLyrs;/*Maximum number of supported + layers for spatial multiplexing + in DL*/ +} RgSchUeCatTbl[CM_MAX_UE_CAT_SUPP + 1]; +EXTERN RgSchUeCatTbl rgUeCatTbl; + +/* Changes for MIMO feature addition */ +/* Removed dependency on MIMO compile-time flag */ +typedef U32 RgSchTbSzTbl[RGSCH_MAX_NUM_LYR_PERCW][RGSCH_NUM_ITBS][RGSCH_MAX_NUM_RB]; + +#ifdef LTE_TDD +typedef U8 RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_TDD_RA_PREAMBLE_FMT+1]; +#else +/* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA + sub-frames from preamble format */ +typedef U8 RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_RA_PREAMBLE_FMT+1]; +#endif +EXTERN RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl; + +EXTERN U8 rgRvTable[4]; + +typedef struct rgDciFmt +{ + U8 dciType; + union + { + RgDciFmt1AInfo dci1a; + } dci; +} RgDciFmt; + +typedef enum rgSchPdcchSearchSpace +{ + RG_SCH_UE_SPECIFIC_SEARCH_SPACE, + RG_SCH_CMN_SEARCH_SPACE, +}RgSchPdcchSearchSpace; + +/** + * @brief + * Information about one PDCCH. + */ +typedef struct rgSchPdcch { + U8 nCce; /*!< CCE index */ + CmLteAggrLvl aggrLvl; /*!< Aggregation level */ + TfuDciInfo dci; /*!< PDCCH format */ + U16 rnti; /*!< RNTI to who the PDCCH is allocated */ +#if (defined (LTE_TDD)) + U8 dlDai; /*!< DAI associated with this PDCCH. + THis is used for F1BCS resource calulcation */ +#endif + /* Added support for SPS*/ +#ifdef LTEMAC_SPS + CmLteTimingInfo relFbkTiming; /*!< Feebback timing information for release + PDCCH */ + Bool isSpsRnti; /*!< TRUE if rnti is SPS RNTI */ + U16 crnti; /*!< CRNTI to who the PDCCH is allocated */ +#endif + CmLList lnk; /*!< To link PDCCHs in a subframe */ +#ifdef EMTC_ENABLE + Void *emtcPdcch; +#endif + RgSchUeCb *ue; /*!< Pointer to the UE Control Block */ + RgSchPdcchSearchSpace pdcchSearchSpace; /*!< Search Space from this PDCCH allocated */ + U8 dciNumOfBits; /*!< Size of DCI in bits */ +} RgSchPdcch; + +/** + * @brief + * PDCCH information for cell. + */ +typedef struct rgSchPdcchInfo { + U8 *map; /*!< Bit map of PDCCHs */ + U8 currCfi; /*!< Number of CCEs */ + U16 nCce; /*!< Total CCEs */ + CmLListCp pdcchs; /*!< List of RgSchPdcch */ +} RgSchPdcchInfo; + +typedef struct rgSchPhich +{ + CmLList lnk; /*!< To link PHICHs in a subframe */ + U8 hqFeedBack; /*!< Harq Feed Back */ + U8 rbStart; /*!< Starting RB */ + U8 nDmrs; /*!< 3 bits for DMRS cyclic shift */ + /* changes for passing iphich at TFU;*/ + Bool isForMsg3; /*! < Phich Ack/Nack conveyed for MSG 3 */ +#ifdef LTE_TDD + U8 iPhich; /*!< For determining phich group */ +#endif +} RgSchPhich; + +typedef struct rgSchPhichInfo +{ + CmLListCp phichs; /*!< List of RgSchPhich */ +} RgSchPhichInfo; + +typedef struct rgSchBcchTb +{ + RgSchPdcch *pdcch; + Buffer *tb; + U16 tbSize; +} RgSchBcchTb; + +typedef struct rgSchPcchTb +{ + RgSchPdcch *pdcch; + Buffer *tb; + U16 tbSize; +} RgSchPcchTb; + +typedef struct rgSchRaRspAlloc +{ + U16 raRnti; + U32 tbSz; + TknU8 backOffInd; /*!< Backoff index value */ + CmLListCp raRspLst; /*!< List of RaCbs */ + CmLListCp contFreeUeLst; /*! List of HandOver or PdcchOrder UEs */ + RgSchPdcch *pdcch; /*!< NULLP if no Rsp allocation done for raRnti*/ +}RgSchRaRspAlloc; + +typedef struct rgSchBchTb +{ + Buffer *tb; /*!< BCH data for this frame */ + U16 tbSize; /*!< Non-Zero if bch data is scheduled for this SF */ +}RgSchBchTb; + +/* Added support for SPS*/ +#ifdef LTEMAC_SPS +/** + * TODO: check compilation + @brief Downlink Resource allocation type information. */ +struct rgSchDlSfAllocInfo +{ + U32 raType0Mask; /*!< RBG allocation mask for type 0*/ + U32 raType1Mask[RG_SCH_NUM_RATYPE1_32BIT_MASK]; /*!< RA Type 1 + allocation mask */ + U32 raType1UsedRbs[RG_SCH_NUM_RATYPE1_32BIT_MASK];/*!< RA Type 1 Used RBs + per subset */ + U32 nxtRbgSubset; /*!< Next RBG subset to be used for allocation */ + U32 raType2Mask[RG_SCH_NUM_RATYPE2_32BIT_MASK]; + /*!< Mask for resource allocation type 2 */ +}; +#endif /* LTEMAC_SPS */ + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + @brief RGR RB range for SFR */ +typedef struct rgrPwrHiCCRange +{ + U8 startRb; /*ueLst */ + Void * laaCb; + CmLListCp hqPLst; /*!< This is a list of hq proc per DL + SF which are scheduled in that SF. + The number of harq procs awaiting + feedback for the same subframe depends on + mode TDD or FDD and max number of Carriers + that can be aggregated */ +#ifdef LTE_ADV + RgSchN3PucchRes n3ScellPucch; +#endif +}RgSchDlHqInfo; + +/*CA Dev End*/ +/** @brief This structure contains the Measurement gap configuration for an UE. + */ +typedef struct rgUeMeasGapCfg +{ + Bool isMesGapEnabled; /*!< Is Measuremnet gap enabled or disabled */ + U8 gapPrd; /*!< Gap period 40ms/80ms */ + U8 gapOffst; /*!< Gap offset - Vaue is 0 to 1*/ +} RgUeMeasGapCfg; + +/** + @brief Measurement Gap related information per UE. */ +typedef struct rgSchUeMeasGapCb +{ + Bool isMesGapEnabled;/*!< TRUE if Measurement gap is enabled for this UE */ + U8 isMeasuring; /*!< Set to TRUE during measurement gap */ + U8 gapPrd; /*!< Measurement gap period configuration for the UE */ + U8 gapOffst; /*!< Measurement gap offset for the UE */ + CmLList measQLnk; /*!< To Link to the measurement gap list */ + CmLList ackNakQLnk; /*!< To Link to the ACK NACK Rep list */ + CmTimer measGapTmr; /*!< Timer for Measurement Gap */ + CmTimer measGapUlInactvTmr; /*!< UL Inactive timer for measurement gap */ + CmTimer measGapDlInactvTmr; /*!< DL Inactive timer for measurement gap */ +} RgSchUeMeasGapCb; + +/** + @brief ACK-NACK repetition related information per UE. */ +typedef struct rgSchUeAckNakRepCb +{ + Bool isAckNackEnabled; /*!< Is ACK/NACK Enabled*/ + U8 isAckNakRep; /*!< Set to TRUE during ACK-NACK repetition prd */ + U8 cfgRepCnt; /*!< Configured value for the repetition counter */ + U8 repCntr; /*!< Actual repetition counter */ + U16 pucchRes; /*!< PUCCH resource for repetition */ + CmTimer ackNakRepUlInactvTmr; /*!< UL Inactive timer for ack-nack repetition */ + CmTimer ackNakRepDlInactvTmr; /*!< DL Inactive timer for ack-nack repetition */ + CmTimer ackNakRepTmr; /*!< Timer for ack-nack repetition */ + CmLList ackNakRepLnk; /*!< ACK NACK repetition queue link */ + CmLListCp *prsntQ; /*!< Pointer to the Queue that this UE is current + present in. */ +} RgSchUeAckNakRepCb; + +/** + * @brief + * UE's MIMO specific information. + */ +typedef struct rgSchUeMimoInfo +{ + RgrTxMode oldTMode; /*!< UE's Previous Transmission Mode */ + RgrTxMode txMode; /*!< UE's Transmission Mode */ + TknU32 doa; /*!< DOA indicator for this UE */ + Bool puschFdbkVld; /*!< True if Precoding Info in PDCCH has to be + in-accordance with the latest PUSCH report */ + TfuDlCqiPuschInfo puschPmiInfo; /*!< PUSCH report details for explicit PMI + * information to PHY during a PDSCH */ + RgrCodeBookRstCfg cdbkSbstRstrctn; /*!< Codebook subset restriction defined as per + * 36.331 section 6.3.2. As of now, this info + * is not processed by MAC. SCH shall use the + * PMI reported by UE unconditionally.*/ +#ifdef DL_LA + S32 txModUpChgFactor; /*!< tx mode chnage factor for step up*/ + S32 txModDownChgFactor; /*!< tx mode chnage factor for step + Down*/ +#endif +}RgSchUeMimoInfo; + +/* Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH for Aperiodic Mode 3-1. +*/ +typedef struct rgSchCqiRawPuschMode31 +{ + U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ + U8 totLenSbDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */ + U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/ + U8 r1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank = 1*/ + U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/ + U8 rg1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank > 1*/ + U8 r1PmiBitLen; /*!< Length of PMI Bits for Rank = 1*/ + U8 rg1PmiBitLen; /*!< Length of PMI Bits for Rank > 1*/ +} RgSchCqiRawPuschMode31; + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH for Aperiodic Mode 3-0. +*/ +typedef struct rgSchCqiRawPuschMode30 +{ + U8 wideBCqiCw; /*!< Length of Wideband CQI */ + U8 totLenSbDiffCqi; /*!< Length of SubBand Differential CQI */ +} RgSchCqiRawPuschMode30; + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH for Aperiodic Mode 2-2. +*/ +typedef struct rgSchCqiRawPuschMode22 +{ + U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ + U8 sBDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */ + U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1 */ + U8 r1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank =1*/ + U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/ + U8 rg1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank >1*/ + U8 posOfM; /*!< Position of M selected SubBands */ + U8 r1PmiBitLen; /*!< Length of PMI Bits for Rank =1*/ + U8 rg1PmiBitLen; /*!< Length of PMI Bits for Rank >1*/ +} RgSchCqiRawPuschMode22; + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH for Aperiodic Mode 2-0. +*/ +typedef struct rgSchCqiRawPuschMode20 +{ + U8 wideBCqiCw; /*!< Length of Wideband CQI */ + U8 subBandDiffCqi; /*!< Length of SubBand Differential CQI */ + U8 posOfM; /*!< Position of M selected SubBands */ +} RgSchCqiRawPuschMode20; + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH for Aperiodic Mode 1-2. +*/ +typedef struct rgSchCqiRawPuschMode12 +{ + U8 wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */ + U8 r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/ + U8 rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword for Rank > 1 */ + U8 r1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank =1 */ + U8 rg1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank > 1 */ +} RgSchCqiRawPuschMode12; + + +/** @brief This structure that stores the length of Bits that +* will be received over PUSCH. +*/ +typedef struct rgSchDlCqiRawPusch +{ + TfuDlCqiPuschMode mode; /*!< PUSCH CQI mode */ + TknU8 ri; /*!< Rank Indicator for TM 3,4 */ + union + { + RgSchCqiRawPuschMode12 mode12Info; /*!< Mode 1-2 information */ + RgSchCqiRawPuschMode20 mode20Info; /*!< Mode 2-0 information */ + RgSchCqiRawPuschMode22 mode22Info; /*!< Mode 2-2 information */ + RgSchCqiRawPuschMode30 mode30Info; /*!< Mode 3-0 information */ + RgSchCqiRawPuschMode31 mode31Info; /*!< Mode 3-1 information */ + }u; +} RgSchDlCqiRawPusch; + +typedef struct rgSchPuschRawCqiInfoPerCell +{ + U8 sCellIdx; /*!< Serving cell idx of the cell for + this cqi info*/ + RgSchDlCqiRawPusch puschRawCqiInfo; /*!< Raw CQI Bit Width for PUSCH */ +} RgSchPuschRawCqiInfoPerCell; + +typedef struct rgSchPuschRawCqiInfoForSCells +{ + U8 numOfCells; /* Num of cells for which Apcqi is comming*/ + RgSchPuschRawCqiInfoPerCell cqiBitWidth[CM_LTE_MAX_CELLS]; +} RgSchPuschRawCqiInfoForSCells; + +typedef struct rgSchPucchRawCqiInfoPerCell +{ + U8 sCellIdx; /*!< Serving cell idx of the cell for + this cqi info*/ + TfuDlCqiPucch pucchRawCqiInfo; /*!< Raw CQI Bit Width for PUCCH */ +} RgSchPucchRawCqiInfoPerCell; + +typedef struct rgSchUeRawCqiBitWidthInfo +{ + TfuRecpReqType type; /*!< Type indicating PUCCH or PUSCH */ + CmLteTimingInfo recvTime; + union + { + RgSchPucchRawCqiInfoPerCell pucch; + RgSchPuschRawCqiInfoForSCells pusch; + }u; +} RgSchUeRawCqiBitWidthInfo; +#endif + + +/* CaDev start */ +#ifdef LTE_ADV + +/** + * @brief + * Enum for storing the different states of a Scell + * RG_SCH_SCELL_INACTIVE : SCell is added but not activate + * RG_SCH_SCELL_TOBE_ACTIVATED : SCell Activation trigger condition is met + Need to be scheduled. + * RG_SCH_SCELL_ACTVTN_IN_PROG : Waiting for Harq feedback for the scell activation + * RG_SCH_SCELL_ACTIVE : SCell is activated succesfully + */ +typedef enum +{ + RG_SCH_SCELL_INACTIVE = 0, /*!sfInfo[(_sfi)].sfType = _state;\ +} + +/* Mark sfi as UL Subframe */ +#define RG_SCH_DYN_TDD_MARKTYPE_UL(_dynTdd, _sfi)\ +{\ + RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_ULD);\ +} + +/* Mark sfi as DL Subframe */ +#define RG_SCH_DYN_TDD_MARKTYPE_DL(_dynTdd, _sfi)\ +{\ + RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_DLD);\ +} + +/* Get SFI and SFN from given time and subframe offset */ +#define RG_SCH_DYN_TDD_GET_SFIDX(_sfi, _crntSfIdx, _offset)\ + (_sfi) = (_crntSfIdx + _offset)% RG_SCH_DYNTDD_MAX_SFINFO + +/** + @brief Dynamic TDD subframe type. */ + +typedef struct rgSchDynTddSfType +{ + U8 sfType; /*!< 0= NOT Defined + 1= DL Cntrl + DL Data + 2= DL Cntrl + DL Data + UL Cntrl + 3= DL Cntrl + UL Data + 4= DL Cntrl + UL Data + UL Cntrl + */ + +}RgSchDynTddSfType; +/** + @brief Dynamic TDD control Block */ + +typedef struct rgSchDynTddCb +{ + Bool isDynTddEnbld; /*!< Is dynamic TDD enabled */ + U8 crntDTddSfIdx; /*!< Pivot Index corresponding + cell's current subframe */ + RgSchDynTddSfType sfInfo[RG_SCH_DYNTDD_MAX_SFINFO]; +}RgSchDynTddCb; + +#endif + +/** + * @brief + * Global Control block for LTE-MAC. + */ +struct _rgSchCb +{ + TskInit rgSchInit; /*!< Task Init info */ + RgSchGenCb genCfg; /*!< General Config info */ + U8 numSaps; /*!< Num RGR Saps = Num TFU Saps */ + RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ + RgSchLowSapCb *tfuSap; /*!< TFU SAP Control Block */ + RgSchUpSapCb *rgmSap; /*!< TFU SAP Control Block */ + CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ + CmTqType tmrTq[RGSCH_TQ_SIZE]; /*!< Timer Task Queue */ + U8 rgSchDlDelta; /* 4UE_TTI_DELTA */ + U8 rgSchCmnDlDelta; + U8 rgSchUlDelta; + RgSchCellCb *cells[CM_LTE_MAX_CELLS]; /* Array to store cellCb ptr */ + RgrSchedEnbCfg rgrSchedEnbCfg; /*!< eNB level RR/PFS Config */ + Void *rgSchEnbPfsDl; /*!< eNB level PFS DL Block */ + + Void * laaCb; +#ifdef RG_5GTF + RgSchDynTddCb rgSchDynTdd; /*!< Dynamic TDD Control Block */ +#endif +}; + +/* Declaration for scheduler control blocks */ +EXTERN RgSchCb rgSchCb[RGSCH_MAX_INST]; + +/* + * Data structures for RAM + */ + +/** + * @brief + * Random Access Req Info to be stored in cellCb. + */ +typedef struct rgSchRaReqInfo +{ + CmLList raReqLstEnt; /*!< Linked list entity for RaReq List */ + CmLteTimingInfo timingInfo; /*!< RACHO: Time of RaReq Reception */ + RgTfuRaReqInfo raReq; /*!< Random Access Request Information */ + RgSchUeCb *ue; /*!< UECB if RAP ID is a dedicated one */ +} RgSchRaReqInfo; + +/** + * @enum rgSchRaState + * Enumeration of random access states. + */ +typedef enum rgSchRaState +{ + RGSCH_RA_MSG3_PENDING, /*!< Msg3 reception pending */ + RGSCH_RA_MSG4_PENDING, /*!< Msg4 transmission pending */ + RGSCH_RA_MSG4_DONE /*!< Msg4 transmission successful */ +} RgSchRaState; + +/** + * @brief + * Control block for Random Access. + */ +struct rgSchRaCb +{ + CmLList raCbLnk; /*!< To link to the raCb list */ + CmLList schdLnk; /*!< To link raCb to the "to be scheduled" + list */ + CmLteRnti tmpCrnti; /*!< Temporary C-RNTI */ + CmLteTimingInfo timingInfo; /*!< Timing information */ + RgSchRntiLnk *rntiLnk; /*!< Link to RNTI for raCb */ + RgSchRaState raState; /*!< Random access state */ + struct + { + U32 bo; /*!< Buffer occupancy for CCCH */ + } dlCcchInfo; /*!< Params for DL CCCH */ + U8 msg3HqProcId; /*!< Msg3 Harq Process ID */ + /*ccpu00128820 - DEL - msg3HqProcRef is delete for Msg3 alloc double delete issue*/ + RgSchUlHqProcCb msg3HqProc; /*!< msg3HqProcRef points to this initially */ + RgSchUeCb *ue; /*!< NULL initially */ + Bool toDel; /*!< To delete this RaCb after msg4 reject */ + TknU8 phr; /*!< To store the PHR, if received along with + Msg3 */ + CmLList rspLnk; /*!< Used to link RACB to a frame for resp */ + U8 rapId; /*!< RAP ID */ + TknU16 ta; /*!< Timing Adjustment */ + RgSchUlGrnt msg3Grnt; /*!< Msg3 grant as given by the UL Sched */ + U32 y[RGSCH_NUM_SUB_FRAMES]; /*!< y values using tmpCrnti by DLSCHED */ + RgSchDlHqEnt *dlHqE; /*!< DL HARQ module */ + U8 ccchCqi; /*!< DL Cqi obtained from RaReq and Used for CCCH */ + RgSchDlRbAlloc rbAllocInfo; /*!< RB Allocation Info for MSG4 Trans/Retrans */ + /* PHR handling for MSG3 */ + CmLteTimingInfo msg3AllocTime; /*!< Allocation time for msg3 grant */ +#ifdef RGR_V1 + /* CR timer changes*/ + CmLList contResTmrLnk; /*!< To link raCb to the + Guard Timer/Contention Resolution timer list*/ + CmLteTimingInfo expiryTime; /*!< Expiry time for Guard/Contention + Resolution timers */ + + U32 ccchSduBo; /*!rntiLnk */ +EXTERN Void rgSCHUtlIndRntiRls2Mac ARGS(( RgSchCellCb *cell, CmLteRnti rnti, + Bool ueIdChng, CmLteRnti newRnti)); + +/*rg008.201 - Added support for SPS*/ +#ifdef LTEMAC_SPS +EXTERN S16 rgSCHDbmDeInitSpsUeCbLst ARGS((RgSchCellCb *cellCb)); +EXTERN S16 rgSCHDbmInsSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb)); +EXTERN RgSchUeCb* rgSCHDbmGetSpsUeCb ARGS((RgSchCellCb *cellCb, CmLteRnti ueId)); +EXTERN RgSchUeCb* rgSCHDbmGetNextSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb)); +EXTERN S16 rgSCHDbmDelSpsUeCb ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb)); +#endif /* LTEMAC_SPS */ + +#ifdef LTE_L2_MEAS +/* + * L2M APIs + */ +EXTERN S16 rgSchL2mMeasReq ARGS (( + RgSchCellCb *cell, + LrgSchMeasReqInfo *measInfo, + RgSchErrInfo err)); +EXTERN S16 RgSchMacL2MeasSend ARGS +(( +Pst* pst, +RgInfL2MeasSndReq *measInfo +)); + +EXTERN S16 RgSchMacL2MeasStop ARGS +(( +Pst* pst, +RgInfL2MeasStopReq *measInfo +)); +#endif /* LTE_L2_MEAS */ +/* + * DHM APIs + */ +/* LTE_ADV_FLAG_REMOVED_START */ +EXTERN S16 rgSchSFRTotalPoolInit ARGS((RgSchCellCb *cell, RgSchDlSf *sf)); +/* LTE_ADV_FLAG_REMOVED_END */ +EXTERN Void rgSCHDhmHqPAdd2FreeLst ARGS (( RgSchDlHqProcCb *hqP)); +EXTERN Void rgSCHDhmHqPAdd2InUseLst ARGS (( RgSchDlHqProcCb *hqP)); +EXTERN Void rgSCHDhmHqPDelFrmFreeLst ARGS (( RgSchDlHqProcCb *hqP)); +EXTERN Void rgSCHDhmHqPDelFrmInUseLst ARGS (( RgSchDlHqProcCb *hqP)); + +EXTERN RgSchDlHqEnt *rgSCHDhmHqEntInit ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHDhmGetAvlHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo timingInfo, + RgSchDlHqProcCb **hqP)); +EXTERN Void rgSCHDhmHqRetx ARGS((RgSchDlHqEnt *hqE, CmLteTimingInfo timeInfo, + RgSchDlHqProcCb *hqP)); +EXTERN RgSchDlHqProcCb * rgSCHDhmLastSchedHqProc ARGS((RgSchDlHqEnt *hqE)); +/* CR timer changes*/ +EXTERN S16 rgSCHDhmGetCcchSduHqProc ARGS((RgSchUeCb *ueCb, CmLteTimingInfo timeInfo, + RgSchDlHqProcCb **hqP)); +EXTERN S16 rgSCHDhmGetMsg4HqProc ARGS((RgSchRaCb *raCb, CmLteTimingInfo timeInfo)); +EXTERN Void rgSCHDhmRlsHqProc ARGS((RgSchDlHqProcCb *hqP)); +/* ccpu00118350 : Correcting NDI manipulation of Harq */ +EXTERN Void rgSCHDhmRlsHqpTb ARGS((RgSchDlHqProcCb *hqP, U8 tbIdx, Bool togNdi)); +EXTERN Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm, +RgSchDlHqProcCb *hqP, U8 tbIdx )); +EXTERN Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE, +CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, U8 tbIdx)); +EXTERN Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm, +RgSchDlHqProcCb *hqP, U8 tbIdx )); +EXTERN Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE, +CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, U8 tbIdx)); +#ifdef RG_UNUSED +EXTERN S16 rgSCHDhmGetHqProcFrmId ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 idx, + RgSchDlHqProcCb **hqP)); +#endif +/* Changes for MIMO feature addition */ +EXTERN Void rgSCHDhmSchdTa ARGS((RgSchUeCb *ueCb, RgSchDlHqTbCb *tbInfo)); +EXTERN S16 rgSCHDhmHqFdbkInd ARGS((Void *cb, U8 cbType, RgSchCellCb *cellCb, + CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo + *rlsHqBufs,RgSchErrInfo *err)); +#ifdef EMTC_ENABLE +EXTERN S16 rgSCHDhmEmtcHqFdbkInd ARGS((Void *cb, U8 cbType, RgSchCellCb *cellCb, + CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo + *rlsHqBufs,RgSchErrInfo *err)); +EXTERN PUBLIC S16 rgSCHUtlAddToResLst +( + CmLListCp *cp, + RgSchIotRes *iotRes + ); +#endif +/*CA Dev Start */ +EXTERN S16 rgSCHDhmPrcFdbkForTb(RgSchCellCb *cell,RgSchUeCb *ue, + RgSchDlHqProcCb *hqP,RgSchDlSf *sf,Bool isMsg4, + U16 rnti,U8 tbCnt,CmLteTimingInfo timingInfo, U8 isAck, + RgInfRlsHqInfo *rlsHqBufs,RgSchErrInfo *err + ); +/*CA Dev End */ +EXTERN Void rgSCHDhmRgrUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUeCfg *ueCfg, RgSchErrInfo *err)); +EXTERN Void rgSCHDhmRgrUeRecfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUeRecfg *ueCfg, RgSchErrInfo *err)); +EXTERN Void rgSCHDhmRgrCellCfg ARGS((RgSchCellCb *cellCb, RgrCellCfg *cellCfg, + RgSchErrInfo *err)); +EXTERN Void rgSCHDhmRgrCellRecfg ARGS((RgSchCellCb *cellCb, RgrCellRecfg + *cellRecfg, RgSchErrInfo *err)); +EXTERN Void rgSCHDhmFreeUe ARGS((RgSchUeCb *ueCb)); +EXTERN Void rgSCHDhmUpdTa ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, U8 ta)); +EXTERN Void rgSCHDhmProcTAExp ARGS((RgSchUeCb *ue)); +/* Changes for MIMO feature addition */ +EXTERN S16 rgSCHDhmAddLcData ARGS((Inst inst, RgSchLchAllocInfo *lchData, + RgSchDlHqTbCb *tbInfo)); +EXTERN S16 rgSCHDhmRlsDlsfHqProc ARGS((RgSchCellCb *cellCb, CmLteTimingInfo +timingInfo)); + +#ifdef LTE_TDD +EXTERN S16 rgSCHDhmTddRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo uciTimingInfo)); +EXTERN S16 rgSCHCfgVldtTddDrxCycCfg ARGS((RgSchCellCb *cell, U16 drxCycle, + U8 onDurTmr, U16 offSet)); +#endif +/* Added support for SPS*/ +#ifdef LTEMAC_SPS +EXTERN S16 rgSCHDhmGetHqProcFrmId ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 idx, +RgSchDlHqProcCb **hqP +)); +#endif /* LTEMAC_SPS */ +/* Freeing up the HARQ proc blocked for + * indefinite time in case of Retx */ +EXTERN S16 rgSCHDhmDlRetxAllocFail ARGS(( +RgSchUeCb *ue, +RgSchDlHqProcCb *proc +)); +/* MS_WORKAROUND for ccpu00122893 temp fix Incorrect HqProc release was done instead of + * a Harq Entity reset. Fixing the same */ +EXTERN Void rgSCHDhmHqEntReset ARGS(( + RgSchDlHqEnt *hqE +)); +/* Measurement GAP and ACK NACK */ + +EXTERN S16 rgSCHMeasGapANRepUeCfg ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCfg *ueCfg +)); +EXTERN S16 rgSCHMeasGapANRepUeRecfg ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +)); +/* ccpu00133470- Added extra argument to identify UE DEL*/ +EXTERN Void rgSCHMeasGapANRepUeDel ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isUeDel +)); +EXTERN S16 rgSCHMeasGapANRepTtiHndl ARGS(( +RgSchCellCb *cell +)); +EXTERN S16 rgSCHMeasGapANRepGetDlInactvUe ARGS(( +RgSchCellCb *cell, +CmLListCp *dlInactvUeLst +)); +EXTERN S16 rgSCHMeasGapANRepGetUlInactvUe ARGS(( +RgSchCellCb *cell, +CmLListCp *ulInactvUeLst +)); +EXTERN Void rgSCHMeasGapANRepDlInactvTmrExpry ARGS(( +RgSchUeCb *ue, +U8 tmrEvnt +)); +EXTERN Void rgSCHMeasGapANRepUlInactvTmrExpry ARGS(( +RgSchUeCb *ue, +U8 tmrEvnt +)); +EXTERN Void rgSCHMeasGapANRepTmrExpry ARGS(( +RgSchUeCb *ue +)); +EXTERN Void rgSCHAckNakRepTmrExpry ARGS(( +RgSchUeCb *ue +)); +EXTERN Void rgSCHAckNakRepSndHqFbkRcpReq ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +CmLteTimingInfo timingInfo)); + +EXTERN Void rgSCHAckNakRepAddToQ ARGS(( +RgSchCellCb *cell, +RgSchDlSf *crntDlSf)); + +/* + * SCH Util APIs + */ +#ifdef LTEMAC_SPS +EXTERN Void rgSCHUtlHdlCrcInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +)); +#endif + +#ifdef LTE_L2_MEAS +EXTERN S16 rgSCHUtlValidateMeasReq ARGS ((RgSchCellCb *cellCb, + LrgSchMeasReqInfo *schL2MeasInfo, + RgSchErrInfo *err + )); +EXTERN S16 rgSchL2mSndCfm ARGS((Pst *pst, + RgSchL2MeasCb *measCb, + LrgSchMeasReqInfo *measInfo, + Bool isErr +)); +EXTERN S16 rgSchFillL2MeasCfm ARGS(( + RgSchCellCb *cell, + RgSchL2MeasCb *measCb, + LrgSchMeasCfmInfo *cfm, + U32 measTime +)); +EXTERN Void rgSchL2mFillCfmPst ARGS(( + Pst *pst, + Pst *cfmPst, + LrgSchMeasReqInfo *measInfo +)); +EXTERN S16 rgSCHL2Meas ARGS(( + RgSchCellCb *cell, + U8 isCalrCrcInd +)); +#endif /* LTE_L2_MEAS */ +/* Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE +EXTERN F64 rgSCHUtlPower ARGS +(( +F64 x, +F64 n +)); + + EXTERN U32 rgSCHUtlParse ARGS + (( + U8 *buff, + U8 startPos, + U8 endPos, + U8 buffSize + )); + + EXTERN U8 rgSCHUtlFindDist ARGS +(( +U16 crntTime, +U16 tempIdx +)); +#endif +EXTERN Bool rgSCHUtlPdcchAvail ARGS((RgSchCellCb *cell, RgSchPdcchInfo + *pdcchInfo, CmLteAggrLvl aggrLvl, RgSchPdcch **pdcch)); +EXTERN Void rgSCHUtlPdcchPut ARGS((RgSchCellCb *cell, RgSchPdcchInfo *pdcchInfo, + RgSchPdcch *pdcch)); +#ifdef LTE_TDD +/* Changes for passing iPhich at TFU interface*/ +EXTERN S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm, + U8 hqFeedBack, U8 nDmrs, U8 rbStart, U8 iPhich)); +#else +EXTERN S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm, + U8 hqFeedBack, U8 nDmrs, U8 rbStart,Bool isForMsg3)); +#endif +EXTERN RgSchDlSf* rgSCHUtlSubFrmGet ARGS((RgSchCellCb *cell, + CmLteTimingInfo frm)); +EXTERN Void rgSCHUtlSubFrmPut ARGS((RgSchCellCb *cell, RgSchDlSf *sf)); +EXTERN U8 rgSCHUtlLog32bitNbase2 ARGS((U32 n)); +/* Added support for SPS*/ + + +#ifdef LTEMAC_SPS +EXTERN RgSchDlHqProcCb * rgSCHDhmSpsDlGetHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, +CmLteTimingInfo timingInfo)); +#endif +#ifdef LTE_TDD +EXTERN U8 rgSCHUtlCalcNCce ARGS((U8 bw, RgrPhichNg ng, U8 cfi, U8 mPhich, + U8 numAntna, Bool isEcp)); +#else +EXTERN U8 rgSCHUtlCalcNCce ARGS((U8 bw, RgrPhichNg ng, U8 cfi, U8 numAntna, Bool +isEcp)); +#endif +#ifdef LTE_TDD +/* Changes for passing iPhich at TFU interface*/ +EXTERN S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, U8 *rbStartRef, + U8 *nDmrsRef, U8 *iPhich)); +#else +EXTERN S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, U8 *rbStartRef, + U8 *nDmrsRef)); +#endif +/* Added changes of TFU_UPGRADE */ +#ifndef TFU_UPGRADE +/* To include the length and ModOrder in DataRecp Req. */ +/* Updating NDI and HARQ proc Id */ +EXTERN S16 rgSCHUtlAllocRcptInfo ARGS((RgSchUlAlloc *alloc, CmLteRnti *rnti, + U8 *iMcsRef, U8 *rbStartRef, U8 *numRbRef, U8 *rvRef, U16 *size, + TfuModScheme *modType,Bool *isRtx, +U8 *nDmrs, +Bool *ndi, +U8 *hqPId)); +#else +EXTERN S16 rgSCHUtlAllocRcptInfo ARGS(( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + CmLteTimingInfo *timeInfo, + TfuUeUlSchRecpInfo *recpReq + )); +#endif /* TFU_UPGRADE */ + +EXTERN S16 rgSCHUtlRgrCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg, + RgSchErrInfo *errInfo)); +EXTERN S16 rgSCHUtlRgrCellRecfg ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg, + RgSchErrInfo *errInfo)); +EXTERN S16 rgSCHUtlFreeCell ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlRgrUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgrUeCfg *cfg, RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlRgrLcCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *dl, RgrLchCfg *cfg,RgSchErrInfo *errInfo)); +EXTERN S16 rgSCHUtlRgrLcDel ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + CmLteLcId lcId, U8 lcgId)); +EXTERN S16 rgSCHUtlRgrLcRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, + RgSchDlLcCb *dlLc,RgrLchRecfg *recfg,RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlRgrLcgCfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, + RgrLcgCfg *cfg,RgSchErrInfo *errInfo)); +EXTERN S16 rgSCHUtlRgrLcgRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, + RgrLcgRecfg *recfg,RgSchErrInfo *err)); +EXTERN Void rgSCHUtlRgrLcgDel ARGS ((RgSchCellCb *cell,RgSchUeCb *ue, + U8 lcgId)); +EXTERN Void rgSCHUtlDlCqiInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + TfuDlCqiRpt *dlCqiInd, CmLteTimingInfo timingInfo)); + +/* Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE +EXTERN Void rgSCHUtlRawCqiInd ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuRawCqiRpt* rawCqiRpt, +CmLteTimingInfo timingInfo +)); + +EXTERN Void rgSCHUtlSrsInd ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuSrsRpt* srsRpt, +CmLteTimingInfo timingInfo +)); +EXTERN S16 rgSCHUtlGetCfgPerOff ARGS +(( +RgSchPerTbl tbl, +U16 cfgIdx, +U16 *peri, +U16 *offset +)); +#endif + +EXTERN Void rgSCHUtlDoaInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + TfuDoaRpt *doaInd)); +EXTERN Void rgSCHUtlDlTARpt ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +/* Changes for MIMO feature addition */ +EXTERN Void rgSCHUtlDlRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm)); +EXTERN Void rgSCHUtlDlProcAddToRetx ARGS((RgSchCellCb *cell, + RgSchDlHqProcCb *hqP)); +EXTERN S16 rgSCHUtlRegSch ARGS((U8 schIdx, RgSchdApis *apis)); +EXTERN Void rgSCHUtlDlHqProcAddToTx ARGS((RgSchDlSf *subFrm, RgSchDlHqProcCb *hqP)); +/* Changes for MIMO feature addition */ +EXTERN Void rgSCHUtlDlHqPTbRmvFrmTx ARGS((RgSchDlSf *subFrm, + RgSchDlHqProcCb *hqP, U8 tbIdx, Bool isRepeating)); +EXTERN S16 rgSCHUtlRgrUeRecfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgrUeRecfg *recfg, RgSchErrInfo *err)); +EXTERN Void rgSCHUtlFreeDlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *dlLc)); +EXTERN Void rgSCHUtlFreeUlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchUlLcCb *ulLc)); +EXTERN Void rgSCHUtlFreeUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +EXTERN Void rgSCHUtlDlDedBoUpd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *svc)); +#ifdef RG_UNUSED +EXTERN S16 rgSCHUtlUpdUlHqProc ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc, + RgSchUlHqProcCb *oldProc)); +#endif +/* PHR handling for MSG3 */ +EXTERN Void rgSCHUtlRecMsg3Alloc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchRaCb *raCb)); +EXTERN S16 rgSCHUtlContResUlGrant ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlSrRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + CmLteTimingInfo, RgSchErrInfo *err)); +EXTERN Void rgSCHUtlUpdBsrShort ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 lcgId, + U8 bsr, RgSchErrInfo *err)); +EXTERN Void rgSCHUtlUpdBsrTrunc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 lcgId, + U8 bsr, RgSchErrInfo *err)); +EXTERN Void rgSCHUtlUpdBsrLong ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + U8 bsr1,U8 bsr2,U8 bsr3,U8 bsr4, RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlUpdPhr ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + U8 phr, RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlUpdExtPhr ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, +RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlDataRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, U8 numLc, + RgSchUlLcCb *lcArr[], U16 bytesArr[], RgSchErrInfo *err)); +EXTERN Void rgSCHUtlUlCqiInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, + TfuUlCqiRpt *ulCqiInfo)); +EXTERN Void rgSCHUtlPucchDeltaPwrInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, + S8 delta)); +EXTERN Void rgSCHUtlUeReset ARGS(( RgSchCellCb *cell, RgSchUeCb *ue)); +EXTERN Void rgSCHUtlUlHqProcForUe ARGS((RgSchCellCb *cell, CmLteTimingInfo frm, + RgSchUeCb *ue, RgSchUlHqProcCb **procRef)); +EXTERN RgSchUlAlloc *rgSCHUtlFirstRcptnReq ARGS((RgSchCellCb *cell)); +EXTERN RgSchUlAlloc *rgSCHUtlNextRcptnReq ARGS((RgSchCellCb *cell, + RgSchUlAlloc *alloc)); +EXTERN RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc ARGS((RgSchCellCb *cell, U8 idx)); +EXTERN RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc ARGS((RgSchCellCb *cell, + RgSchUlAlloc *alloc, U8 idx)); +EXTERN S16 rgSCHUtlTfuBndReq ARGS((Inst inst, SuId suId, SpId spId)); +EXTERN S16 rgSCHUtlTfuUBndReq ARGS((Inst inst, RgSchLowSapCfgInfo sapCfg, Reason reason)); +#ifdef EMTC_ENABLE +EXTERN S16 rgSCHEmtcUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc, + Bool resetCmnLcInfo, Bool restAlloc)); +#endif +EXTERN S16 rgSCHUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc, + Bool resetCmnLcInfo, Bool restAlloc)); +EXTERN S16 rgSCHUtlGetSfAlloc ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlPutSfAlloc ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlAllocSBuf ARGS((Inst inst, Data **pData, Size size)); +/* ccpu00117052 - MOD - Passing double pointer +for proper NULLP assignment*/ +EXTERN Void rgSCHUtlFreeSBuf ARGS((Inst inst, Data **data, Size size)); +EXTERN Void rgSCHUtlFillDgnParams ARGS((Inst inst, RgUstaDgn *dgn,U8 dgnType)); +EXTERN Void rgSCHUtlGetPstToLyr ARGS((Pst *pst,RgSchCb *schCb,Inst macInst)); +EXTERN S16 rgSCHUtlFillRgInfCmnLcInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc, + CmLteLcId lcId, Bool sendInd)); +EXTERN S16 rgSCHUtlFillRgInfRarInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlFillPdschDciInfo ARGS((TfuPdschDciInfo *pdschDci,TfuDciInfo + *pdcchDci)); + /* CA dev Start */ +EXTERN Void rgSCHUtlFillRgInfUeInfo ARGS((RgSchDlSf*, RgSchCellCb *cell, CmLListCp *dlDrxInactvTmrLst, + CmLListCp *dlInActvLst, CmLListCp *ulInActvLst)); + /* CA dev End */ +EXTERN S16 rgSCHUtlUpdSch ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb, + RgSchUeCb *ueCb, RgInfUeDatInd *pdu,RgSchErrInfo *err)); +EXTERN S16 rgSCHUtlHndlCcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt *boRpt)); +EXTERN S16 rgSCHUtlHndlBcchPcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt + *boUpdt)); +EXTERN S16 rgSCHUtlRgrBndCfm ARGS ((Inst inst, SuId suId,U8 status)); +/* Added for sending TTI tick to RRM */ +#ifdef RGR_RRM_TICK +EXTERN S16 rgSCHUtlRgrTtiInd ARGS ((RgSchCellCb *cell, RgrTtiIndInfo *ttiInd)); +#endif +EXTERN S16 schSendCfgCfm ARGS ((Region reg, Pool pool, \ + RgrCfgTransId transId, U8 status)); +EXTERN S16 rgSCHUtlProcMsg3 ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb, + RgSchUeCb *ueCb, CmLteRnti rnti,RgInfUeDatInd *pdu, + RgSchErrInfo *err )); +#ifdef RG_PHASE_2 +EXTERN S16 rgSCHUtlTfuGrpPwrCntrlReq ARGS((Inst inst,S16 sapId, + TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq)); +#endif +EXTERN S16 rgSCHUtlTfuCntrlReq ARGS((Inst inst, S16 sapId, + TfuCntrlReqInfo *cntrlReq)); +EXTERN S16 rgSCHUtlTfuRecpReq ARGS((Inst inst, S16 sapId, + TfuRecpReqInfo *recpReq)); +EXTERN S16 rgSCHUtlValidateTfuSap ARGS((Inst inst,SuId suId)); +EXTERN S16 rgSCHUtlAllocEventMem ARGS((Inst inst,Ptr *memPtr,Size memSize)); +EXTERN S16 rgSCHUtlGetEventMem ARGS((Ptr *ptr,Size len,Ptr memCpa)); +EXTERN S16 rgSCHUtlGetRlsHqAlloc ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlPutRlsHqAlloc ARGS((RgSchCellCb *cell)); + +EXTERN S16 rgSCHUtlDlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +EXTERN S16 rgSCHUtlUlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +EXTERN Void rgSCHUtlHdlUlTransInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + CmLteTimingInfo timingInfo)); +#ifdef TFU_UPGRADE +EXTERN Void rgSCHUtlUpdACqiTrigWt ARGS((RgSchUeCb *ue,RgSchUeCellInfo *sCellInfo, U8 isAck)); +#endif +/* Nprb indication at PHY for common Ch */ +/* Corrected allocation for common channels */ +EXTERN PUBLIC S32 rgSCHUtlGetAllwdCchTbSz ARGS((U32 bo, U8 *nPrb, U8 *mcs +)); +/* CR timer changes*/ +EXTERN PUBLIC S16 rgSCHUtlUpdtBo ARGS((RgSchCellCb *cell, + RgInfCmnBoRpt *staRsp)); +EXTERN PUBLIC S16 rgSCHUtlAddUeToCcchSduLst ARGS( + (RgSchCellCb *cell, + RgSchUeCb *ueCb)); +#ifdef EMTC_ENABLE +EXTERN PUBLIC S16 rgSCHUtlAddUeToEmtcCcchSduLst ARGS( + (RgSchCellCb *cell, + RgSchUeCb *ueCb)); + +EXTERN S16 rgSCHRamRmvFrmEmtcRaInfoSchdLst ARGS((RgSchCellCb *cell, RgSchRaCb *raCb)); +EXTERN Void rgSCHRamEmtcDelRaCb ARGS((RgSchCellCb *cell, RgSchRaCb *raCb)); +EXTERN S16 rgSCHRamEmtcUpdtBo ARGS((RgSchCellCb *cell, RgSchRaCb *raCb, + RgInfCmnBoRpt *staRsp)); +#endif +/* Added for SI Enhancement*/ +#ifdef RGR_SI_SCH +EXTERN Void rgSCHUtlPutSiInfo ARGS((RgSchCellCb *cell)); +EXTERN Void rgSCHUtlFreeWarningSiSeg ARGS((Region reg,Pool pool, + CmLListCp *siPduLst)); +EXTERN Void rgSCHUtlFreeWarningSiPdu ARGS((RgSchCellCb *cell)); +EXTERN Buffer *rgSCHUtlGetWarningSiPdu ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHUtlGetMcsAndNPrb ARGS((RgSchCellCb *cell, U8 *nPrb, U8 *mcs, MsgLen *msgLen)); +EXTERN S16 rgSCHUtlCalMcsAndNPrb ARGS((RgSchCellCb *cell, U8 cfgType, MsgLen msgLen, U8 siId)); +#endif/*RGR_SI_SCH*/ + +#ifdef LTE_TDD +EXTERN S16 rgSCHUtlAllocUeANFdbkInfo ARGS((RgSchUeCb *ue,U8 servCellIdx)); +EXTERN Void rgSCHUtlDelUeANFdbkInfo ARGS((RgSchUeCb *ue,U8 servCellIdx)); +EXTERN S16 rgSCHUtlInitUeANFdbkInfo ARGS((RgSchTddANInfo *anInfo)); +EXTERN RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo ARGS((RgSchUeCb *ueCb, CmLteTimingInfo *timeInfo,U8 servCellIdx)); +EXTERN U8 rgSCHUtlGetDlSfIdx ARGS((RgSchCellCb *cell, CmLteTimingInfo *timeInfo)); +EXTERN Void rgSCHUtlPrachCfgInit ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg )); +EXTERN Void rgSCHUtlGetNxtDlSfInfo ARGS((CmLteTimingInfo curDlTime, RgSchCellCb *cell, RgSchDlSf *dlSf, RgSchDlSf **nxtDlsf, CmLteTimingInfo *nxtDlTime)); +EXTERN Void rgSCHUtlGetPrevDlSfInfo ARGS((RgSchCellCb * cell, CmLteTimingInfo curDlTime, CmLteTimingInfo *prevDlTime, U8 *numSubfrm)); +#endif +EXTERN Void rgSCHCmnDlSch ARGS +(( +RgSchCellCb *cell +)); +EXTERN Void rgSCHCmnSndCnsldtInfo ARGS +(( +RgSchCellCb *cell +)); +EXTERN Void rgSCHCmnCnsldtSfAlloc ARGS +(( +RgSchCellCb *cell +)); + +/* Added support for SPS*/ +EXTERN Void rgSCHCmnDlAllocFnlz ARGS +(( +RgSchCellCb *cell +)); + +#ifdef LTEMAC_SPS +EXTERN Void rgSCHUtlDlRelPdcchFbk ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isAck +)); + +EXTERN Void rgSCHUtlDlProcAck ARGS(( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +)); +EXTERN S16 rgSCHUtlSpsRelInd ARGS(( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +Bool isExplRel +)); + +EXTERN Void rgSCHCmnDlSch ARGS +(( +RgSchCellCb *cell +)); + +EXTERN S16 rgSCHUtlSpsActInd ARGS(( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +U16 spsSduSize +)); + +EXTERN Void rgSCHUtlHdlCrcFailInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +)); + +EXTERN Void rgSCHUtlHdlCrntiCE ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); + +#endif /* LTEMAC_SPS*/ + +/******* : START *****/ +EXTERN S16 rgSCHUtlUlSfInit ARGS(( + RgSchCellCb *cell, + RgSchUlSf *sf, + U8 idx, + U8 maxUePerSf + )); +EXTERN Void rgSCHUtlUlSfDeinit ARGS(( + RgSchCellCb *cell, + RgSchUlSf *sf + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetHole ARGS(( + RgSchUlSf *sf, + U8 numRb, + RgSchUlHole *hole + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole ARGS(( + RgSchUlSf *sf, + RgSchUlHole *hole + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole ARGS(( + RgSchUlSf *sf, + U8 numRb, + RgSchUlHole *hole + )); +EXTERN Void rgSCHUtlUlAllocRls ARGS(( + RgSchUlSf *sf, + RgSchUlAlloc *alloc + )); + +/* UL_ALLOC_ENHANCEMENT */ +EXTERN Void rgSCHUtlUlAllocRelease ARGS(( + RgSchUlAlloc *alloc + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocFirst ARGS(( + RgSchUlSf *sf + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocNxt ARGS(( + RgSchUlSf *sf, + RgSchUlAlloc *alloc + )); +EXTERN RgSchUlHole *rgSCHUtlUlHoleFirst ARGS(( + RgSchUlSf *sf + )); +EXTERN RgSchUlHole *rgSCHUtlUlHoleNxt ARGS(( + RgSchUlSf *sf, + RgSchUlHole *hole + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt ARGS(( + RgSchUlAllocDb *db, + RgSchUlAlloc *prv + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocGetFirst ARGS(( + RgSchUlAllocDb *db + )); +EXTERN Void rgSCHUtlUlHoleAddAlloc ARGS(( + RgSchUlSf *sf, + RgSchUlAlloc *alloc + )); +/* UL_ALLOC_ENHANCEMENT */ +EXTERN Void rgSCHUtlUlHoleAddAllocation ARGS(( + RgSchUlAlloc *alloc + )); + +EXTERN Void rgSCHUtlUlHoleJoin ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *prv, + RgSchUlHole *nxt, + RgSchUlAlloc *alloc + )); +EXTERN Void rgSCHUtlUlHoleExtndRight ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *prv, + RgSchUlAlloc *alloc + )); +EXTERN Void rgSCHUtlUlHoleExtndLeft ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *nxt, + RgSchUlAlloc *alloc + )); +EXTERN Void rgSCHUtlUlHoleNew ARGS(( + RgSchUlHoleDb *db, + RgSchUlAlloc *alloc + )); +EXTERN Void rgSCHUtlUlHoleUpdAllocLnks ARGS(( + RgSchUlHole *hole, + RgSchUlAlloc *prvAlloc, + RgSchUlAlloc *nxtAlloc + )); +EXTERN Void rgSCHUtlUlHoleIns ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *hole + )); +EXTERN Void rgSCHUtlUlHoleIncr ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *hole + )); +EXTERN Void rgSCHUtlUlHoleDecr ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *hole + )); +EXTERN Void rgSCHUtlUlHoleRls ARGS(( + RgSchUlHoleDb *db, + RgSchUlHole *hole + )); +EXTERN S16 rgSCHUtlUlAllocMemInit ARGS(( + RgSchCellCb *cell, + RgSchUlAllocMem *mem, + U8 maxAllocs + )); +EXTERN Void rgSCHUtlUlAllocMemDeinit ARGS(( + RgSchCellCb *cell, + RgSchUlAllocMem *mem + )); +EXTERN S16 rgSCHUtlUlHoleMemInit ARGS(( + RgSchCellCb *cell, + RgSchUlHoleMem *mem, + U8 maxHoles, + RgSchUlHole **holeRef + )); +EXTERN Void rgSCHUtlUlHoleMemDeinit ARGS(( + RgSchCellCb *cell, + RgSchUlHoleMem *mem + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlAllocMemGet ARGS(( + RgSchUlAllocMem *mem + )); +EXTERN Void rgSCHUtlUlAllocMemRls ARGS(( + RgSchUlAllocMem *mem, + RgSchUlAlloc *alloc + )); +EXTERN RgSchUlHole *rgSCHUtlUlHoleMemGet ARGS(( + RgSchUlHoleMem *mem + )); +EXTERN Void rgSCHUtlUlHoleMemRls ARGS(( + RgSchUlHoleMem *mem, + RgSchUlHole *hole + )); +EXTERN RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc ARGS(( + RgSchUlSf *sf, + U8 startSb, + U8 numSb +)); +/******* : END *****/ + +/* DRX function declarations */ +EXTERN S16 rgSCHDrxCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg)); +EXTERN Void rgSCHDrxCellDel ARGS((RgSchCellCb *cell)); +EXTERN S16 rgSCHDrxUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgrUeCfg *ueCfg)); +#ifdef RGR_V2 +EXTERN S16 rgSCHDrxUeReCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgrUeRecfg *ueCfg)); +#endif +EXTERN S16 rgSCHDrxUeDel ARGS((RgSchCellCb *cell,RgSchUeCb *ue)); +EXTERN Void rgSCHDrxTtiInd ARGS ((RgSchCellCb *cell)); + +EXTERN S16 rgSCHDrxSfAlloc ARGS ((RgSchCellCb *cellCb, RgSchDlSf + *dlSf)); +EXTERN S16 rgSCHDrxDlTrnsFail ARGS((RgSchCellCb *cell, RgSchDlHqProcCb + *dlHq)); +EXTERN Void rgSCHDrxDedRa ARGS((RgSchCellCb *cellCb, RgSchUeCb* ueCb)); +EXTERN S16 rgSCHDrxSrInd ARGS((RgSchCellCb *cell,RgSchUeCb *ue)); + +EXTERN Void rgSCHDrxStrtInActvTmr ARGS((RgSchCellCb *cell, + CmLListCp *ueLst, + U8 direction)); +EXTERN S16 rgSCHUtlGetDrxSchdUesInDl ARGS((RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgSchDlHqProcCb *dlHq, + RgInfUeAlloc *allocInfo, + CmLListCp *dlDrxInactvTmrLst, + CmLListCp *dlInActvLst, + CmLListCp *ulInActvLst)); +EXTERN Void rgSCHDrxStartHarqRTTTmr ARGS((RgSchCellCb *cell, + RgSchDlHqProcCb *hqP, + U8 tbCnt)); +EXTERN Void rgSCHDrxUeHqReset ARGS((RgSchCellCb *cell, + RgSchUeCb *ue, + RgSchDlHqEnt *hqE, + U8 cellIdx)); + +#ifdef TFU_UPGRADE +#ifdef LTE_TDD +EXTERN CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl; +#else +EXTERN CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl; +#endif +#endif + +#ifdef LTEMAC_HDFDD +EXTERN S16 rgSCHHdFddUeCfg ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + Bool hdFdd)); +EXTERN S16 rgSCHHdFddUeDel ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb)); +EXTERN Void rgSCHCmnHdFddPtUlMrk ARGS(( + RgSchCellCb *cellCb)); +EXTERN Void rgSCHCmnHdFddChkUlAllow ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + U8 *flag)); +EXTERN Void rgSCHCmnHdFddChkDlAllow ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + Bool *flag)); +EXTERN Void rgSCHCmnHdFddChkNackAllow ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + CmLteTimingInfo timInfo, + Bool *flag)); +EXTERN Void rgSCHCmnHdFddUpdULMark ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb)); +EXTERN Void rgSCHCmnHdFddUpdDLMark ARGS(( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb)); +EXTERN Void rgSCHHdFddGetSfn ARGS(( + U16 *sfn, + CmLteTimingInfo timeInfo, + S16 offset)); +#endif /* ifdef LTEMAC_HDFDD */ + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT +PUBLIC S16 rgSCHUtlRgrStaInd ARGS(( +RgSchCellCb *cell, +RgrStaIndInfo *rgrSta +)); + +PUBLIC S16 rgSCHUtlFillSndStaInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrStaIndInfo *staInfo, +U8 numCqiRept +)); +#endif /* End of RGR_CQI_REPT */ +PUBLIC S16 rgSCHUtlRgrUeStaInd ARGS(( +RgSchCellCb *cell, +RgrUeStaIndInfo *rgrUeSta +)); + +PUBLIC S16 rgSCHUtlFillSndUeStaInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeStaIndInfo *ueStaInfo +)); + + +/* LTE_ADV_FLAG_REMOVED_START */ +PUBLIC S16 rgSCHUtlRgrLoadInfInd ARGS(( +RgSchCellCb *cell, +RgrLoadInfIndInfo *rgrLoadInf +)); +/* LTE_ADV_FLAG_REMOVED_END */ +#ifdef LTE_ADV +#ifdef TFU_UPGRADE +PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode ARGS(( +RgrSchFrmt1b3TypEnum fdbkType +)); + +EXTERN TfuAckNackMode rgSchUtlGetFdbkMode ARGS(( +RgrSchFrmt1b3TypEnum fdbkType +)); + +#endif /*TFU_UPGRADE */ +#endif /* LTE_ADV */ +/* FIX */ +PUBLIC Void rgSCHUtlRlsRnti ARGS(( +RgSchCellCb *cellCb, +RgSchRntiLnk *rntiLnk, +Bool ueIdChngd, +CmLteRnti newRnti +)); +PUBLIC S16 rgSCHUtlRgmBndCfm ARGS(( +Inst instId, +SuId suId, +U8 status +)); +PUBLIC Void rgSCHDhmDelHqEnt ARGS(( +RgSchCellCb *cell, +RgSchDlHqEnt **hqE +)); +PUBLIC Void rgSCHDhmAssgnUeHqEntFrmRaCb ARGS(( +RgSchUeCb *ue, +RgSchRaCb *raCb +)); +PUBLIC Void rgSCHUtlReTxTa ARGS(( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb)); +/* LTE_ADV_FLAG_REMOVED_START */ +PUBLIC Void rgSchSFRTotalPoolFree ARGS(( +RgSchSFRTotalPoolInfo *sfrTotalPoolInfo, +RgSchCellCb *cell)); +PUBLIC Void rgSchDSFRPwrCheck ARGS(( +RgSchDlSf *sf, +Bool *isAllUePwrHigh)); +/* LTE_ADV_FLAG_REMOVED_END */ + +PUBLIC S16 rgSCHUtlUpdAvgPrbUsage ARGS(( +RgSchCellCb *cell +)); + +PUBLIC U8 rgSchUtlCfg0ReTxIdx ARGS(( +RgSchCellCb *cell, +CmLteTimingInfo phichTime, +U8 hqFdbkIdx +)); + +EXTERN S16 rgSCHUtlBuildNSendLcgReg ARGS(( +RgSchCellCb *cell, +CmLteRnti crnti, +U8 lcgId, +Bool isGbr +)); + +EXTERN Void rgSCHUtlPdcchInit ARGS(( + RgSchCellCb *cell, + RgSchDlSf *subFrm, + U16 nCce)); +EXTERN Void rgSCHDynCfiReCfg ARGS(( + RgSchCellCb *cell, + Bool isDynCfiEnb +)); +PUBLIC Void rgSchUtlCalcTotalPrbReq ARGS((RgSchCellCb *cell, + RgSchUeCb *ue, + U32 bo, + U32 *prbReqrd)); +EXTERN U8 rgSchUtlGetNumSbs ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 *numSbs +)); + +EXTERN U8 rgSchUtlSortInsUeLst ARGS(( +RgSchCellCb *cell, +CmLListCp *ueLst, +CmLList *node, +U8 subbandRequired +)); +EXTERN S16 rgSCHUtlResetCpuOvrLdState ARGS(( + RgSchCellCb *cell, + U8 cnrtCpuOvrLdIns +)); +EXTERN Void rgSCHUtlCpuOvrLdAdjItbsCap ARGS(( + RgSchCellCb *cell +)); +#ifdef TFU_UPGRADE +EXTERN S16 rgSCHTomUtlPcqiSbCalcBpIdx ARGS(( +CmLteTimingInfo crntTimInfo, +RgSchUeCb *ueCb, +RgSchUePCqiCb *cqiCb +)); + +#ifdef LTE_ADV +EXTERN S16 rgSCHUtlSCellHndlCqiCollsn ARGS(( +RgSchUePCqiCb *cqiCb +)); + +EXTERN S16 rgSCHUtlSCellHndlRiCollsn ARGS(( +RgSchUePCqiCb *cqiCb +)); + +#endif/*LTE_ADV*/ +#endif/*TFU_UPGRADE*/ + +EXTERN Void rgSCHTomUtlGetTrigSet ARGS(( + RgSchCellCb *cell, + RgSchUeCb *ueCb, + U8 cqiReq, + U8 *triggerSet +)); + +EXTERN Void rgSCHUtlUpdUeDciSize ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +Bool isCsi2Bit +)); +EXTERN Void rgSCHUtlCalcDciSizes ARGS(( +RgSchCellCb *cell +)); + +EXTERN Void rgSchCmnPreDlSch ARGS (( + RgSchCellCb **cell, + U8 nCell, + RgSchCellCb **cellLst + )); + +EXTERN Void rgSchCmnPstDlSch ARGS (( + RgSchCellCb *cell + )); + +EXTERN PUBLIC U8 rgSCHCmnGetBiIndex ARGS (( +RgSchCellCb *cell, +U32 ueCount +)); + +EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __SCH__ */ + + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrsch/rg_sch_cfg.c b/src/5gnrsch/rg_sch_cfg.c new file mode 100755 index 000000000..4e3dfdb12 --- /dev/null +++ b/src/5gnrsch/rg_sch_cfg.c @@ -0,0 +1,10460 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point functions. + + File: rg_sch_cfg.c + +**********************************************************************/ + +/** @file rg_sch_cfg.c +@brief This module handles the configuration of SCH by RRC and RRM. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_FILE_ID=186; +static int RLOG_MODULE_ID=4096; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_mblk.h" /* common memory link list library */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" +#include "rgr.h" +#include "rgm.h" +#include "tfu.h" +#include "rg_env.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_err.h" +#include "rg_sch_cmn.h" +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for MAC */ +#include "rg_sch.x" /* typedefs for MAC */ +/* [ccpu00124018]-MOD- Retrieving CQI value from cell config*/ +#include "rg_sch_cmn.x" +#include "rg_sch_clist.x" + + +/* LTE-MAC Scheduler instance control block structures */ +PUBLIC RgSchCb rgSchCb[RGSCH_MAX_INST]; + +#ifdef PHY_ERROR_LOGING +PUBLIC RgSchUlAllocCntr rgSchUlAllocCntr; +#endif + +#ifdef EMTC_ENABLE +EXTERN Void rgSCHEmtcPOTrigger ARGS (( +RgSchCellCb *cell, +RgSchUeCb *ue +)); + +EXTERN S16 rgSchEmtcUpdSiCfg ARGS (( +RgSchCellCb *cell, +RgrCellRecfg *cellRecfg +)); + +EXTERN S16 rgSCHEmtcCfgVldtDrxReTxCfg ARGS(( +U16 reTxTmr +)); + +EXTERN S16 rgSCHEmtcCfgVldtDrxUlReTxCfg ARGS(( +U16 reTxTmr +)); +#endif + +PUBLIC S16 rgSCHEnbPfsDlCfg ARGS(( + Inst instIdx, + RgSchErrInfo *err + )); +/* local defines */ +PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg ARGS (( RgSchCellCb *cell, + RgSchUeCb *ue, RgrUeRecfg *ueRecfg, RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHCfgVldtUePwrCfg ARGS((RgSchCellCb *cell, + RgrUeUlPwrCfg *pwrCfg)); +PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg ARGS((RgSchCellCb *cell, + RgrUeGrpPwrCfg *grpPwrCfg)); +#ifdef LTEMAC_SPS +PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg ARGS((RgSchCellCb *cell, + RgrUeSpsDlCfg *dlSpsCfg)); +PRIVATE S16 rgSCHCfgVldtSpsReCfg ARGS ((RgSchCellCb *cell, + RgSchUeCb *ue, RgrUeRecfg *ueRecfg)); +#endif /*LTEMAC_SPS*/ +PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg ARGS((RgSchCellCb *cell,RgrUeDlCqiCfg *ueDlCqiCfg)); +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg ARGS ((RgSchCellCb *cell, + RgrUeCfg *ueCfg)); +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg ARGS ((RgSchCellCb *cell, + RgrUeRecfg *ueRecfg)); +PRIVATE Void rgSCHCfgFreeDlDedLcCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + RgSchDlLcCb *dlLc)); +PRIVATE Void rgSCHCfgFreeDlCmnLcCb ARGS((RgSchClcDlLcCb *cmnDlLc)); +PRIVATE Void rgSCHCfgFreeUeCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +PRIVATE Void rgSCHCfgFreeRgrCfgLst ARGS((RgSchCellCb *cell)); +PRIVATE Void rgSCHCfgFreeCmnLcLst ARGS((RgSchCellCb *cell)); +PRIVATE Void rgSCHCfgFreeUeLst ARGS((RgSchCellCb *cell)); +#ifdef LTEMAC_SPS +PRIVATE Void rgSCHCfgFreeSpsUeLst ARGS((RgSchCellCb *cell)); +#endif +PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg ARGS((Inst inst, RgrCellCfg *cellCfg, + RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg ARGS((Inst inst, RgrCellCfg *cellCfg, + RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHCfgVldtRgrCellSchCfg ARGS((Inst inst, RgrCellCfg *cellCfg)); +PRIVATE S16 rgSCHCfgVldtRgrSchCfg ARGS((Inst inst, RgrSchedEnbCfg *schedEnbCfg)); +PRIVATE S16 rgSCHCfgVldtRgrCellRACfg ARGS((Inst inst, RgrCellCfg *cellCfg)); +PRIVATE Void rgSCHCfgRgrUePhrMsg3 ARGS(( RgSchCellCb *cell, + RgSchRaCb *raCb,RgSchUeCb *ue, RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHCfgRgrCmnLcCfg ARGS((RgSchCellCb *cell, RgrCmnLchCfg *lcCfg, + RgSchErrInfo *errInfo)); +PUBLIC Void rgSCHSCellFreeBuf ARGS((Inst inst,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,U8 idx)); +#ifdef RGR_SI_SCH +PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg ARGS(( Inst inst, RgrSiCfg *siCfg)); +#endif/*RGR_SI_SCH */ + +/* LTE_ADV_FLAG_REMOVED_START */ +PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg ARGS(( Inst inst, + RgrLteAdvancedCellConfig *lteAdvCfg, U8 dlTotalBw)); +/* LTE_ADV_FLAG_REMOVED_END */ + +PRIVATE S16 rgSCHCfgVldtDrxUeCfg ARGS ((RgSchCellCb *cell, + RgrUeDrxCfg *ueDrxCfg)); +PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg ARGS((U8 onDurTmr)); +PRIVATE S16 rgSCHCfgVldtDrxInActvCfg ARGS((U16 inActvTmr)); +PRIVATE S16 rgSCHCfgVldtDrxReTxCfg ARGS((U8 reTxTmr)); +PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg ARGS((RgrDrxLongCycleOffst lngCycleOffst)); +PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs ARGS((U16 val)); +PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg ARGS((RgrDrxShortDrx shrtCycCfg)); +PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg ARGS((Inst inst, + RgrCellCsgParamCfg *csgParam)); +#ifdef TFU_UPGRADE + +PUBLIC S16 rgSCHCfgACqiUeCfg ARGS(( RgSchCellCb *cellCb,RgSchUeCb *ue, RgSchUeACqiCb *aCqiCb, + RgrTxMode ueTxMode,RgrUeAprdDlCqiCfg *aCqiCfg, CmLteUeCategory ueCat )); + +PUBLIC S16 rgSCHCfgAcqiUeReCfg ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUeAprdDlCqiCfg *acqiCfg, CmLteUeCategory ueCat )); + +PUBLIC S16 rgSCHUtlGetCfgPerOff ARGS(( RgSchPerTbl tbl, U16 cfgIdx, + U16 *peri, U16 *offset )); + +PUBLIC S16 rgSCHCfgRiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg, CmLteUeCategory ueCat )); + +PUBLIC S16 rgSCHCfgPCqiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat )); + +PUBLIC S16 rgSCHCfgSrsUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb, + RgrUeUlSrsCfg *srsCfg )); + +PUBLIC S16 rgSCHCfgSrUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb, + RgrUeSrCfg *srCfg)); + +PUBLIC S16 rgSCHCfgPCqiUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat)); + +PUBLIC S16 rgSCHCfgSrsUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUeUlSrsCfg *srsCfg)); + +PUBLIC S16 rgSCHCfgSrUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, + RgrUeSrCfg *srCfg)); + +PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode ARGS((RgSchCellCb *cellCb, + RgrTxMode txMde, RgrAprdCqiMode puschMode,RgSchErrInfo *errInfo)); + +PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg ARGS(( RgSchCellCb *cellCb, + CmLteRnti crnti, RgrUeAprdDlCqiCfg *acqiCfg, RgrUeTxModeCfg txMode, + RgSchErrInfo *errInfo )); + +PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode ARGS((RgSchCellCb *cellCb, + RgrTxMode txMde, RgrPrdCqiMode pucchMode,RgSchErrInfo *errInfo)); + +#ifdef LTEMAC_HDFDD +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb, + CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, Bool hdFdd, + RgrUeTxModeCfg txMode, RgSchErrInfo *errInfo)); +#else +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb, + CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, RgrUeTxModeCfg txMode, + RgSchErrInfo *errInfo)); +#endif +#ifdef LTEMAC_HDFDD +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb, + CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg, Bool hdFdd, + RgSchErrInfo *errInfo)); +#else +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb, + CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg, + RgSchErrInfo *errInfo)); +#endif + +#ifdef LTEMAC_HDFDD +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti, + RgrUeSrCfg *srCfg, Bool hdFdd, RgSchErrInfo *errInfo)); +#else +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti, + RgrUeSrCfg *srCfg, RgSchErrInfo *errInfo)); +#endif +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg ARGS (( RgSchCellCb *cellCb, + RgrUeCfg *ueCfg, + RgSchErrInfo *errInfo)); + +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg ARGS (( RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeRecfg *ueReCfg, + RgSchErrInfo *errInfo )); + +PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel ARGS ((RgSchCellCb *cellCb, + RgSchUeCb *ueCb)); + +PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz ARGS (( RgSchUeACqiCb *acqiCb,U8 numTxAnt, + U8* cqiPmiSzR1,U8* cqiPmiSzRn1 )); + +/* Added the function to be used instead of the + * MACRO RG_SCH_GET_PERIODICITY_TBL */ +PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl* rgSCHCfgUtlGetPcqiSrsSrRiTbl ARGS (( + RgSchPerTbl tblType, + U8 * min, + U8 * max)); + +#endif /* TFU_UPGRADE */ +PRIVATE Void rgSCHCfgUeTaRecfg ARGS (( RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeRecfg *ueReCfg, + RgSchErrInfo *errInfo )); +#ifdef LTE_ADV +PUBLIC S16 rgSCHSCellCfgUeCfg ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +)); + +PUBLIC S16 rgSCHSCellCfgUePucchReCfg ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +)); +PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg ARGS(( +RgrUeRecfg *ueRecfg, +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchErrInfo *errInfo +)); +PRIVATE S16 rgSCHSCellCfgUeCfgRollBack ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +)); +#endif + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) +PRIVATE S16 rgSCHCfgUeCqiReptReCfg ARGS (( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +)); + +PRIVATE S16 rgSCHCfgVldtCqiReptReCfg ARGS (( +RgSchCellCb *cell, +RgrUeRecfg *ueRecfg +)); +#endif +/*LTE_L2_MEAS_PHASE2*/ +#ifdef LTE_L2_MEAS +PRIVATE S16 rgSchAddToL2Meas ARGS ((RgSchCellCb *cellCb,RgSchDlLcCb *dlLc)); +#endif +#ifdef EMTC_ENABLE +PUBLIC S16 rgSCHEmtcCfgVldtDrxOnDurCfg +( +U16 onDurTmr +); +PUBLIC Void rgSCHUtlUpdEmtcY +( +RgSchUeCb *ue +); +EXTERN Void rgSCHEmtcHqPAlloc +( +RgSchCellCb *cell, +RgSchDlHqEnt *hqEnt +); +#endif + +/* local typedefs */ +CONSTANT RgSchSrsTxOffst rgSrsTxOffstTbl[RGSCH_MAX_SRS_SFCFG_IDX+1]= + {{1,{0,0,0,0,0,0,0,0}}, + {1,{0,0,0,0,0,0,0,0}}, + {1,{1,0,0,0,0,0,0,0}}, + {1,{0,0,0,0,0,0,0,0}}, + {1,{1,0,0,0,0,0,0,0}}, + {1,{2,0,0,0,0,0,0,0}}, + {1,{3,0,0,0,0,0,0,0}}, + {2,{0,1,0,0,0,0,0,0}}, + {2,{2,3,0,0,0,0,0,0}}, + {1,{0,0,0,0,0,0,0,0}}, + {1,{1,0,0,0,0,0,0,0}}, + {1,{2,0,0,0,0,0,0,0}}, + {1,{3,0,0,0,0,0,0,0}}, + {7,{0,1,2,3,4,6,8,0}}, + {8,{0,1,2,3,4,5,6,8}}, + {0,{0,0,0,0,0,0,0,0}}}; + +/* local externs */ + +#ifdef TFU_UPGRADE +/* SRSCfg Table: Ref 36.213, Table: 8.2.1 */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl +rgSchUeSrsCfgIdxFddTbl[RG_SCH_SRS_ISRS_INDX_MAX_FDD]= +{ + { 0,1, 2, 0 }, + { 2,6, 5, 2 }, + { 7,16, 10, 7 }, + { 17,36, 20, 17}, + { 37,76, 40, 37}, + { 77,156, 80, 77}, + { 157,316,160,157}, + { 317,636,320,317 } +}; + +/* Reference : 36.213 Table 8.2-2 */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl +rgSchUeSrsCfgIdxTddTbl[RG_SCH_SRS_ISRS_INDX_MAX_TDD]= +{ + { 10,14, 5, 10 }, + { 15,24, 10, 15 }, + { 25,44, 20, 25 }, + { 45,84, 40, 45 }, + { 85,164, 80, 85 }, + { 165,324,160, 165 }, + { 325,644,320, 325 } + /* RESERVED: Configuration Module should not allow Res values */ +}; + +/*Reference: 36.213 Table:7.2.2-1A */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl +rgSchUePCqiCfgIdxFddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_FDD]= +{ + { 0,1, 2, 0 }, + { 2,6, 5, 2 }, + { 7,16, 10,7 }, + {17,36, 20,17}, + {37,76, 40, 37}, + {77,156, 80, 77}, + {157,316,160,157}, + {318,349,32,318}, + {350,413,64, 350}, + {414,541,128,414 } + /* RESERVED: Configuration should not allow Res values */ +}; + +/* Reference: 36.213 Table:7.2.2-1C */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl +rgSchUeCqiPmiCfgIdxTddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_TDD]= +{ + { 0,0, 1, 0 }, + { 1,5, 5, 1 }, + { 6,15, 10,6 }, + {16,35, 20,16}, + {36,75, 40,36}, + {76,155, 80,76}, + {156,315,160,156} + /* RESERVED: Configuration should not allow Res values */ +}; + +/* Note: RI table is same for FDD and TDD */ +/*Reference: 36.213 Table:7.2.2-1B */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl +rgSchUeRiCfgIdxTbl[RG_SCH_RI_CFGIDX_MAX]= +{ + { 0,160, 1, 0 }, + { 161,321, 2, 161 }, + { 322,482, 4, 322 }, + { 483,643, 8, 483}, + { 644,804, 16,644}, + { 805,965, 32,805 } + /* RESERVED: Configuration should not allow Res values */ +}; + +/*Reference: 36.213 Table:7.2.2-2 */ +CONSTANT RgSchUeBwSubSzBwParts +rgSchUeBwSubSzBwPartsTbl[RG_SCH_BW_SUBSZ_BWPARTS_MAX]= +{ + {6,7, 0, 0}, /*TODO: 6,7, NA, NA */ + {8, 10, 4,1}, + {11, 26, 4,2}, + {27, 63, 6,3}, + {64, 110, 8,4} +}; + + +/* Reference : 36.213 Table 10.1-5 */ +/* Note: SR is same table for TDD and FDD */ +CONSTANT RgSchUePCqiSrsSrCfgIdxTbl rgSchUeSrCfgIdxTbl[RG_SCH_ISR_INDX_MAX]= +{ + { 0,4, 5, 0 }, + { 5,14, 10, 5 }, + { 15,34, 20,15 }, + { 35,74, 40,35}, + { 75,154, 80, 75} + /* RESERVED: Configuration should not allow Res values */ +}; + +/*Reference:36.213: Derived from Table: 7.2.1-5 for Label L. + The Label L is CEIL(log2(BinCoe(N and M)))*/ +CONSTANT U8 RgSCHUeAcqi2022LBitWidth[6][28] ={ +{0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5}, +{0,0,2,3,4,4,5,5,6,6,6,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,9}, +{0,0,0,2,4,5,6,6,7,7,8,8,9,9,9,10,10,10,10,11,11,11,11,11,12,12,12,12}, +{0,0,0,0,3,4,6,7,7,8,9,9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,15,15}, +{0,0,0,0,0,3,5,6,7,8,9,10,11,11,12,13,13,14,14,14,15,15,16,16,16,17,17,17}, +{0,0,0,0,0,0,3,5,7,8,9,10,11,12,13,13,14,15,15,16,16,17,17,18,18,18,19,19} +}; + +#endif + +EXTERN U8 rgSchCmnHarqRtt[]; +#ifdef EMTC_ENABLE +EXTERN S16 rgSCHEmtcCellAlloc ARGS((RgSchCellCb *cel)); +EXTERN Void rgSCHEmtcCellFree ARGS((RgSchCellCb *cel)); +EXTERN Void rgSCHEmtcUeInfoFree ARGS((RgSchCellCb *cell, RgSchUeCb *ue)); +EXTERN U8 rgSchfillPucchSrRepNumCountemtc ARGS((RgSchUeCb *ueCb)); +EXTERN U8 rgSchfillPucchCqiRepNumCountemtc ARGS((RgSchUePCqiCb *cqiCb, RgSchUeCb *ueCb)); +EXTERN S16 rgEmtcvalidateSiCfg ARGS((RgrSiCfgReqInfo *siCfg,RgSchCellCb *cell)); +#endif +/* forward references */ + + +/** + * @brief Validates the SCH EndoeB configuration request from RRM to SCH. + * + * @details + * + * Function : rgSCHCfgVldtRgrSchedEnbCfg + * + ** Processing Steps: + * - Retrieve the cell control block. + * - If successful, + * - Validate the range of configured values recieved in + * configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * @param[in] Inst inst + * @param[in] RgrSchedEnbCfg *schedEnbCfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrSchedEnbCfg +( +Inst inst, +RgrSchedEnbCfg *schedEnbCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrSchedEnbCfg(inst, schedEnbCfg, errInfo) +Inst inst; +RgrSchedEnbCfg *schedEnbCfg; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrSchedEnbCfg); + RGSCHDBGPRM(inst, (rgSchPBuf(inst), "VALIDATE RGR SCH ENB CONFIG: \n")); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG; + + // TODO + if ((rgSCHCfgVldtRgrSchCfg(inst, schedEnbCfg)) != ROK) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst), "Validation for scheduler related " + "config failed\n")); + RETVALUE(RFAILED); + } + + RLOG1(L_INFO, "MIMO_DBG:: SCH:: numAntPorts=%d\n",schedEnbCfg->numTxAntPorts); + + /* Validation for the ENB parameters */ + if ((schedEnbCfg->numTxAntPorts == 0) || (schedEnbCfg->numTxAntPorts > 4)) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst),"Invalid number of transmit antenna" + " ports %d\n", schedEnbCfg->numTxAntPorts)); + RETVALUE(RFAILED); + } + + /* Validate csg access mode */ + if((schedEnbCfg->accsMode < RGR_CELL_ACCS_OPEN) || + (schedEnbCfg->accsMode > RGR_CELL_ACCS_HYBRID)) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst), "Invalid CSG Access mode\n")); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR SCHED ENB config validation done:"\n)); + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrSchedEnbCfg */ + +/** + * @brief Validates the cell configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrCellCfg + * + * Processing Steps: + * - Retrieve the cell control block. + * - If successful, + * - Validate the range of configured values recieved in + * configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * @param[in] Inst inst + * @param[in] RgrCellCfg *cellCfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrCellCfg +( +Inst inst, +RgrCellCfg *cellCfg, +RgSchCellCb *cell, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrCellCfg(inst, cellCfg, cell, errInfo) +Inst inst; +RgrCellCfg *cellCfg; +RgSchCellCb *cell; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrCellCfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_CFG; + + /* check if cell exists already */ + if ((U8 *)cell != NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Cell Id already exists"); + RETVALUE(RFAILED); + } + + if(cellCfg->macInst >= SCH_INST_START) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid MAC Instance %d ", + cellCfg->macInst); + RETVALUE(RFAILED); + } + + if (cellCfg->macRnti.startRnti < RGSCH_MIN_MAC_RNTI ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid start RNTI %d for cell ", + cellCfg->macRnti.startRnti); + RETVALUE(RFAILED); + } + + if ((rgSCHCfgVldtRgrCellSchCfg(inst, cellCfg)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for scheduler related " + "config failed"); + RETVALUE(RFAILED); + } + + if ((cellCfg->dlHqCfg.maxDlHqTx < RGSCH_MIN_HQ_TX) || + (cellCfg->dlHqCfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid Downlink HARQ configuration:" + " maxDlHqTx %d maxMsg4HqTx %d", cellCfg->dlHqCfg.maxDlHqTx, + cellCfg->dlHqCfg.maxMsg4HqTx); + RETVALUE(RFAILED); + } + if ((cellCfg->cfiCfg.cfi < RGSCH_MIN_CFI_VAL) || + (cellCfg->cfiCfg.cfi > RGSCH_MAX_CFI_VAL)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid CFI configuration %d", + cellCfg->cfiCfg.cfi); + RETVALUE(RFAILED); + } + if (((cellCfg->puschSubBand.subbandStart) + + ((cellCfg->puschSubBand.numSubbands -1) * cellCfg->puschSubBand.size)) + > (cellCfg->bwCfg.ulTotalBw - 1)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PUSCH subband configuration:" + " subBandStart %d numSubBands %d subBandSize %d ulTotBw %d", + cellCfg->puschSubBand.subbandStart, + cellCfg->puschSubBand.numSubbands, cellCfg->puschSubBand.size, + cellCfg->bwCfg.ulTotalBw); + RETVALUE(RFAILED); + } + + if (((cellCfg->bwCfg.dlTotalBw < RGSCH_MIN_DL_BW) || + (cellCfg->bwCfg.dlTotalBw > RGSCH_MAX_DL_BW)) || + ((cellCfg->bwCfg.ulTotalBw < RGSCH_MIN_UL_BW) || + (cellCfg->bwCfg.ulTotalBw > RGSCH_MAX_UL_BW))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid Bandwidth configuration:" + " ul %d dl %d",cellCfg->bwCfg.ulTotalBw, + cellCfg->bwCfg.dlTotalBw); + RETVALUE(RFAILED); + } + if (cellCfg->phichCfg.ngEnum > RGR_NG_TWO) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PHICH Ng configuration %d", + (U8)cellCfg->phichCfg.ngEnum); + RETVALUE(RFAILED); + } + /* Validation for extended PHICH Duration */ + if ((cellCfg->phichCfg.isDurExtend == TRUE) && + (cellCfg->bwCfg.dlTotalBw <= 10) && (cellCfg->cfiCfg.cfi < 2)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid cfi value for" + "Extended PHICH duration cfi:%d dlBw:%d", + (U8)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw); + RETVALUE(RFAILED); + } + if ((cellCfg->phichCfg.isDurExtend == TRUE) && + (cellCfg->bwCfg.dlTotalBw > 10) && (cellCfg->cfiCfg.cfi < 3)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid cfi value for" + "Extended PHICH duration cfi:%d dlBw:%d", + (U8)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw); + RETVALUE(RFAILED); + } + RLOG4(L_INFO,"CA_DBG:: PUCCH configuration:" + " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", + cellCfg->pucchCfg.resourceSize, + cellCfg->pucchCfg.n1PucchAn, + cellCfg->pucchCfg.deltaShift, + cellCfg->pucchCfg.cyclicShift); + + /* ccpu00138567- Removing validation check for resourceSize as 0. + * From the spec, n2RB value 0 is a valid config. */ + if ((cellCfg->pucchCfg.resourceSize >= cellCfg->bwCfg.ulTotalBw/2) || + (cellCfg->pucchCfg.n1PucchAn == 0) || + (cellCfg->pucchCfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) || + (cellCfg->pucchCfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS) || + (cellCfg->pucchCfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid PUCCH configuration:" + " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", + cellCfg->pucchCfg.resourceSize, + cellCfg->pucchCfg.n1PucchAn, + cellCfg->pucchCfg.deltaShift, + cellCfg->pucchCfg.cyclicShift); + RETVALUE(RFAILED); + } + if (cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsBwEnum > RGR_SRS_BWCFG_7) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid SRS configuration: " + " srsBw %d", (U8)cellCfg->srsCfg.srsBwEnum); + RETVALUE(RFAILED); + } + + if ((rgSCHCfgVldtRgrCellRACfg(inst, cellCfg)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for Random access related" + "config failed"); + RETVALUE(RFAILED); + } + + if ((rgSCHCfgVldtRgrCellPwrCfg(inst, cellCfg, errInfo)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for cell power " + "config failed"); + RETVALUE(RFAILED); + } + + /* Validate the common logical channel configuration */ + if( (cellCfg->numCmnLcs < RGR_MIN_CMN_LC_PER_CELL)|| + (cellCfg->numCmnLcs > RGR_MAX_CMN_LC_PER_CELL)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid number(%d) of common logical" + "channels in cell config", cellCfg->numCmnLcs); + RETVALUE(RFAILED); + } + if ((rgSCHCfgVldtRgrCmnLcCfg(inst, cellCfg, errInfo)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for common logical" + "channels failed"); + RETVALUE(RFAILED); + } + + /* Added 0 as a valid value for number of TICKs RRM + * 0 implies no ticks i.e. shutting off the feature.*/ + +#ifdef RGR_SI_SCH + if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellCfg->siCfg))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for SI" + "configuration failed"); + RETVALUE(RFAILED); + } +#endif /*RGR_SI_SCH */ + + /*ccpu00116923 - ADD - Srs Present support - Start*/ +#ifdef TFU_UPGRADE +#ifdef LTE_TDD + if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 13) +#else + if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 14) +#endif + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid" + "Subframe configuration"); + RETVALUE(RFAILED); + } +#endif + /*ccpu00116923 - ADD - Srs Present support - End*/ + + if ((cellCfg->bcchTxPwrOffset > 10000) || + (cellCfg->pcchTxPwrOffset > 10000) || + (cellCfg->rarTxPwrOffset > 10000) || + (cellCfg->phichTxPwrOffset > 10000) + ) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, + "Invalid txPower offset "); + RETVALUE(RFAILED); + } + +/* LTE_ADV_FLAG_REMOVED_START */ + /* Checking Whether DSFR is enabled without enabling SFR */ + if(((cellCfg->rgrLteAdvCfg.pres & RGR_DSFR) && + (RGR_ENABLE == cellCfg->rgrLteAdvCfg.dsfrCfg.status)) && + (!((cellCfg->rgrLteAdvCfg.pres & RGR_SFR) && + (RGR_ENABLE == cellCfg->rgrLteAdvCfg.sfrCfg.status)))) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "DSFR is enbaled" + "Without enabling SFR"); + RETVALUE(RFAILED); + } + + if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellCfg->rgrLteAdvCfg), + cellCfg->bwCfg.dlTotalBw)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for LTE Adv" + "configuration failed"); + RETVALUE(RFAILED); + } +#ifdef LTE_ADV + if ((rgSCHCfgVldtRgrCellLteLAACfg(inst, cellCfg)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Validation for LTE LAA" + "configuration failed"); + RETVALUE(RFAILED); + } +#endif +/* LTE_ADV_FLAG_REMOVED_END */ + if (cellCfg->msg4pAVal > RGRUE_DLPWRCNTRL_PA_DB3) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId, "Invalid" + "msg4pAVal %u", cellCfg->msg4pAVal); + RETVALUE(RFAILED); + } + + /* Validate RgrCellCsgParamCfg */ + if(rgSchCb[inst].rgrSchedEnbCfg.accsMode == RGR_CELL_ACCS_HYBRID) + { + if((rgSCHCfgVldtRgrCellCsgParamCfg(inst, + &(cellCfg->csgParamCfg)) != ROK)) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst), "Validation failed for \n" + "Access CSG parameter failed\n")); + RETVALUE(RFAILED); + } + } +#ifdef EMTC_ENABLE + if (cellCfg->emtcEnable) + { + if(ROK != rgSCHCfgVldtRgrEmtcCellCfg(cellCfg)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid EMTC cell Configuration %d for cell" ,cellCfg->cellId); + RETVALUE(RFAILED); + } + } +#endif + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrCellCfg */ + +/** + * @brief Validates the scheduler related configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrSchCfg + * + * Processing Steps: + * - Validate the scheduler related configuration request from RRC to MAC at CFG: + * validate the value range for the configured values. + * - If validated successfully, + * - Return ROK . + * - Else + * - Return RFAILED. + * + * @param[in] Inst inst + * @param[out] RgSchedCfg *rgSchedCfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrSchCfg +( +Inst inst, +RgrSchedEnbCfg *rgSchedCfg +) +#else +PUBLIC S16 rgSCHCfgVldtRgrSchCfg(inst, rgSchedCfg) +Inst inst; +RgrSchedCfg *rgSchedCfg; +#endif +{ + TRC2(rgSCHCfgVldtRgrSchCfg); + + RGSCHDBGPRM(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Validating \ + scheduler related Configuration")); + if (rgSchedCfg->ulSchdType > (RGSCH_NUM_SCHEDULERS - 1)) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Invalid \ + UL scheduler type %d \n", rgSchedCfg->ulSchdType)); + RETVALUE(RFAILED); + } + if (rgSchedCfg->dlSchdType > (RGSCH_NUM_SCHEDULERS - 1)) + { + RGSCHDBGERR(inst, (rgSchPBuf(inst), "rgSCHCfgVldtRgrSchCfg:Invalid \ + DL scheduler type %d \n", rgSchedCfg->dlSchdType)); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} +/** + * @brief Validates the scheduler related configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrCellSchCfg + * + * Processing Steps: + * - Validate the scheduler related configuration request from RRC to MAC at CFG: + * validate the value range for the configured values. + * - If validated successfully, + * - Return ROK and pointer to the cell of UE. + * - Else + * - Return RFAILED. + * + * @param[in] Inst inst + * @param[out] RgSchCellCfg *cellCfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrCellSchCfg +( +Inst inst, +RgrCellCfg *cellCfg +) +#else +PUBLIC S16 rgSCHCfgVldtRgrCellSchCfg(inst, cellCfg) +Inst inst; +RgrCellCfg *cellCfg; +#endif +{ + TRC2(rgSCHCfgVldtRgrCellSchCfg); + +#if RGSCH_NUM_DLFS_SCHEDULERS + if (cellCfg->dlfsSchdType > RGSCH_NUM_DLFS_SCHEDULERS - 1) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid dlfs scheduler type %d for cell", + cellCfg->dlfsSchdType); + RETVALUE(RFAILED); + } +#endif + RETVALUE(ROK); +} +/** + * @brief Validates the RACH related configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrCellRACfg + * + * Processing Steps: + * - Validate the RA configuration request from RRC to MAC at CFG: + * validate the value range for the configured values. + * - If validated successfully, + * - Return ROK and pointer to the cell of UE. + * - Else + * - Return RFAILED. + * + * @param[in] Inst inst + * @param[out] RgSchCellCfg *cellCfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrCellRACfg +( +Inst inst, +RgrCellCfg *cellCfg +) +#else +PUBLIC S16 rgSCHCfgVldtRgrCellRACfg(inst, cellCfg) +Inst inst; +RgrCellCfg *cellCfg; +#endif +{ + TRC2(rgSCHCfgVldtRgrCellRACfg); + + +#ifdef LTE_TDD + if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_TDD_RA_PREAMBLE_FMT) || +#else + if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) || +#endif + (cellCfg->rachCfg.raWinSize < RGSCH_MIN_RA_WINSIZE) || + (cellCfg->rachCfg.raWinSize > RGSCH_MAX_RA_WINSIZE) || + (cellCfg->rachCfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) || + (cellCfg->rachCfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE) || + (cellCfg->rachCfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE) || + (cellCfg->rachCfg.sizeRaPreambleGrpA > + cellCfg->rachCfg.numRaPreamble) || + (cellCfg->rachCfg.prachResource > + (cellCfg->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB))) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid RACH configuration:" + "preamble Fmt %d raWinSize %d maxMsg3Tx %d", + cellCfg->rachCfg.preambleFormat, cellCfg->rachCfg.raWinSize, + cellCfg->rachCfg.maxMsg3Tx); + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid numRaPreamble %d sizeRaPreambleGrpA %d", + cellCfg->rachCfg.numRaPreamble, + cellCfg->rachCfg.sizeRaPreambleGrpA); + RETVALUE(RFAILED); + } + /* RACHO */ + /* verify that the ded Preambles cfgd for Pdcch Order + * do not collide with that of non-dedicated and validates against + * the configuration index and number of RACH + * ded-preambles. For non-zero ded preamble cfg, + * the config index is expected to be != NA.*/ + if ((cellCfg->macPreambleSet.pres) && + ((cellCfg->macPreambleSet.start < cellCfg->rachCfg.numRaPreamble) || + (cellCfg->macPreambleSet.start >= RGSCH_MAX_NUM_RA_PREAMBLE) || + (cellCfg->macPreambleSet.size < 1) || + (cellCfg->macPreambleSet.size > RGSCH_MAX_NUM_RA_PREAMBLE- + cellCfg->rachCfg.numRaPreamble) || + (cellCfg->rachCfg.raOccasion.sfnEnum == RGR_SFN_NA))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId,"Invalid RACH Preambleset conf:" + "preambleSet Start %d preambleSet Size %d", + cellCfg->macPreambleSet.start, cellCfg->macPreambleSet.size); + RETVALUE(RFAILED); + } +#ifdef RGR_V1 + if(cellCfg->rachCfg.contResTmr) + { + U8 idx; +#ifdef LTE_TDD + idx = cellCfg->ulDlCfgIdx; +#else + idx = 7; /* FDD */ +#endif + /* maxMsg4TxDelay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + + 3 TTI (MAX L1+L2 processing delay at the UE) */ + U8 maxMsg4TxDelay = (cellCfg->dlHqCfg.maxMsg4HqTx-1) * + rgSchCmnHarqRtt[idx] + 3; + + + if(maxMsg4TxDelay >= cellCfg->rachCfg.contResTmr) + { + RLOG_ARG2(L_WARNING,DBG_CELLID,cellCfg->cellId , + "Warining !: Contention Resolution timer not greater than the " + "guard timer. Conte Res timer %d Guard timer %d", + cellCfg->rachCfg.contResTmr, + maxMsg4TxDelay ); + /* [ccpu00138532]-DEL- removed return fail here as it is ok if the + max Msg4 Tx delay is more than the contension Resolution timer. + In such case, the CRI CE will be scheduled immediately once + msg3 is received */ + } + } + else + { + /* ccpu00128575 ADD - If contention resolution timer is configured as 0, + Then return fail*/ + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, + "Contention Resolution timer is configured as '0'"); + RETVALUE(RFAILED); + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief Validates the UE configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeCfg + * + * Processing Steps: + * - Validate the UE configuration request from RRC to MAC at CFG: + * validate the value range for the configured values. + * - If validated successfully, + * - Return ROK and pointer to the cell of UE. + * - Else + * - Return RFAILED. + * + * @param[in] Inst inst + * @param[in] RgrUeCfg *ueCfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeCfg +( +Inst inst, +RgrUeCfg *ueCfg, +RgSchCellCb **cell, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeCfg(inst, ueCfg, cell, errInfo) +Inst inst; +RgrUeCfg *ueCfg; +RgSchCellCb **cell; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrUeCfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_CFG; + + if (((*cell) == NULLP) || + ((*cell)->cellId != ueCfg->cellId)) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"Cell does not exist %d", + ueCfg->cellId); + RETVALUE(RFAILED); + } + /* RACHO: + * Check configured preamble id not colliding with non dedicated or PDCCH + * order preamble sets. When valid preamble id given check that C-RNTI given + * in configuration is not amongst the C-RNTI'smanaged by scheduler */ + if ((rgSCHRamVldtUeCfg(*cell, ueCfg)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Preamble Id configuration" + "failed ",ueCfg->cellId); + RETVALUE(RFAILED); + } + /* Check if Ue already configured */ + if (rgSCHDbmGetUeCb(*cell, ueCfg->crnti) != NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d UEID already exists", + ueCfg->cellId); + RETVALUE(RFAILED); + } + /* Validate Transmission UE modes */ + if ((ueCfg->txMode.pres == TRUE) && ((ueCfg->txMode.txModeEnum < RGR_UE_TM_1) + || (ueCfg->txMode.txModeEnum > RGR_UE_TM_7))) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid transmission mode for" + " UE is %d", ueCfg->cellId,(U8)ueCfg->txMode.txModeEnum); + RETVALUE(RFAILED); + } + + /* Validate UE Category */ + if (ueCfg->ueCatEnum > CM_LTE_UE_CAT_8) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid category for UE %d", + ueCfg->cellId,(U8)ueCfg->ueCatEnum); + RETVALUE(RFAILED); + } + + /* Validate UE Access Stratum Release */ + if (ueCfg->accessStratumRls > RGR_REL_10) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid Access Stratum Release %u for UE\n", + ueCfg->accessStratumRls)); + RETVALUE(RFAILED); + } + RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "Configured Access Stratum Release %u\n", \ + ueCfg->accessStratumRls)); + + if ((*cell)->numTxAntPorts == 1) + { + if ((ueCfg->txMode.pres == TRUE) && + (ueCfg->txMode.txModeEnum > RGR_UE_TM_1)) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid transmission mode for" + " UE (%d) for the configured Cell Antenna Ports",ueCfg->cellId, + (U8)ueCfg->txMode.txModeEnum); + RETVALUE(RFAILED); + } + } + + if ((rgSCHCfgVldtUeCqiModeCfg(*cell, &ueCfg->ueDlCqiCfg)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti, "CELLID:%d Invalid CQI Mode configuration", + ueCfg->cellId); + RETVALUE(RFAILED); + } + + /* Validate Max Uplink HARQ transmission value */ + if (ueCfg->ueUlHqCfg.maxUlHqTx < RGSCH_MIN_HQ_TX) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid Uplink HARQ config for " + "UE %d",ueCfg->cellId,ueCfg->ueUlHqCfg.maxUlHqTx); + RETVALUE(RFAILED); + } + + if (rgSCHCfgVldtUePwrCfg(*cell, &ueCfg->ueUlPwrCfg) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid PUSCH Group power" + " configuration",ueCfg->cellId); + RETVALUE(RFAILED); + } + + if (rgSCHCfgVldtUeMeasGapAckNakRepCfg(*cell, ueCfg) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid MeasGap/AckNackRep" + " configuration",ueCfg->cellId); + RETVALUE(RFAILED); + } + +#ifdef LTEMAC_SPS + /* Validating SPS RNTI */ + if (((ueCfg->ueSpsCfg.spsRnti >= (*cell)->rntiDb.rntiStart) && + (ueCfg->ueSpsCfg.spsRnti<=((*cell)->rntiDb.rntiStart+(*cell)->rntiDb.maxRntis))) + ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_SI_RNTI) + ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_P_RNTI)) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid SPS RNTI " + " in DL SPS Config",ueCfg->cellId); + RETVALUE(RFAILED); + } + + if (ueCfg->ueSpsCfg.dlSpsCfg.isDlSpsEnabled) + { + if (rgSCHCfgVldtUeDlSpsCfg(*cell, &ueCfg->ueSpsCfg.dlSpsCfg) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid DL SPS configuration" + " for the UE",ueCfg->cellId); + RETVALUE(RFAILED); + } + } +#endif +#ifdef TFU_UPGRADE + /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */ + if ( ROK != rgSCHCfgVldtCqiSrSrsUeCfg(*cell, ueCfg, errInfo)) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid Periodic CQI/SR/SRS" + "configuration",ueCfg->cellId); + RETVALUE(RFAILED); + } +#endif + + /* Validate DRX specific parameters */ + if ( ROK != rgSCHCfgVldtDrxUeCfg(*cell, &(ueCfg->ueDrxCfg))) + { + RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid DRX configuration", + ueCfg->cellId); + RETVALUE(RFAILED); + } + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + if (ueCfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid numColltdCqiRept," + "MAX supported %d",RGR_CQIRPTS_MAXN,ueCfg->cellId); + RETVALUE(RFAILED); + } +#endif /* End of RGR_CQI_REPT */ + +#ifdef EMTC_ENABLE +/*This is to validate the EMTC related configuration if a UE is an EMTC UE*/ + if(TRUE == ueCfg->emtcUeCfg.pres) + { + if ( ROK != rgSCHCfgVldtEmtcUeCfg(*cell, &(ueCfg->emtcUeCfg))) + { + RLOG_ARG2(L_ERROR,DBG_CRNTI,ueCfg->crnti,"CELLID:%d Invalid EMTC UE configurationfor crnti:%d", + ueCfg->cellId, ueCfg->crnti); + RETVALUE(RFAILED); + } + } +#endif + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrUeCfg */ + + +/** + * @brief Validates the cell reconfiguration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrCellRecfg + * + * Processing Steps: + * - Retrieve the cell control block. + * - If successful, + * - Validate the range of reconfigured values recieved in + * re-configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * + * @param[in] Inst inst + * @param[in] RgrCellRecfg *cellRecfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrCellRecfg +( +Inst inst, +RgrCellRecfg *cellRecfg, +RgSchCellCb **cell, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrCellRecfg(inst, cellRecfg, cell, errInfo) +Inst inst; +RgrCellRecfg *cellRecfg; +RgSchCellCb **cell; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrCellRecfg); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_RECFG; + + /* Fetch cell and validate cell Id with the cell control block*/ + if (((*cell) == NULLP) || + ((*cell)->cellId != cellRecfg->cellId)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Cell control block does not exist"); + RETVALUE(RFAILED); + } + + /* Validate recieved values */ + if ((cellRecfg->recfgTypes & RGR_CELL_DL_HARQ_RECFG) && + ((cellRecfg->dlHqRecfg.maxDlHqTx < RGSCH_MIN_HQ_TX) || + (cellRecfg->dlHqRecfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Downlink HARQ configuration:" + " maxDlHqTx %d maxMsg4HqTx %d", cellRecfg->dlHqRecfg.maxDlHqTx, + cellRecfg->dlHqRecfg.maxMsg4HqTx); + RETVALUE(RFAILED); + } + if ((cellRecfg->recfgTypes & RGR_CELL_CFI_RECFG) && + ((cellRecfg->cfiRecfg.cfi < RGSCH_MIN_CFI_VAL) || + (cellRecfg->cfiRecfg.cfi > RGSCH_MAX_CFI_VAL))) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid CFI configuration %d", + cellRecfg->cfiRecfg.cfi); + RETVALUE(RFAILED); + } + if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG) + { + /* ccpu00138567- Removing validation check for resourceSize as 0. + * From the spec, n2RB value 0 is a valid config. */ + if ((cellRecfg->pucchRecfg.n1PucchAn == 0) || + (cellRecfg->pucchRecfg.resourceSize >= (*cell)->bwCfg.ulTotalBw/2)|| + ((cellRecfg->pucchRecfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) || + (cellRecfg->pucchRecfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS)) || + (cellRecfg->pucchRecfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid PUCCH configuration: " + "N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d", + cellRecfg->pucchRecfg.resourceSize, + cellRecfg->pucchRecfg.n1PucchAn, + cellRecfg->pucchRecfg.deltaShift, + cellRecfg->pucchRecfg.cyclicShift); + RETVALUE(RFAILED); + } + } + if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG) + { + if (cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsBwEnum > RGR_SRS_BWCFG_7) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid SRS configuration: " + "srsBw %d", (U8)cellRecfg->srsRecfg.srsBwEnum); + RETVALUE(RFAILED); + } + + /*ccpu00116923 - ADD - Srs Present support - Start*/ +#ifdef TFU_UPGRADE +#ifdef LTE_TDD + if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 13) +#else + if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 14) +#endif + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Subframe configuration "); + RETVALUE(RFAILED); + } +#endif + /*ccpu00116923 - ADD - Srs Present support - End*/ + } + if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG) + { + if ((cellRecfg->rachRecfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) || + ((cellRecfg->rachRecfg.raWinSize < RGSCH_MIN_RA_WINSIZE) || + (cellRecfg->rachRecfg.raWinSize > RGSCH_MAX_RA_WINSIZE)) || + (cellRecfg->rachRecfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) || + ((cellRecfg->rachRecfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE) + || (cellRecfg->rachRecfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE)) + || (cellRecfg->rachRecfg.sizeRaPreambleGrpA > + cellRecfg->rachRecfg.numRaPreamble) || + (cellRecfg->rachRecfg.prachResource > + (*cell)->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB)) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid RACH configuration:" + " preamble Fmt %d raWinSize %d maxMsg3Tx %d", + cellRecfg->rachRecfg.preambleFormat, + cellRecfg->rachRecfg.raWinSize, + cellRecfg->rachRecfg.maxMsg3Tx); + RLOG_ARG2(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid RACH configuration:" + "numRaPreamble %d sizeRaPreambleGrpA %d", + cellRecfg->rachRecfg.numRaPreamble, + cellRecfg->rachRecfg.sizeRaPreambleGrpA); + RETVALUE(RFAILED); + } + } + +#ifdef RGR_SI_SCH + if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG) + { + if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellRecfg->siReCfg))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Validation for SI" + "Re-configuration failed"); + RETVALUE(RFAILED); + } + } +#endif /*RGR_SI_SCH */ + +/* LTE_ADV_FLAG_REMOVED_START */ + if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG) + { + /* Checkin whether DSFR is enbaled without enabling SFR. + * So we need to check if SFR is enabled along with DSFR + * in the same reconfiguration or it is already enabled earlier*/ + if((cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR) && + (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.dsfrCfg.status)) + { + if(!(((cellRecfg->rgrLteAdvCfg.pres & RGR_SFR) && + (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.sfrCfg.status)) || + ((*cell)->lteAdvCb.sfrCfg.status == RGR_ENABLE))) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"DSFR is enbaled" + "Without enabling SFR"); + RETVALUE(RFAILED); + } + } + if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellRecfg->rgrLteAdvCfg), + (*cell)->bwCfg.dlTotalBw)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Validation for Lte Adv" + "Re-configuration failed"); + RETVALUE(RFAILED); + } + } +/* LTE_ADV_FLAG_REMOVED_END */ + + /* Validating minimum resource for non-CSG users */ + if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG) + { + if (cellRecfg->csgParamCfg.minDlResNonCsg > 100) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Configuration " + "of minimum DL resources for NON-CSG"); + RETVALUE(RFAILED); + } + if (cellRecfg->csgParamCfg.minUlResNonCsg > 100) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Invalid Configuration " + "of minimum UL resources for NON-CSG"); + RETVALUE(RFAILED); + } + } + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrCellRecfg */ + +#ifdef LTE_ADV +/** + * @brief Ue SCell configuration for scheduler. It is invoked during first time + * Scell configuration. It is not for reconfiguration + * + * @details + * + * Function : rgSCHSCellCfgUeCfg + * + * This functions updates UE specific scheduler + * information upon UE SCell first time Scell configuration + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHSCellCfgUeCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHSCellCfgUeCfg(cell, ue, ueRecfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *err; +#endif +{ + U8 idx; + Inst inst = cell->instIdx; + RgSchCellCb *secCellCb = NULLP; + U8 sCellidx = 0; + RgSchUeCellInfo *sCellInfo = NULLP; + RgrUeSecCellCfg *sCellInfoCfg = NULLP; +#ifdef TFU_UPGRADE + RgrUeAprdDlCqiCfg *aCqiCfg; + RgrUePrdDlCqiCfg *pCqiCfg; +#endif + + TRC2(rgSCHSCellCfgUeCfg); + + RLOG0(L_INFO, "SCELL recfg received from APP \n"); + + RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), + "--------------------------------------------------------------------\n" + "UE SCell ReConfiguration at SCH: rnti (%u) cell(%u)\n" + "--------------------------------------------------------------------\n", + ue->ueId, cell->cellId)); + + + for(idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) + { + /* Allocate the Ue control block */ + if (((rgSCHUtlAllocSBuf(inst, (Data **)&sCellInfo, + sizeof(RgSchUeCellInfo))) != ROK)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx :Memomy allocation " + "Failed while Adding SCell Information\n", idx)); + RETVALUE(RFAILED); + } + + + sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; + + + sCellInfo->sCellIdx = sCellInfoCfg->sCellIdx; + sCellInfo->sCellId = sCellInfoCfg->sCellId; + + if(PRSNT_NODEF == sCellInfoCfg->sCellDeActTmr.pres) + { + /* Configure implicit release */ + ue->sCellDeactTmrVal.val = sCellInfoCfg->sCellDeActTmr.val; + ue->isScellExplicitDeAct = FALSE; + ue->sCellDeactTmrVal.pres = PRSNT_NODEF; + } + else if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE) + { + /* Configure explicit release */ + ue->sCellDeactTmrVal.val = RGSCH_SCELL_DEACT_TMR_INFINITY_VAL; + ue->isScellExplicitDeAct = TRUE; + ue->sCellDeactTmrVal.pres = PRSNT_NODEF; + } + else + { + ue->sCellDeactTmrVal.val = 0; + ue->isScellExplicitDeAct = FALSE; + ue->sCellDeactTmrVal.pres = NOTPRSNT; + } + + sCellInfo->sCellState = RG_SCH_SCELL_INACTIVE; + + sCellInfo->ue = ue; + ue->cellInfo[(sCellInfoCfg->sCellIdx)] = sCellInfo; + sCellidx = ((sCellInfo->sCellId - + rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); + ue->cellIdToCellIdxMap[sCellidx] = sCellInfo->sCellIdx; + + /* For for time one Scell got added, setting allocCmnUlPdcch flag to TRUE, So that + we will allocate PDCCH from common search space and the csiRequest field in DCI0 will + be one bit (spec 36.213 sec 7.2.1)*/ +#ifdef LTE_ADV + if ( ue->numSCells == 0) + { + ue->allocCmnUlPdcch = TRUE; + } +#endif + ue->numSCells++; +#ifdef CA_DBG + printf("\n SCell added for ue %d numScells %d\n",ue->ueId,ue->numSCells); +#endif + /* retrieve teh sec cell Cb */ + if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, sCellInfo->sCellId)) == NULLP) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCell doesnt exists")); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } + + if(TRUE == sCellInfoCfg->txMode.pres) + { + sCellInfo->txMode = sCellInfoCfg->txMode; + } + else + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx Tx mode not present ",idx)); + sCellInfoCfg->txMode.pres = TRUE; + sCellInfoCfg->txMode.txModeEnum = RGR_UE_TM_1; + + sCellInfo->txMode = sCellInfoCfg->txMode; + } + cmInitTimers (&sCellInfo->actDelayTmr, 1); + cmInitTimers (&sCellInfo->deactTmr, 1); + + ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum); + +#ifdef TFU_UPGRADE + if(TRUE == sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.pres) + { + sCellInfo->acqiCb.aCqiCfg.aprdModeEnum = + sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.aprdModeEnum; + } + + if(TRUE == sCellInfoCfg->uePdschDedCfg.uepACfg.pAPrsnt) + { + sCellInfo->pA.pres = TRUE; + sCellInfo->pA.val = sCellInfoCfg->uePdschDedCfg.uepACfg.pA; + } + else + { + sCellInfo->pA.pres = FALSE; + } + + aCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg; + RGSCHDBGPRM(cell->instIdx, (rgSchPBuf(cell->instIdx), + "rgSCHCfgACqiUeCfg cellId =%d,Config Presence =%d for \ + Sec Cell Id = %d\n", + cellCb->cellId, aCqiCfg->pres,sCellInfo->sCellId)); + + /* if aperiodic cqi is present then only call the below function as it is + * not mandatory*/ + if(aCqiCfg->pres) + { + if( ROK != rgSCHCfgACqiUeCfg(secCellCb,ue, &sCellInfo->acqiCb, + sCellInfo->txMode.txModeEnum, aCqiCfg, ue->ueCatEnum)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx ACQI Cfg" + "failed..n\n", idx)); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } + } + /* Configuring PCQI */ + /* Scell needs to be added to the + * pcqi list only after activation */ + pCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.prdCqiCfg; + + if(ROK != rgSCHSCellPCqiCfg(cell,secCellCb,ue,pCqiCfg, + ue->ueCatEnum,sCellInfoCfg->sCellIdx)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx PCQI Cfg failed..n\n", idx)); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } +#endif + + /* Configuring ACQI */ + + /* Stroing the secCell for easy access */ + sCellInfo->cell = secCellCb; + + +#ifdef LTE_ADV + if (ROK != rgSCHLaaInitDlRbAllocCb(secCellCb, + &sCellInfo->dlAllocCb)) + { + RETVALUE(RFAILED); + } +#endif + /* Initialize Harq entity */ + + sCellInfo->hqEnt = rgSCHDhmHqEntInit(secCellCb); + if (sCellInfo->hqEnt == NULLP) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UEID:Hq Entity Initialization " + "failed in config\n", ue->ueId)); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } +#ifdef EMTC_ENABLE + rgSCHEmtcHqPAlloc(secCellCb, sCellInfo->hqEnt); +#endif + rgSCHCmnDlInitHqEnt(secCellCb, sCellInfo->hqEnt); + + sCellInfo->hqEnt->ue = ue; + /* Init SCell Specific Sched Spfc UE DL CB */ + if ((secCellCb->sc.apis->rgSCHRgrSCellUeCfg(secCellCb, ue, sCellInfoCfg, err)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Spec Sched DL UE CFG FAILED\n")); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } + +#ifdef LTE_TDD + if((rgSCHUtlAllocUeANFdbkInfo(ue,sCellInfoCfg->sCellIdx)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UEID:Memomy allocation " + "Failed while UE related Ack Nack Information\n", + ue->ueId)); + rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx); + RETVALUE(RFAILED); + } +#endif /* LTE_TDD */ + +#ifdef LTE_ADV + sCellInfo->sCellLnk.node = (PTR)sCellInfo; + cmLListAdd2Tail(&secCellCb->sCellUeLst, &sCellInfo->sCellLnk); +#endif + + /* Inserting UECB into SCELL DBM */ + rgSCHDbmInsUeCb(secCellCb, ue); + } + +#ifndef MAC_5GTF_UPDATE + ue->ul.useExtBSRSizes = ueRecfg->ueSCellCfgInfo.useExtBSRSizes; +#else + ue->ul.useExtBSRSizes = TRUE; +#endif + + for (idx = 0; idx < RGSCH_ULCTRL_RECP_DIST; idx++) + { + ue->ul.ctrlOnServCellIdx[idx] = 0xFF; + } + /* Trigger SCell addition to primary MAC */ + RETVALUE(ROK); + +} /* rgSCHSCellCfgUeCfg */ +/*f1b_Sprint */ +/** + * @brief UE SCell PUCCH reconfiguration for scheduler + * + * @details + * + * Function : rgSCHSCellCfgUePucchReCfg + * + * This functions updates UE specific scheduler + * information upon UE SCell PUCCH reconfiguration + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHSCellCfgUePucchReCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHSCellCfgUePucchReCfg(cell, ue, ueRecfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *err; +#endif +{ + Inst inst = cell->instIdx; + RgrUeSCellAckPucchCfg *sCellPucchRecfg = NULLP; + U8 idx; + + TRC2(rgSCHSCellCfgUePucchReCfg); + RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), + "--------------------------------------------------------------------\n" + "UE SCell PUCCH ReConfiguration at SCH: rnti (%u) cell(%u)\n" + "--------------------------------------------------------------------\n", + ue->ueId, cell->cellId)); + + + sCellPucchRecfg = &ueRecfg->sCellAckN1ResCfg; + /* Copy the UCI format type suported/configured for UE */ + ue->uciFrmtTyp = sCellPucchRecfg->pucchFormatType; + + if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS) + { + ue->n1PucchF1bResCb.cw1N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count; + ue->n1PucchF1bResCb.cw2N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count; + + for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count; idx++) + { + ue->n1PucchF1bResCb.cw1N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1[idx]; + } + + for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count; idx++) + { + ue->n1PucchF1bResCb.cw2N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2[idx]; + } + } +#ifdef LTE_ADV + else if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT3) + { + ue->n3PucchResCb.antP0N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0Count; + ue->n3PucchResCb.antP1N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1Count; + for (idx = 0;idx < ue->n3PucchResCb.antP0N3ResCount; idx++ ) + { + ue->n3PucchResCb.antP0N3Res[idx].n3PucchIdx + = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0[idx]; + ue->n3PucchResCb.antP0N3Res[idx].n3Lnk.node = NULLP; + ue->n3PucchResCb.antP0N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX; + } + for (idx = 0;idx < ue->n3PucchResCb.antP1N3ResCount; idx++ ) + { + ue->n3PucchResCb.antP1N3Res[idx].n3PucchIdx + = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1[idx]; + ue->n3PucchResCb.antP1N3Res[idx].n3Lnk.node = NULLP; + ue->n3PucchResCb.antP1N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX; + } + ue->simulAckNackCQIFormat3 = ueRecfg->simulAckNackCQIFormat3; + } +#endif + else + { + RLOG1(L_ERROR,"Wrong PUCCH Format:%d configured for CA",ue->uciFrmtTyp); + } + + RETVALUE(ROK); + +} /* rgSCHSCellCfgUePucchReCfg */ +/** + * @brief Validates the UE SCell Reconfiguration request from APP to SCH. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeSCellRecfg + * + * Processing Steps: + * - Validate Number of SCells + * - If validated successfully, + * - Process Number of SCells + * - Else + * - Return RFAILED. + * - Validate SCellIdx value, + * - If validated successfully, + * - Process Number of RgrUeSecCellCfg + * - Else + * - Return RFAILED. + * + * @param[in] RgrUeRecfg *ueRecfg + * @param[out] RgSchCellCb *cell + * @param[out] RgSchUeCb *ue + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg +( +RgrUeRecfg *ueRecfg, +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeSCellRecfg(inst, ueRecfg, cell, ue, errInfo) +RgrUeRecfg *ueRecfg; +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchErrInfo *errInfo; +#endif +{ + RgrUeSecCellCfg *ueSCellDedCfg = NULLP; + RgSchCellCb *sCell = NULLP; + Inst inst = cell->instIdx; + + TRC2(rgSCHCfgVldtRgrUeSCellRecfg); + + RGSCHDBGPRM(inst, (rgSchPBuf(inst), "VALIDATE RGR UE SCELL RECONFIG: cellId %d " + "oldUeId %d cell %p \n", ueRecfg->cellId, ueRecfg->oldCrnti)); + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG; + + if((ueRecfg->ueSCellCfgInfo.numSCells > RGR_MAX_SCELL_PER_UE) || + (ueRecfg->ueSCellCfgInfo.numSCells < 1)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid number of SCELL " + " in SCELL Recfg\n")); + RETVALUE(RFAILED); + } + + for(U8 idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) + { + ueSCellDedCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; + if(ROK != rgSchUtlVldtCellId(inst, ueSCellDedCfg->sCellId)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCellId is out of range")); + RETVALUE(RFAILED); + } + /* Validate existence of sec cell */ + sCell = rgSchUtlGetCellCb(inst, ueSCellDedCfg->sCellId); + if(NULLP == sCell ) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCell doesnt exists")); + RETVALUE(RFAILED); + } + + /* validate the range of serv cell index */ + if((ueSCellDedCfg->sCellIdx < 1) || + (ueSCellDedCfg->sCellIdx > RGR_MAX_SCELL_PER_UE)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid Serv Cell Idx %d\n", + ueSCellDedCfg->sCellIdx)); + RETVALUE(RFAILED); + } + + /* Is this sec cell alredy confiured */ + if(NULLP != ue->cellInfo[ueSCellDedCfg->sCellIdx]) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Secll with id %d already added\n", + ueSCellDedCfg->sCellIdx)); + RETVALUE(RFAILED); + } + + /* Validate CQI config params */ + if((rgSCHCfgVldtUeCqiModeCfg(sCell, &ueSCellDedCfg->ueSCellDlCqiCfg)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid CQI Mode " + " configuration for Ue %d\n",ue->ueId)); + RETVALUE(RFAILED); + } +#ifdef TFU_UPGRADE + /* 1. Validate UE Aperiodic CQI related parameters */ + if( ROK != rgSCHCfgVldtRgrUeACqiCfg (sCell, ue->ueId, + &ueSCellDedCfg->ueSCellDlCqiCfg.aprdCqiCfg, ueSCellDedCfg->txMode, + errInfo )) + { + RGSCHDBGERR(sCell->instIdx, (rgSchPBuf(sCell->instIdx), + "rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Aperiodic CQI configuration\n")); + RETVALUE(RFAILED); + } + +#ifdef LTEMAC_HDFDD + if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId, + &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg, ueRecfg->isHdFddEnbld, + ueSCellDedCfg->txMode, errInfo )) +#else + if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId, + &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg, + ueSCellDedCfg->txMode, + errInfo )) +#endif + { + RGSCHDBGERR(sCell->instIdx, (rgSchPBuf(sCell->instIdx), + "rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Periodic CQI configuration\n")); + RETVALUE(RFAILED); + } + + if((ueSCellDedCfg->txMode.txModeEnum < RGR_UE_TM_1) || + (ueSCellDedCfg->txMode.txModeEnum > RGR_UE_TM_9)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCELL Invalid transmission mode for" + " UE %d\n", (U8)ueSCellDedCfg->txMode.txModeEnum)); + RETVALUE(RFAILED); + } +#endif + } + + errInfo->errCause = RGSCHERR_NONE; + RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR Ue SCell Reconfig validation done: " + "cellId %d oldUeId %d\n", ueRecfg->cellId, ue->ueId)); + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrUeSCellRecfg */ + +/** + * @brief Ue SCell configuration roll back due to failure during configuration + * of any scell + * + * @details + * + * Function : rgSCHSCellCfgUeCfgRollBack + * + * This functions roll backs the configuration of successfully added Scell + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHSCellCfgUeCfgRollBack +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE S16 rgSCHSCellCfgUeCfgRollBack(cell, ue, ueRecfg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +#endif +{ + Inst inst = cell->instIdx; + RgrUeSecCellCfg *sCellInfoCfg = NULLP; + RgSchUeCellInfo *sCellInfo = NULLP; + RgSchCmnCell *cellSch = NULLP; + + TRC2(rgSCHSCellCfgUeCfgRollBack); + + RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), + "--------------------------------------------------------------------\n" + "UE SCell config roll back at SCH: rnti (%u) cell(%u)\n" + "--------------------------------------------------------------------\n", + ue->ueId, cell->cellId)); + + /* Free all Added scell in this transaction */ + for(U8 idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++) + { + sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx]; + sCellInfo = ue->cellInfo[(sCellInfoCfg->sCellIdx)]; + + /* if sCellInfo is not NULLP that means this Scell is added hence + * delte it*/ + if (NULLP != sCellInfo) + { + /* Clear Scheduler specific list for this UE from the + * corresponding CELL */ + cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell); + cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue); + + /* Delete harq Entity of Scell*/ + rgSCHDhmDelHqEnt(cell, &(sCellInfo->hqEnt)); + + rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo), + sizeof(RgSchUeCellInfo)); + + ue->cellInfo[(sCellInfoCfg->sCellIdx)] = NULLP; + ue->numSCells--; +#ifdef LTE_ADV + if (ue->numSCells == 0) + { + ue->allocCmnUlPdcch = TRUE; + /* As there is no SCell left so DCI 0 size at UE specific search space + * will be recalculated as the CSI is reduced to 1 bit */ + rgSCHUtlUpdUeDciSize(cell, ue, FALSE); + } +#endif + } + } + RETVALUE(ROK); +} +#endif /* LTE_ADV */ +/** + * @brief Validates the UE reconfiguration request from RRC to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeRecfg + * + * Processing Steps: + * - Retrieve the UE control block. + * - If successful, + * - Validate the range of reconfigured values recieved in + * re-configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell and ue. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * + * @param[in] Inst inst + * @param[in] RgrUeRecfg *ueRecfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchUeCb **ue + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeRecfg +( +Inst inst, +RgrUeRecfg *ueRecfg, +RgSchCellCb **cell, +RgSchUeCb **ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeRecfg(inst, ueRecfg, cell, ue, errInfo) +Inst inst; +RgrUeRecfg *ueRecfg; +RgSchCellCb **cell; +RgSchUeCb **ue; +RgSchErrInfo *errInfo; +#endif +{ + + TRC2(rgSCHCfgVldtRgrUeRecfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RECFG; + + if (((*cell) == NULLP) || + ((*cell)->cellId != ueRecfg->cellId)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId, + "Cell does not exist for OLD CRNTI:%d",ueRecfg->oldCrnti); + RETVALUE(RFAILED); + } + + /* Fetch the Old Ue */ + if ((*ue = rgSCHDbmGetUeCb(*cell, ueRecfg->oldCrnti)) == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"OLD CRNTI:%d does not exist", + ueRecfg->oldCrnti); + RETVALUE(RFAILED); + } + +#ifdef LTE_ADV + if(RGR_UE_SCELL_ADD_RECFG & ueRecfg->ueRecfgTypes) + { + S16 ret = rgSCHCfgVldtRgrUeSCellRecfg(ueRecfg,*cell, *ue, errInfo); + if ( ret != ROK) + { + RGSCHDBGERR(inst,(rgSchPBuf(inst), "Ue SCell Recfg Validation FAILED\n")); + RETVALUE(RFAILED); + } + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); + } +#endif + + if (ueRecfg->oldCrnti != ueRecfg->newCrnti) + { + if (rgSCHDbmGetUeCb(*cell, ueRecfg->newCrnti) != NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"NEW CRNTI:%d already exists", + ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + + if ((ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG) &&\ + ((*ue)->csgMmbrSta == ueRecfg->csgMmbrSta)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE ID [%d] invalid CSG Membership reconfig :%d ", + ueRecfg->newCrnti, (U8)ueRecfg->csgMmbrSta); + RETVALUE(RFAILED); + } + /* Validate values */ + if ((ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) && + (ueRecfg->txMode.pres == TRUE) && + ((ueRecfg->txMode.txModeEnum < RGR_UE_TM_1) || + (ueRecfg->txMode.txModeEnum > RGR_UE_TM_7))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid transmission mode %d" + "for NEW CRNTI:%d", (U8)ueRecfg->txMode.txModeEnum,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#ifndef TFU_UPGRADE + if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) && + (((ueRecfg->prdDlCqiRecfg.k < 1) || (ueRecfg->prdDlCqiRecfg.k > 4)) || + ((ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx < 1) || + (ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx > 1024)))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid Periodic CQI INFO" + "OLD CRNTI:%d NEW CRNTI:%d",(U8)ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#endif + if ((ueRecfg->ueRecfgTypes & RGR_UE_ULHARQ_RECFG) && + (ueRecfg->ueUlHqRecfg.maxUlHqTx < RGSCH_MIN_HQ_TX)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid Uplink HARQ config %d" + "for NEW CRNTI:%d", ueRecfg->ueUlHqRecfg.maxUlHqTx,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#ifndef TFU_UPGRADE + if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) && + (ueRecfg->prdDlCqiRecfg.prdModeEnum > RGR_PRD_CQI_MOD21)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid periodic mode config for" + " DL CQI %d NEW CRNTI:%d", (U8)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#else + if ((ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG) && + (ueRecfg->cqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid periodic mode config for " + "DL CQI %d for NEW CRNTI:%d",(U8)ueRecfg->cqiCfg.cqiSetup.prdModeEnum,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#endif /* TFU_UPGRADE */ + /* Validate UE Category */ + if (ueRecfg->ueCatEnum > CM_LTE_UE_CAT_8) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid category %d for NEW CRNTI:%d", + (U8)ueRecfg->ueCatEnum,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + + /* Validate UE Access Stratum Release */ + if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ + (ueRecfg->accessStratumRls > RGR_REL_11)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid Access Stratum Release %u for UE\n", + ueRecfg->accessStratumRls)); + RETVALUE(RFAILED); + } + RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "Configured Access Stratum Release %u\n", \ + ueRecfg->accessStratumRls)); + + if ((ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG) && + ((ueRecfg->aprdDlCqiRecfg.pres == TRUE) && + ((ueRecfg->aprdDlCqiRecfg.aprdModeEnum > RGR_APRD_CQI_MOD31) || + (*cell)->bwCfg.dlTotalBw <= 7))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid aperiodic mode config for" + " DL CQI %d for NEW CRNTI:%d", (U8)ueRecfg->aprdDlCqiRecfg.aprdModeEnum,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + if ((ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG) && + (rgSCHCfgVldtUePwrCfg(*cell, &ueRecfg->ueUlPwrRecfg) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid PUSCH Group power" + " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + + + if ((ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG) && + (rgSCHCfgVldtUeMeasGapAckNakRepRecfg(*cell, ueRecfg) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid MeasGap/AckNackRep" + " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#ifdef LTEMAC_SPS + if(rgSCHCfgVldtSpsReCfg(*cell, *ue, ueRecfg)!= ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid SPS" + " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#endif +#ifdef TFU_UPGRADE + /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */ + if ( ROK != rgSCHCfgVldtCqiSrSrsUeReCfg(*cell, *ue, ueRecfg, errInfo)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid ACQI, PCQI/SR/SRS " + "Re-configuration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#endif + if ((ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) && + (rgSCHCfgVldtDrxUeCfg(*cell, &(ueRecfg->ueDrxRecfg)) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid drxParams" + " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* Validate DL Power Control Config parameters */ + if(rgSCHCfgVldtCqiReptReCfg(*cell, ueRecfg)!= ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid DL Power Control" + " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti); + RETVALUE(RFAILED); + } +#endif /* End of RGR_CQI_REPT */ + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrUeRecfg */ + + +/** + * @brief Validates the logical channel reconfiguration request from + * RRC to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrLchRecfg + * + * Processing Steps: + * - Retrieve the uplink and downlink logical channel control block. + * - If successful, + * - Validate the range of reconfigured values recieved in + * re-configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell, UE and logical channel. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * + * @param[in] RgrLchRecfg *lcRecfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchUeCb **ue + * @param[out] RgSchUlLcCb **ulLc + * @param[out] RgSchDlLcCb **dlLc + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrLchRecfg +( +Inst inst, +RgrLchRecfg *lcRecfg, +RgSchCellCb **cell, +RgSchUeCb **ue, +RgSchDlLcCb **dlLc, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrLchRecfg(inst, lcRecfg, cell, ue, dlLc, errInfo) +Inst inst; +RgrLchRecfg *lcRecfg; +RgSchCellCb **cell; +RgSchUeCb **ue; +RgSchDlLcCb **dlLc; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrLchRecfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LC_RECFG; + + if (((*cell) == NULLP) || + ((*cell)->cellId != lcRecfg->cellId)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Cell does not exist " + "for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue for dedicated channels */ + if ((*ue = rgSCHDbmGetUeCb(*cell, lcRecfg->crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"UEID does not exist" + "dedicated logical channel for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); + RETVALUE(RFAILED); + } + + if ((*dlLc = rgSCHDbmGetDlDedLcCb((*ue), lcRecfg->lcId)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Dedicated DL LC does not " + "exist for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrLchRecfg */ + +/** + * @brief Validates the UE Reset request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeReset + * + * Processing Steps: + * - Retrieve the CELL control block + * - If cell does not exist return RFAILED + * - Retrieve UE Control block + * - If UE does not exist return RFAILED + * - Return ROK + * + * @param[in] Inst inst + * @param[in] RgrRst *reset + * @param[out] RgSchCellCb **cell + * @param[out] RgSchUeCb **ue + * @param[out] RgErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeReset +( +Inst inst, +RgrRst *reset, +RgSchCellCb *cell, +RgSchUeCb **ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeReset(inst, reset, cell, ue, errInfo) +Inst inst; +RgrRst *reset; +RgSchCellCb *cell; +RgSchUeCb **ue; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrUeReset); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RESET; + + if ((cell == NULLP) || (cell->cellId != reset->cellId)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"CELL does not exist for CRNTI:%d", + reset->crnti); + RETVALUE(RFAILED); + } + /* Fetch the Ue */ + if ((*ue = rgSCHDbmGetUeCb(&(*cell), reset->crnti)) == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"UE does not exist for CRNTI:%d", + reset->crnti); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrUeReset */ + + +/** + * @brief Validates the logical channel reconfiguration request from + * RRC to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrLcgRecfg + * + * Processing Steps: + * - Retrieve the uplink and downlink logical channel control block. + * - If successful, + * - Validate the range of reconfigured values recieved in + * re-configuration request. + * - If validated successfully, + * - Return ROK and pointer to the cell, UE and logical channel. + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * + * @param[in] RgrLchRecfg *lcRecfg + * @param[out] RgSchCellCb **cell + * @param[out] RgSchUeCb **ue + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrLcgRecfg +( +Inst inst, +RgrLcgRecfg *lcgRecfg, +RgSchCellCb *cell, +RgSchUeCb **ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrLcgRecfg(inst, lcgRecfg, cell, ue, errInfo) +Inst inst; +RgrLcgRecfg *lcgRecfg; +RgSchCellCb *cell; +RgSchUeCb **ue; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrLcgRecfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LCG_RECFG; + + if (((cell) == NULLP) || + ((cell)->cellId != lcgRecfg->cellId)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Cell does not exist for" + "CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue for dedicated channels */ + if ((*ue = rgSCHDbmGetUeCb(&(*cell), lcgRecfg->crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"UE does not exist for " + "dedicated logical channel group CRNTI:%d LCGID:%d", + lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); + RETVALUE(RFAILED); + } + if (lcgRecfg->ulRecfg.lcgId > (RGSCH_MAX_LCG_PER_UE - 1)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Invalid lcgId for uplink logical" + "channel CRNTI:%d LCGID:%d", + lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); + RETVALUE(RFAILED); + } + + if ((lcgRecfg->ulRecfg.gbr != 0) && (lcgRecfg->ulRecfg.mbr < lcgRecfg->ulRecfg.gbr)) + { + RGSCHDBGINFO(inst, (rgSchPBuf(inst), "Dedicated Logical Group %d validation failed" + " for ue %d for cell %d\n", lcgCfg->ulInfo.lcgId, lcgCfg->crnti, lcgCfg->cellId)); + RETVALUE(RFAILED); + } + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrLcgRecfg */ + +/** + * + * @details + * + * Function : rgSCHDynCfiCfg + * + * @param[in] RgSchCellCb *cell + * RgrCellCfg *cellCfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHDynCfiCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg +) +#else +PRIVATE S16 rgSCHDynCfiCfg(cell, cellCfg) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +#endif +{ + U8 cfi; +#ifdef LTE_TDD + U8 ulDlCfgIdx = cellCfg->ulDlCfgIdx; + U8 mphIdx; + U8 maxMPhich; + U16 numDlSf; +#endif + + TRC2(rgSCHDynCfiCfg); + + cell->dynCfiCb.isDynCfiEnb = cellCfg->isDynCfiEnb; + + /* Initializing Failure Sample Period */ + cell->dynCfiCb.failSamplePrd = (RGSCH_CFI_TTI_MON_INTRVL * + RGSCH_CFI_STEP_UP_TTI_PRCNTG)/100; + /* Initializing Number of Failure Samples */ + cell->dynCfiCb.numFailSamples = (RGSCH_CFI_TTI_MON_INTRVL/ + cell->dynCfiCb.failSamplePrd); + cell->dynCfiCb.maxCfi = RGSCH_MAX_CFI_VAL; + /* Allocating memory for CCE failure average array based on + * monitoring interval and CCE failure sample period */ + if((rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&(cell->dynCfiCb.cceFailSamples), + (cell->dynCfiCb.numFailSamples * sizeof(U16)))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); + RETVALUE(RFAILED); + } + + /* Setting the Invalid value 0xFF to pdcchSfIdx, it will be assigned + * a valid value during CFI swithing is done */ + cell->dynCfiCb.pdcchSfIdx = 0xFF; + +#ifdef LTE_TDD + /* In case of config index 0, the mphich index can be upto 2 + * in other config index cases, it will always be set as 1*/ + if(ulDlCfgIdx == 0) + { + maxMPhich = RG_SCH_MAX_MPHICH; + } + else + { + maxMPhich = RG_SCH_MAX_MPHICH -1; + } + /* Calculate the number of CCEs in the cell */ + for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) + { + for(mphIdx = 0; mphIdx < maxMPhich; mphIdx++) + { + cell->dynCfiCb.cfi2NCceTbl[mphIdx][cfi] = + rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw, + cell->phichCfg.ngEnum, cfi, mphIdx, + cell->numTxAntPorts, + cell->isCpDlExtend); + } + } +#else + /* Calculate the number of CCEs in the cell */ + for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) + { + /* CFI Index starts from 1 so that there can be a direct mapping from + actual CFI value to cfi Index. mPhich index will always be set + as 0 for FDD */ + cell->dynCfiCb.cfi2NCceTbl[0][cfi] = + rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw, cell->phichCfg.ngEnum, + cfi, cell->numTxAntPorts, cell->isCpDlExtend); + } + + /* Calculate the number of CCEs in the cell */ + if(cell->dynCfiCb.isDynCfiEnb == TRUE) + { + /* In case if Dynamic CFI feature is enabled, default CFI + * value 1 is used */ + cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][1]; + } + else + { + cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCfg->cfiCfg.cfi]; + } +#endif + +#ifdef LTE_TDD + numDlSf = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][9] * + (RGSCH_CFI_TTI_MON_INTRVL/10); + cell->dynCfiCb.cfiStepUpTtiCnt = + (RGSCH_CFI_STEP_UP_TTI_PRCNTG * numDlSf)/100; + cell->dynCfiCb.cfiStepDownTtiCnt = + (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG * numDlSf)/100; +#else + cell->dynCfiCb.cfiStepUpTtiCnt = (RGSCH_CFI_STEP_UP_TTI_PRCNTG * + RGSCH_CFI_TTI_MON_INTRVL)/100; + cell->dynCfiCb.cfiStepDownTtiCnt = (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG * + RGSCH_CFI_TTI_MON_INTRVL)/100; +#endif + + RETVALUE(ROK); +} + +/** + * @brief Handler for the SCHED Enb configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrSchedEnbCfg + * + * Processing Steps: + * - Invoke SCH with SCHEDULER control block to update + * scheduler specific information. + * - Update rgSch control block with the values recieved in the + * configuration. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgSchSchedEnbCfg *schedEnbCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrSchedEnbCfg +( +Inst inst, +SpId spId, +RgrSchedEnbCfg *schedEnbCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrSchedEnbCfg(inst, spId, schedEnbCfg, errInfo) +Inst inst, +SpId spId; +RgrSchedEnbCfg *schedEnbCfg; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgRgrSchedEnbCfg); + + RGSCHDBGPRM(inst, (rgSchPBuf(inst), "APPLYING RGR SCH ENB CONFIG: \n")); + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG; + + rgSchCb[inst].rgrSchedEnbCfg = *schedEnbCfg; + RGSCHDBGPRM(inst, (rgSchPBuf(inst),"\ndlSchdType %d ulSchdType %d dlTptCoeffi %d" + "dlFairCoeffi %d ulTptCoeffi %d ulFairCoeffi %d\n", + schedEnbCfg->dlSchdType, schedEnbCfg->ulSchdType, schedEnbCfg->dlSchInfo.dlPfs.tptCoeffi, + schedEnbCfg->dlSchInfo.dlPfs.fairCoeffi, schedEnbCfg->ulSchInfo.ulPfs.tptCoeffi, + schedEnbCfg->ulSchInfo.ulPfs.fairCoeffi)); + +#ifdef RG_5GTF + rgSchCb[inst].rgSchDynTdd.isDynTddEnbld = schedEnbCfg->isDynTddEnbld; +#endif +# if 0 + if(RGR_SCH_TYPE_PFS == schedEnbCfg->dlSchdType) + { + rgSCHEnbPfsDlCfg(inst, errInfo); + } +#endif + errInfo->errCause = RGSCHERR_NONE; + RGSCHDBGINFO(inst, (rgSchPBuf(inst), "RGR SCH ENBconfig done: \n")); + RETVALUE(ROK); +} /* rgSCHCfgRgrSchedEnbCfg */ + +#ifdef RG_5GTF +/** + * @brief Handler for the cell configuration of 5gtf. + * + * @details + * + * Function : rgSCH5gtfCellCfg + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCellCfg *cellCfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCH5gtfCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg +) +#else +PUBLIC S16 rgSCH5gtfCellCfg(cell, cellCfg) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +#endif +{ + U8 idx; + + TRC2(rgSCHCfgRgrCellCfg); + + for(idx = 0; idx < MAX_5GTF_GROUP; idx++) + { + cell->cell5gtfCb.ueGrp5gConf[idx].beamBitMask = 0; + } + + for(idx = 0 ; idx < MAX_5GTF_SUBFRAME_INFO ; ++idx) + { + cell->cell5gtfCb.dynConfig[idx] = cellCfg->Cell5gtfCfg.dynConfig[idx]; + } + cell->cell5gtfCb.numUes = cellCfg->Cell5gtfCfg.numUes; + cell->cell5gtfCb.uePerGrpPerTti = cellCfg->Cell5gtfCfg.uePerGrp; + cell->cell5gtfCb.ueGrpPerTti = cellCfg->Cell5gtfCfg.ueGrpPerTti; + cell->cell5gtfCb.numCCs = cellCfg->Cell5gtfCfg.numOfCC; + cell->cell5gtfCb.bwPerCC = cellCfg->Cell5gtfCfg.bwPerCC; + printf("\ncell cfg at schd,numUes:%u,uepergrp:%u,uegrppertti:%u,numCC:%u,bwPerc:%u cfi %u\n", + cell->cell5gtfCb.numUes,cell->cell5gtfCb.uePerGrpPerTti,cell->cell5gtfCb.ueGrpPerTti, + cell->cell5gtfCb.numCCs,cell->cell5gtfCb.bwPerCC, cell->cell5gtfCb.cfi); + RETVALUE(ROK); +} +#endif + +#ifdef XEON_LMT_ITBS +EXTERN U16 gWrMaxDlItbs; +EXTERN U16 gWrMaxUlItbs; +#endif +/** + * @brief Handler for the cell configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrCellCfg + * + * Processing Steps: + * - Invoke SCH with cell control block to update + * scheduler specific information. + * - Update cell control block with the values recieved in the + * configuration. + * - Add to the active list of cells if cell becomes ACTIVE. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgSchCellCfg *cellCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrCellCfg +( +RgSchCb *instCb, +SpId spId, +RgrCellCfg *cellCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrCellCfg(instCb, spId, cellCfg, errInfo) +RgSchCb *instCb; +SpId spId; +RgrCellCfg *cellCfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + U8 idx; + Pst pst; + RgInfCellReg cellRegReq; + RgSchCellCb *cell = NULLP; + Inst inst = instCb->rgSchInit.inst; + U32 Idx1 = (U8)((cellCfg->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); + + TRC2(rgSCHCfgRgrCellCfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_CELL_CFG; + + cmMemset((U8*)&pst, (U8)0, sizeof(Pst)); + + /* Allocate the scheduler's cell control block */ + if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&cell, sizeof(RgSchCellCb))) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); + RETVALUE(RFAILED); + } +#ifdef EMTC_ENABLE + if(cellCfg->emtcEnable) + { + if((ret = rgSCHEmtcCellAlloc(cell)) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for emtc cell"); + RETVALUE(RFAILED); + } + } +#endif + if ((U8 *)cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell"); + RETVALUE(RFAILED); + } + /* Initialize the lists of the cell */ + ret = rgSCHDbmInitCell(cell); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"DBM initialization FAILED for cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } +/* LTE_ADV_FLAG_REMOVED_START */ + if(cellCfg->rgrLteAdvCfg.pres & RGR_ABS) + { + cell->lteAdvCb.absCfg = + cellCfg->rgrLteAdvCfg.absCfg; + cmMemset((U8*)cell->lteAdvCb.absLoadInfo, 0, sizeof(U32)*RGR_ABS_PATTERN_LEN); + cell->lteAdvCb.absLoadTtiCnt = 0; + } + + if(cellCfg->rgrLteAdvCfg.pres & RGR_SFR) + { + cell->lteAdvCb.sfrCfg = + cellCfg->rgrLteAdvCfg.sfrCfg; + } + if(cellCfg->rgrLteAdvCfg.pres & RGR_DSFR) + { + cell->lteAdvCb.dsfrCfg = + cellCfg->rgrLteAdvCfg.dsfrCfg; + } +/* LTE_ADV_FLAG_REMOVED_END */ + +#ifdef EMTC_ENABLE + cell->emtcEnable = cellCfg->emtcEnable; +#endif + /* Initialize the cell */ + cell->cellId = cellCfg->cellId; + cell->instIdx = inst; + cell->macInst = cellCfg->macInst; + cell->isCpUlExtend = cellCfg->isCpUlExtend; + cell->isCpDlExtend = cellCfg->isCpDlExtend; + + cell->numTxAntPorts = rgSchCb[inst].rgrSchedEnbCfg.numTxAntPorts; + if(cell->numTxAntPorts == 1) + { + cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_ONE_ANT_PORT; + } + else if(cell->numTxAntPorts == 2) + { + cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_TWO_ANT_PORT; + } + else + { + cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_FOUR_ANT_PORT; + } + cell->bwCfg = cellCfg->bwCfg; + cell->pbchRbStart = ((((cell->bwCfg.dlTotalBw * 12)/2) - 36)/12); /* Ref section 6.6 in 36.211 */ + cell->pbchRbEnd = cell->pbchRbStart + 5; + cell->pucchCfg = cellCfg->pucchCfg; + cell->rachCfg = cellCfg->rachCfg; + cell->siCfg = cellCfg->siCfg; + cell->t300TmrVal = cellCfg->t300TmrVal; +#ifdef RGR_SI_SCH + /*Initialize the SI CB in Cell CB */ + cmMemset((U8 *)&cell->siCb, 0, sizeof(RgSchSiCb)); +#endif + /*Fix: Added Guard Pool for RNTI which will contain RNTIs + *for UEs deleted from Scheduler but not yet from MAC*/ + cmLListInit(&cell->rntiDb.rntiGuardPool); + + /* Initialize the inWindow to sync with scheduler time when ticks starts */ +#ifdef LTEMAC_HDFDD + cell->siCb.inWindow = (cellCfg->siCfg.siWinSize - + (RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL)); +#else + cell->siCb.inWindow = (cellCfg->siCfg.siWinSize - + (RG_SCH_CMN_DL_DELTA)); +#endif + + if(cell->siCb.inWindow < 0) + { + cell->siCb.inWindow = 0; + } + cell->macPreambleSet = cellCfg->macPreambleSet; + cell->phichCfg = cellCfg->phichCfg; + + /* Initialize UL and DL CCCH logical channels */ + cell->ulCcchId = RGSCH_INVALID_LC_ID; + cell->dlCcchId = RGSCH_INVALID_LC_ID; + + /* Update SRS configuration */ + cell->srsCfg.isSrsCfgPres = cellCfg->srsCfg.isSrsCfgSetup; + if(cellCfg->srsCfg.isSrsCfgSetup) + { + cell->srsCfg.srsCfgPrdEnum = cellCfg->srsCfg.srsCfgPrdEnum; + cell->srsCfg.srsBwEnum = cellCfg->srsCfg.srsBwEnum; + cell->srsCfg.srsTxOffst = + rgSrsTxOffstTbl[cellCfg->srsCfg.srsSubFrameCfg]; + /*ccpu00116923 - ADD - Srs Present support */ +#ifdef TFU_UPGRADE + cell->srsCfg.srsSubFrameCfg = cellCfg->srsCfg.srsSubFrameCfg; +#endif + } + + /* Configure all the common logical channels for the cell */ + for(idx = 0; idx < cellCfg->numCmnLcs; idx++) + { + /* This never returns failure and hence not checked for */ + rgSCHCfgRgrCmnLcCfg(cell, &(cellCfg->cmnLcCfg[idx]), errInfo); + } + + /* Invoke the MeasGap and ACK NACK Rep handler for cell cfg */ + + /* Dynamic CFI cell configuration */ + ret = rgSCHDynCfiCfg(cell, cellCfg); + if(ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr cell Config failed at " + "Scheduler for cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + /* Updating Auto TM Mode enable/diable flag */ + cell->isAutoCfgModeEnb = cellCfg->isAutoCfgModeEnb; + { + if(cell->isAutoCfgModeEnb) + { + RLOG0(L_INFO,"Auto Mode Cfg enabled durint cell cfg\n"); + } + } + /* CPU OvrLoad State Initialization */ +#ifdef XEON_LMT_ITBS + cell->thresholds.maxDlItbs = gWrMaxDlItbs; + cell->thresholds.maxUlItbs = gWrMaxUlItbs; + RLOG2(L_INFO,"LIMIT DL and UL ITBS %d:%d \n",gWrMaxDlItbs,gWrMaxUlItbs); +#else + cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS; + cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS; +#endif + cell->measurements.dlTpt = 0; + cell->measurements.ulTpt = 0; + cell->measurements.dlBytesCnt = 0; + cell->measurements.ulBytesCnt = 0; + cell->cpuOvrLdCntrl.cpuOvrLdIns = 0; /* 0 - No command */ + cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0; + cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0; + for ( idx = 0; idx < 10; idx++ ) + { + cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] = cellCfg->maxDlUeNewTxPerTti; + cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] = cellCfg->maxUlUeNewTxPerTti; + } + + /* Invoke scheduler to update scheduler specific information */ + ret = rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr cell Config failed at " + "Scheduler for cell "); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + + /* Invoke DHM to update DHM specific information */ + rgSCHDhmRgrCellCfg(cell, cellCfg, errInfo); + + + /* Initialize RNTI DB */ + ret = rgSCHDbmRntiDbInit(cell, cellCfg->macRnti.startRnti, + cellCfg->macRnti.size); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr Cell Config failed at" + " RNTI DB init for cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + + /* Update the cell with recieved configuration */ + cell->dlHqCfg = cellCfg->dlHqCfg; + + RLOG1(L_INFO,"Config DL HQTX = %d\n",cell->dlHqCfg.maxDlHqTx); + + cell->crntSfIdx = 0; + /* Allocate the subframe allocation information */ + if((ret = rgSCHUtlGetSfAlloc(cell)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for " + "cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + /* Update RACH Related information + * XXX: Below function yet to be written in RAM + * To store the preambles given in the configuration for PDCCH order in the + * scheduler cell control block. Initialize the PRACH Mask Index allocated + * for these preambles to invalid values */ + + cell->crntHqIdx = 0; + /* Allocate the subframe allocation information */ + if((ret = rgSCHUtlGetRlsHqAlloc(cell)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for" + "cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + + /* Associate a pair of upper and lower sapCbs with this cell */ + instCb->rgrSap[spId].cell = cell; + instCb->tfuSap[spId].cell = cell; + instCb->rgmSap[spId].cell = cell; + cell->tfuSap = &(instCb->tfuSap[spId]); + + /* CaDev Start */ + instCb->cells[Idx1] = cell; + /* CaDev End */ + + /* rg001.201: Added for sending TTI tick to RRM */ +#if (defined(RGR_RRM_TICK) || defined(RGR_CQI_REPT)) + /* Associate the RGR SAP as well utilized while sending TTI + * Ticks to RGR User. */ + cell->rgrSap = &(instCb->rgrSap[spId]); +#endif + cell->rgmSap = &(instCb->rgmSap[spId]); +#ifdef RGR_RRM_TICK + /* Store the periodicity configured */ + cell->rrmTtiIndPrd = cellCfg->rrmTtiIndPrd; +#endif + +#ifdef LTE_L2_MEAS + cmLListInit(&cell->l2mList); +#endif + + if (rgSCHDrxCellCfg(cell,cellCfg) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Drx Memory allocation FAILED for" + " cell"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + cell->overLoadBackOffEnab = FALSE;/* Disabling RachOverload by default */ + /* Updating CSG Parameters */ + cell->minDlResNonCsg = cellCfg->csgParamCfg.minDlResNonCsg; + cell->minUlResNonCsg = cellCfg->csgParamCfg.minUlResNonCsg; + + /* Register the cell with MAC */ + rgSCHUtlGetPstToLyr(&pst, instCb, cell->macInst); + cellRegReq.cellId = cell->cellId; + cellRegReq.cellSapId = spId; +#ifdef LTE_TDD + cellRegReq.maxDlHqProcPerUe = rgSchTddDlNumHarqProcTbl[cellCfg->ulDlCfgIdx]; +#else + cellRegReq.maxDlHqProcPerUe = RGSCH_MAX_DL_HQ_PROC; +#endif + RgSchMacCellReg(&pst, &cellRegReq); + +#ifdef TENB_STATS + cell->tenbStats = TSL2AllocCellStatsBlk(cell->cellId); + cell->tenbStats->cellId = cell->cellId; +#endif + + rgSCHUtlCalcDciSizes(cell); + +#ifdef LTE_ADV + /* Initilalization of the list of UE for which this cell is secondary cell*/ + cmLListInit(&cell->sCellUeLst); +#endif + + +#ifdef LTE_ADV + ret = rgSCHLaaSCellCbInit(cell, cellCfg); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Rgr Cell Config failed at" + " Initializing the LAA Cell Control Cb"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } + cell->isPucchFormat3Sptd = cellCfg->isPucchFormat3Sptd; + RLOG_ARG0(L_INFO,DBG_CELLID,cellCfg->cellId,"Format 3 is Enabled"); + printf ("\n Format 3 is Enabled for CELL:%d",cell->cellId); +#endif + + +#ifdef EMTC_ENABLE + + if(cell->emtcEnable) + { + if (rgSCHCfgEmtcCellCfg(cell,&(cellCfg->emtcCellCfg)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"EMTC Config Failed" + " cell"); + RETVALUE(RFAILED); + } + } +#endif + +#ifdef RG_5GTF + ret = rgSCH5gtfCellCfg(cell, cellCfg); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR, DBG_CELLID,cellCfg->cellId,"5GTF Rgr Cell Config failed"); + rgSCHCfgFreeCellCb(cell); + RETVALUE(RFAILED); + } +#endif + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrCellCfg */ + +/** + * @brief Handler for the UE configuration request from RRC to MAC. + * + * @details + * + * Function : rgSCHCfgRgrUeCfg + * + * Processing Steps: + * - Allocate and create UE control block. + * - Update UE control block with the values recieved in the + * configuration. + * - Invoke RAM, SCH, UHM and DHM with created UE control block, to + * update random access, scheduler, uplink harq and downlink harq + * specific information respectively. + * - If successful, add the control block to hash list of UEs for the cell + * else Rollback and FAIL. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrUeCfg *ueCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrUeCfg +( +RgSchCellCb *cell, +RgrUeCfg *ueCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrUeCfg(cell, ueCfg, errInfo) +RgSchCellCb *cell; +RgrUeCfg *ueCfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + RgSchRaCb *raCb=NULLP; + RgSchUeCb *ue = NULLP; + Inst inst = cell->instIdx; + U32 lcgCnt; + RgSchDlHqEnt *hqEnt = NULLP; +#ifdef LTE_TDD + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 maxSubframes ; + U8 maxDlSubframes; +#endif + U32 idx = 0; +#ifdef TFU_UPGRADE + RgSchUePCqiCb *cqiCb = NULLP; +#endif + TRC2(rgSCHCfgRgrUeCfg); + + do { + errInfo->errCause = RGSCHERR_CFG_RGR_UE_CFG; + /* RACHO : Check for raCb only if preamble Id not provded */ +#ifndef PRE_DEF_UE_CTX + if (ueCfg->dedPreambleId.pres == NOTPRSNT) + { + if ((raCb = rgSCHDbmGetRaCb(cell, ueCfg->crnti)) == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"No RaCb exists for" + "CRNTI:%d ",ueCfg->crnti); + break; + } + } +#endif + + /* Allocate the Ue control block */ + if (((rgSCHUtlAllocSBuf(inst, (Data **)&ue, sizeof(RgSchUeCb))) != ROK) || + ((U8 *)ue == NULLP)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId, "Memory allocation" + " FAILED for CRNTI:%d", ueCfg->crnti); + break; + } + + /* Inititialize Ue control block */ + ue->ueId = ueCfg->crnti; + ue->cell = cell; + /*ccpu00117778- Initialize Transmission Indices upon UE CB creation */ +#ifdef LA + ue->lastRprdAckNackTime.sfn = cell->crntTime.sfn; + ue->lastRprdAckNackTime.subframe = cell->crntTime.subframe; + ue->ueIdle = FALSE; +#endif + + /* Allocate the Ue control block */ + if (((rgSCHUtlAllocSBuf(inst, (Data **)&(ue->cellInfo[RGSCH_PCELL_INDEX]), + sizeof(RgSchUeCellInfo))) != ROK)) + { +#ifndef ALIGN_64BIT + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%lu]SCellIdx :Memomy allocation " + "Failed while Adding SCell Information\n", idx)); +#else + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%u]SCellIdx :Memomy allocation " + "Failed while Adding SCell Information\n", idx)); +#endif + RETVALUE(RFAILED); + } + + ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)] = RGSCH_PCELL_INDEX; + ue->cellInfo[RGSCH_PCELL_INDEX]->cell = cell; + ue->cellInfo[RGSCH_PCELL_INDEX]->ue = ue; +#ifdef LTE_ADV + ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE; + ue->cellInfo[RGSCH_PCELL_INDEX]->sCellIdx = RGSCH_PCELL_INDEX; + ue->cellInfo[RGSCH_PCELL_INDEX]->sCellId = cell->cellId; + + if (ROK != rgSCHLaaInitDlRbAllocCb(cell, + &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb)) + { + RETVALUE(RFAILED); + } +#endif +#ifdef TFU_UPGRADE + cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell); + cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + ue->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; + ue->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; +#endif + /* LTE_ADV_FLAG_REMOVED_START */ + /* While doing UE configuration for SFR at SCH, by default + * CC UE power is configured as LOW */ + ue->lteAdvUeCb.isCCUePHigh = FALSE; + /* LTE_ADV_FLAG_REMOVED_END */ + + /* Initialize the lists of the UE */ + if((rgSCHDbmInitUe(ue)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"DBM initialization " + "failed for CRNTI:%d", ueCfg->crnti); + break; + } +#ifdef EMTC_ENABLE + if(raCb != NULLP) + { + if(TRUE == raCb->isEmtcRaCb) + { + ue->isEmtcUe = TRUE; + if (rgSCHUtlUpdUeEmtcInfo(cell, ueCfg, ue) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"EMTC UE Cfg" + "failed for CRNTI:%d", ueCfg->crnti); + break; + } + } + } +#endif + + /* Initialize scheduler related information for UE */ + if(rgSCHUtlRgrUeCfg(cell, ue, ueCfg, errInfo) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Scheduler handling " + "failed in config for CRNTI:%d", ueCfg->crnti); + break; + } + + ret = rgSCHUhmHqEntInit(cell, ue); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"UHM HARQ Ent Init " + "Failed for CRNTI:%d", ueCfg->crnti); + break; + } + + /* Initialize RAM related information for UE + * RACHO: if preamble Id is present in ueCfg then raCb will be NULL + * so rgSCHRamRgrUeCfg should take care of creating raCb */ + if ((ueCfg->dedPreambleId.pres == NOTPRSNT) && (NULLP != raCb) ) + { + if((rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Random access " + "handling config failed for CRNTI:%d", ueCfg->crnti); + break; + } + } + else /* if HO Ue */ + { + RG_SCH_CMN_GET_UE_HQE(ue, cell) = rgSCHDhmHqEntInit(cell); + hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell); + if (hqEnt == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Hq Entity Initialization " + "failed in config for CRNTI:%d", ueCfg->crnti); + break; + } +#ifdef EMTC_ENABLE + rgSCHEmtcHqPAlloc(cell, hqEnt); +#endif + hqEnt->ue = ue; + /* Fix : syed Assign hqEnt to UE only if msg4 is done */ + + rgSCHCmnDlInitHqEnt(cell, hqEnt); + + /* For Hand-In UE Request Aper CQI report + * immediately */ + if (ueCfg->ueDlCqiCfg.aprdCqiCfg.pres) + { + /* Set APCQI for Pcell only*/ + ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; + } + } + /* CA dev Start */ +#ifdef LTE_TDD + maxDlSubframes = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + maxSubframes = 2 * maxDlSubframes; + ue->dl.numHqDlSfInfo = maxSubframes; + rgSCHUtlAllocSBuf(cell->instIdx, + (Data **)&ue->dl.dlSfHqInfo, sizeof(RgSchDlHqInfo) * (ue->dl.numHqDlSfInfo)); + +#else + ue->dl.numHqDlSfInfo = RGSCH_NUM_DL_SUBFRAMES; +#endif +#ifndef RG_5GTF + for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++) + { + cmLListInit(&ue->dl.dlSfHqInfo[idx].hqPLst); + ue->dl.dlSfHqInfo[idx].dlSfUeLnk.node = NULLP; + + } +#else + { + U8 cellIdx=0; + for (cellIdx = 0;cellIdx < MAX_5GTF_CELL ; cellIdx++) + { + for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++) + { + cmLListInit(&ue->dl.dlSfHqInfo[cellIdx][idx].hqPLst); + ue->dl.dlSfHqInfo[cellIdx][idx].dlSfUeLnk.node = NULLP; + } + } + } +#endif +#ifdef LTE_ADV + rgSCHLaaInitDlHqInfo(cell, ue); +#endif + /* CA dev End */ + + /* Initialize lcgIds to Invalid */ + for (lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++) + { + ue->ul.lcgArr[lcgCnt].lcgId = RGSCH_INVALID_LCG_ID; + } + if(raCb != NULLP) + { + rgSCHCfgRgrUePhrMsg3(cell,raCb,ue,errInfo); + /* Moved this code out of rgSCHCfgRgrUePhrMsg3() + * as it was not the appropriate place to + * do this. */ + if (raCb->raState == RGSCH_RA_MSG4_DONE) + { + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "RNTI:%d RaCb deleted as Msg4 transmission is done", + raCb->tmpCrnti); + rgSCHRamDelRaCb(cell, raCb, FALSE); + } + } + /* Initialize uplink HARQ related information for UE */ + rgSCHUhmRgrUeCfg(cell, ue, ueCfg); + cmInitTimers(&ue->bsrTmr, 1); +#ifdef RGR_V1 + /* Added periodic BSR timer */ + cmInitTimers(&ue->bsrTmr, 1); + + /* Fix - Added proper configuration from U-ARM */ + if(ueCfg->ueBsrTmrCfg.isPrdBsrTmrPres == TRUE) + { + ue->ul.bsrTmrCfg.isPrdBsrTmrPres = TRUE; + ue->ul.bsrTmrCfg.prdBsrTmr = ueCfg->ueBsrTmrCfg.prdBsrTmr; + ue->ul.bsrTmrCfg.retxBsrTmr = ueCfg->ueBsrTmrCfg.retxBsrTmr; + } + +#endif + /* Initialize downlink HARQ related information for UE */ + rgSCHDhmRgrUeCfg(cell, ue, ueCfg, errInfo); + + /* Initialize MeasureGap and Acknack Rep Information for UE */ + if((rgSCHMeasGapANRepUeCfg(cell, ue, ueCfg)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Measurement Gap and" + " AckNack Rep failed in Config for CRNTI:%d", ueCfg->crnti); + break; + } + + +#ifdef LTE_TDD + if((rgSCHUtlAllocUeANFdbkInfo(ue,RGSCH_PCELL_INDEX)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"Memomy allocation " + "Failed while UE related Ack Nack Information for CRNTI:%d", + ueCfg->crnti); + break; + } + ue->dl.ackNackMode = ueCfg->ackNackModeEnum; +#endif /* LTE_TDD */ + + /* Insert Ue */ + rgSCHDbmInsUeCb(cell, ue); + +#ifdef TFU_UPGRADE + /* Int ialize APeriodic CQI/PMI/RI Information for UE */ + + RGSCHDBGPRM(cell->instIdx,(rgSchPBuf(cell->instIdx), + "\n rgSCHCfgRgrUeCfg : CellID=%d UeId =%d AcqiCfg Pres =%d", + cell->cellId, ue->ueId, ueCfg->ueDlCqiCfg.aprdCqiCfg.pres)); + + /*Store Trigger Set Bit String to UE */ + + ret = rgSCHCfgACqiUeCfg(cell,ue, (RG_SCH_CMN_GET_ACQICB(ue,cell)),ue->mimoInfo.txMode, + &ueCfg->ueDlCqiCfg.aprdCqiCfg, ue->ueCatEnum); + + ue->cqiRiWritIdx = 0; + ue->cqiRiReadIdx = 0; + /* Initialize Periodic CQI/PMI, RI Information for UE */ + ret = rgSCHCfgPCqiUeCfg(cell, ue, &ueCfg->ueDlCqiCfg.prdCqiCfg, + ue->ueCatEnum); + + /* Initialize UL SRS Information for UE */ + ret = rgSCHCfgSrsUeCfg(cell, ue, &ueCfg->srsCfg); + + /* Initialize SR Information for UE */ + ret = rgSCHCfgSrUeCfg(cell, ue, &ueCfg->srCfg); +#endif + +#ifdef LTEMAC_HDFDD + if (rgSCHHdFddUeCfg(cell, ue, ueCfg->isHdFddEnbld) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId, + "Could not do HD-FDD config for CRNTI:%d",ueCfg->crnti); + break; + } + +#endif /* LTEMAC_HDFDD */ + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + ue->cqiReptCfgInfo.numColltdCqiRept = + ueCfg->ueCqiReptCfg.numColltdCqiRept; +#endif /* End of RGR_CQI_REPT */ +#ifdef TFU_UPGRADE + RG_SCH_CMN_GET_PA(ue,cell).pres = FALSE; + if (RG_SCH_UE_CFG_ISPAPRSNT(ueCfg->uePdschDedCfg.uepACfg)) + { + RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE; + RG_SCH_CMN_GET_PA(ue,cell).val = ueCfg->uePdschDedCfg.uepACfg.pA; + } +#endif + ue->isDrxEnabled = ueCfg->ueDrxCfg.isDrxEnabled; + + if ( ue->isDrxEnabled ) + { + if((rgSCHDrxUeCfg(cell,ue,ueCfg)) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueCfg->cellId,"DRX configuration failed", + ueCfg->crnti); + break; + } + } + + /* LTE_ADV_FLAG_REMOVED_START */ + if ((cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) || \ + (cell->lteAdvCb.absCfg.status == RGR_ENABLE)) + { + ue->lteAdvUeCb.rgrLteAdvUeCfg = ueCfg->ueLteAdvCfg; + } + /* LTE_ADV_FLAG_REMOVED_END */ + +#ifdef TENB_STATS + ue->tenbStats = TSL2AllocUeStatsBlk(ue->ueId); + ue->tenbStats->stats.rnti = ue->ueId; +#endif +#ifdef LTE_ADV + /*Update A Value for PCell TBs*/ + ue->f1bCsAVal = rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode); + RLOG_ARG1(L_ERROR,DBG_CELLID, ueCfg->cellId, + "\n UeCfg A value is %d\n",ue->f1bCsAVal); +#endif + errInfo->errCause = RGSCHERR_NONE; + + ue->accessStratumRls = ueCfg->accessStratumRls; + if (ue->numSCells > 0) + { + /* 2 bit CSI */ + rgSCHUtlUpdUeDciSize(cell, ue, TRUE); + } + else + { + /* 1 bit CSI Access Stratum Release Change */ + rgSCHUtlUpdUeDciSize(cell, ue, FALSE); + } + + RETVALUE(ROK); + }while(0); + + if (ue) + { + rgSCHCfgFreeUeCb(cell, ue); + } + RETVALUE(RFAILED); +} /* rgSCHCfgRgrUeCfg */ + +/** + * @brief Handler for PHR for MSG3. + * + * @details + * + * Function : rgSCHCfgRgrUePhrMsg3 + * + * Processing Steps: + * Handle PHR related config for MSG3 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrUeCb *ueCb + * @param[in] RgSchRaCb *raCb + * @param[out] RgSchErrInfo *errInfo + **/ +#ifdef ANSI +PRIVATE Void rgSCHCfgRgrUePhrMsg3 +( +RgSchCellCb *cell, +RgSchRaCb *raCb, +RgSchUeCb *ue, +RgSchErrInfo *errInfo +) +#else +PRIVATE Void rgSCHCfgRgrUePhrMsg3(cell, raCb, ue, errInfo) +RgSchCellCb *cell; +RgSchRaCb *raCb; +RgSchUeCb *ue; +RgSchErrInfo *errInfo; +#endif +{ + + TRC2(rgSCHCfgRgrUePhrMsg3); + + /* Record msg3 allocation in the UE */ + rgSCHUtlRecMsg3Alloc(cell, ue, raCb); + + /* If raCb received PHR, update scheduler */ + if(raCb->phr.pres == TRUE) + { + ue->macCeRptTime = raCb->msg3AllocTime; + rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo); + } + + RETVOID; +} + +/** + * + * @details + * + * Function : rgSCHDynCfiReCfg + * + * @param[in] RgSchCellCb *cell + * Bool isDynCfiEnb + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHDynCfiReCfg +( +RgSchCellCb *cell, +Bool isDynCfiEnb +) +#else +PUBLIC Void rgSCHDynCfiReCfg(cell, isDynCfiEnb) +RgSchCellCb *cell; +Bool isDynCfiEnb; +#endif +{ + U8 idx; + RgSchCmnDlCell *cellSchDl = RG_SCH_CMN_GET_DL_CELL(cell); + + TRC2(rgSCHDynCfiReCfg); + + if(isDynCfiEnb) + { + cell->dynCfiCb.ttiCnt = 0; + cellSchDl->newCfi = cellSchDl->currCfi; + } + else + { + /* Resetting the parameters*/ + cell->dynCfiCb.cceFailCnt = 0; + cell->dynCfiCb.cceFailSum = 0; + cell->dynCfiCb.prevCceFailIdx = 0; + + for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++) + { + cell->dynCfiCb.cceFailSamples[idx] = 0; + } + + cell->dynCfiCb.cceUsed = 0; + cell->dynCfiCb.lowCceCnt = 0; + cell->dynCfiCb.ttiCnt = 0; + } +} +/** + * @brief Handler for the cell reconfiguration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrCellRecfg + * + * Processing Steps: + * - Invoke SCH with cell control block to update + * scheduler specific information. + * - Update cell control block with the values recieved in the + * configuration. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellRecfg *cellRecfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrCellRecfg +( +RgSchCellCb *cell, +RgrCellRecfg *cellRecfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrCellRecfg(cell, cellRecfg, errInfo) +RgSchCellCb *cell; +RgrCellRecfg *cellRecfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + Inst inst = cell->instIdx; +/* LTE_ADV_FLAG_REMOVED_START */ + U8 i = 0; + U16 len; /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ +/* LTE_ADV_FLAG_REMOVED_END */ + + TRC2(rgSCHCfgRgrCellRecfg); + + + errInfo->errCause = RGSCHERR_CFG_RGR_CELL_RECFG; + + /* Invoke scheduler to update scheduler specific information */ + ret = rgSCHUtlRgrCellRecfg(cell, cellRecfg, errInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId, "RGR Cell re-configuration failed " + "at Scheduler "); + RETVALUE(RFAILED); + } + + /* Invoke DHM to update DHM specific information */ + rgSCHDhmRgrCellRecfg(cell, cellRecfg, errInfo); + + /* PUCCH Reconfiguration */ + if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG) + { + cell->pucchCfg = cellRecfg->pucchRecfg; + } + + /* SRS Reconfiguration */ + if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG) + { + cell->srsCfg.isSrsCfgPres = cellRecfg->srsRecfg.isSrsCfgSetup; + if(cellRecfg->srsRecfg.isSrsCfgSetup) + { + cell->srsCfg.srsCfgPrdEnum = cellRecfg->srsRecfg.srsCfgPrdEnum; + cell->srsCfg.srsBwEnum = cellRecfg->srsRecfg.srsBwEnum; + cell->srsCfg.srsTxOffst = + rgSrsTxOffstTbl[cellRecfg->srsRecfg.srsSubFrameCfg]; + /*ccpu00116923 - ADD - Srs Present support */ +#ifdef TFU_UPGRADE + cell->srsCfg.srsSubFrameCfg = cellRecfg->srsRecfg.srsSubFrameCfg; +#endif + } + } + + /* RACH Reconfiguration */ + if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG) + { + cell->rachCfg = cellRecfg->rachRecfg; + } + + /* ccpu00132256:MOD: Moved this assignment from Validation to here.*/ + if (cellRecfg->recfgTypes & RGR_CELL_TMRS_RECFG) + { + cell->t300TmrVal = cellRecfg->t300TmrVal; + } +#ifdef RGR_SI_SCH + /* SI Reconfiguration */ + if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG) + { + /*Set the specified SI configuration. */ + cell->siCb.newSiCfg = cellRecfg->siReCfg; + /* Set the Bit mask for SI re-configuration */ + cell->siCb.siBitMask |= RGSCH_SI_SICFG_UPD; +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + rgSchEmtcUpdSiCfg(cell, cellRecfg); + } +#endif + } +#endif /*RGR_SI_SCH */ + + /* Overload RACH Control changes */ + if (cellRecfg->recfgTypes & RGR_CELL_CNTRL_CMD_RECFG) + { + if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_RACH_OVRLD) + { + cell->overLoadBackOffEnab = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffEnb; + cell->overLoadBackOffval = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffVal; + } + else if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_CPU_OVRLD) + { + if( ROK != rgSCHUtlResetCpuOvrLdState(cell, cellRecfg->cntrlCmdCfg.cmdDesc.\ + cpuOvrLd.instruction)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID, cellRecfg->cellId, + "Invalid CPU OvrLd Ins %d for cell", + cellRecfg->cntrlCmdCfg.cmdDesc.cpuOvrLd.instruction); + RETVALUE(RFAILED); + } + } + } + +/* LTE_ADV_FLAG_REMOVED_START */ + if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG) + { + if(cellRecfg->rgrLteAdvCfg.pres & RGR_ABS) + { + cell->lteAdvCb.absCfg = + cellRecfg->rgrLteAdvCfg.absCfg; + } + if(cellRecfg->rgrLteAdvCfg.pres & RGR_SFR) + { + cmMemcpy((U8 *)&cell->lteAdvCb.sfrCfg, (U8 *)&cellRecfg->rgrLteAdvCfg.sfrCfg, + sizeof(RgrSfrConfig)); + /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ + if (cellRecfg->rgrLteAdvCfg.sfrCfg.status == RGR_ENABLE) + { + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + /*initialise the pools of CC and CE*/ + if(rgSchSFRTotalPoolInit(cell, cell->subFrms[i])) + { + RETVALUE(RFAILED); + } + } + } + else + { + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + /*initialise the pools of CC and CE*/ + rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell); + } + + if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + /* releasing rntp info val from each subframe */ + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw); + } + + /* releasing RNTP Aggregation Info from CellCb*/ + rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); + + cell->lteAdvCb.dsfrCfg.status = RGR_DISABLE; + } + } + } + /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** Start */ + if(cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR) + { + cell->lteAdvCb.dsfrCfg = + cellRecfg->rgrLteAdvCfg.dsfrCfg; + if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + /*initialise the pools of CC and CE*/ + if(rgSchDSFRRntpInfoInit(&cell->subFrms[i]->rntpInfo,cell,cell->bwCfg.dlTotalBw)) + { + RETVALUE(RFAILED); + } + } + /*Calculating the length of RNTP array based on Dl Bandwidth */ + len = (U16)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /* KW fix for LTE_ADV */ + if(cell->rntpAggrInfo.pres == NOTPRSNT) + { + if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val), + (len * sizeof(U8)))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId, + "Memory allocation FAILED for RNTP Alloc"); + RETVALUE(RFAILED); + } + cell->rntpAggrInfo.pres = PRSNT_NODEF; + cell->rntpAggrInfo.len = len; + } + } + /* in case if DSFR is disabled, need to free RNTP pattern val*/ + else + { + /* releasing rntp info val from each subframe */ + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw); + } + + /* releasing RNTP Aggregation Info from CellCb*/ + rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); + } + } + /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** End */ + } +/* LTE_ADV_FLAG_REMOVED_END */ + + /* Dynamic CFI cell Reconfiguration */ + if(cellRecfg->recfgTypes & RGR_CELL_DYN_CFI_RECFG) + { + if(cell->dynCfiCb.isDynCfiEnb != cellRecfg->isDynCfiEnb) + { + if(cell->dynCfiCb.switchOvrInProgress) + { + cell->dynCfiCb.dynCfiRecfgPend = TRUE; + } + else + { + cell->dynCfiCb.isDynCfiEnb = cellRecfg->isDynCfiEnb; + rgSCHDynCfiReCfg(cell, cellRecfg->isDynCfiEnb); + } + } + else + { + /* To hanlde the case where reconfiguration comes for disabling + * and then enabling before switchover period expires */ + cell->dynCfiCb.dynCfiRecfgPend = FALSE; + } + } + /* Dynamic config of AUTO chnage flag */ + if(cellRecfg->recfgTypes & RGR_CELL_AUTO_CFG_MODE_RECFG) + { + if(cell->isAutoCfgModeEnb != cellRecfg->isAutoCfgModeEnb) + { + cell->isAutoCfgModeEnb = cellRecfg->isAutoCfgModeEnb; + } + } + { + if(cell->isAutoCfgModeEnb) + { + RLOG0(L_INFO,"Auto Mode Cfg enabled durint cell recfg\n"); + } + } + + if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG) + { + cell->minDlResNonCsg = cellRecfg->csgParamCfg.minDlResNonCsg; + cell->minUlResNonCsg = cellRecfg->csgParamCfg.minUlResNonCsg; + } + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrCellRecfg */ + +/** + * @brief Handler for the UE reconfiguration request from RRC to MAC. + * + * @details + * + * Function : rgSCHCfgRgrUeRecfgRntiChg + * + * Processing Steps: + * - If rnti changes, + * - Invoke RAM for UE reconfiguration. + * - Delete old UE from the list. + * - Update the new rnti and re-insert the UE in the list. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHCfgRgrUeRecfgRntiChg(cell, ue, ueRecfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *errInfo; +#endif +{ +#ifdef LTE_ADV + U8 sCellIdx; +#endif + S16 ret; + RgSchRaCb *raCb; + RgSchRaCb *oldRaCb; + RgSchDlHqEnt **hqEnt = &(RG_SCH_CMN_GET_UE_HQE(ue, cell)); + U8 idx; + + TRC2(rgSCHCfgRgrUeRecfgRntiChg); + + /* Handle CRNTI change in reconfiguration */ + if (ueRecfg->oldCrnti != ueRecfg->newCrnti) + { + RgSchRntiLnk *oldRntiLnk=NULLP; + CmLteRnti oldRnti = 0; + if ((raCb = rgSCHDbmGetRaCb(cell, ueRecfg->newCrnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UEID:No RaCb exists while" + "Reconfig for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + + /* rntiLnk does not exist for a HandIn UE. Hence this check. */ + if(ue->rntiLnk) + { + oldRntiLnk = ue->rntiLnk; + } + else + { + /* Fix : syed HO UE does not have a valid ue->rntiLnk */ + oldRnti = ue->ueId; + } + + RLOG2(L_INFO,"UE ID CHNG OLD %d new %d",ueRecfg->oldCrnti, ueRecfg->newCrnti); + + /* Fix : syed Deleting Old DL HqEnt. It would be assigned after + * reest RACH(msg4) is completed. */ + rgSCHDhmDelHqEnt(cell, hqEnt); + + /* Initialize RAM related information for UE */ + ret = rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"RAM Handling for UE Reconfig failed" + "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + /* Delete Ue from the ue list */ + rgSCHDbmDelUeCb(cell, ue); + +#ifdef LTE_ADV + if (ue->numSCells) + { + for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++) + { + if(ue->cellInfo[sCellIdx] != NULLP) + { + rgSCHDbmDelUeCb(ue->cellInfo[sCellIdx]->cell, ue); + } + } + } +#endif + + /* Inititialize Ue control block */ + ue->ueId = ueRecfg->newCrnti; + RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, + "Changing RNTI from %d to %d", + ueRecfg->oldCrnti, + ueRecfg->newCrnti); +#ifdef EMTC_ENABLE + if(ue->isEmtcUe) + { + rgSCHUtlUpdEmtcY(ue); + } +#endif + + /* Fix ccpu00122631: PCell_Reest: Updating new Rnti in all the cells + * dlAllocCb + */ + for(idx = 0; idx < CM_LTE_MAX_CELLS; idx++) + { + if(ue->cellInfo[idx]) + { + ue->cellInfo[idx]->dlAllocCb.rnti = ueRecfg->newCrnti; + } + } + + rgSCHUtlRecMsg3Alloc(cell, ue, raCb); + + /* If raCb received PHR, update scheduler */ + if(raCb->phr.pres == TRUE) + { + ue->macCeRptTime = raCb->msg3AllocTime; + rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo); + } + +#ifdef RGR_V2 /* Acc Fix */ + if(TRUE == ue->isDrxEnabled) + { + ueRecfg->ueDrxRecfg.isDrxEnabled = TRUE; + ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg); + + if ( ret != ROK ) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE DRX re-est failed" + "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } +#endif /* Acc Fix */ + + /* Re-insert updated Ue */ + rgSCHDbmInsUeCb(cell, ue); + +#ifdef LTE_ADV + if (ue->numSCells) + { + for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++) + { + if(ue->cellInfo[sCellIdx] != NULLP) + { + rgSCHDbmInsUeCb(ue->cellInfo[sCellIdx]->cell, ue); + } + } + } +#endif + + +#ifdef TENB_STATS + ue->tenbStats->stats.rnti = ue->ueId; +#endif + + /* Fix : syed If MSG4 is done, since corresponding ueCb + * is ready, the raCb should be cleared immediately. + * Otherwise it would remain in the cell until timed out + * and till then the hq Feedbacks will be assumed to be + * for msg4 */ + if (raCb->raState == RGSCH_RA_MSG4_DONE) + { + RLOG_ARG1(L_DEBUG,DBG_CELLID,ueRecfg->cellId, + "RNTI:%d with RaCb deleted as Msg4 transmission is done", + raCb->tmpCrnti); + rgSCHRamDelRaCb(cell, raCb, FALSE); + } + /* Fix : syed moving the UL CQI initialization to UERESET */ + + /* Release Older rnti */ + if(oldRntiLnk) + { + /* This is the rare case in which back to back reestablishment is + * happening and previous re-est was not done completely (MSG4 was + * not done) for an UE, and again re-est is triggered for the same + * UE. We are deleting the old RA CB for the previous re-est which + * still exist due to MSG4 not transmitted successfully */ + if ((oldRaCb = rgSCHDbmGetRaCb(cell, oldRntiLnk->rnti)) != NULLP) + { + rgSCHRamDelRaCb(cell, oldRaCb, FALSE); + } + + rgSCHUtlRlsRnti(cell, oldRntiLnk, TRUE, ueRecfg->newCrnti); + } + else + { + /* Fix : syed HO UE does not have a valid ue->rntiLnk */ + /* Just indicate to MAC, no need to release at SCH */ + RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, + "HO OldRnti:%d RLS and NewRnti:%d CHNG IND TO MAC", + oldRnti, ueRecfg->newCrnti); + rgSCHUtlIndRntiRls2Mac(cell, oldRnti, TRUE, ueRecfg->newCrnti); + } + } + RETVALUE(ROK); +} +/** + * @brief Handler for the UE reconfiguration request from RRC to MAC. + * + * @details + * + * Function : rgSCHCfgRgrUeRecfg + * + * Processing Steps: + * - If rnti changes, + * - Invoke RAM for UE reconfiguration. + * - Delete old UE from the list. + * - Update the new rnti and re-insert the UE in the list. + * - Update the UE control block with the reconfigured values. + * - Invoke SCH, UHM and DHM with updated UE control block to + * update scheduler, uplink HARQ and downlink HARQ specific + * parameters. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrUeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrUeRecfg(cell, ue, ueRecfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; +#ifdef LTE_ADV + Bool dciChange = TRUE; +#endif + + TRC2(rgSCHCfgRgrUeRecfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_UE_RECFG; + +#ifdef LTE_ADV + if (ue->numSCells > 0) + { + dciChange = FALSE; + } + if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ + (ue->accessStratumRls != ueRecfg->accessStratumRls)) + { + ue->accessStratumRls = ueRecfg->accessStratumRls; + dciChange = TRUE; + } + + /* if SCELL_RECFG is present , no other + * type will be present. Process Scell addition + * and return + * */ + if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_ADD_RECFG) + { + ret = rgSCHSCellCfgUeCfg(cell, ue, ueRecfg, errInfo); + if( ret != ROK) + { + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG; + /*FH: SCell config failed for a scell index hence revert all successful + * Scell config and send negative confirmation to APP*/ + rgSCHSCellCfgUeCfgRollBack(cell, ue, ueRecfg); + RETVALUE(RFAILED); + } + } + if (dciChange == TRUE) + { + if (ue->numSCells > 0) + { + /* 2 bit CSI */ + rgSCHUtlUpdUeDciSize(cell, ue, TRUE); + } + else + { + /* 1 bit CSI Access Stratum Release Change */ + rgSCHUtlUpdUeDciSize(cell, ue, FALSE); + } + } + if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_PUCCH_RECFG) + { + ret = rgSCHSCellCfgUePucchReCfg(cell, ue, ueRecfg, errInfo); + if( ret != ROK) + { + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_PUCCH_RECFG; + RETVALUE(RFAILED); + } + } +#else + if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \ + (ue->accessStratumRls != ueRecfg->accessStratumRls)) + { + ue->accessStratumRls = ueRecfg->accessStratumRls; + rgSCHUtlUpdUeDciSize(cell, ue, FALSE); + } +#endif /* LTE_ADV */ + + if (ueRecfg->ueRecfgTypes) + { + /* Update scheduler related information for UE */ + ret = rgSCHUtlRgrUeRecfg(cell, ue, ueRecfg, errInfo); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, + "Scheduler handling while reconfig failed" + "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + + /* Update uplink HARQ related information for UE */ + rgSCHUhmRgrUeRecfg(cell, ue, ueRecfg); + + /* Update TA related information for UE */ + if (ueRecfg->ueRecfgTypes & RGR_UE_TATMR_RECFG) + { + rgSCHCfgUeTaRecfg(cell, ue, ueRecfg, errInfo); + } + + /*Update Measurement Gap and AckNack Details */ + /* After merging from 2.2 */ + if (ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG) + { + ret = rgSCHMeasGapANRepUeRecfg(cell, ue, ueRecfg); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Measurement Gap and" + "AckNack Rep Recfg failed for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + if (ueRecfg->ueRecfgTypes & RGR_UE_BSRTMR_RECFG) + { + cmInitTimers(&ue->bsrTmr, 1); + ue->ul.bsrTmrCfg = ueRecfg->ueBsrTmrRecfg; + if ((ue->ul.bsrTmrCfg.isPrdBsrTmrPres) && + (ue->ul.bsrTmrCfg.prdBsrTmr == 0xFFFF)) + { + ue->ul.bsrTmrCfg.isPrdBsrTmrPres = FALSE; + } + } + } + + if (RFAILED == rgSCHCfgRgrUeRecfgRntiChg (cell, ue, ueRecfg, errInfo)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"RNTI change " + "failed for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + +#ifdef TFU_UPGRADE + /* Re-Initialize Aperiodic CQI Information for UE*/ + if ( ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG ) + { + ret = rgSCHCfgAcqiUeReCfg(cell, ue, &ueRecfg->aprdDlCqiRecfg, + ue->ueCatEnum); + } + /* Re-Initialize Periodic CQI/PMI, RI Information for UE */ + if ( ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG) + { + ret = rgSCHCfgPCqiUeReCfg(cell, ue, &ueRecfg->cqiCfg, + ue->ueCatEnum); + } + /* Re-Initialize UL SRS Information for UE */ + if ( ueRecfg->ueRecfgTypes & RGR_UE_SRS_RECFG) + { + ret = rgSCHCfgSrsUeReCfg(cell, ue, &ueRecfg->srsCfg); + } + /* Re-Initialize SR Information for UE */ + if ( ueRecfg->ueRecfgTypes & RGR_UE_SR_RECFG) + { + ret = rgSCHCfgSrUeReCfg(cell, ue, &ueRecfg->srCfg); + } +#endif + +#ifdef LTEMAC_HDFDD + if(ueRecfg->isHdFddEnbld) + { + ret = rgSCHHdFddUeCfg(cell, ue, ueRecfg->isHdFddEnbld); + if (ret != ROK) + { + errInfo->errCause = RGSCHERR_HDFDD_SPSCFGRD; + RETVALUE(ret); + } + } +#endif /* LTEMAC_HDFDD */ +#ifdef RGR_V2 + if ( ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) + { + ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg); + + if ( ret != ROK ) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"UE DRX reconfig failed" + "failed for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } +#endif +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* CQI Reporting (N) Re-configuration */ + if(ueRecfg->ueRecfgTypes & RGR_UE_CQIREPT_RECFG) + { + ret = rgSCHCfgUeCqiReptReCfg(cell, ue, ueRecfg); + if(ret != OK) + { + errInfo->errCause = RGSCHERR_CQIREPT; + RETVALUE(ret); + } + } +#endif /* End of RGR_CQI_REPT */ +#ifdef TFU_UPGRADE + /* pA Re-configuration */ + if((ueRecfg->ueRecfgTypes & RGR_UE_PA_RECFG) && + RG_SCH_UE_CFG_ISPAPRSNT(ueRecfg->uePdschDedCfg.uepACfg)) + { + RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE; + RG_SCH_CMN_GET_PA(ue,cell).val = ueRecfg->uePdschDedCfg.uepACfg.pA; + } +#endif + +/* LTE_ADV_FLAG_REMOVED_START */ + if(ueRecfg->ueRecfgTypes & RGR_UE_LTEA_RECFG) + { + if(ueRecfg->ueLteAdvCfg.pres & RGR_ABS) + { + ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe = ueRecfg->ueLteAdvCfg.isAbsUe; + } + + if(ueRecfg->ueLteAdvCfg.pres & RGR_SFR) + { + ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge = ueRecfg->ueLteAdvCfg.isUeCellEdge; + } + } +/* LTE_ADV_FLAG_REMOVED_END */ +#ifdef EMTC_ENABLE + if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_DPLXMODE_RECFG) + { + rgSCHEmtcHdFddUeCfg (cell, ue, + ueRecfg->emtcUeRecfg.isHdFddEnbld); + } + if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_PO_TRIGGER) + { + rgSCHEmtcPOTrigger(cell, ue); + } +#endif + errInfo->errCause = RGSCHERR_NONE; + + RETVALUE(ROK); +} /* rgSCHCfgRgrUeRecfg */ + + +/** + * @brief Handler for the logical channel reconfiguration request from + * RRC to MAC. + * + * @details + * + * Function : rgSCHCfgRgrLchRecfg + * + * Processing Steps: + * - Invoke scheduler to update scheduler specific information. + * - Update the dedicated logical channel Cb with the reconfigured + * values. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgUlCellCb *cell + * @param[in] RgUlUeCb *ue + * @param[in] RgSchUlLcCb *ulLc + * @param[in] RgSchDlLcCb *dlLc + * @param[in] RgrLchRecfg *lcRecfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLchRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchRecfg *lcRecfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLchRecfg(cell, ue, dlLc, lcRecfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchRecfg *lcRecfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret = ROK; + + TRC2(rgSCHCfgRgrLchRecfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_LC_RECFG; + /* Invoke Scheduler to update the new configuration */ + ret = rgSCHUtlRgrLcRecfg(cell, ue, dlLc, lcRecfg, errInfo); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcRecfg->cellId,"Scheduler handling for LC Recfg" + " failed for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrLchRecfg */ +/** + * @brief Handler for the logical channel reconfiguration request from + * RRC to MAC. + * + * @details + * + * Function : rgSCHCfgRgrLcgRecfg + * + * Processing Steps: + * - Invoke scheduler to update scheduler specific information. + * - Update the dedicated logical channel Cb with the re-configured + * values. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgUlCellCb *cell + * @param[in] RgUlUeCb *ue + * @param[in] RgrLcgRecfg *lcgRecfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLcgRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrLcgRecfg *lcgRecfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLcgRecfg(cell, ue, lcgRecfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrLcgRecfg *lcgRecfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret = ROK; + + TRC2(rgSCHCfgRgrLcgRecfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_LCG_RECFG; + + /*Added for handling LCG ReConfig if the LCG was deleted */ + ue->ul.lcgArr[lcgRecfg->ulRecfg.lcgId].lcgId = lcgRecfg->ulRecfg.lcgId; + + /* Invoke Scheduler to update the new configuration */ + ret = rgSCHUtlRgrLcgRecfg(cell, ue, lcgRecfg, errInfo); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgRecfg->cellId,"Scheduler handling for LCG Recfg" + " failed for CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrLcgRecfg */ + +/** + * @brief Handler for the UE Reset request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrUeReset + * + * Processing Steps: + * - Call Measument Gap Module and Ack/Nack Module for resetting UE. + * - Call Common Schduler UE rest API which inturn will call scheduler + * specific UE Reset APis to reset UE. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrRst *reset + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrUeReset +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrRst *reset, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrUeReset(cell, ue, reset, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrRst *reset; +RgSchErrInfo *errInfo; +#endif +{ + U32 idx; + RgSchRaCb *raCb; + + TRC2(rgSCHCfgRgrUeReset); + + + errInfo->errCause = RGSCHERR_CFG_RGR_UE_RESET; + + /* Setting BO of Each Logical Channel of the UE to 0 */ + for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; idx++) + { + if(ue->dl.lcCb[idx] != NULLP) + ue->dl.lcCb[idx]->bo = 0; + } + + /* Reset the totalBo */ + ue->totalBo = 0; + /* Call DRX module to stop all DRX timers */ + /* ccpu00129899 */ + if(ue->drxCb != NULLP) + { + (Void)rgSCHDrxUeDel(cell,ue); + } + + /* ccpu00140894- Stop TXMode transiition timer if it is running*/ + if (ue->txModeTransTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue); + ue->txModeTransCmplt =TRUE; + } + + /* ccpu00133470- Meas Gap should be released during RRC re-establishment */ + rgSCHMeasGapANRepUeDel(cell, ue, FALSE); + + /* Call Common scheduler which in turn will call specific scheduler for UE + * Reset*/ + rgSCHUtlUeReset(cell, ue); +#ifdef LTE_ADV + /*PCell which is at idx 0 is always active. Adding a line after the loop + *setting RGSCH_PCELL_INDEX to SCELL ACTIVE*/ + ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE; +#endif + + /* In case of back to back reestablishments, when this UE's + * previous ReEst is still in progress and has got RESET + * as part of new ReEst */ + if((raCb = rgSCHDbmGetRaCb(cell, ue->ueId)) != NULLP) + { + rgSCHRamDelRaCb(cell, raCb, FALSE); + } + /* Fix : syed set UE inactive in DL until UE is reinitialization completed */ + ue->dl.dlInactvMask |= RG_HQENT_INACTIVE; + ue->ul.ulInactvMask |= RG_HQENT_INACTIVE; + /* [ccpu00127141] Resetting TA related parameters */ + ue->dl.taCb.ta = RGSCH_NO_TA_RQD; + ue->dl.taCb.state = RGSCH_TA_IDLE; + + /*[ccpu00121813]-ADD-Initializing outstanding TA value */ + ue->dl.taCb.outStndngTa = FALSE; + ue->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD; + + if (ue->dl.taCb.cfgTaTmr) + { + rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr); + } + +#ifdef DL_LA + /* Resetting the Tx mode change factor on UE reset */ + ue->mimoInfo.txModUpChgFactor = 0; + ue->mimoInfo.txModDownChgFactor = 0; +#endif + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrUeReset */ + +/** + * @brief Handler for the cell delete request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrCellDel + * + * Processing Steps: + * - Fetch the cell control block. + * - Remove the cell control block from the hash list of cells. + * - Free the cell control block. + * - If successful, return ROK else return RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrDel *cellDelInfo + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrCellDel +( +RgSchCellCb *cell, +RgrDel *cellDelInfo, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrCellDel(cell, cellDelInfo, errInfo) +RgSchCellCb *cell; +RgrDel *cellDelInfo; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgRgrCellDel); + + + errInfo->errCause = RGSCHERR_CFG_RGR_CELL_DEL; + + if (cell->cellId != cellDelInfo->u.cellDel.cellId) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellDelInfo->u.cellDel.cellId, + "Cell does not exist"); + RETVALUE(RFAILED); + } + + /* Free the active cell */ + rgSCHCfgFreeCellCb(cell); + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrCellDel */ + + +/** + * @brief Handler for the UE delete request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrUeDel + * + * Processing Steps: + * - Fetch the UE control block. + * - Remove the UE control block from the hash list of UEs for the cell. + * - Free the UE control block. + * - If successful, return ROK else return RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrDel *ueDelInfo + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrUeDel +( +RgSchCellCb *cell, +RgrDel *ueDelInfo, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrUeDel(cell, ueDelInfo, errInfo) +RgSchCellCb *cell; +RgrDel *ueDelInfo; +RgSchErrInfo *errInfo; +#endif +{ + RgSchUeCb *ue; + RgSchRaCb *raCb; +#ifdef LTE_ADV + Inst inst = cell->instIdx; + RgSchCellCb *secCellCb = NULLP; +#endif + + TRC2(rgSCHCfgRgrUeDel); + errInfo->errCause = RGSCHERR_CFG_RGR_UE_DEL; + + if (cell->cellId != ueDelInfo->u.ueDel.cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueDelInfo->u.ueDel.cellId, + "Cell does not exist CRNTI:%d", + ueDelInfo->u.ueDel.crnti); + RETVALUE(RFAILED); + } + if ((ue = rgSCHDbmGetUeCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP) + { + if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,ueDelInfo->u.ueDel.cellId, + "RaCb does not exist for CRNTI:%d",ueDelInfo->u.ueDel.crnti); + RETVALUE(RFAILED); + } + else + { + /* This happens in case of Msg4 rejection */ + raCb->toDel = TRUE; + RETVALUE(ROK); + } + } + else + { +#ifdef LTE_ADV + if(ueDelInfo->u.ueScellRel.ueDelTypes & RGR_UE_SCELL_DEL_RECFG) + { + for(U8 idx = 0; idx < ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.numSCells; idx++) + { + if(NULLP != (secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, \ + ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellId))) + { + rgSCHUtlSndUeSCellDel2Mac(secCellCb, ue->ueId); + rgSCHSCellDelUeSCell(cell,ue,ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellIdx); + ue->numSCells--; + if ( ue->numSCells == 0) + { + ue->allocCmnUlPdcch = TRUE; + } + } + } + if (ue->numSCells == 0) + { + /* As there is no SCell left so DCI 0 size at UE specific search space + * will be recalculated as the CSI is reduced to 1 bit */ + rgSCHUtlUpdUeDciSize(cell, ue, FALSE); + } + } + else +#endif + { + /* Delete Ue from the UE list of CELL*/ + rgSCHDbmDelUeCb(cell, ue); + +#ifdef LTE_L2_MEAS + rgSCHDbmDelL2MUe(cell, ue); +#endif + + /* Call MeasGap and AckNakRep processing module */ + rgSCHMeasGapANRepUeDel(cell, ue, TRUE); + + /* ccpu00140894- Stop TXMode transiition timer if it is running*/ + if (ue->txModeTransTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue); + } + + /* Call DRX module to remove UEs from various + * lists it maintain + */ + /* ccpu00129899 */ + if(ue->drxCb != NULLP) + { + (Void)rgSCHDrxUeDel(cell,ue); + /* Free Ue */ + } + /*Fix: If RA CB exists, delete it*/ + if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) != NULLP) + { + /* Fix : syed RNTI was getting released twice, once by racb del + * and subsequently by ueDel. Let it get released by ueDel alone */ + rgSCHRamDelRaCb(cell, raCb, FALSE); + } +#ifdef EMTC_ENABLE + if(ue->isEmtcUe) + { + rgSCHEmtcUeDel(cell, ue); + } +#endif + + rgSCHCfgFreeUeCb(cell, ue); + + errInfo->errCause = RGSCHERR_NONE; + + } + RETVALUE(ROK); + } +} /* rgSCHCfgRgrUeDel */ + + +/** + * @brief Handler for the logical channel delete request from + * RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrLcDel + * + * Processing Steps: + * - Fetch the logical channel control block. + * - Free the logical channel control block. + * - If successful, return ROK else return RFAILED. + * + * @param[in] RgrDel *lcDelInfo + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLcDel +( +RgSchCellCb *cell, +RgrDel *lcDelInfo, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLcDel(cell, lcDelInfo, errInfo) +RgSchCellCb *cell; +RgrDel *lcDelInfo; +RgSchErrInfo *errInfo; +#endif +{ + RgSchUeCb *ue; + RgSchDlLcCb *dlLc; +#ifdef LTE_L2_MEAS + U8 lcId; + U8 idx; + RgSchUlLcCb *ulLc; +#endif + + TRC2(rgSCHCfgRgrLcDel); + + errInfo->errCause = RGSCHERR_CFG_RGR_LC_DEL; + + /* Fetch the Active cell */ + if (cell->cellId != lcDelInfo->u.lchDel.cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Cell does not exist %d", + lcDelInfo->u.lchDel.cellId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue */ + if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lchDel.crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, + "UE does not exist for CRNTI:%d LCID:%d", + lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); + RETVALUE(RFAILED); + } + if (lcDelInfo->u.lchDel.lcgId > 3) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, + "[%d]UEID:For LC %d, LCGid %d is invalid", + lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId, + lcDelInfo->u.lchDel.lcgId); + RETVALUE(RFAILED); + } + if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, lcDelInfo->u.lchDel.lcId)) + == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, + "LC does not exist for CRNTI:%d LCID:%d", + lcDelInfo->u.lchDel.crnti, lcDelInfo->u.lchDel.lcId); + RETVALUE(RFAILED); + } + rgSCHUtlRgrLcDel(cell, ue, lcDelInfo->u.lchDel.lcId,lcDelInfo->u.lchDel.lcgId); + + /* Reduce any pending bo from this LC(if any) + * from the UE's total BO */ + if(dlLc->bo) + { + if(ue->totalBo >= dlLc->bo) + { + ue->totalBo -= dlLc->bo; + } + else + { + ue->totalBo = 0; /* this scenario should not occur */ + } + } + rgSCHDbmDelDlDedLcCb(ue, dlLc); + rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); + +#ifdef LTE_L2_MEAS + lcId = lcDelInfo->u.lchDel.lcId; + if (TRUE == ue->ul.lcCb[lcId -1].isValid) + { + ulLc = &(ue->ul.lcCb[lcId -1]); + ue->ul.lcCb[lcId -1].isValid = FALSE; + + if((ulLc->qciCb->ulUeCount) && + (ue->ulActiveLCs & (1 << (ulLc->qciCb->qci -1)))) + { + ulLc->qciCb->ulUeCount--; + ue->ulActiveLCs &= ~(1 << (ulLc->qciCb->qci -1)); + } + /* Shifting LCs in LCG Array because of LC deletion */ + for (idx = ulLc->lcgArrIdx +1; idx < ulLc->lcg->numLch; + idx++) + { + ulLc->lcg->lcArray[idx -1] = + ulLc->lcg->lcArray[idx]; + ulLc->lcg->lcArray[idx -1]->lcgArrIdx = idx -1; + } + ulLc->lcg->numLch--; + ulLc->lcg->lcArray[idx -1] = NULLP; + } +#endif /* LTE_L2_MEAS */ + + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrLcDel */ + + + +/** + * @brief Handler for the logical channel delete request from + * RRM to MAC. + * + * @details + * + * Function : rgSCHCfgRgrLcgDel + * + * Processing Steps: + * - Fetch the logical channel control block. + * - Free the logical channel control block. + * - If successful, return ROK else return RFAILED. + * + * @param[in] RgrDel *lcDelInfo + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLcgDel +( +RgSchCellCb *cell, +RgrDel *lcDelInfo, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLcgDel(cell, lcDelInfo, errInfo) +RgSchCellCb *cell; +RgrDel *lcDelInfo; +RgSchErrInfo *errInfo; +#endif +{ + RgSchUeCb *ue = NULLP; +#ifdef LTE_L2_MEAS + U8 lcCount = 0; +#endif + U8 lcgId = 0; + + TRC2(rgSCHCfgRgrLcgDel); + + + lcgId = lcDelInfo->u.lcgDel.lcgId; + + errInfo->errCause = RGSCHERR_CFG_RGR_LCG_DEL; + + /* Fetch the Active cell */ + if (cell->cellId != lcDelInfo->u.lcgDel.cellId) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, + "CELL does not exist for CRNTI:%d LCGID:%d", + lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue */ + if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lcgDel.crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcDelInfo->u.lchDel.cellId, + "UE does not exist for CRNTI:%d LCGID:%d", + lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId); + RETVALUE(RFAILED); + } + + /* set lcgId in UEs lcg cntrl blk to invalid */ + rgSCHUtlRgrLcgDel(cell, ue, lcgId); + ue->ul.lcgArr[lcgId].lcgId = RGSCH_INVALID_LCG_ID; + +#ifdef LTE_L2_MEAS + /* Since LCs are being deleted, if any of them are contributing + to Active UE count for a QCI, decrease the count */ + for (lcCount =0; (lcCount < RGSCH_MAX_LC_PER_UE) && + (lcCount < ue->ul.lcgArr[lcgId].numLch) ; lcCount++) + { + if (ue->ul.lcgArr[lcgId].lcArray[lcCount]) + { + if((ue->ul.lcgArr[lcgId]. + lcArray[lcCount]->qciCb->ulUeCount) && + (ue->ulActiveLCs & + (1 << ((ue->ul.lcgArr[lcgId]. + lcArray[lcCount])->qciCb->qci -1)))) + { + /* L2_COUNTERS */ + ue->ul.lcgArr[lcgId]. + lcArray[lcCount]->qciCb->ulUeCount--; + ue->ulActiveLCs &= ~(1 << + (ue->ul.lcgArr[lcgId]. + lcArray[lcCount]->qciCb->qci -1)); + } + } + } +#endif + + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); +} /* rgSCHCfgRgrLcgDel */ + + + +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrLcCfg + * + * + * Desc : Validates dedicated logical channel configuration recieved from RRM. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrLcCfg +( +Inst inst, +RgrLchCfg *lcCfg, +RgSchCellCb **cell, +RgSchUeCb **ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrLcCfg(inst, lcCfg, cell, ue, errInfo) +Inst inst; +RgrLchCfg *lcCfg; +RgSchCellCb **cell; +RgSchUeCb **ue; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrLcCfg); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LC_CFG; + + if (((*cell) == NULLP) || + ((*cell)->cellId != lcCfg->cellId)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Cell does not existi for " + "CRNTI:%d LCID:%d",lcCfg->crnti, lcCfg->lcId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue */ + if ((*ue = rgSCHDbmGetUeCb(*cell, lcCfg->crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"UE does not exist for dedicated" + " logical channel CRNTI:%d LCID:%d", lcCfg->crnti, lcCfg->lcId); + RETVALUE(RFAILED); + } + + /* Validate logical channel Id */ + if ((lcCfg->lcId < RGSCH_DEDLC_MIN_LCID) + ||(lcCfg->lcId > RGSCH_DEDLC_MAX_LCID)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid logical channel Id:%d" + "for CRNTI:%d",lcCfg->lcId,lcCfg->crnti); + RETVALUE(RFAILED); + } + + if (lcCfg->lcType != CM_LTE_LCH_DTCH && lcCfg->lcType != CM_LTE_LCH_DCCH) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid logical channel Type %d" + "CRNTI:%d LCID:%d",lcCfg->lcType,lcCfg->crnti, lcCfg->lcId); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrLcCfg */ + +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrLcgCfg + * + * + * Desc : Validates dedicated logical channel group configuration recieved from RRM. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrLcgCfg +( +Inst inst, +RgrLcgCfg *lcgCfg, +RgSchCellCb **cell, +RgSchUeCb **ue, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrLcgCfg(inst, lcgCfg, cell, ue, errInfo) +Inst inst; +RgrLcgCfg *lcgCfg; +RgSchCellCb **cell; +RgSchUeCb **ue; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrLcgCfg); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LCG_CFG; + + if (((*cell) == NULLP) || + ((*cell)->cellId != lcgCfg->cellId)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgCfg->cellId,"Cell does not exist for" + "CRNTI:%d LCGID:%d",lcgCfg->crnti,lcgCfg->ulInfo.lcgId); + RETVALUE(RFAILED); + } + + /* Fetch the Ue */ + if ((*ue = rgSCHDbmGetUeCb(*cell, lcgCfg->crnti)) == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcgCfg->cellId,"UE does not exist for " + "dedicated logical channel CRNTI:%d LCGID:%d", lcgCfg->crnti, lcgCfg->ulInfo.lcgId); + RETVALUE(RFAILED); + } + + if ((lcgCfg->ulInfo.gbr != 0) && (lcgCfg->ulInfo.mbr < lcgCfg->ulInfo.gbr)) + { + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrLcgCfg */ + + +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrCellPwrCfg + * + * Desc : Validates cell power configuration. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg +( +Inst inst, +RgrCellCfg *cellCfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHCfgVldtRgrCellPwrCfg(inst, cellCfg, errInfo) +Inst inst; +RgrCellCfg *cellCfg; +RgSchErrInfo *errInfo; +#endif +{ + UNUSED(inst); + UNUSED(cellCfg); + UNUSED(errInfo); + + TRC2(rgSCHCfgVldtRgrCellPwrCfg); + + /* This function does nothing now, placeholder for + * subsequent power config validations that may be needed */ + + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrCellPwrCfg */ + + +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrCmnLcCfg + * + * + * Desc : Validates common logical channel configuration recieved from RRM. + * + * @param[in] Inst inst + * @param[in] RgrCellCfg *cellCfg + * @param[out] RgSchErrInfo *errInfo + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg +( +Inst inst, +RgrCellCfg *cellCfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHCfgVldtRgrCmnLcCfg(inst, cellCfg, errInfo) +Inst inst; +RgrCellCfg *cellCfg; +RgSchErrInfo *errInfo; +#endif +{ + U8 idx; + RgrCmnLchCfg *lcCfg; + U8 dirVld = FALSE; + U8 bitMask = 0x00; + U8 cnt=0; + + TRC2(rgSCHCfgVldtRgrCmnLcCfg); + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CMN_LC_CFG; + + for (idx = 0; idx < cellCfg->numCmnLcs; idx++) + { + lcCfg = &(cellCfg->cmnLcCfg[idx]); + /* Validate downlink info */ + if (lcCfg->dir & RGR_DIR_TX) + { + if (lcCfg->lcType == CM_LTE_LCH_BCCH) + { + if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH) + { + if(cnt == 0) + { + bitMask |= RGSCH_BCCH_DLSCH_CFG1; + cnt++; + } + else + { + + if(( + (cellCfg->siCfg.siWinSize == 1) || + (cellCfg->siCfg.siWinSize == 2) || + (cellCfg->siCfg.siWinSize == 5) || + (cellCfg->siCfg.siWinSize == 10) || + (cellCfg->siCfg.siWinSize == 15) || + (cellCfg->siCfg.siWinSize == 20) || + (cellCfg->siCfg.siWinSize == 40)) && + (cellCfg->siCfg.retxCnt>0) + ) + { + bitMask |= RGSCH_BCCH_DLSCH_CFG2; + } + else + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, + "Invalid si config for cell"); + RETVALUE(RFAILED); + } + } + } + else if (lcCfg->dlTrchType == CM_LTE_TRCH_BCH) + { + bitMask |= RGSCH_BCCH_BCH_CFG; + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId, + "Invalid transport channel %d for cell", lcCfg->dlTrchType); + RETVALUE(RFAILED); + } + } + else if (lcCfg->lcType == CM_LTE_LCH_PCCH) + { + bitMask |= RGSCH_PCCH_CFG; + } + else if (lcCfg->lcType == CM_LTE_LCH_CCCH) + { + bitMask |= RGSCH_DL_CCCH_CFG; + } + dirVld = TRUE; + } + + /* Validate uplink info */ + if (lcCfg->dir & RGR_DIR_RX) + { + /* Uplink CCCH */ + if (lcCfg->lcType != CM_LTE_LCH_CCCH) + { + RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId,"Invalid UL common lcType %d " + "for cell", lcCfg->lcType); + RETVALUE(RFAILED); + } + else + { + bitMask |= RGSCH_UL_CCCH_CFG; + } + dirVld = TRUE; + } + + /* Invalid direction */ + if (!dirVld) + { + RLOG_ARG1(L_ERROR,DBG_CELLID, cellCfg->cellId,"Invalid Direction %d", + lcCfg->dir); + RETVALUE(RFAILED); + } + } + if (bitMask != RGSCH_CELL_ACTIVE_CFG) + { + RLOG_ARG0(L_ERROR,DBG_CELLID, cellCfg->cellId, + "Invalid Common channel config for cell"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrCmnLcCfg */ + + +/*********************************************************** + * + * Func : rgSCHCfgVldtUeCqiModeCfg + * + * + * Desc : Validates UE CQI modes Configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg +( +RgSchCellCb *cell, +RgrUeDlCqiCfg *ueDlCqiCfg +) +#else +PRIVATE S16 rgSCHCfgVldtUeCqiModeCfg(cell, ueDlCqiCfg) +RgSchCellCb *cell; +RgrUeDlCqiCfg *ueDlCqiCfg; +#endif +{ + + TRC2(rgSCHCfgVldtUeCqiModeCfg) + +#ifndef TFU_UPGRADE + if((ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx < 1) || + (ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx > 1024)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid Periodic CQI Info"); + RETVALUE(RFAILED); + } +#endif + /* Validate UE Aperiodic CQI mode */ + if ((ueDlCqiCfg->aprdCqiCfg.pres == TRUE) && + ((ueDlCqiCfg->aprdCqiCfg.aprdModeEnum > RGR_APRD_CQI_MOD31) || + (cell->bwCfg.dlTotalBw <= 7))) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid Aperiodic mode config for DL CQI", + ueDlCqiCfg->aprdCqiCfg.aprdModeEnum); + RETVALUE(RFAILED); + } +#ifndef TFU_UPGRADE + /* Validate UE Periodic CQI mode */ + if (ueDlCqiCfg->prdCqiCfg.prdModeEnum > RGR_PRD_CQI_MOD21) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid periodic mode config for DL CQI", + ueDlCqiCfg->prdCqiCfg.prdModeEnum); + RETVALUE(RFAILED); + } + /* Validate K value in periodic CQI Config */ + if(((ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD20) || + (ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD21)) && + ((ueDlCqiCfg->prdCqiCfg.k < 1)|| + (ueDlCqiCfg->prdCqiCfg.k > 4))) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid K for Subband CQI reporting"); + RETVALUE(RFAILED); + } +#else + if ((ueDlCqiCfg->prdCqiCfg.type == 1) && + (ueDlCqiCfg->prdCqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid periodic mode config for DL CQI", + ueDlCqiCfg->prdCqiCfg.cqiSetup.prdModeEnum); + RETVALUE(RFAILED); + } + +#endif + + RETVALUE(ROK); + +} +/*********************************************************** + * + * Func : rgSCHCfgVldtUeMeasGapAckNakRepCfg + * + * + * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg +( +RgSchCellCb *cell, +RgrUeCfg *ueCfg +) +#else +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg(cell, ueCfg) +RgSchCellCb *cell; +RgrUeCfg *ueCfg; +#endif +{ + + TRC2(rgSCHCfgVldtUeMeasGapAckNakRepCfg) + +#ifdef LTE_TDD + if ((ueCfg->ackNackModeEnum == RGR_TDD_ACKNACK_MODE_MULT) && + (ueCfg->ueAckNackCfg.isAckNackEnabled == TRUE)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"TDD ACK NACK Multiplexing Mode" + "is not allowed when Ack/Nack is Enabled: %d CRNTI:%d", + ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti); + RETVALUE(RFAILED); + } +#endif /* LTE_TDD */ + /* Validate AckNackRep Factor */ + if((ueCfg->ueAckNackCfg.isAckNackEnabled == FALSE) && + (!ueCfg->ueMesGapCfg.isMesGapEnabled)) + { + RETVALUE(ROK); + } + + if(ueCfg->ueAckNackCfg.isAckNackEnabled) + { + if ( (ueCfg->ueAckNackCfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2) + || (ueCfg->ueAckNackCfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId, "Invalid ACK NACK REP Factor:%d CRNTI:%d", + ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti); + RETVALUE(RFAILED); + } + } + if(ueCfg->ueMesGapCfg.isMesGapEnabled) + { + switch(ueCfg->ueMesGapCfg.gapPrd) + { + case RG_MEAS_GAPPRD_40: + if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_40) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Offset:%d CRNTI:%d", + ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti); + RETVALUE(RFAILED); + } + break; + case RG_MEAS_GAPPRD_80: + if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_80) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Offset:%d CRNTI:%d", + ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti); + RETVALUE(RFAILED); + } + break; + default: + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueCfg->cellId,"Invalid GAP Periodicity Settings:%d" + "CRNTI:%d", ueCfg->ueMesGapCfg.gapPrd,ueCfg->crnti); + RETVALUE(RFAILED); + } + } + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtUeMeasGapAckNakRepCfg*/ + + +/*********************************************************** + * + * Func : rgSCHCfgVldtUeMeasGapAckNakRepRecfg + * + * + * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg +( +RgSchCellCb *cell, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg(cell, ueRecfg) +RgSchCellCb *cell; +RgrUeRecfg *ueRecfg; +#endif +{ + + TRC2(rgSCHCfgVldtUeMeasGapAckNakRepRecfg) + if((ueRecfg->ueAckNackRecfg.isAckNackEnabled == FALSE) && + (!ueRecfg->ueMeasGapRecfg.isMesGapEnabled)) + { + RETVALUE(ROK); + } + + if(ueRecfg->ueAckNackRecfg.isAckNackEnabled ) + { + /* Validate AckNackRep Factor */ + if ( (ueRecfg->ueAckNackRecfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2) + || (ueRecfg->ueAckNackRecfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid ACK NACK REP Factor:%d" + "NEW CRNTI:%d",ueRecfg->ueAckNackRecfg.ackNackRepFactor,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + if(ueRecfg->ueMeasGapRecfg.isMesGapEnabled) + { + switch(ueRecfg->ueMeasGapRecfg.gapPrd) + { + case RG_MEAS_GAPPRD_40: + if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_40) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Offset:%d" + "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + break; + case RG_MEAS_GAPPRD_80: + if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_80) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Offset:%d" + "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + break; + default: + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid GAP Periodicity Settings:%d" + "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapPrd,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtUeMeasGapAckNakRepRecfg*/ + +#ifdef LTEMAC_SPS +/*********************************************************** + * + * Func : rgSCHCfgVldtUeDlSpsCfg + * + * + * Desc : Validates UE's DL SPS configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg +( +RgSchCellCb *cell, +RgrUeSpsDlCfg *dlSpsCfg +) +#else +PRIVATE S16 rgSCHCfgVldtUeDlSpsCfg(cell, dlSpsCfg) +RgSchCellCb *cell; +RgrUeSpsDlCfg *dlSpsCfg; +#endif +{ + + U8 idx = 0; + + TRC2(rgSCHCfgVldtUeDlSpsCfg); + + /* peridicity validation done in SPS module */ + if ((dlSpsCfg->numPucchVal > RG_SCH_MAX_NUM_N1PUCCH_PER_UE) || + (dlSpsCfg->numPucchVal == 0)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid number of n1Pucch values" + " in DL SPS Config"); + RETVALUE(RFAILED); + } + + for (idx = 0; idx < dlSpsCfg->numPucchVal; ++idx) + { + if (dlSpsCfg->n1PucchVal[idx] > RG_SCH_MAX_N1PUCCH_VAL) + { +#ifdef ALIGN_64BIT + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid N1Pucch value" + " in DL SPS Config %u", dlSpsCfg->n1PucchVal[idx]); +#else + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid N1Pucch value" + " in DL SPS Config %lu", dlSpsCfg->n1PucchVal[idx]); +#endif + RETVALUE(RFAILED); + } + } + /* SPS_TODO: check will change for TDD */ + if ((dlSpsCfg->numSpsHqProc == 0) || + (dlSpsCfg->numSpsHqProc > RGSCH_MAX_DL_HQ_PROC)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid number of SPS HARQ procs" + " in DL SPS Config"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtDlSpsCfg */ +#endif /* LTEMAC_SPS */ + +/*********************************************************** + * + * Func : rgSCHCfgVldtUePwrCfg + * + * + * Desc : Validates UE Group power configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUePwrCfg +( +RgSchCellCb *cell, +RgrUeUlPwrCfg *pwrCfg +) +#else +PRIVATE S16 rgSCHCfgVldtUePwrCfg(cell, pwrCfg) +RgSchCellCb *cell; +RgrUeUlPwrCfg *pwrCfg; +#endif +{ + + TRC2(rgSCHCfgVldtUePwrCfg); + + /* Group power control works only in accumulated mode */ + if (!pwrCfg->isAccumulated) + { + /* Fix */ + if (pwrCfg->uePuschPwr.pres) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Accumulation configutation" + " not in sync with group power configuration"); + RETVALUE(RFAILED); + } + } + + if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePuschPwr) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid PUSCH Group power" + " configuration"); + RETVALUE(RFAILED); + } + if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePucchPwr) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid PUSCH Group power" + " configuration"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtUePwrCfg */ + +/*********************************************************** + * + * Func : rgSCHCfgVldtUeGrpPwrCfg + * + * + * Desc : Validates UE Group power configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg +( +RgSchCellCb *cell, +RgrUeGrpPwrCfg *grpPwrCfg +) +#else +PRIVATE S16 rgSCHCfgVldtUeGrpPwrCfg(cell, grpPwrCfg) +RgSchCellCb *cell; +RgrUeGrpPwrCfg *grpPwrCfg; +#endif +{ + + TRC2(rgSCHCfgVldtUeGrpPwrCfg); + + if ((grpPwrCfg->pres) && + (((grpPwrCfg->tpcRnti > cell->rntiDb.rntiStart) && + ((grpPwrCfg->tpcRnti < + (cell->rntiDb.rntiStart + cell->rntiDb.maxRntis)))))) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Uplink Group power " + "configuration"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtUeGrpPwrCfg */ + +#ifdef LTEMAC_SPS +/*********************************************************** + * + * Func : rgSCHCfgVldtSpsReCfg + * + * + * Desc : Validates UE SPS and other SPS dependent + * configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtSpsReCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE S16 rgSCHCfgVldtSpsReCfg(cell, ue, ueRecfg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +#endif +{ + + TRC2(rgSCHCfgVldtSpsReCfg); + if ((ueRecfg->ueRecfgTypes & RGR_UE_DLSPS_RECFG) && + (ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled)) + { + /* Validating SPS RNTI */ + if (((ueRecfg->ueSpsRecfg.spsRnti >= cell->rntiDb.rntiStart) && + (ueRecfg->ueSpsRecfg.spsRnti<= + (cell->rntiDb.rntiStart+cell->rntiDb.maxRntis)))|| + (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_SI_RNTI) || + (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_P_RNTI)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid SPS RNTI " + " in DL SPS Recfg OLD CRNTI:%d NEW CCRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + if (rgSCHCfgVldtUeDlSpsCfg(cell, &ueRecfg->ueSpsRecfg.dlSpsCfg) != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid DL SPS configuration" + " for the OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + +#if RG_SPS_UNUSED + if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled) + { + if (ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) + { + /* ccpu00117035 - MOD - changed instIdx to inst */ + /* ccpu00117035 - MOD - changed ueID to oldCrnti*/ + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, + " DRX reconfig not supported DL SPS enabled for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } +#endif +/* ccpu00117627 - ADD - SPS recfg validation against HDFDD */ +#ifdef LTEMAC_HDFDD + if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled) + { + if(ue->hdFddEnbld == TRUE) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, + "DL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } + if(ueRecfg->ueSpsRecfg.ulSpsCfg.isUlSpsEnabled) + { + if(ue->hdFddEnbld == TRUE) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,ueRecfg->cellId, + "UL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d", + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + } +#endif + + RETVALUE(ROK); +} /*rgSCHCfgVldtSpsReCfg*/ +#endif + +#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) +/*********************************************************** + * + * Func : rgSCHCfgVldtCqiReptReCfg + * + * + * Desc : Validates UE CQI report for DL Power control + * configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtCqiReptReCfg +( +RgSchCellCb *cell, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE S16 rgSCHCfgVldtCqiReptReCfg(cell, ueRecfg) +RgSchCellCb *cell; +RgrUeRecfg *ueRecfg; +#endif +{ + + TRC2(rgSCHCfgVldtCqiReptReCfg); + /* Validate DL Power Control Config parameters */ + if (ueRecfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalide numColltdCqiRept," + "MAX supported %d for OLD CRNTI:%d NEW CRNTI:%d",RGR_CQIRPTS_MAXN, + ueRecfg->oldCrnti,ueRecfg->newCrnti); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /*rgSCHCfgVldtCqiReptReCfg*/ +#endif + +/*********************************************************** + * + * Func : rgSCHCfgRgrLcChfg + * + * + * Desc : Handles dedicated logical channel configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLchCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrLchCfg *lcCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLchCfg(cell, ue, lcCfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrLchCfg *lcCfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + RgSchDlLcCb *dlLc = NULLP; + Inst inst = cell->instIdx; +#ifdef LTE_L2_MEAS + RgSchUlLcCb *ulLc; +#endif + + TRC2(rgSCHCfgRgrLchCfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_DED_LC_CFG; + + /* Allocate the downlink logical channel control block */ + if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&dlLc, + sizeof(RgSchDlLcCb))) != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Memory allocation FAILED for " + "Downlink LCId:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti); + RETVALUE(RFAILED); + } + if ((U8 *)dlLc == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,lcCfg->cellId,"Memory allocation FAILED for " + "Downlink LCID:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti); + RETVALUE(RFAILED); + } + dlLc->lcId = lcCfg->lcId; +#ifdef LTE_ADV + rgSCHLaaLcCfg(cell, dlLc, lcCfg); +#endif + + rgSCHDbmInsDlDedLcCb(ue, dlLc); + + ret = rgSCHUtlRgrLcCfg(cell, ue, dlLc, lcCfg, errInfo); + + if (ret != ROK) + { + /* ROLLBACK */ + if (dlLc) + { + rgSCHDbmDelDlDedLcCb(ue, dlLc); + rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); + } + + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " + "configuration failed at SCH:UEID:%d LCID:%d CRNTI:%d", + ue->ueId, lcCfg->lcId,lcCfg->crnti); + RETVALUE(RFAILED); + } +#ifdef LTE_L2_MEAS + RGSCH_ARRAY_BOUND_CHECK(inst, ue->ul.lcCb, (lcCfg->lcId -1)); + if ( !lcCfg->lcId || + (TRUE == ue->ul.lcCb[lcCfg->lcId -1].isValid)) + { + /* ROLLBACK */ + if (dlLc) + { + rgSCHDbmDelDlDedLcCb(ue, dlLc); + rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); + } + + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " + "configuration failed at SCH: UL LC CB already existing" + " UEID:%d LCID:%d CRNTI:%d", + ue->ueId, lcCfg->lcId,lcCfg->crnti); + RETVALUE(RFAILED); + } + + /* Create UL LC context to maintain LCG to LC mapping and + LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE + PER QCI */ + ue->ul.lcCb[lcCfg->lcId -1].isValid = TRUE; + ulLc = &(ue->ul.lcCb[lcCfg->lcId -1]); + + ulLc->lcId = lcCfg->lcId; + ulLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]); + ulLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci; + ue->ul.lcgArr[lcCfg->lcgId].lcArray[ue->ul.lcgArr[lcCfg->lcgId].numLch] = ulLc; + ulLc->lcg = &ue->ul.lcgArr[lcCfg->lcgId]; + ulLc->lcgArrIdx = ue->ul.lcgArr[lcCfg->lcgId].numLch; + ue->ul.lcgArr[lcCfg->lcgId].numLch++; + + dlLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]); + dlLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci; + if(lcCfg->lcType == CM_LTE_LCH_DTCH) + { + rgSchAddToL2Meas(cell,dlLc); /*LTE_L2_MEAS_PHASE2*/ + } +#endif /* LTE_L2_MEAS */ + + RETVALUE(ROK); +} /* rgSCHCfgRgrLchCfg */ + +/*********************************************************** + * + * Func : rgSCHCfgRgrLcgCfg + * + * + * Desc : Handles dedicated logical channel group configuration + * recieved from RRM. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRgrLcgCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrLcgCfg *lcgCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgRgrLcgCfg(cell, ue, lcgCfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrLcgCfg *lcgCfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret = ROK; + +#ifdef RG_UNUSED +//#ifdef LTE_L2_MEAS + U32 idx; + RgSchUlLcCb *ulLc; +#endif + TRC2(rgSCHCfgRgrLcgCfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_DED_LCG_CFG; + + ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = lcgCfg->ulInfo.lcgId; + + ret = rgSCHUtlRgrLcgCfg(cell, ue, lcgCfg, errInfo); + if (ret != ROK) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Dedicated logical channel " + "configuration failed at SCH: UEID:%d LCGID:%d CRNTI:%d", + ue->ueId, lcgCfg->ulInfo.lcgId,lcgCfg->crnti); + /* Roll back lcgCfg */ + ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = RGSCH_INVALID_LCG_ID; + rgSCHUtlRgrLcgDel(cell, ue, lcgCfg->ulInfo.lcgId); + RETVALUE(RFAILED); + } +#ifdef RG_UNUSED +//#ifdef LTE_L2_MEAS + /* Copy all info of UL LCH in cfg to ulLcgCb */ + for (idx = 0; idx < lcgCfg->ulInfo.numLch; idx++) + { + /* Allocate the uplink logical channel control block */ + if((ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&ulLc, + sizeof(RgSchUlLcCb))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Memory allocation FAILED for "); + RETVALUE(RFAILED); + } + if ((U8 *)ulLc == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Memory allocation FAILED for "); + RETVALUE(RFAILED); + } + /* Create UL LC context to maintain LCG to LC mapping and + LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE + PER QCI */ + ulLc->lcId = lcgCfg->ulInfo.lchUlCfg[idx].lcId; + ulLc->qciCb = &(cell->qciArray[lcgCfg->ulInfo.lchUlCfg[idx].qci]); + ulLc->qciCb->qci = lcgCfg->ulInfo.lchUlCfg[idx].qci; + ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcArray[idx] = ulLc; + /* L2_COUNTERS */ + ue->ul.lcCb[ulLc->lcId -1] = ulLc; + ulLc->lcg = &ue->ul.lcgArr[lcgCfg->ulInfo.lcgId]; + ulLc->lcgArrIdx = idx; + } + ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].numLch = lcgCfg->ulInfo.numLch; +#endif /* LTE_L2_MEAS */ + + RETVALUE(ROK); +} /* rgSCHCfgRgrLcgCfg */ + + + +/*********************************************************** + * + * Func : rgSCHCfgRgrCmnLcCfg + * + * + * Desc : Handles dedicated logical channel configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgRgrCmnLcCfg +( +RgSchCellCb *cell, +RgrCmnLchCfg *lcCfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHCfgRgrCmnLcCfg(cell, lcCfg, errInfo) +RgSchCellCb *cell; +RgrCmnLchCfg *lcCfg; +RgSchErrInfo *errInfo; +#endif +{ + RgSchClcDlLcCb cmnLcCb; + TRC2(rgSCHCfgRgrCmnLcCfg); + + errInfo->errCause = RGSCHERR_CFG_RGR_CMN_LC_CFG; + + cmMemset((U8 *)&cmnLcCb, 0, sizeof(cmnLcCb)); + + /* Handle configuration for CCCH/BCCH/PCCH */ + if (lcCfg->lcType == CM_LTE_LCH_CCCH) + { + /* UL and DL CCCH configuration */ + if (lcCfg->dir & RGR_DIR_TX) + { + cell->dlCcchId = lcCfg->lcId; + } + + if (lcCfg->dir & RGR_DIR_RX) + { + cell->ulCcchId = lcCfg->lcId; + } + } + else + { + cmnLcCb.lcId = lcCfg->lcId; + rgSCHDbmInitCmnLcBoLst(&cmnLcCb); + if (lcCfg->lcType == CM_LTE_LCH_BCCH) + { + /* BCCH on BCH and DLSCH configuration */ + if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH) + { + rgSCHDbmInsBcchOnDlsch(cell, &cmnLcCb); + } + else + { + rgSCHDbmInsBcchOnBch(cell, &cmnLcCb); + } + } + else /* PCCH configuration */ + { + rgSCHDbmInsPcch(cell, &cmnLcCb); + } + } + + RETVALUE(ROK); +} /* rgSCHCfgRgrCmnLcCfg */ + + + +/*********************************************************** + * + * Func : rgSCHCfgFreeDlDedLcCb + * + * + * Desc : + * - Processing Steps: + * - Frees downlink dedicated logical channel control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeDlDedLcCb +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc +) +#else +PRIVATE Void rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +#endif +{ + Inst inst = cell->instIdx; + TRC2(rgSCHCfgFreeDlDedLcCb); + + rgSCHUtlFreeDlLc(cell, ue, dlLc); + + /* De-allocate the Cb */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&dlLc, sizeof(*dlLc)); + + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeDlDedLcCb */ + + +/*********************************************************** + * + * Func : rgSCHCfgFreeDlCmnLcCb + * + * + * Desc : + * - Processing Steps: + * - Frees downlink common logical channel control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeDlCmnLcCb +( +RgSchClcDlLcCb *cmnDlLc +) +#else +PRIVATE Void rgSCHCfgFreeDlCmnLcCb(cmnDlLc) +RgSchClcDlLcCb *cmnDlLc; +#endif +{ + TRC2(rgSCHCfgFreeDlCmnLcCb); + + cmMemset((U8*)cmnDlLc, 0, sizeof(*cmnDlLc)); + cmnDlLc->lcId = RGSCH_INVALID_LC_ID; + RETVOID; +} /* rgSCHCfgFreeDlCmnLcCb */ + + +/*********************************************************** + * + * Func : rgSCHCfgFreeCellCb + * + * + * Desc : + * - Processing Steps: + * - Frees scheduler cell control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCfgFreeCellCb +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCfgFreeCellCb(cell) +RgSchCellCb *cell; +#endif +{ + Inst inst = cell->instIdx; + CmLList *node; + Buffer *pdu; + RgSchWarningSiInfo *warningSi; + RgSchWarningSiPdu *warningSiPdu; + U8 idx; + + TRC2(rgSCHCfgFreeCellCb); + /* ccpu00132385- SI Warning PDUs which are not processed need to be deleted */ + /* Search for used index in WarningSi */ + for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) + { + if(cell->siCb.warningSi[idx].siId == 0) + continue; + cell->siCb.siCtx.siId = cell->siCb.warningSi[idx].siId; + warningSi = (RgSchWarningSiInfo *) cell->siCb. + siArray[cell->siCb.siCtx.siId-1].si; + if(warningSi != NULLP) + { + /* ccpu00136659: CMAS ETWS design change */ + while (CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node)) + { + warningSiPdu = (RgSchWarningSiPdu *)node->node; + pdu = warningSiPdu->pdu; + /* ccpu00136659: CMAS ETWS design change */ + cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node); + RGSCH_FREE_MSG(pdu); + } + cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP; + } + } + /* Free lists of the cell */ + rgSCHCfgFreeUeLst(cell); +#ifdef LTEMAC_SPS + rgSCHCfgFreeSpsUeLst(cell); +#endif /* LTEMAC_SPS */ +#ifdef EMTC_ENABLE + if ( TRUE == cell->emtcEnable ) + { + rgSCHEmtcCellDel(cell); + } +#endif + rgSCHRamFreeCell(cell); + + rgSCHDbmRntiDbDeInit(cell); + /* Deallocate the subframe allocation information */ + rgSCHUtlPutSfAlloc(cell); + rgSCHUtlFreeCell(cell); + + rgSCHCfgFreeRgrCfgLst(cell); + rgSCHCfgFreeCmnLcLst(cell); + + rgSCHUtlPutRlsHqAlloc(cell); + +#ifdef LTE_TDD + rgSCHDbmDeInitUeTfuPendLst(cell); +#endif /* LTE_TDD */ + +#ifdef RGR_SI_SCH + rgSCHUtlPutSiInfo(cell); +#endif/*RGR_SI_SCH*/ + + (Void)rgSCHDrxCellDel(cell); + + rgSCHUtlFreeSBuf(inst, (Data**)&(cell->dynCfiCb.cceFailSamples), + (cell->dynCfiCb.numFailSamples * sizeof(U16))); + +#ifdef TENB_STATS + TSL2DeallocCellStatsBlk(cell->cellId); +#endif + +#ifdef LTE_ADV + /* LAA_SCELL: Trigger the De-Init function for the LAA Module */ + rgSCHLaaSCellCbDeInit(cell); +#endif + +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + rgSCHEmtcCellFree(cell); + } +#endif + /* De-allocate the Cell */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&cell, sizeof(*cell)); + + + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeCellCb */ + + +/*********************************************************** + * + * Func : rgSCHCfgFreeUeCb + * + * + * Desc : + * - Processing Steps: + * - Frees UE control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeUeCb +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCfgFreeUeCb(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + RgUeUlHqCb *ulHqEnt; + RgSchDlLcCb *dlLc; + Inst inst = cell->instIdx; + U8 lcCnt; + U8 lcgId; + TRC2(rgSCHCfgFreeUeCb); + + /* Free all logical channel info per UE */ + while((dlLc = rgSCHDbmGetNextDlDedLcCb(ue, NULLP)) != NULLP) + { + rgSCHDbmDelDlDedLcCb(ue, dlLc); + rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc); + } + for (lcCnt =0; lcCntul.lcCb[lcCnt].isValid == TRUE) + { + lcgId = ue->ul.lcCb[lcCnt].lcg->lcgId; + if (lcgId <=3) + { + rgSCHUtlRgrLcDel(cell, ue, ue->ul.lcCb[lcCnt].lcId,lcgId); + ue->ul.lcCb[lcCnt].isValid = FALSE; + } + } + } + + ulHqEnt = &(ueUl->hqEnt); + /* Free Scheduler specific information per UE */ + rgSCHUtlFreeUe(cell, ue); + + /* Free Uplink HARQ specific information per UE */ + rgSCHUhmFreeUe(cell, ulHqEnt); + + if ( ue->drxCb != NULLP) + { + /* free drxCb */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(ue->drxCb)), + sizeof(RgSchDrxUeCb)); + } + + ue->drxCb = (RgSchDrxUeCb *)NULLP; + /* Free Downlink HARQ specific information per UE */ + rgSCHDhmFreeUe(ue); + /* Release the RNTI */ + if (ue->rntiLnk) + { + rgSCHUtlRlsRnti(cell, ue->rntiLnk, FALSE, 0); + } + else + { + /* Fix : syed HO UE does not have a valid ue->rntiLnk */ + /* Just indicate to MAC, no need to release at SCH */ + rgSCHUtlIndRntiRls2Mac(cell, ue->ueId, FALSE, 0); + } +/* rg009.201. Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE + rgSCHCfgPCqiSrsSrUeDel(cell,ue); +#endif +#ifdef LTEMAC_HDFDD + rgSCHHdFddUeDel(cell, ue); +#endif +#ifdef TENB_STATS + if (ue->tenbStats) + { + TSL2DeallocUeStatsBlk(ue->ueId, ue->tenbStats); + } +#endif + + /* CA TODO Some handling needed while SCell Delete*/ +#ifdef LTE_ADV + /* Delete the UE from the PCell secCellActCeLst*/ + rgSCHSCellRmvFrmActLst(cell, ue); + rgSCHSCellDelUe(cell,ue); +#endif + +#ifdef LTE_ADV + rgSCHLaaDeInitDlRbAllocCb(cell, &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb); +#endif + + rgSCHUtlFreeSBuf(inst, (Data **)&ue->cellInfo[0], sizeof(RgSchUeCellInfo)); + /* De-allocate the Ue */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ +#ifdef EMTC_ENABLE + if(ue->isEmtcUe) + { + rgSCHEmtcUeInfoFree(cell, ue); + } +#endif + rgSCHUtlFreeSBuf(inst, (Data **)&ue, sizeof(*ue)); + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeUeCb */ + +/*********************************************************** + * + * Func : rgSCHCfgFreeRgrCfgLst + * + * + * Desc : + * - Processing Steps: + * - Frees configuration lists in cell control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeRgrCfgLst +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCfgFreeRgrCfgLst(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCfgElem *rgCfgElem; + Inst inst = cell->instIdx; + + TRC2(rgSCHCfgFreeRgrCfgLst); + + /* Free CURRENT RGR cfg list */ + while ((rgCfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP) + { + rgSCHDbmDelCrntRgrCfgElem(cell, rgCfgElem); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem)); + } + + /* Free PENDING RGR cfg list */ + while ((rgCfgElem = rgSCHDbmGetNextPndngRgrCfgElem(cell, NULLP)) != NULLP) + { + rgSCHDbmDelPndngRgrCfgElem(cell, rgCfgElem); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem)); + } + + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeRgrCfgLst */ + + +/*********************************************************** + * + * Func : rgSCHCfgFreeCmnLcLst + * + * + * Desc : + * - Processing Steps: + * - Frees common logical channels in cell control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeCmnLcLst +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCfgFreeCmnLcLst(cell) +RgSchCellCb *cell; +#endif +{ + RgSchClcDlLcCb *dlCmnLc; + + TRC2(rgSCHCfgFreeCmnLcLst); + + if ((dlCmnLc = rgSCHDbmGetBcchOnBch(cell)) != NULLP) + { + rgSCHCfgFreeDlCmnLcCb(dlCmnLc); + } + if ((dlCmnLc = rgSCHDbmGetFirstBcchOnDlsch(cell)) != NULLP) + { + rgSCHCfgFreeDlCmnLcCb(dlCmnLc); + } + if ((dlCmnLc = rgSCHDbmGetSecondBcchOnDlsch(cell)) != NULLP) + { + rgSCHCfgFreeDlCmnLcCb(dlCmnLc); + } + if ((dlCmnLc = rgSCHDbmGetPcch(cell)) != NULLP) + { + rgSCHCfgFreeDlCmnLcCb(dlCmnLc); + } + + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeCmnLcLst */ + + +/*********************************************************** + * + * Func : rgSCHCfgFreeUeLst + * + * + * Desc : + * - Processing Steps: + * - Frees UE list in cell control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeUeLst +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCfgFreeUeLst(cell) +RgSchCellCb *cell; +#endif +{ + RgSchUeCb *ue; +#ifdef LTE_ADV + RgSchUeCellInfo *sCellInfo; + CmLList *node; +#endif + TRC2(rgSCHCfgFreeUeLst); + + /* Free Ues in the list */ + while ((ue = rgSCHDbmGetNextUeCb(cell, NULLP)) != NULLP) + { + rgSCHDbmDelUeCb(cell, ue); + +#ifdef LTE_ADV + if(ue->cell != cell) + { + continue; + } +#endif + + /* Call MeasGap and AckNakRep processing module */ + rgSCHMeasGapANRepUeDel(cell, ue, TRUE); + + rgSCHCfgFreeUeCb(cell, ue); + } + + /* De-initialize the Ue list */ + rgSCHDbmDeInitUeCbLst(cell); + + +#ifdef LTE_ADV + node = cell->sCellUeLst.first; + while(node) + { + sCellInfo = (RgSchUeCellInfo *)node->node; + node = node->next; + rgSCHSCellDelUeSCell(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx); + } +#endif + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} /* rgSCHCfgFreeUeLst */ + +#ifdef LTEMAC_SPS +/*********************************************************** + * + * Func : rgSCHCfgFreeSpsUeLst + * + * + * Desc : + * - Processing Steps: + * - Frees Sps UE list in cell control block. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgFreeSpsUeLst +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCfgFreeSpsUeLst(cell) +RgSchCellCb *cell; +#endif +{ + RgSchUeCb *ue; + + TRC2(rgSCHCfgFreeSpsUeLst); + + /* Free Ues in the list */ + while ((ue = rgSCHDbmGetNextSpsUeCb(cell, NULLP))) + { + rgSCHDbmDelSpsUeCb(cell, ue); + } + + /* De-initialize the Ue list */ + rgSCHDbmDeInitSpsUeCbLst(cell); + +} /* rgSCHCfgFreeSpsUeLst */ + +#endif /* LTEMAC_SPS */ + +#ifdef RGR_SI_SCH +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrCellSiCfg + * + * Desc : Validates SI Configuration for SI + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg +( +Inst inst, +RgrSiCfg *siCfg +) +#else +PRIVATE S16 rgSCHCfgVldtRgrCellSiCfg(inst, siCfg) +Inst inst; +RgrSiCfg *siCfg; +#endif +{ + U8 idx; /* idx for iteration */ + + UNUSED(inst); + + TRC2(rgSCHCfgVldtRgrCellSiCfg); + + +#ifndef LTE_TDD + /* Check that retxCnt value should be <= value of siWinSize. + This validation is only applicable for FDD mode. */ + if(siCfg->retxCnt > siCfg->siWinSize) + { + RLOG0(L_ERROR,"retxCnt is greater than siWinSize, validation failed"); + RETVALUE(RFAILED); + } +#endif + + /* Validate that a valid value for numSi has been specified */ + if(siCfg->numSi > RGR_MAX_NUM_SI) + { + RLOG0(L_ERROR,"Validation for numSi in SI CFG failed"); + RETVALUE(RFAILED); + } + + /* MinPeriodicity will have the least configured periodicity + * Hence initializing with Max periodicity */ + siCfg->minPeriodicity = RGR_SI_PERD_512; + + /*Validate the value of periodicity specified for SIs */ + for(idx = 0;idx < siCfg->numSi;idx++) + { + siCfg->minPeriodicity = RGSCH_MIN(siCfg->minPeriodicity, + siCfg->siPeriodicity[idx]); + /* Set the siPeriodicity as a multiple of 80 subframes */ + switch(siCfg->siPeriodicity[idx]) + { + case RGR_SI_PERD_8: + case RGR_SI_PERD_16: + case RGR_SI_PERD_32: + case RGR_SI_PERD_64: + case RGR_SI_PERD_128: + case RGR_SI_PERD_256: + case RGR_SI_PERD_512: + continue; + + default: + RLOG0(L_ERROR,"Validation for SI Periodicity in SI-CFG failed"); + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrCellSiCfg */ + +/* LTE_ADV_FLAG_REMOVED_START */ +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrCellLtrAdvCfg + * + * Desc : Validates Lte Adv Configuration + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg +( + Inst inst, + RgrLteAdvancedCellConfig *lteAdvCfg, + U8 dlTotalBw + ) +#else +PRIVATE S16 rgSCHCfgVldtRgrCellLteAdvCfg(inst, lteAdvCfg, dlTotalBw) + Inst inst; + RgrLteAdvancedCellConfig *lteAdvCfg; + U8 dlTotalBw; +#endif +{ + U8 temp[RGR_ABS_PATTERN_LEN]; + U32 idx; + UNUSED(inst); + + TRC2(rgSCHCfgVldtRgrCellLteAdvCfg); + + + if((lteAdvCfg->pres & RGR_SFR) && (RGR_ENABLE == lteAdvCfg->sfrCfg.status)) + { + if(lteAdvCfg->sfrCfg.cellEdgeRbRange.startRb > lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb) + { + RLOG0(L_ERROR,"Invalid configuration of cell edge bandwidth for SFR feature"); + RETVALUE(RFAILED); + } + + if(lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb >= dlTotalBw) + { + RLOG0(L_ERROR,"Invalid configuration of cell edge end RB for SFR feature"); + RETVALUE(RFAILED); + } + +#ifdef TFU_UPGRADE + if(lteAdvCfg->sfrCfg.pwrThreshold.pLow >= lteAdvCfg->sfrCfg.pwrThreshold.pHigh) + { + RLOG0(L_ERROR,"Invalid configuration of power threshold for SFR feature"); + RETVALUE(RFAILED); + } +#endif + } + + if((lteAdvCfg->pres & RGR_ABS) && (RGR_ENABLE == lteAdvCfg->absCfg.status)) + { + if((RGR_ABS_MUTE != lteAdvCfg->absCfg.absPatternType) && + (RGR_ABS_TRANSMIT != lteAdvCfg->absCfg.absPatternType)) + { + RLOG0(L_ERROR,"Invalid configuration of ABS pattern type"); + RETVALUE(RFAILED); + } + + cmMemcpy(temp, (U8 *) lteAdvCfg->absCfg.absPattern,RGR_ABS_PATTERN_LEN); + + /* Added validation for ABS pattern len */ + for(idx = 0; idx < RGR_ABS_PATTERN_LEN; idx++) + { + if((temp[idx] != 1) && (temp[idx] != 0)) + { + RLOG0(L_ERROR,"Invalid configuration of ABS pattern type"); + RETVALUE(RFAILED); + } + } + } + + RETVALUE(ROK); +} +/* LTE_ADV_FLAG_REMOVED_END */ + + +/*********************************************************** + * + * Func : rgSCHCfgVldtRgrCellCsgParamCfg + * + * Desc : Validates CSG Parameter Configuration + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg +( +Inst inst, +RgrCellCsgParamCfg *csgParam +) +#else +PRIVATE S16 rgSCHCfgVldtRgrCellCsgParamCfg(inst, csgParam) +Inst inst; +RgrCellCsgParamCfg *csgParam; +#endif +{ + + TRC2(rgSCHCfgVldtRgrCellCsgParamCfg); + + RGSCHDBGPRM(inst, (rgSchPBuf(inst), "Validating CSG Parameters \n")); + + if(csgParam->minDlResNonCsg > 100) + { + RLOG0(L_ERROR,"Invalid Configuration of minimum DL resources " + "for NON-CSG"); + RETVALUE(RFAILED); + } + if(csgParam->minUlResNonCsg > 100) + { + RLOG0(L_ERROR,"Invalid Configuration of minimum UL resources " + "for NON-CSG"); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} + +/** + * @brief Validates the SI configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrSiCfg + * + * Processing Steps: + * - Validate the range of configured values recieved in + * configuration request. + * - If validated successfully, + * - Return ROK + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * @param[in] Inst inst + * @param[in] RgrCellCfg *siCfg + * @param[out] RgSchCellCb *cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrSiCfg +( +Inst inst, +RgrSiCfgReqInfo *siCfg, +RgSchCellCb *cell, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHCfgVldtRgrSiCfg(inst, siCfg, cell, errInfo) +Inst inst; +RgrSiCfgReqInfo *siCfg; +RgSchCellCb *cell; +RgSchErrInfo *errInfo; +#endif +{ + MsgLen msgLen = 0; + U8 numSi; + + TRC2(rgSCHCfgVldtRgrSiCfg); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_SI_CFG; + + /*Validate the cfgType parameter */ + switch(siCfg->cfgType) + { + /*ccpu00140789*/ + case RGR_SI_STOP: + numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ? + cell->siCb.newSiCfg.numSi : cell->siCfg.numSi; + if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) || + (siCfg->siId > numSi)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid SI Id value" + " specified"); + RETVALUE(RFAILED); + } + errInfo->errCause = RGSCHERR_NONE; + RETVALUE(ROK); + break; + case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */ + case RGR_SI_CFG_TYPE_SIB1: /* SI CFG TYPE SIB1 */ + case RGR_SI_CFG_TYPE_SIB1_PWS: /* SI CFG TYPE SIB1_PWS */ + case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */ +#ifdef EMTC_ENABLE + case RGR_SI_CFG_EMTC_TYPE_SIB1_BR: + case RGR_SI_CFG_EMTC_TYPE_SIB1_BR_PER: +#endif + break; + + case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */ + /*Check that value of SI should be less than equal + to configured numSi parameter value */ + /* Added siId validation for lower limit */ + numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ? + cell->siCb.newSiCfg.numSi : cell->siCfg.numSi; + if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) || + (siCfg->siId > numSi)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid SI Id value" + " specified"); + RETVALUE(RFAILED); + } + + if(siCfg->siId > ((cell->siCfg.minPeriodicity * 10)/cell->siCfg.siWinSize)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "SiId can not be scheduled "); + RETVALUE(RFAILED); + } + break; + +#ifdef EMTC_ENABLE + case RGR_SI_CFG_EMTC_TYPE_SI: + case RGR_SI_CFG_EMTC_TYPE_SI_PER: + if(ROK != rgEmtcvalidateSiCfg(siCfg,cell)) + { + RETVALUE(RFAILED); + } + break; +#endif + default: + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid cfgType " + "parameter value"); + RETVALUE(RFAILED); + } + + /*Validate the specified pdu */ + if(NULLP == siCfg->pdu) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid NULLP pdu " + "specified"); + RETVALUE(RFAILED); + } + + /*Check if PDU is of 0 length*/ + SFndLenMsg(siCfg->pdu, &msgLen); + if(0 == msgLen) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid pdu " + "specified"); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrSiCfg */ +#endif /*RGR_SI_SCH*/ + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + * @brief Validates the RNTP INF request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrLoadInf + * + * Processing Steps: + * - Validate the range of configured values recieved in + * LOAD INF request. + * - If validated successfully, + * - Return ROK + * - Else + * - Return RFAILED. + * - Else return RFAILED. + * @param[in] Inst inst + * @param[in] RgrLoadInfReqInfo *loadInfReq + * @param[out] RgSchCellCb *cell + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrLoadInf +( + Inst inst, + RgrLoadInfReqInfo *loadInfReq, + RgSchCellCb *cell, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, errInfo) + Inst inst; + RgrLoadInfReqInfo *loadInfReq; + RgSchCellCb *cell; + RgSchErrInfo *errInfo; +#endif +{ + + TRC2(rgSCHCfgVldtRgrLoadInf); + + + errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LOAD_INF; + + /* Validate if the CC startRb which we have received from DSFR lies in CE sub-band of the receiving eNB */ + if((loadInfReq->rgrCcPHighStartRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) && + (loadInfReq->rgrCcPHighStartRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid rgrCcPHighStartRb received specified"); + RETVALUE(RFAILED); + } + + /* Validate if the CC endRb which we have received from DSFR lies in CE sub-band of the receiving eNB */ + if((loadInfReq->rgrCcPHighEndRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) && + (loadInfReq->rgrCcPHighEndRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid rgrCcPHighEndRb received specified"); + RETVALUE(RFAILED); + } + + errInfo->errCause = RGSCHERR_NONE; + + + RETVALUE(ROK); +} /* rgSCHCfgVldtRgrLoadInf */ +/* LTE_ADV_FLAG_REMOVED_END */ + +#ifdef TFU_UPGRADE + +/******************************************************************** + * UE ACQI, PCQI, RI, SRS and SR Re/Configuration Validation Functions * + * * + *********************************************************************/ + + /* + * @brief Validates the Tx Mode and PUSCH Mode configuration. + * + * @details + * + * Function : rgSCHCfgVldtRgrTxmodePuschMode + * + * Processing Steps: + * - Validate whether the configured PUSCH Mode and the + * Configured Tx Mode are in the right combination + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgrTxMode txMde + * @param[in] RgrAprdCqiMode puschMode + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode +( + RgSchCellCb *cellCb, + RgrTxMode txMde, + RgrAprdCqiMode puschMode, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrTxmodePuschMode(cellCb, txMde, puschMode,errInfo) + RgSchCellCb *cellCb; + RgrTxMode txMde; + RgrAprdCqiMode puschMode; + RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrTxmodePuschMode); + + + if (txMde == RGR_UE_TM_1 || txMde == RGR_UE_TM_2 || + txMde == RGR_UE_TM_3 || txMde == RGR_UE_TM_7) + { + if (puschMode == RGR_APRD_CQI_MOD12 || + puschMode == RGR_APRD_CQI_MOD22 || + puschMode == RGR_APRD_CQI_MOD31) + { + RETVALUE(RFAILED); + } + } + + if (txMde == RGR_UE_TM_4 || txMde == RGR_UE_TM_6) + { + if (puschMode == RGR_APRD_CQI_MOD20 || + puschMode == RGR_APRD_CQI_MOD30) + { + RETVALUE(RFAILED); + } + } + + if (txMde == RGR_UE_TM_5 ) + { + if (puschMode != RGR_APRD_CQI_MOD31) + { + RETVALUE(RFAILED); + } + } +#ifdef LTE_ADV + /* TOODO:: Tm8 and TM9 validation has to + * be changed as mentioned inthe commented + * code below*/ + /* TM8 and TM9 supports all modes + * Mode 1-2, 2-2, 3-1 if pmi/ri reporting enabled + * 2-0,3-0 of pmi/ri reporitng isdisabled * + * if pmi/ri is enabled + * Mode 1-2, 2-2, 3-1 if with pmi/ri and csi-rs ports > 1 + * 2-0,3-0 of pmi/ri reporitng isdisabled and csi-rs ports == 1*/ + +#endif + RETVALUE(ROK); +}/*rgSCHCfgVldtRgrTxmodePuschMode ends*/ + + /* + * @brief Validates the UE ACQI configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeACqiCfg + * + * Processing Steps: + * - Validate the UE configuration request from RRC to MAC at CFG: + * validate the ACQI Configuration + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb, + * @param[in] CmLteRnti crnti, + * @param[in] RgrUeAprdDlCqiCfg *acqiCfg, + * @param[in] RgrUeTxModeCfg txMode, + * @param[out] RgSchErrInfo *errInfo + + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUeAprdDlCqiCfg *acqiCfg, + RgrUeTxModeCfg txMode, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeACqiCfg(cellCb, crnti, acqiCfg,txMode, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUeAprdDlCqiCfg *acqiCfg; + RgrUeTxModeCfg txMode; + RgSchErrInfo *errInfo; +#endif +{ + RgrTxMode txMde; + RgrAprdCqiMode puschMode; + TRC2(rgSCHCfgVldtRgrUeACqiCfg); + + + if(acqiCfg->pres) + { + if(txMode.pres == TRUE) + { + txMde = txMode.txModeEnum; + puschMode = acqiCfg->aprdModeEnum; + if ( ROK != rgSCHCfgVldtRgrTxmodePuschMode(cellCb, txMde, + puschMode, errInfo)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Aperiodic CQI configuration CRNTI:%d",crnti); + RETVALUE(RFAILED); + } + } + } + RETVALUE(ROK); +} + + /* + * @brief Validates the Tx Mode and PUCCH Mode configuration. + * + * @details + * + * Function : rgSCHCfgVldtRgrTxmodePucchMode + * + * Processing Steps: + * - Validate whether the configured PUCCH Mode and the + * Configured Tx Mode are in the right combination + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgrTxMode txMde + * @param[in] RgrPrdCqiMode pucchMode + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode +( + RgSchCellCb *cellCb, + RgrTxMode txMde, + RgrPrdCqiMode pucchMode, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrTxmodePucchMode(cellCb, txMde, pucchMode,errInfo) + RgSchCellCb *cellCb; + RgrTxMode txMde; + RgrPrdCqiMode pucchMode; + RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHCfgVldtRgrTxmodePucchMode); + + + if (pucchMode == RGR_PRD_CQI_MOD10 || pucchMode == RGR_PRD_CQI_MOD20 ) + { + if (txMde ==RGR_UE_TM_4 || txMde ==RGR_UE_TM_5 || txMde ==RGR_UE_TM_6) + { + RETVALUE(RFAILED); + } + } + else if (pucchMode == RGR_PRD_CQI_MOD11 || pucchMode == RGR_PRD_CQI_MOD21) + { + if (txMde ==RGR_UE_TM_1 || txMde ==RGR_UE_TM_2 || txMde ==RGR_UE_TM_3 \ + || txMde ==RGR_UE_TM_7) + { + RETVALUE(RFAILED); + } + } + /* TODO:: Tm8 and TM9 validation needs to be added */ + RETVALUE(ROK); +} + +/* + * @brief Validates the UE Periodic CQI, PMI, RI, re/configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUePCqiCfg + * + * Processing Steps: + * - Validate the UE configuration request from RRC to MAC at CFG: + * validate the value range for Periodic CQI, PMI, RI values. + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb, + * @param[in] CmLteRnti crnti, + * @param[in] RgrUePrdDlCqiCfg *cqiCfg, + * @param[in] RgrUeTxModeCfg txMode, + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef LTEMAC_HDFDD +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUePrdDlCqiCfg *cqiCfg, + Bool hdFdd, + RgrUeTxModeCfg txMode, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg(cellCb, crnti, cqiCfg, hdFdd, + txMode, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUePrdDlCqiCfg *cqiCfg; + Bool hdFdd; + RgrUeTxModeCfg txMode; + RgSchErrInfo *errInfo; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg + ( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUePrdDlCqiCfg *cqiCfg, + RgrUeTxModeCfg txMode, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUePCqiCfg(cellCb, crnti, cqiCfg, txMode, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUePrdDlCqiCfg *cqiCfg; + RgrUeTxModeCfg txMode; + RgSchErrInfo *errInfo; +#endif +#endif +{ + RgrTxMode txMde; + RgrPrdCqiMode pucchMode; + + TRC2(rgSCHCfgVldtRgrUePCqiCfg); + + txMde = RGR_UE_TM_1; + pucchMode = RGR_PRD_CQI_MOD20; + if ( RGR_SCH_PCQI_SETUP == cqiCfg->type ) + { + /*1. Validate for Tx Mode and PUCCH Mode combination*/ + if(txMode.pres == TRUE) + { + txMde = txMode.txModeEnum; + pucchMode = cqiCfg->cqiSetup.prdModeEnum; + if ( ROK != rgSCHCfgVldtRgrTxmodePucchMode(cellCb, txMde, + pucchMode, errInfo)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Tx Mode-PUCCH Mode combination CRNTI:%d",crnti); + RETVALUE(RFAILED); + } + } + + /*2. Validate for PCQI Reporting Type and PUCCH Mode combination*/ + if((cqiCfg->cqiSetup.cqiRepType==1) && + ((pucchMode == RGR_PRD_CQI_MOD20) || + (pucchMode == RGR_PRD_CQI_MOD21))) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti); + RETVALUE(RFAILED); + } + + if((cqiCfg->cqiSetup.cqiRepType==2) && + ((pucchMode == RGR_PRD_CQI_MOD10) || + (pucchMode == RGR_PRD_CQI_MOD11))) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti); + RETVALUE(RFAILED); + } + + /*3. Validate CQI/PMI and RI Configuration related parameter values */ + /*TODO- To be compared with configured n2Pucch Index*/ + if (cqiCfg->cqiSetup.cqiPResIdx > RG_SCH_PUCCH_RES_MAX_SUPP ) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid CQI-PUCCH resourceIndex=%d Cfg Val=%d CRNTI:%d", + RG_SCH_PUCCH_RES_MAX_SUPP, cqiCfg->type,crnti); + RETVALUE(RFAILED); + } + +#ifdef LTEMAC_HDFDD + if(hdFdd) + { + if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| + (cqiCfg->cqiSetup.cqiPCfgIdx < 7) || + (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg CQI Min Index Sup =%d" + "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP, + RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); + RETVALUE(RFAILED); + } + } + else + { + if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| + (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg CQI Min Index Sup =%d " + "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP, + RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); + RETVALUE(RFAILED); + } + } +#else + if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)|| + (cqiCfg->cqiSetup.cqiPCfgIdx == 317)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg CQI Min Index Sup =%d" + "Max Index Sup=%d Cfg Val=%d CRNTI;%d", RG_SCH_ICQI_MIN_SUPP, + RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti); + RETVALUE(RFAILED); + } +#endif + + if((cqiCfg->cqiSetup.cqiRepType < RGR_UE_PCQI_WB_REP) || + (cqiCfg->cqiSetup.cqiRepType > RGR_UE_PCQI_SB_REP)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Cfg CQI Report" + "ModeCfg Val=%d CRNTI:%d", cqiCfg->type,crnti); + RETVALUE(RFAILED); + } + + if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) && + ((cqiCfg->cqiSetup.k < RG_SCH_CQI_K_MIN) || + (cqiCfg->cqiSetup.k > RG_SCH_CQI_K_MAX))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid CQI Cfg K Cfg Val=%d CRNTI:%d", cqiCfg->type,crnti); + RETVALUE(RFAILED); + } + + if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) && + (cellCb->bwCfg.dlTotalBw <= 7)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Periodic CQI mode Cfg for dlTotalBw (%d) for CRNTI:%d", + cellCb->bwCfg.dlTotalBw, crnti); + RETVALUE(RFAILED); + } + +#ifndef LTE_TDD + if (cqiCfg->cqiSetup.cqiPCfgIdx == RG_SCH_ICQI_RESV_FDD ) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Reserved value Cfg =%d CRNTI:%d", + cqiCfg->cqiSetup.cqiPResIdx,crnti); + RETVALUE(RFAILED); + } +#endif + + /* 4. Check RI Configuration values */ + if(cqiCfg->cqiSetup.riEna == TRUE) + { + if(txMode.pres == TRUE) + { + if((txMde != RGR_UE_TM_3) + && (txMde != RGR_UE_TM_4) + && (txMde != RGR_UE_TM_8) +#ifdef LTE_ADV + && (txMde != RGR_UE_TM_9) +#endif + ) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Transmission Mode =%d CRNTI:%d", + txMde,crnti); + RETVALUE(RFAILED); + } + } + + if(cqiCfg->cqiSetup.riCfgIdx > RG_SCH_IRI_MAX_SUPP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Index RI value Cfg =%d CRNTI:%d", + cqiCfg->cqiSetup.riCfgIdx,crnti); + RETVALUE(RFAILED); + } + } + } + + + RETVALUE(ROK); +} + +/* + * @brief Validates the UE SRS Re/Configuation request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeUlSrsCfg + * + * Processing Steps: + * - Validate the UE configuration request from RRC to MAC at CFG: + * validate the value range for SRS values. + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb, + * @param[in] CmLteRnti crnti, + * @param[in] RgrUeUlSrsCfg *srsCfg, + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef LTEMAC_HDFDD +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUeUlSrsCfg *srsCfg, + Bool hdFdd, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, crnti, srsCfg, hdFdd, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUeUlSrsCfg *srsCfg; + Bool hdFdd; + RgSchErrInfo *errInfo; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUeUlSrsCfg *srsCfg, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, crnti, srsCfg, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUeUlSrsCfg *srsCfg; + RgSchErrInfo *errInfo; +#endif +#endif +{ + U16 srsPeri=0; + U16 srsOffset=0; + U8 srsSubframe=0; + + TRC2(rgSCHCfgVldtRgrUeUlSrsCfg); + + + if ( RGR_SCH_SRS_SETUP == srsCfg->type ) + { + + /*ccpu00130768 - ADD - if cell specific SRS is not configured*/ + if(cellCb->srsCfg.isSrsCfgPres == FALSE) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Cell specific SRS is not configured CRNTI:%d",crnti); + RETVALUE(RFAILED); + } + + /* 1. Validate SRS Configuration related parameter values */ + /* 1.1 iSRS should be 0-636; Ref: 36.213. Table 8.2-1 */ +#ifdef LTEMAC_HDFDD + if(hdFdd) + { + if ( (srsCfg->srsSetup.srsCfgIdx < 7) || + (srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP) ) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg " + "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", + RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } + } + else + { + if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP ) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg" + "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", + RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } + + } +#else + if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP ) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg" + "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d", + RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP, + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } +#endif +#ifdef LTE_TDD + /* Compute SRS Offset and Periodicity */ + rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL, + srsCfg->srsSetup.srsCfgIdx, + &srsPeri, &srsOffset); +#else + rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL, + srsCfg->srsSetup.srsCfgIdx, + &srsPeri, &srsOffset); +#endif + srsSubframe = srsOffset%RGSCH_NUM_SUB_FRAMES; +#ifdef LTE_TDD + if(rgSchTddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) { +#else + if(rgSchFddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) { +#endif + RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId, + "UE specific SRS is not occuring in Cell specific SRS subframe" + "srs Cfg Idx =%d CRNTI:%d", + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } + + + if ( srsCfg->srsSetup.fDomPosi > RG_SCH_SRS_FREQDOM_POS_MAX ) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg" + "SRS Min Freq Domain Position =%d" + "Max Freq Domain Position =%d Cfg Val=%d CRNTI:%d", + RG_SCH_SRS_FREQDOM_POS_MIN, RG_SCH_SRS_FREQDOM_POS_MAX, + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } + + if ( srsCfg->srsSetup.txComb > RG_SCH_SRS_TXCOMB_MAX ) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Not Supported or Invalid Cfg" + "SRS Min TX Comb =%d Max TX Comb =%d Cfg Val=%d CRNTI:%d", + RG_SCH_SRS_TXCOMB_MIN, RG_SCH_SRS_TXCOMB_MAX, + srsCfg->srsSetup.srsCfgIdx,crnti); + RETVALUE(RFAILED); + } + } + RETVALUE(ROK); +} + +/* + * @brief Validates the UE SR Re/configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtRgrUeSrCfg + * + * Processing Steps: + * - Validate the UE re/configuration request from RRC to MAC at CFG: + * validate the value range for SR values. + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb, + * @param[in] CmLteRnti crnti, + * @param[in] RgrUeSrCfg *srCfg, + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef LTEMAC_HDFDD +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUeSrCfg *srCfg, + Bool hdFdd, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg(cellCb, crnti, srCfg, hdFdd, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUeSrCfg *srCfg; + Bool hdFdd; + RgSchErrInfo *errInfo; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg +( + RgSchCellCb *cellCb, + CmLteRnti crnti, + RgrUeSrCfg *srCfg, + RgSchErrInfo *errInfo + ) +#else +PUBLIC S16 rgSCHCfgVldtRgrUeSrCfg(cellCb, crnti, srCfg, errInfo) + RgSchCellCb *cellCb; + CmLteRnti crnti; + RgrUeSrCfg *srCfg; + RgSchErrInfo *errInfo; +#endif +#endif +{ + + TRC2(rgSCHCfgVldtRgrUeSrCfg); + + + + if ( RGR_SCH_SR_SETUP == srCfg->type ) + { + /* 1. Validate SR Configuration related parameter values */ +#ifdef LTEMAC_HDFDD + if(hdFdd) + { + if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || + ( srCfg->srSetup.srCfgIdx < 5 ) || + ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SR Index Cfg =%d" + "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, + RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); + + RETVALUE(RFAILED); + } + } + else + { + if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || + ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SR Index Cfg =%d" + "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, + RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); + + RETVALUE(RFAILED); + } + } +#else + if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) || + ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP )) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SR Index Cfg =%d" + "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx, + RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti); + + RETVALUE(RFAILED); + } +#endif + } + RETVALUE(ROK); +} + + +/* + * @brief Validates the UE Aperiodic & Periodic CQI, PMI, RI, SRS and SR Configuration + * request from RRM to MAC. + * + * @details + * + * Function :rgSCHCfgVldtCqiSrSrsUeCfg + * + * Processing Steps: + * - Validate the UE configuration request from RRC to MAC at CFG: + * validate the value range for Aperiodic & Periodic CQI, PMI, RI , SRS and SR values. + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgrUeCfg *ueCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg +( + RgSchCellCb *cellCb, + RgrUeCfg *ueCfg, + RgSchErrInfo *errInfo + ) +#else +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeCfg(cellCb, ueCfg, errInfo) + RgSchCellCb *cellCb; + RgrUeCfg *ueCfg; + RgSchErrInfo *errInfo; +#endif +{ + + TRC2(rgSCHCfgVldtCqiSrSrsUeCfg); + + + /* 1. Validate UE Aperiodic CQI related parameters */ + if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueCfg->crnti, + &ueCfg->ueDlCqiCfg.aprdCqiCfg, ueCfg->txMode, errInfo )) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Aperiodic CQI configuration CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + + /* 1. Validate UE Periodic CQI/PMI, SRS and SR related parameters */ +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti, + &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->isHdFddEnbld, + ueCfg->txMode, errInfo )) +#else + if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti, + &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->txMode, errInfo )) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Periodic CQI configuration CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + + /* 2. Validate SRS Configuration related parameter values */ +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti, &ueCfg->srsCfg, + ueCfg->isHdFddEnbld, errInfo )) +#else + if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti, + &ueCfg->srsCfg, errInfo )) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SRS configuration CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + + /* 3. Validate SR Configuration related parameter values */ +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti, &ueCfg->srCfg, + ueCfg->isHdFddEnbld, errInfo)) +#else + if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti, + &ueCfg->srCfg, errInfo)) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SR configuration CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + +} + + + +/***************************************************************** + * UE PCQI, RI, SRS and SR Re Configuration Validation Functions * + * * + ******************************************************************/ +/* + * @brief Validates the UE Periodic CQI, PMI, RI, SRS and SR + * Re-configuration request from RRM to MAC. + * + * @details + * + * Function : rgSCHCfgVldtCqiSrSrsUeReCfg + * + * Processing Steps: + * - Validate the UE Re configuration request from RRC to MAC at CFG: + * validate the value range for Periodic CQI, PMI, RI, SRS and SR values. + * - If validated successfully, + * - Return ROK. + * - Else + * - Return RFAILED. + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgSchUeCb *ueCb + * @param[in] RgrUeCfg *ueCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeRecfg *ueReCfg, + RgSchErrInfo *errInfo + ) +#else +PRIVATE S16 rgSCHCfgVldtCqiSrSrsUeReCfg(cellCb, ueCb, ueReCfg, errInfo) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeRecfg *ueReCfg; + RgSchErrInfo *errInfo; +#endif +{ + RgrUeTxModeCfg txMode; + TRC3(rgSCHCfgVldtCqiSrSrsUeReCfg); + + txMode.pres = TRUE; + txMode.tmTrnstnState = RGR_TXMODE_RECFG_CMPLT; + if ((ueReCfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) && + (ueReCfg->txMode.pres == TRUE)) + { + txMode.txModeEnum = ueReCfg->txMode.txModeEnum; + } + else + { + txMode.txModeEnum = ueCb->mimoInfo.txMode; + } + + /* 1. Validate UE CQI/PMI, SRS and SR related parameters */ + + if ( ueReCfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG ) + { + if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueReCfg->oldCrnti, + &ueReCfg->aprdDlCqiRecfg, txMode, errInfo )) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Aperiodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti); + RETVALUE(RFAILED); + } + } + + + /* 2. Validate UE CQI/PMI, SRS and SR related parameters */ + + if ( ueReCfg->ueRecfgTypes & RGR_UE_PCQI_RECFG ) + { +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti, + &ueReCfg->cqiCfg, ueReCfg->isHdFddEnbld, txMode, errInfo )) +#else + if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti, + &ueReCfg->cqiCfg, txMode, errInfo )) +#endif + + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid Periodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti); + RETVALUE(RFAILED); + } + } + + if(ueReCfg->ueRecfgTypes & RGR_UE_SRS_RECFG ) + { +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti, + &ueReCfg->srsCfg, ueReCfg->isHdFddEnbld, errInfo )) +#else + if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti, + &ueReCfg->srsCfg, errInfo )) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SRS configuration OLD CRNTI:%d",ueReCfg->oldCrnti); + RETVALUE(RFAILED); + } + + } + + if ( ueReCfg->ueRecfgTypes & RGR_UE_SR_RECFG ) + { +#ifdef LTEMAC_HDFDD + if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti, + &ueReCfg->srCfg, ueReCfg->isHdFddEnbld, errInfo)) +#else + if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti, + &ueReCfg->srCfg, errInfo)) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, + "Invalid SR configuration OLD CRNTI:%d",ueReCfg->oldCrnti); + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); +} + + +/***************************************************************** + * UE ACQI, PCQI, RI, SRS SR Configuration Functions * + * * + ******************************************************************/ + /** + * @brief Handles Aperiodic CQI , PMI, RI configuration for a UE. + * + * @details + * + * Function : rgSCHCfgACqiUeCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE configuration. It + * shall do the validations for the spec-defined values. + * + * Processing Steps: + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrTxMode txMode + * @param[in] RgrUeAprdDlCqiCfg *aCqiCfg + * @param[in] CmLteUeCategory ueCat + * @return S16 + * -# ROK + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgACqiUeCfg +( +RgSchCellCb *cellCb, +RgSchUeCb *ue, +RgSchUeACqiCb *acqiCb, +RgrTxMode ueTxMode, +RgrUeAprdDlCqiCfg *aCqiCfg, +CmLteUeCategory ueCat +) +#else +PUBLIC S16 rgSCHCfgACqiUeCfg(cellCb,ue,acqiCb ueTxMode, aCqiCfg, ueCat) +RgSchCellCb *cellCb; +RgSchUeCb *ue; +RgSchUeACqiCb *acqiCb; +RgrTxMode ueTxMode; +RgrUeAprdDlCqiCfg *aCqiCfg; +CmLteUeCategory ueCat; +#endif +{ + U8 M; /*Num of Subbands -- Applicable only for Mode 2-0 and 2-2*/ + U8 k; /*SubBand Size (RB) -- + Holds different values depending on Mode*/ + U8 cqiPmiSzR1; /*CQIPMI Size for Rank =1*/ + U8 cqiPmiSzRn1; /*CQIPMI Size for Rank > 1*/ + + TRC3(rgSCHCfgACqiUeCfg); + + cqiPmiSzR1 = 0; + cqiPmiSzRn1 = 0; + + acqiCb->aCqiCfg.pres = aCqiCfg->pres; + acqiCb->aCqiCfg.aprdModeEnum = aCqiCfg->aprdModeEnum; + + if(aCqiCfg->pres) + { +#ifdef LTE_ADV + /*Store Trigger Set Bit String to UE */ + RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); + pCellInfo->acqiCb.aCqiCfg.triggerSet1 = aCqiCfg->triggerSet1; + pCellInfo->acqiCb.aCqiCfg.triggerSet2 = aCqiCfg->triggerSet2; +#endif + + + switch(aCqiCfg->aprdModeEnum) + { + case RGR_APRD_CQI_MOD12: + case RGR_APRD_CQI_MOD30: + case RGR_APRD_CQI_MOD31: + RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k); + acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k); + acqiCb->k = k; + break; + + case RGR_APRD_CQI_MOD20: + case RGR_APRD_CQI_MOD22: + RG_SCH_GET_SBCQI_M_K_VAL(cellCb->bwCfg.dlTotalBw, M, k); + acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k); + acqiCb->k = k; + acqiCb->M = M; + acqiCb->L = RgSCHUeAcqi2022LBitWidth[M-1][acqiCb->N-1]; + break; + + default: + break; + } + if((ueTxMode == RGR_UE_TM_3) || + (ueTxMode == RGR_UE_TM_4)) + { + if(cellCb->numTxAntPorts ==2) + { + acqiCb->riNumBits = 1; + } + else if(cellCb->numTxAntPorts ==4) + { + if(ueCat == CM_LTE_UE_CAT_8) + { + acqiCb->riNumBits = 3; + } + else if(ueCat >= CM_LTE_UE_CAT_5) + { + acqiCb->riNumBits = 2; + } + else + { + acqiCb->riNumBits = 1; + } + } + } + rgSCHCfgUtlFetchAcqiBitSz(acqiCb, cellCb->numTxAntPorts, + &cqiPmiSzR1, &cqiPmiSzRn1); + acqiCb->cqiPmiSzR1 = cqiPmiSzR1; + acqiCb->cqiPmiSzRn1 = cqiPmiSzRn1; + } + acqiCb->cqiReqField = TRUE; +#ifdef LTE_ADV + rgSchCmnSetCqiReqField(RG_SCH_CMN_GET_SCELL_INFO(ue, cellCb),ue,&acqiCb->cqiReqField); +#endif + + RETVALUE(ROK); +} + +/** + * @brief Handles Periodic CQI , PMI, RI configuration for a UE. + * + * @details + * + * Function : rgSCHCfgPCqiUeCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE configuration. It shall do the + * validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific Periodic CQI related configuration, + * - If Periodic CQI/PMI is configured, + * - Update UE with the configured values. + - Compute and Update next occurance of CQI/PMI or RI Tranmission instance. + - Update the CQI offset and CQI perodicity information + - Add Ue to cell's list + * + * + * - For UE-specific Periodic RI related configuration, + * - If Periodic RI is configured, + * - Update UE with the configured values. + - Compute and Update next occurance of RI Tranmission instance. + - Update the RI offset and RI perodicity information + * + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUePrdDlCqiCfg *cqiCfg + * @param[in] CmLteUeCategory ueCat + * @return S16 + * -# ROK + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgPCqiUeCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg, + CmLteUeCategory ueCat + ) +#else +PUBLIC S16 rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUePrdDlCqiCfg *cqiCfg; + CmLteUeCategory ueCat; +#endif +{ + CmLteTimingInfo timingInfo; + U16 crntTime; + U16 cqiTrInstTime; + U8 j; /*Bandwidth Parts*/ + U8 temp; + U8 loop; + RgSchUePCqiCb *cqiCb = NULLP; + TRC3(rgSCHCfgPCqiUeCfg); + + crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+ + (cellCb->crntTime.subframe); + cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); + cqiCb->servCellInfo = ueCb->cellInfo[0]; + /* Periodic CQI is setup */ + if (cqiCfg->type == RGR_SCH_PCQI_SETUP) + { + for(loop = 0; loop < MAX_CQI_RI_RPT_BUFF;loop++) + { + ueCb->rawCqiBitW[loop].type = TFU_RECP_REQ_INVLD; /* setting invalid type*/ + } + /* 1. Copy the Received CQI Cfg parameters to ueCb */ + cmMemcpy((U8 *)&cqiCb->cqiCfg, (U8 *)cqiCfg, + sizeof(RgrUePrdDlCqiCfg)); + + /* 2. Compute Periodic CQI Periodicity and subframe offset */ +#ifndef LTE_TDD + rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx, + &cqiCb->cqiPeri, &cqiCb->cqiOffset); +#else + rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL, + cqiCfg->cqiSetup.cqiPCfgIdx, + &cqiCb->cqiPeri, &cqiCb->cqiOffset); +#endif + RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, + "rgSCHCfgPCqiUeCfg(): UEID:%d CQI Peri=%d, CQI Offset=%d", + ueCb->ueId, + cqiCb->cqiPeri, + cqiCb->cqiOffset); + + + cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset) + %cqiCb->cqiPeri; + cqiCb->nCqiTrIdx = (crntTime + + (cqiCb->cqiPeri - cqiTrInstTime)); + /* Introduced timing delta for reception req + * in FDD*/ + if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) + { + cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri; + } + + /* To handle the SFN wrap around case */ + cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx % (RGSCH_MAX_SFN * RGSCH_NUM_SUB_FRAMES_5G); + + timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G; + timingInfo.subframe = cqiCb->nCqiTrIdx % RGSCH_NUM_SUB_FRAMES_5G; + + cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + %RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + +#ifdef EMTC_ENABLE + /*CQI Repetition configuration*/ + if(ueCb->isEmtcUe) + { + rgSchfillPucchCqiRepNumCountemtc(cqiCb, ueCb); + } +#endif + + if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType) + { + U8 k; /*SubBand Size (RB) */ + RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j); + RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k); + cqiCb->J = j; /*Number of Bandwidth Parts*/ + /*h: reporting instances required for a complete CQI/PMI report */ + /*j:Number of bandwidth parts; k: Subband Size*/ + cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1; + /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/ + temp = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, (j*k)); + cqiCb->label = (temp & (temp-1)) ? + (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp); + + rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb, cqiCb); + } +#ifdef LTE_ADV + else + { + cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1; + } +#endif + + /* Place the UE in cellCb->tIUeLstCp */ + cqiCb->cqiLstEnt.node=(PTR) cqiCb; +#ifdef LTE_ADV + cqiCb->isCqiIgnoByCollsn = FALSE; + cqiCb->isRiIgnoByCollsn = FALSE; +#endif + + + cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, + &cqiCb->cqiLstEnt); + + + /* 4. Rank Indicator Cfg handler */ + rgSCHCfgRiUeCfg(cellCb, ueCb, cqiCfg, ueCat); + } + else + { + cqiCb->cqiCfg.type = RGR_SCH_PCQI_REL; + if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,\ + &cqiCb->cqiLstEnt); + } + if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, \ + &cqiCb->riLstEnt); + RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL, + &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); + } + cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->riDist = RG_SCH_INVALID_IDX; + } + ueCb->nPCqiCb = cqiCb; + ueCb->nPRiCb = cqiCb; + RETVALUE(ROK); +} + +/** + * @brief Handles Periodic RI configuration for a UE. + * + * @details + * + * Function : rgSCHCfgRiUeCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE configuration. It shall do the + * validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific Periodic RI related configuration, + * - If Periodic RI is configured, + * - Update UE with the configured values. + - Compute and Update next occurance of RI Tranmission instance. + - Update the RI offset and RI perodicity information + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUePrdDlCqiCfg *cqiCfg + * @param[in] CmLteUeCategory ueCat + * @return S16 + * -# ROK + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCfgRiUeCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg, + CmLteUeCategory ueCat + ) +#else +PUBLIC S16 rgSCHCfgRiUeCfg(cellCb, ueCb, cqiCfg, ueCat) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUePrdDlCqiCfg *cqiCfg; + CmLteUeCategory ueCat; +#endif +{ + U16 crntTime; + U16 riTrInsTime; + U8 j; /*Bandwidth parts. Valid for Modes 2-0, 2-1*/ + U16 periodicity; + U16 tempIdx; + RgSchUePCqiCb *cqiCb = NULLP; + + TRC3(rgSCHCfgRiUeCfg); + + + + crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + +(cellCb->crntTime.subframe); + cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); + /* 1. Rank Indicator is enabled */ + if(cqiCfg->cqiSetup.riEna) + { + + rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL, + cqiCfg->cqiSetup.riCfgIdx, + &cqiCb->riPeri, &cqiCb->riOffset); + + RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, + "rgSCHCfgRiUeCfg(): RI Peri=%d, RI Offset=%d UEID:%d", + cqiCb->riPeri, cqiCb->riOffset,ueCb->ueId); + + cqiCb->perRiVal = 1; + cqiCb->invalidateCqi = FALSE; + + if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType) + { + /* + 1. wideband RI reporting is configured + (Mode 1-0 or 1-1) + (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod + *MriPeriod)=0 + */ + periodicity = cqiCb->cqiPeri * cqiCb->riPeri; + } + else + { + /* + * Where Widesband and Subband RI reporting is configured + * (Mode 2-0 or 2-1 ) + * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI ) + * Mod(H. NCqiperiod *MriPeriod )=0 + * where H= J * K +1; J=Number of bandwidth parts(BW/subsize). + * K is RGR interf input + */ + + RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j); + cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1; + periodicity = cqiCb->h * cqiCb->cqiPeri * + cqiCb->riPeri; + } + + /* In case of SFN wraparound, the SB CQI reporting cycle breaks + * and RI->WB CQI->SBCQI.. should resume. RI is repositioned + * accordingly. WBCQI handling is naturally accomplished */ + if (periodicity >= RGSCH_MAX_SUBFRM_5G) + { + periodicity = cqiCb->cqiOffset - cqiCb->riOffset + + RGSCH_MAX_SUBFRM_5G - (crntTime); + tempIdx = crntTime + periodicity; + printf("CHECK_SID - periodicity %d tempIdx %d\n", periodicity, tempIdx); + } + else + { + if ((crntTime + TFU_RECPREQ_DLDELTA + periodicity) > + (RGSCH_MAX_SUBFRM_5G - 1)) + { + riTrInsTime = (periodicity - cqiCb->cqiOffset + cqiCb->riOffset) % periodicity; + tempIdx = RGSCH_MAX_SUBFRM_5G + (periodicity - riTrInsTime); + } + else + { + riTrInsTime = ((periodicity +crntTime )- \ + cqiCb->cqiOffset + cqiCb->riOffset)\ + % periodicity; + tempIdx = (crntTime + (periodicity -riTrInsTime)); + } + } + if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) + { + tempIdx = tempIdx + periodicity; + } + cqiCb->nRiTrIdx = tempIdx + % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) + { + cqiCb->riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), + (U16) tempIdx); + } + else + { + cqiCb->riDist =0; + } + if(ueCb->mimoInfo.txMode == RGR_UE_TM_3 + || ueCb->mimoInfo.txMode == RGR_UE_TM_4) + { + if (cellCb->numTxAntPorts ==2) + { + cqiCb->riNumBits = 1; + } + else if(cellCb->numTxAntPorts ==4) + { + if(ueCat == CM_LTE_UE_CAT_8) + { + cqiCb->riNumBits = 3; + } + else if(ueCat >= CM_LTE_UE_CAT_5) + { + cqiCb->riNumBits = 2; + } + else + { + cqiCb->riNumBits = 1; + } + } + } + /* Place the UE in cellCb->tIUeLstCp */ + cqiCb->riLstEnt.node=(PTR) cqiCb; + + cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, + &cqiCb->riLstEnt); + RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD, + &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); + + + } + else + { + cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->riDist = RG_SCH_INVALID_IDX; + } + + RETVALUE(ROK); + +} + +/* @brief Handles SRS configuration for a UE. + * + * @details + * + * Function : rgSCHCfgSrsUeCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE configuration. It shall do the + * validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific SRS related configuration, + * - If SRS is configured, + * - Update UE with the configured values. + - Compute and Update next occurance of SRS Tranmission instance. + - Update the SRS offset and SRS perodicity information + - Add Ue to cell's srs list + * - else + * - next occurance transmission instance of SRS = RG_SCH_INVALID_IDX + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeUlSrsCfg *srsCfg + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgSrsUeCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeUlSrsCfg *srsCfg + ) +#else +PUBLIC S16 rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeUlSrsCfg *srsCfg; +#endif +{ + U16 srsTrInsTime; + U16 crntTime; + U16 tempIdx; + + TRC3(rgSCHCfgSrsUeCfg); + + + crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + +(cellCb->crntTime.subframe); + + if(RGR_SCH_SRS_SETUP == srsCfg->type) + { + /* 1. Copy the Received Cfg parameters to local cb */ + cmMemcpy((U8 *)&ueCb->srsCb.srsCfg, (U8 *)srsCfg, sizeof(RgrUeUlSrsCfg)); + +#ifndef LTE_TDD + /* 2. Compute SRS Offset and Periodicity */ + rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL, + srsCfg->srsSetup.srsCfgIdx, + &ueCb->srsCb.peri, &ueCb->srsCb.offset); +#else + rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL, + srsCfg->srsSetup.srsCfgIdx, + &ueCb->srsCb.peri, &ueCb->srsCb.offset); +#endif + + RLOG_ARG3(L_DEBUG,DBG_CELLID,cellCb->cellId, + "rgSCHCfgSrsUeCfg(): SRS Peri=%d, SRS Offset=%d UEID:%d", + ueCb->srsCb.peri,ueCb->srsCb.offset,ueCb->ueId); + + /* 3. Compute next Tranmission index for SRS */ + /* Referenence: 36.213 Section:8.2 + i. SRS transmission instances for TDD with period > 2 and for FDD are + ((10*sfn +Ksrs-suframeoffset))/mod(periodicity)) + FDD: Ksrs is 0...9 + TDD: Ksrs Table 8.2-3: + ii.The SRS transmission instances for TDD (periodicity == 2) + (Ksrs-Toffset)mod(5)==0. Note: This is not supported now + */ + + srsTrInsTime = ((ueCb->srsCb.peri+crntTime) - ueCb->srsCb.offset) + %ueCb->srsCb.peri; + tempIdx = (crntTime + (ueCb->srsCb.peri - srsTrInsTime)); +#ifdef LTE_TDD + if (tempIdx <= (crntTime + TFU_DELTA)) +#else + if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) +#endif + { + tempIdx = tempIdx + ueCb->srsCb.peri; + } + ueCb->srsCb.nSrsTrIdx =(U16) (tempIdx + % RG_SCH_PCQI_SRS_SR_TRINS_SIZE); + if(ueCb->srsCb.peri >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) + { +#ifdef LTE_TDD + ueCb->srsCb.srsDist = rgSCHUtlFindDist((U8)(crntTime+TFU_DELTA), + (U16)tempIdx); +#else + ueCb->srsCb.srsDist = rgSCHUtlFindDist((U8)(crntTime + TFU_RECPREQ_DLDELTA), + (U16)tempIdx); +#endif + } + else + { + ueCb->srsCb.srsDist = 0; + } + + /*UE Tx Antenna Selection - START*/ + if(ueCb->ul.ulTxAntSel.pres == TRUE ) + { + /*for both partial and full sounding bandwidth, + and when frequency hopping is disabled */ + ueCb->srsCb.selectedAnt = (crntTime/ueCb->srsCb.peri)%2; + } + else + { + /* TS 36.213 specifies that if Tx Antenna Selection is + disabled/not supported then its Port 0*/ + ueCb->srsCb.selectedAnt=0; + } + ueCb->validTxAnt = ueCb->srsCb.selectedAnt; + /*UE Tx Antenna Selection - ENDS*/ + + ueCb->srsCb.srsLstEnt.node=(PTR)ueCb; + cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, + &ueCb->srsCb.srsLstEnt); + + + } + else + { + /* SRS Release / Not configured */ + ueCb->srsCb.srsCfg.type = RGR_SCH_SRS_REL; + if(ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, + &ueCb->srsCb.srsLstEnt); + } + ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; + ueCb->srsCb.srsLstEnt.node =(PTR) NULLP; + } + + RETVALUE(ROK); +} + + +/* * @brief Handles SR configuration for a UE. + * + * @details + * + * Function : rgSCHCfgSrUeCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE configuration. It shall do the + * validations for the spec-defined values. + * + * - If SR is configured, + * - Update UE with the configured values. + - Compute and Update next occurance of SR Tranmission instance. + - Update the SR offset and SR perodicity information + - Add Ue to cell->tIUeLstCp[n] + * - else + * - next occurance transmission instance of SR = RG_INVALID_SR_ID + * + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeSrCfg *srCfg + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgSrUeCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeSrCfg *srCfg + ) +#else +PUBLIC S16 rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeSrCfg *srCfg; +#endif +{ + U16 srTrInsTime; + U16 crntTime; + + TRC3(rgSCHCfgSrUeCfg); + + + crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + +(cellCb->crntTime.subframe); + if(srCfg->type == RGR_SCH_SR_SETUP) + { + /* 1. Copy the Received Cfg parameters to local cb */ + cmMemcpy((U8 *)&ueCb->srCb.srCfg, (U8 *)srCfg, sizeof(RgrUeSrCfg)); + + + /* 2. Compute SR periodicity and offset */ + rgSCHUtlGetCfgPerOff( RG_SCH_SR_TBL, + srCfg->srSetup.srCfgIdx, + &ueCb->srCb.peri, &ueCb->srCb.offset); + + RLOG_ARG4(L_DEBUG,DBG_CELLID,cellCb->cellId , + "SR Config: idx(%u), period (%u) offset (%u) UEID:%d", + srCfg->srSetup.srCfgIdx, + ueCb->srCb.peri, + ueCb->srCb.offset, + ueCb->ueId); +#ifdef EMTC_ENABLE + if(ueCb->isEmtcUe) + { + rgSchfillPucchSrRepNumCountemtc(ueCb); + } +#endif + /* 3. Compute Next Transmission Instance */ + + srTrInsTime = ((ueCb->srCb.peri+crntTime) - ueCb->srCb.offset) + %ueCb->srCb.peri; + ueCb->srCb.nSrTrIdx = (crntTime + (ueCb->srCb.peri- srTrInsTime)); +#ifdef LTE_TDD + if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_DELTA)) +#else + if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA)) +#endif + { + ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx + ueCb->srCb.peri; + } + ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx + % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + ueCb->srCb.srLstEnt.node= (PTR) ueCb; + + /* 4. Place UE in Cell SR Tranmisison Instance List */ + cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, + &ueCb->srCb.srLstEnt); + } + else + { + ueCb->srCb.srCfg.type = RGR_SCH_SR_REL; + + if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, + &ueCb->srCb.srLstEnt); + } + ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; + ueCb->srCb.srLstEnt.node = (PTR)NULLP; + } + + RETVALUE(ROK); +} + + +/***************************************************************** + * UE PCQI, RI, SRS and SR Re Configuration Functions * + * * + ******************************************************************/ + + +/* * @brief Handles Periodic CQI, PMI, RI Re-configuration for a UE. + * + * @details + * + * Function : rgSCHCfgPCqiUeReCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the + * validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific Periodic CQI related configuration, + * - If Periodic CQI/PMI is re configured(first time enabled), + * - Update UE with the configured values. + * - Compute and Update next occurance of CQI/PMI or RI Tranmission + * instance. + * - Update the CQI offset and CQI perodicity information + * - Add Ue to cell's list + * - If Periodic CQI/PMI is re configured(modify), + * - Update UE with the configured values. + * - Del Ue from cell->tIUeLstCp list + * - Compute and Update next occurance of CQI/PMI or RI Tranmission + * instance. + * - Update the CQI offset and CQI perodicity information + * - Add Ue to cell's list + * - If Periodic CQI/PMI is re configured(disabled), + * - Update UE with the configured values. + * - Del Ue from cell's list + * - Update next occurance of CQI/PMI or RI Tranmission instance. + * - next occurance of CQI/PMI = RG_INVALID_CQIPMI_ID + * + * - For UE-specific Periodic RI related configuration, + * - If Periodic RI is configured(first time enabled), + * - Update UE with the configured values. + * - Compute and Update next occurance of RI Tranmission instance. + * - Update the RI offset and RI perodicity information + * - If Periodic RI is configured(modify), + * - Update UE with the configured values. + * - Compute and Update next occurance of RI Tranmission instance. + * - Update the RI offset and RI perodicity information + * - else + * - next occurance of RI = RG_INVALID_CQIPMI_ID + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeCfg *ueCfg + * + * @return S16 + * -# ROK + * + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgPCqiUeReCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUePrdDlCqiCfg *cqiCfg, + CmLteUeCategory ueCat + ) +#else +PUBLIC S16 rgSCHCfgPCqiUeReCfg(cellCb, ueCb, cqiCfg, ueCat) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUePrdDlCqiCfg *cqiCfg; + CmLteUeCategory ueCat; +#endif +{ + + RgSchUePCqiCb *cqiCb = NULLP; + TRC3(rgSCHCfgPCqiUeReCfg); + + cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); + /* Fix: ccpu00124008 Fix for incorrect check causing missed CQI reception instance */ + if((cqiCfg->type == RGR_SCH_PCQI_SETUP) && + (cqiCb->cqiCfg.type != RGR_SCH_PCQI_SETUP)) + { + /* 1. cqi is in Release (Disable) state, Recfg is allowing Setup (Enable) + */ + rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); + + } + else if((cqiCfg->type == RGR_SCH_PCQI_SETUP) && + (cqiCb->cqiCfg.type == RGR_SCH_PCQI_SETUP )) + { + + /* + 2. Present is SETUP(Enable) state, Recfg is modifying SETUP(Enable) + + 2.1 Delete UE from the cqiList + 2.2 Set next occurance Transmission instace to "INVALID" + 2.3 Compute Next occurance Transmission instace + 2.4 Placed ue in Transmission instance list. + */ + if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX ) + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, + &cqiCb->cqiLstEnt); + + if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX ) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, + &cqiCb->riLstEnt); + RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL, + &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst); + } + + + cqiCb->cqiLstEnt.next = NULLP; + cqiCb->cqiLstEnt.prev = NULLP; + cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + cqiCb->riDist = RG_SCH_INVALID_IDX; + + rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); + } + else + { + /* Present is SETUP(Enable) state, Recfg is Release(Disable) */ + rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat); + } + + /* ccpu00140578:: */ + cqiCb->riRecpPrcsd = FALSE; + RETVALUE(ROK); +} + + +/* * @brief Handles SRS Re-configuration for a UE. + * + * @details + * + * Function : rgSCHCfgSrsUeReCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the + * validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific SRS related re configuration, + * - If SRS is configured modified(First time Enabled), + * - Update UE with the configured values. + * - Compute and Update next occurance of SRS Tranmission instance. + * - Update the SRS offset and SRS perodicity information + * - Add Ue to cell's list + * - If SRS is configured modified(Changed offset or index ), + * - Delete UE from cell->tIUeLstCp[n] if present + * - Update UE with the configured values. + * - Compute and Update next occurance of SRS Tranmission instance. + * - Update the SRS offset and SRS perodicity information + * - Add Ue to cell's list + * - If SRS is configured modified(disabled), + * - Delete UE from cell->tIUeLstCp[n] if present + * - Update next occurance of SRS Tranmission instance to "INVALID". + * - Update the SRS offset and SRS perodicity information "INVALID" + * - else + * - ROK + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeUlSrsCfg *srsCfg + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgSrsUeReCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeUlSrsCfg *srsCfg + ) +#else +PUBLIC S16 rgSCHCfgSrsUeReCfg(cellCb, ueCb, srsCfg) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeUlSrsCfg *srsCfg; +#endif +{ + + TRC3(rgSCHCfgSrsUeReCfg); + + + + if(( RGR_SCH_SRS_SETUP == srsCfg->type) || + ( RGR_SCH_SRS_SETUP != ueCb->srsCb.srsCfg.type )) + { + /* 1. Present is Release(Disable) state, Recfg is allowing + * SETUP(Enable) */ + rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); + } + else if (( RGR_SCH_SRS_SETUP == srsCfg->type ) && + ( RGR_SCH_SRS_SETUP == ueCb->srsCb.srsCfg.type)) + { + + /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable) + + 2.1 Delete UE from the cqiList + 2.2 Set next occurance Transmission instance to "INVALID" + 2.3 Compute Next occurance Transmission instance + 2.4 Placed ue in Transmission instance list. + */ + if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, + &ueCb->srsCb.srsLstEnt); + ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; + } + + rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); + } + else + { + /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable)*/ + rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg); + } + /* ccpu00140578:: */ + ueCb->srsCb.srsRecpPrcsd = FALSE; + + RETVALUE(ROK); +} + +/* @brief Handles SR Re-configuration for a UE. + * + * @details + * + * Function : rgSCHCfgSrUeReCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE Re configuration. + * It shall do the validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific SR related re configuration, + * - If SR is configured modified(First time Enabled), + * - Update UE with the configured values. + * - Compute and Update next occurance of SR Tranmission instance. + * - Update the SR offset and SR perodicity information + * - Add Ue to cell->tIUeLstCp[n] + * - If SR is configured modified(Changed offset or index ), + * - Delete UE from cell->tIUeLstCp[n] if present + * - Update UE with the configured values. + * - Compute and Update next occurance of SR Tranmission instance. + * - Update the SR offset and SR perodicity information + * - Add Ue to cell->tIUeLstCp[n] + * - If SR is configured modified(disabled), + * - Delete UE from cell->tIUeLstCp[n] if present + * - Update next occurance of SR Tranmission instance to "INVALID". + * - Update the SR offset and SR perodicity information "INVALID" + * - else + * - ROK + * + * + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeCfg *ueCfg + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgSrUeReCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeSrCfg *srCfg + ) +#else +PUBLIC S16 rgSCHCfgSrUeReCfg(cellCb, ueCb, srCfg) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeSrCfg *srCfg; +#endif +{ + TRC3(rgSCHCfgSrUeReCfg); + + + /* Fix : syed Incorrect check for SR RECFG */ + if((srCfg->type == RGR_SCH_SR_SETUP) && + (ueCb->srCb.srCfg.type != RGR_SCH_SR_SETUP)) + { + /* + 1. Present is Release(Disable) state, Recfg is allowing SETUP(Enable) + */ + rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); + } + else if((srCfg->type == RGR_SCH_SR_SETUP) && + (ueCb->srCb.srCfg.type == RGR_SCH_SR_SETUP)) + { + + /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable) + + 2.1 Delete UE from the cqiList + 2.2 Compute Next occurance Transmission instace + */ + if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX ) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, + &ueCb->srCb.srLstEnt); + ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; + } + rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); + + } + else + { + /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable) */ + rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg); + } + + RETVALUE(ROK); +} + +/* @brief Handles ACQI Re-configuration for a UE. + * + * @details + * + * Function : rgSCHCfgAcqiUeReCfg + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at UE Re configuration. + * It shall do the validations for the spec-defined values. + * + * Processing Steps: + * - For UE-specific ACQI related re configuration, + * - Check if the ACQI Mode has been changed from the + * existing Configuration. + * - If the configuration has been changed, + * - Call Aperiodic Config function to change the config + * - else + * - ROK + * + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeAprdDlCqiCfg *acqiCfg + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgAcqiUeReCfg +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb, + RgrUeAprdDlCqiCfg *acqiCfg, + CmLteUeCategory ueCat + ) +#else +PUBLIC S16 rgSCHCfgAcqiUeReCfg(cellCb, ueCb, acqiCfg, ueCat) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; + RgrUeAprdDlCqiCfg *acqiCfg; + CmLteUeCategory ueCat; +#endif +{ + TRC3(rgSCHCfgAcqiUeReCfg); + + RETVALUE(rgSCHCfgACqiUeCfg(cellCb,ueCb,(RG_SCH_CMN_GET_ACQICB(ueCb,cellCb)) + ,ueCb->mimoInfo.txMode, acqiCfg, ueCat)); + +} + +/***************************************************************** + * UE PCQI, RI, SRS and SR Configuration Delete * + * * + *****************************************************************/ + +/* @brief Free Periodic CQI/PMI/RI, SRS and SR transmission instance + * related data structures of this UE from CellCb + * + * @details + * + * Function : rgSCHCfgPCqiSrsSrUeDel + * + * Invoking Module Processing: + * - This shall be invoked by SCH_GOM at Ue deletion. + * + * Processing Steps: + * - For SRS Transmission Instance + * - if (srsTxInst!= RG_INVALID) + * - Remove from the cellCb->tIUeLstCp[srsTxInst*3+2] + * - else + * - Nothing to do + * - For SR Transmission Instance + * - if (srTxInst!= RG_INVALID) + * - Remove from the cellCb->tIUeLstCp[srTxInst*3+1] + * - else + * - Nothing to do + * - For Periodic CQI/PMI RI Transmission Instance + * - if (pCqiTxInst!= RG_INVALID) + * - Remove from the cellCb->tIUeLstCp[srTxInst*3+0] + * - else + * - Nothing to do + * - Return ROK + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * + * @return S16 + * -# ROK + */ +#ifdef ANSI +PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel +( + RgSchCellCb *cellCb, + RgSchUeCb *ueCb + ) +#else +PUBLIC S16 rgSCHCfgPCqiSrsSrUeDel(cellCb, ueCb) + RgSchCellCb *cellCb; + RgSchUeCb *ueCb; +#endif +{ +#ifdef LTE_ADV + U32 cellIdx; + U32 sCellCnt = 0; +#endif + RgSchUePCqiCb *cqiRiCb = NULLP; + TRC3(rgSCHCfgPCqiSrsSrUeDel); + + cqiRiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb); + + + + /* Delete SRS Transmission Instance */ + if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst, + &ueCb->srsCb.srsLstEnt); + ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX; + } + + /* Delete SR Transmission Instance */ + if (ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst, + &ueCb->srCb.srLstEnt); + ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX; + } + + /* Delete Periodic CQI/PMI Transmission Instance */ + if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst, + &cqiRiCb->cqiLstEnt); + cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; + + /* Delete Periodic RI Transmission Instance */ + + if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst, + &cqiRiCb->riLstEnt); + RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL, + &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst); + cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + } + } + +#ifdef LTE_ADV + for (cellIdx =1; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++) + { + /* If a serving cell is configured */ + if(ueCb->cellInfo[cellIdx] != NULLP) + { + /* If the serving cell is in ACTIVE state and + If it is not the same serving cell as cqiRiCb for which + collision is being checked */ + cqiRiCb = &ueCb->cellInfo[cellIdx]->cqiCb; + /* Delete Periodic CQI/PMI Transmission Instance */ + if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst, + &cqiRiCb->cqiLstEnt); + cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX; + + /* Delete Periodic RI Transmission Instance */ + + if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX) + { + cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst, + &cqiRiCb->riLstEnt); + RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL, + &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst); + cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX; + } + } + sCellCnt++; + /* If all of the num of configured scells are checked then break */ + if (sCellCnt == ueCb->numSCells) + { + break; + } + } + } +#endif + + RETVALUE(ROK); +} + + +/* @brief Search the cfgIdx in given table and retrive periodicity & offset + * @details + * + * Function : rgSCHUtlGetCfgPerOff + * + * Invoking Module Processing: + * - This shall be invoked by Cfg Module + * + * Processing Steps: + * binary search for given entry in table + * find the periodicty, offset for a given config index from the table + * - Return ROK + * @param[in] RgSchPerTbl tbl + * @param[in] U16 cfgIdx + * @param[out] U16 *peri + * @param[out] U16 *offset + * + * @return S16 + * -# ROK + * + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetCfgPerOff +( + RgSchPerTbl tbl, + U16 cfgIdx, + U16 *peri, + U16 *offset + ) +#else +PUBLIC S16 rgSCHUtlGetCfgPerOff ( tbl, cfgIdx, peri, offset) + RgSchPerTbl tbl; + U16 cfgIdx; + U16 *peri; + U16 *offset; +#endif +{ + U8 mid; + U8 min = 0; + U8 max = 0; + CONSTANT RgSchUePCqiSrsSrCfgIdxTbl* table; + TRC3(rgSCHUtlGetCfgPerOff); + + /* Added the function instead of the MACRO to get the + * periodicity table */ + table = rgSCHCfgUtlGetPcqiSrsSrRiTbl ( tbl,&min,&max ); + do{ + mid = (min+max)/2; + if (( cfgIdx >= table[mid].min) && + ( cfgIdx <= table[mid].max)) + { + *peri = table[mid].peri; + *offset = cfgIdx - table[mid].offset; + break; + } + + if ( cfgIdx > table[mid].min) + { + min = mid+1; + } + else + { + max = mid-1; + } + + }while( min <= max ); + + RETVALUE(ROK); +} + + +/*********************************************************** + * + * Func : rgSCHCfgUtlFetchAcqiBitSz + * + * + * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them + * for decoding. + * + * Ret : Void + * ROK - RETVOID + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz +( + RgSchUeACqiCb *acqiCb, + U8 numTxAnt, + U8* cqiPmiSzR1, + U8* cqiPmiSzRn1 + ) +#else +PRIVATE Void rgSCHCfgUtlFetchAcqiBitSz(acqiCb, numTxAnt, cqiPmiSzR1, cqiPmiSzRn1) + RgSchUeACqiCb *acqiCb; + U8 numTxAnt; + U8* cqiPmiSzR1; + U8* cqiPmiSzRn1; +#endif +{ + + U32 confRepMode; + + + TRC3(rgSCHCfgUtlFetchAcqiBitSz); + + confRepMode = acqiCb->aCqiCfg.aprdModeEnum; + switch(confRepMode) + { + case RGR_APRD_CQI_MOD12: + { + if(numTxAnt == 2) + { + *cqiPmiSzR1 = 4 + 2*acqiCb->N; + *cqiPmiSzRn1 = 8+ acqiCb->N; + } + else if(numTxAnt == 4) + { + *cqiPmiSzR1 = 4 + 4*acqiCb->N; + *cqiPmiSzRn1 = 8 + 4*acqiCb->N; + } + } + break; + + case RGR_APRD_CQI_MOD20: + { + *cqiPmiSzR1 = 6 + acqiCb->L; + *cqiPmiSzRn1 = 6 + acqiCb->L; + } + break; + + case RGR_APRD_CQI_MOD22: + { + if(numTxAnt == 2) + { + *cqiPmiSzR1 = 10 + acqiCb->L; + *cqiPmiSzRn1 = 14 + acqiCb->L; + } + else if(numTxAnt == 4) + { + *cqiPmiSzR1 = 14 + acqiCb->L; + *cqiPmiSzRn1 = 20 + acqiCb->L; + } + } + break; + + case RGR_APRD_CQI_MOD30: + { + *cqiPmiSzR1 = 4 + 2*acqiCb->N; + *cqiPmiSzRn1 = 4 + 2*acqiCb->N; + } + break; + + case RGR_APRD_CQI_MOD31: + { + if(numTxAnt == 2) + { + *cqiPmiSzR1 = 6 + 2*acqiCb->N; + *cqiPmiSzRn1 = 9 + 4*acqiCb->N; + } + else if(numTxAnt == 4) + { + *cqiPmiSzR1 = 8 + 2*acqiCb->N; + *cqiPmiSzRn1 = 12 + 4*acqiCb->N; + } + } + break; + default: + break; + } + RETVOID; +} +/* Added the function rgSCHCfgUtlGetPcqiCrsSrRiTbl to be used + * instead of the MACRO RG_SCH_GET_PERIODICITY_TBL */ +/*********************************************************** + * + * Func : rgSCHCfgUtlGetPcqiCrsSrRiTbl + * + * + * Desc : Get the Srs Cqi Crs Ri Table + * + * Ret : Void + * ROK - RETVOID + * + * Notes: + * + * File : + * + **********************************************************/ + +#ifdef ANSI +PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * rgSCHCfgUtlGetPcqiSrsSrRiTbl +( + RgSchPerTbl tblType, + U8* min, + U8* max +) +#else +PRIVATE CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * rgSCHCfgUtlGetPcqiSrsSrRiTbl(tblType, min, max) + RgSchPerTbl tblType; + U8* min; + U8* max; +#endif +{ + CONSTANT RgSchUePCqiSrsSrCfgIdxTbl * table; + TRC3(rgSCHCfgUtlGetPcqiCrsSrRiTbl); + + switch (tblType) + { + + case RG_SCH_FDD_PCQI_TBL: + { + table = rgSchUePCqiCfgIdxFddTbl; + * min = 0; + * max=RG_SCH_CQIPMI_CFGIDX_MAX_FDD; + break; + } + case RG_SCH_TDD_PCQI_TBL: + { + table = rgSchUeCqiPmiCfgIdxTddTbl; + * min = 0; + * max=RG_SCH_CQIPMI_CFGIDX_MAX_TDD; + break; + } + case RG_SCH_RI_TBL: + { + table = rgSchUeRiCfgIdxTbl; + * min = 0; + * max=RG_SCH_RI_CFGIDX_MAX; + break; + } + case RG_SCH_FDD_SRS_TBL: + { + table = rgSchUeSrsCfgIdxFddTbl; + * min = 0; + * max=RG_SCH_SRS_ISRS_INDX_MAX_FDD; + break; + } + case RG_SCH_TDD_SRS_TBL: + { + table = rgSchUeSrsCfgIdxTddTbl; + * min = 0; + * max=RG_SCH_SRS_ISRS_INDX_MAX_TDD; + break; + } + case RG_SCH_SR_TBL: + { + table = rgSchUeSrCfgIdxTbl; + * min = 0; + * max=RG_SCH_ISR_INDX_MAX; + break; + } + default: + { + table = (CONSTANT RgSchUePCqiSrsSrCfgIdxTbl *) 0; + * min = 0; + * max = 0; + break; + } + + } + RETVALUE ( table ); +} +/* #endif */ +#endif /* TFU_UPGRADE */ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxUeCfg + * + * + * Desc : Validates UE DRX Timers Configuration recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxUeCfg +( +RgSchCellCb *cell, +RgrUeDrxCfg *ueDrxCfg +) +#else +PRIVATE S16 rgSCHCfgVldtDrxUeCfg(cell, ueDrxCfg) +RgSchCellCb *cell; +RgrUeDrxCfg *ueDrxCfg; +#endif +{ + TRC2(rgSCHCfgVldtDrxUeCfg) + + + if (ueDrxCfg->isDrxEnabled == FALSE) + { + RETVALUE(ROK); + } + +#ifdef LTEMAC_R9 + if ( ueDrxCfg->cqiMask.pres ) + { + if ( ueDrxCfg->cqiMask.val != RGR_DRX_SETUP ) + { +#ifdef ALIGN_64BIT + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid cqiMask configuration (%d)", + ueDrxCfg->cqiMask.val); +#else + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid cqiMask configuration(%ld)", + ueDrxCfg->cqiMask.val); +#endif + RETVALUE(RFAILED); + } + } +#endif /*LTEMAC_R9*/ +#ifdef EMTC_ENABLE + if(ueDrxCfg->isEmtcUe) + { + if(ueDrxCfg->drxOnDurTmrR13Pres) + { + if ( rgSCHEmtcCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d)", + ueDrxCfg->drxOnDurTmr); + RETVALUE(RFAILED); + } + } + else + { + if (rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d) for EMTC", + ueDrxCfg->drxOnDurTmr); + RETVALUE(RFAILED); + } + + } + } + else +#endif + { + if ( rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid onDurTimer configuration(%d) for EMTC", + ueDrxCfg->drxOnDurTmr); + RETVALUE(RFAILED); + } + } + + if ( rgSCHCfgVldtDrxInActvCfg(ueDrxCfg->drxInactvTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Inactivity configuration(%d)", + ueDrxCfg->drxInactvTmr); + RETVALUE(RFAILED); + } +#ifdef EMTC_ENABLE + if(ueDrxCfg->isEmtcUe) + { + if(ueDrxCfg->drxRetxTmrR13Pres) + { + if ( rgSCHEmtcCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d) for EMTC", + ueDrxCfg->drxRetxTmr); + RETVALUE(RFAILED); + } + } + else + { + if (rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d)", + ueDrxCfg->drxRetxTmr); + RETVALUE(RFAILED); + } + + } + } + else +#endif + { + if ( rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d)", + ueDrxCfg->drxRetxTmr); + RETVALUE(RFAILED); + } + } +#ifdef EMTC_ENABLE + if(ueDrxCfg->isEmtcUe) + { + if ( rgSCHEmtcCfgVldtDrxUlReTxCfg(ueDrxCfg->emtcDrxUlRetxTmr) != ROK ) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid DrxReTX configuration(%d) for EMTC", + ueDrxCfg->drxRetxTmr); + RETVALUE(RFAILED); + } + + } +#endif + + if ( rgSCHCfgVldtDrxLngCycCfg(ueDrxCfg->drxLongCycleOffst) != ROK ) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid LongCycle configuration"); + RETVALUE(RFAILED); + } + + if ( ueDrxCfg->drxLongCycleOffst.longDrxCycle < ueDrxCfg->drxOnDurTmr ) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " + " and onDuration timer values"); + RETVALUE(RFAILED); + } + +#ifdef LTE_TDD + if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxLongCycleOffst.longDrxCycle, + ueDrxCfg->drxOnDurTmr, ueDrxCfg->drxLongCycleOffst.drxStartOffst) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " + " and onDuration timer values"); + RETVALUE(RFAILED); + } +#endif + + if( TRUE == ueDrxCfg->drxShortDrx.pres ) + { + if ( ueDrxCfg->drxShortDrx.shortDrxCycle < ueDrxCfg->drxOnDurTmr ) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of short DRX " + "Cycle and onDuration timer values"); + RETVALUE(RFAILED); + } + + if ( (ueDrxCfg->drxLongCycleOffst.longDrxCycle % + ueDrxCfg->drxShortDrx.shortDrxCycle) != 0) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId," Long DRX cycle is not multiple of " + "short DRX cycle"); + RETVALUE(RFAILED); + } + + if ( rgSCHCfgVldtDrxShrtCycCfg(ueDrxCfg->drxShortDrx) != ROK ) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid Short Cycle configuration"); + RETVALUE(RFAILED); + } + +#ifdef LTE_TDD + if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxShortDrx.shortDrxCycle, + ueDrxCfg->drxOnDurTmr, + ueDrxCfg->drxLongCycleOffst.drxStartOffst % + ueDrxCfg->drxShortDrx.shortDrxCycle) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid combination of Long DRX Cycle " + " and onDuration timer values"); + RETVALUE(RFAILED); + } +#endif + } + + RETVALUE(ROK); +}/*rgSCHCfgVldtDrxUeCfg*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxOnDurCfg + * + * + * Desc : Validates UE DRX On Duration configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg +( +U8 onDurTmr +) +#else +PRIVATE S16 rgSCHCfgVldtDrxOnDurCfg(onDurTmr) +U8 onDurTmr; +#endif +{ + TRC2(rgSCHCfgVldtDrxOnDurCfg) + + switch ( onDurTmr ) + { + case RGR_DRX_PRD_1PSF: + case RGR_DRX_PRD_2PSF: + case RGR_DRX_PRD_3PSF: + case RGR_DRX_PRD_4PSF: + case RGR_DRX_PRD_5PSF: + case RGR_DRX_PRD_6PSF: + case RGR_DRX_PRD_8PSF: + case RGR_DRX_PRD_10PSF: + case RGR_DRX_PRD_20PSF: + case RGR_DRX_PRD_30PSF: + case RGR_DRX_PRD_40PSF: + case RGR_DRX_PRD_50PSF: + case RGR_DRX_PRD_60PSF: + case RGR_DRX_PRD_80PSF: + case RGR_DRX_PRD_100PSF: + case RGR_DRX_PRD_200PSF: + break; + + default: + { + RETVALUE(RFAILED); + } + }/*switch(onDurTmr)*/ + + RETVALUE(ROK); +}/*rgSCHCfgVldtOnDurCfg*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxInActvCfg + * + * + * Desc : Validates UE DRX InActivity configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxInActvCfg +( +U16 inActvTmr +) +#else +PRIVATE S16 rgSCHCfgVldtDrxInActvCfg(inActvTmr) +U16 inActvTmr; +#endif +{ + TRC2(rgSCHCfgVldtDrxInActvCfg) + + switch ( inActvTmr ) + { + case RGR_DRX_PRD_1PSF: + case RGR_DRX_PRD_2PSF: + case RGR_DRX_PRD_3PSF: + case RGR_DRX_PRD_4PSF: + case RGR_DRX_PRD_5PSF: + case RGR_DRX_PRD_6PSF: + case RGR_DRX_PRD_8PSF: + case RGR_DRX_PRD_10PSF: + case RGR_DRX_PRD_20PSF: + case RGR_DRX_PRD_30PSF: + case RGR_DRX_PRD_40PSF: + case RGR_DRX_PRD_50PSF: + case RGR_DRX_PRD_60PSF: + case RGR_DRX_PRD_80PSF: + case RGR_DRX_PRD_100PSF: + case RGR_DRX_PRD_200PSF: + case RGR_DRX_PRD_300PSF: + case RGR_DRX_PRD_500PSF: + case RGR_DRX_PRD_750PSF: + case RGR_DRX_PRD_1280PSF: + case RGR_DRX_PRD_1920PSF: + case RGR_DRX_PRD_2560PSF: + break; + + default: + { + RETVALUE(RFAILED); + } + }/*switch(InactvTmr)*/ + + RETVALUE(ROK); +}/*rgSCHCfgVldtDrxInActvCfg*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxReTxCfg + * + * + * Desc : Validates DRX ReTx timer configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxReTxCfg +( +U8 reTxTmr +) +#else +PRIVATE S16 rgSCHCfgVldtDrxReTxCfg(reTxTmr) +U8 reTxTmr; +#endif +{ + TRC2(rgSCHCfgVldtDrxReTxCfg) + + switch ( reTxTmr ) + { + case RGR_DRX_PRD_1PSF: + case RGR_DRX_PRD_2PSF: + case RGR_DRX_PRD_4PSF: + case RGR_DRX_PRD_6PSF: + case RGR_DRX_PRD_8PSF: + case RGR_DRX_PRD_16PSF: + case RGR_DRX_PRD_24PSF: + case RGR_DRX_PRD_33PSF: + break; + + default: + { + RETVALUE(RFAILED); + } + }/*switch(drxRetxTmr)*/ + + RETVALUE(ROK); +}/*rgSCHCfgVldtDrxReTxCfg*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxShrtCycCfg + * + * + * Desc : Validates DRX Short Cycle timer configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg +( +RgrDrxLongCycleOffst lngCycleOffst +) +#else +PRIVATE S16 rgSCHCfgVldtDrxLngCycCfg(lngCycleOffst) +RgrDrxLongCycleOffst lngCycleOffst; +#endif +{ + TRC2(rgSCHCfgVldtDrxLngCycCfg) + + if ( rgSCHCfgVldtDrxLngCyclTmrs(lngCycleOffst.longDrxCycle) != ROK ) + { + RETVALUE(RFAILED); + } + + if ( lngCycleOffst.drxStartOffst >= lngCycleOffst.longDrxCycle ) + { + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/*rgSCHCfgVldtDrxLngCycCfg*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxLngCyclTmrs + * + * + * Desc : Validates DRX Long Cycle timer values + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs +( +U16 val +) +#else +PRIVATE S16 rgSCHCfgVldtDrxLngCyclTmrs(val) +U16 val; +#endif +{ + TRC2(rgSCHCfgVldtDrxLngCyclTmrs) + + switch ( val ) + { + case RGR_DRX_PRD_10SF: + case RGR_DRX_PRD_20SF: + case RGR_DRX_PRD_32SF: + case RGR_DRX_PRD_40SF: + case RGR_DRX_PRD_64SF: + case RGR_DRX_PRD_80SF: + case RGR_DRX_PRD_128SF: + case RGR_DRX_PRD_160SF: + case RGR_DRX_PRD_256SF: + case RGR_DRX_PRD_320SF: + case RGR_DRX_PRD_512SF: + case RGR_DRX_PRD_640SF: + case RGR_DRX_PRD_1024SF: + case RGR_DRX_PRD_1280SF: + case RGR_DRX_PRD_2048SF: + case RGR_DRX_PRD_2560SF: + break; + + default: + { + RETVALUE(RFAILED); + } + }/*switch(longDrxCycle)*/ + + RETVALUE(ROK); +}/*rgSCHCfgVldtDrxLngCyclTmrs*/ + +/*********************************************************** + * + * Func : rgSCHCfgVldtDrxShrtCycCfg + * + * + * Desc : Validates DRX Short Cycle timer configuration + * recieved from RRC. + * + * Ret : S16 + * ROK - Success + * + * RFAILED - Failed + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg +( +RgrDrxShortDrx shrtCycCfg +) +#else +PRIVATE S16 rgSCHCfgVldtDrxShrtCycCfg(shrtCycCfg) +RgrDrxShortDrx shrtCycCfg; +#endif +{ + TRC2(rgSCHCfgVldtDrxShrtCycCfg) + + switch(shrtCycCfg.shortDrxCycle) + { + case RGR_DRX_PRD_2SF: + case RGR_DRX_PRD_5SF: + case RGR_DRX_PRD_8SF: + case RGR_DRX_PRD_10SF: + case RGR_DRX_PRD_16SF: + case RGR_DRX_PRD_20SF: + case RGR_DRX_PRD_32SF: + case RGR_DRX_PRD_40SF: + case RGR_DRX_PRD_64SF: + case RGR_DRX_PRD_80SF: + case RGR_DRX_PRD_128SF: + case RGR_DRX_PRD_160SF: + case RGR_DRX_PRD_256SF: + case RGR_DRX_PRD_320SF: + case RGR_DRX_PRD_640SF: + break; + + default: + { + RETVALUE(RFAILED); + } + + }/*switch(shortDrxCycle)*/ + + if ( (shrtCycCfg.drxShortCycleTmr < RGR_DRX_SHRTCYCLE_MIN) || + (shrtCycCfg.drxShortCycleTmr > RGR_DRX_SHRTCYCLE_MAX) + ) + { + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} + +/** + * @brief Handler for TA related UE Reconfiguration. + * + * @details + * + * Function : rgSCHCfgUeTaRecfg + * + * This function shall fetch the TA timer related information into the + * respective ueCb from the UE configuration as provided by the + * upper layers. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * @param[in] RgrUeCfg *ueCfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE Void rgSCHCfgUeTaRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgrUeRecfg *ueCfg, +RgSchErrInfo *err +) +#else +PRIVATE Void rgSCHCfgUeTaRecfg(cell, ueCb, ueCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +RgrUeRecfg *ueCfg; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHCfgUeTaRecfg) + + UNUSED(err); + + /* Update the TA related information */ + + if (ueCfg->ueTaTmrRecfg.pres) + { + /* Configuring taTmr with 30 deficit, to enable eNodeB sending + * TA command before the expiry of TA at UE. Also considering for + * possible retx for this TA command */ + /* [ccpu00121813]-ADD-Added chk if tatmr val > 30 */ + if(ueCfg->ueTaTmrRecfg.taTmr > 30) + { + ueCb->dl.taCb.cfgTaTmr = ueCfg->ueTaTmrRecfg.taTmr - 30; + } + /* If TA Timer is running. Stop it and then start it*/ + if (ueCb->taTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, ueCb->taTmr.tmrEvnt, ueCb); + rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr); + } + else + { + rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr); + } + } + RETVOID; +} /* rgSCHCfgUeTaRecfg */ + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2))) +/*********************************************************** + * + * Func : rgSCHCfgUeCqiReptReCfg + * + * + * Desc : Reconfiguration of PUSH N CQI Reporting + * + * Ret : RFAILED in case of failure + * ROK if success + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCfgUeCqiReptReCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE S16 rgSCHCfgUeCqiReptReCfg(cell, ue, ueRecfg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +#endif +{ + S16 retVal; + TRC3(rgSCHCfgUeCqiReptReCfg) + + /* Check has it been disabled */ + if(ueRecfg->ueCqiReptCfg.numColltdCqiRept) + { + /* Check if we need to send CQI reports collagted so far and send if so */ + if(ue->schCqiInfo.cqiCount >= + ueRecfg->ueCqiReptCfg.numColltdCqiRept) + { + RgrStaIndInfo *staInfo; + /* if yes, Send StaInd to RRM */ + retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo, + sizeof(RgrStaIndInfo)); + if(retVal != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Could not allocate memory for sending StaInd OLD CRNTI:%d",ueRecfg->oldCrnti); + RETVALUE(retVal); + } + + /* Fill StaInd for sending collated N CQI rpeort */ + rgSCHUtlFillSndStaInd(cell, ue, staInfo, + ueRecfg->ueCqiReptCfg.numColltdCqiRept); + } + } + else + { + ue->schCqiInfo.cqiCount = 0; + } + + ue->cqiReptCfgInfo.numColltdCqiRept = + ueRecfg->ueCqiReptCfg.numColltdCqiRept; + RETVALUE(ROK); +} /* End of rgSCHCfgUeCqiReptReCfg */ +#endif /* End of RGR_CQI_REPT */ +/*This function Added Ue in ongoing L2 Meas*/ +/*LTE_L2_MEAS_PHASE2*/ +#ifdef LTE_L2_MEAS +PRIVATE S16 rgSchAddToL2Meas(RgSchCellCb *cellCb,RgSchDlLcCb *dlLc) +{ + CmLList *lnk; + U16 idx; + RgSchL2MeasCb *measCb = NULLP; + lnk = cellCb->l2mList.first; + + while(lnk != NULLP) + { + /* Get the MeasCb : RgSchL2MeasCb */ + measCb = (RgSchL2MeasCb *)lnk->node; + if (measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) + { + for(idx = 0;idx < measCb->measReq.avgPrbQciDl.numQci;idx++) + { + if(measCb->measReq.avgPrbQciDl.qci[idx] == dlLc->qciCb->qci) + { + break; /*exit from for loop*/ + } + } + if(idx == measCb->measReq.avgPrbQciDl.numQci) + { + measCb->measReq.avgPrbQciDl.qci[measCb->measReq.avgPrbQciDl.numQci++] = dlLc->qciCb->qci; + } + } + lnk = lnk->next; + }/*End of while loop*/ + + RETVALUE(ROK); +} +#endif +#ifdef LTE_ADV +/** + * @brief UE SCell Buffer Free + * + * @details + * + * Function : rgSCHSCellFreeBuf + * + * This functions will free allocated memory + * for UE secondart cellCB + * + * + * @param[in] Inst inst + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] U8 idx + * @return VOID + **/ +#ifdef ANSI +PUBLIC Void rgSCHSCellFreeBuf +( +Inst inst, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +U8 idx +) +#else +PUBLIC Void rgSCHSCellFreeBuf(inst ,ue, ueRecfg, idx) +Inst inst; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +U8 idx; +#endif +{ + RgSchUeCellInfo *sCellInfo = NULLP; + RgrUeSecCellCfg *sCellInfoRecfg = NULLP; + + TRC2(rgSCHSCellFreeBuf); + + for(U8 i = 0; i <= idx; i++) + { + sCellInfoRecfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[i]; + sCellInfo = ue->cellInfo[(sCellInfoRecfg->sCellIdx)]; + + if (NULLP != sCellInfo) + { + rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo), + sizeof(RgSchUeCellInfo)); + ue->cellInfo[(sCellInfoRecfg->sCellIdx)] = NULLP; + + } + } + RETVOID; +} +#endif +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_clist.x b/src/5gnrsch/rg_sch_clist.x similarity index 100% rename from src/5gnrmac/rg_sch_clist.x rename to src/5gnrsch/rg_sch_clist.x diff --git a/src/5gnrsch/rg_sch_cmn.c b/src/5gnrsch/rg_sch_cmn.c new file mode 100755 index 000000000..75fa54a27 --- /dev/null +++ b/src/5gnrsch/rg_sch_cmn.c @@ -0,0 +1,32471 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch_cmn.c + +**********************************************************************/ + +/** @file rg_sch_cmn.c +@brief This file implements the schedulers main access to MAC layer code. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_FILE_ID=187; +static int RLOG_MODULE_ID=4096; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "cm5.h" +#include "lrg.h" +#include "rgr.h" +#include "tfu.h" +#include "rgm.h" +#include "rg_env.h" +#include "rg_sch_err.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_cmn.h" +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for Scheduler */ +#include "rg_sch_cmn.x" /* typedefs for Scheduler */ +#ifdef MAC_SCH_STATS +#include "lrg.x" /* Stats Structures */ +#endif /* MAC_SCH_STATS */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef EMTC_ENABLE +EXTERN U32 emtcStatsUlTomSrInd; +EXTERN U32 emtcStatsUlBsrTmrTxp; +#endif + +#define RG_ITBS_DIFF(_x, _y) ((_x) > (_y) ? (_x) - (_y) : (_y) - (_x)) +EXTERN Void rgSCHSc1UlInit ARGS((RgUlSchdApis *apis)); +#ifdef RG_PHASE2_SCHED +EXTERN Void rgSCHRrUlInit ARGS((RgUlSchdApis *apis)); +#ifdef EMTC_ENABLE +EXTERN Void rgSCHEmtcHqInfoFree ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP)); +EXTERN Void rgSCHEmtcRrUlInit ARGS((RgUlSchdApis *apis)); +EXTERN Void rgSCHEmtcCmnDlInit ARGS((Void)); +EXTERN Void rgSCHEmtcCmnUlInit ARGS((Void)); +EXTERN Void rgSCHEmtcCmnUeNbReset ARGS((RgSchUeCb *ueCb)); +EXTERN RgSchCmnCqiToTbs *rgSchEmtcCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI]; +#endif +EXTERN Void rgSCHMaxciUlInit ARGS((RgUlSchdApis *apis)); +EXTERN Void rgSCHPfsUlInit ARGS((RgUlSchdApis *apis)); +#endif +EXTERN Void rgSCHSc1DlInit ARGS((RgDlSchdApis *apis)); +#ifdef RG_PHASE2_SCHED +EXTERN Void rgSCHRrDlInit ARGS((RgDlSchdApis *apis)); +#ifdef EMTC_ENABLE +EXTERN Void rgSCHEmtcRrDlInit ARGS((RgDlEmtcSchdApis *apis)); +#endif +EXTERN Void rgSCHMaxciDlInit ARGS((RgDlSchdApis *apis)); +EXTERN Void rgSCHPfsDlInit ARGS((RgDlSchdApis *apis)); +#ifdef TFU_UPGRADE +EXTERN Void rgSCHDlfsInit ARGS((RgDlfsSchdApis *apis)); +#endif +#endif +#ifdef EMTC_ENABLE +EXTERN Void rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl ARGS((RgSchCellCb *cell)); +EXTERN Void rgSCHCmnGetEmtcDciFrmtSizes ARGS((RgSchCellCb *cell)); +EXTERN Void rgSCHEmtcRrUlProcRmvFrmRetx ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *proc)); +EXTERN S16 rgSCHCmnPrecompEmtcMsg3Vars +ARGS(( +RgSchCmnUlCell *cellUl, +U8 ccchCqi, +U16 msgSzA, +U8 sbSize, +Bool isEcp +)); +PUBLIC Void rgSCHEmtcCmnUeCcchSduDel +( +RgSchCellCb *cell, +RgSchUeCb *ueCb +); +EXTERN Void rgSCHEmtcRmvFrmTaLst +( +RgSchCmnDlCell *cellDl, +RgSchUeCb *ue +); +EXTERN Void rgSCHEmtcInitTaLst +( +RgSchCmnDlCell *cellDl +); +EXTERN Void rgSCHEmtcAddToTaLst +( +RgSchCmnDlCell *cellDl, +RgSchUeCb *ue +); + +#endif + +#ifdef RGR_SI_SCH +PRIVATE Void rgSCHDlSiSched ARGS((RgSchCellCb *cell, + RgSchCmnDlRbAllocInfo *allocInfo, + RgInfSfAlloc *subfrmAlloc)); +PRIVATE Void rgSCHChkNUpdSiCfg ARGS((RgSchCellCb *cell)); +PRIVATE Void rgSCHSelectSi ARGS((RgSchCellCb *cell)); +#endif /*RGR_SI_SCH*/ +/* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD +PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +); +PRIVATE S16 rgSCHCmnBuildRntpInfo ( +RgSchCellCb *cell, +U8 *rntpPtr, +U8 startRb, +U8 nmbRb, +U16 bw +); +#endif + +PUBLIC Void rgSCHCmnDlSpsSch +( + RgSchCellCb *cell +); +/* LTE_ADV_FLAG_REMOVED_END */ + +PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHBcchPcchDlRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnDlBcchPcchAlloc ARGS(( +RgSchCellCb *cell +)); +#ifdef RGR_CQI_REPT +PRIVATE Void rgSCHCmnDlCqiOnPucchInd ARGS (( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + RgrUeCqiRept *ueCqiRept, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + )); +PRIVATE Void rgSCHCmnDlCqiOnPuschInd ARGS (( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPusch *puschCqi, + RgrUeCqiRept *ueCqiRept, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + )); +#else +PRIVATE Void rgSCHCmnDlCqiOnPucchInd ARGS (( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + )); +PRIVATE Void rgSCHCmnDlCqiOnPuschInd ARGS (( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPusch *puschCqi + )); +#endif +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT +PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept ARGS(( + RgSchCellCb *cell, + RgSchUeCb *ue, + RgrUeCqiRept *ueCqiRept)); +#endif /* End of RGR_CQI_REPT */ +/* Fix: syed align multiple UEs to refresh at same time */ +PRIVATE Void rgSCHCmnGetRefreshPer ARGS(( + RgSchCellCb *cell, + RgSchUeCb *ue, + U32 *waitPer)); +PRIVATE S16 rgSCHCmnApplyUeRefresh ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue)); +#ifdef DL_LA +PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE Void rgSCHCheckAndSetTxScheme ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +#endif + +#ifdef LTE_TDD +PRIVATE U32 rgSCHCmnCalcDwPtsTbSz ARGS +(( +RgSchCellCb *cell, +U32 bo, +U8 *rb, +U8 *iTbs, +U8 lyr, +U8 cfi +)); + +PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw ARGS +(( +RgSchCellCb *cell, +U32 bo, +U8 *rb, +U8 maxRb, +U8 *iTbs1, +U8 *iTbs2, +U8 lyr1, +U8 lyr2, +U32 *tb1Sz, +U32 *tb2Sz, +U8 cfi +)); + +#endif +PRIVATE Void rgSCHCmnNonDlfsType0Alloc +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +RgSchUeCb *ue +); +PRIVATE Void rgSCHCmnInitRbAlloc ARGS +(( +RgSchCellCb *cell +)); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/* local defines */ +PUBLIC RgSchdApis rgSchCmnApis; +PRIVATE RgUlSchdApis rgSchUlSchdTbl[RGSCH_NUM_SCHEDULERS]; +PRIVATE RgDlSchdApis rgSchDlSchdTbl[RGSCH_NUM_SCHEDULERS]; +#ifdef EMTC_ENABLE +PRIVATE RgUlSchdApis rgSchEmtcUlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS]; +PRIVATE RgDlEmtcSchdApis rgSchEmtcDlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS]; +#endif +#ifdef RG_PHASE2_SCHED +PRIVATE RgDlfsSchdApis rgSchDlfsSchdTbl[RGSCH_NUM_DLFS_SCHEDULERS]; +#endif +PRIVATE RgUlSchdInits rgSchUlSchdInits = RGSCH_ULSCHED_INITS; +PRIVATE RgDlSchdInits rgSchDlSchdInits = RGSCH_DLSCHED_INITS; +#ifdef EMTC_ENABLE +PRIVATE RgEmtcUlSchdInits rgSchEmtcUlSchdInits = RGSCH_EMTC_ULSCHED_INITS; +PRIVATE RgEmtcDlSchdInits rgSchEmtcDlSchdInits = RGSCH_EMTC_DLSCHED_INITS; +#endif +#if (defined (RG_PHASE2_SCHED) && defined (TFU_UPGRADE)) +PRIVATE RgDlfsSchdInits rgSchDlfsSchdInits = RGSCH_DLFSSCHED_INITS; +#endif + +typedef Void (*RgSchCmnDlAllocRbFunc) ARGS((RgSchCellCb *cell, RgSchDlSf *subFrm, +RgSchUeCb *ue, U32 bo, U32 *effBo, RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo)); +typedef U8 (*RgSchCmnDlGetPrecInfFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + U8 numLyrs, Bool bothCwEnbld)); + +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1 ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +)); +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +)); +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +)); +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2 ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +)); +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +)); +PRIVATE Void rgSCHCmnDlAllocTxRbTM1 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocTxRbTM2 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocTxRbTM3 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocTxRbTM4 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +#ifdef RG_UNUSED +PRIVATE Void rgSCHCmnDlAllocTxRbTM5 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +#endif +PRIVATE Void rgSCHCmnDlAllocTxRbTM6 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocTxRbTM7 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocRetxRbTM1 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocRetxRbTM2 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocRetxRbTM3 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocRetxRbTM4 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +#ifdef RG_UNUSED +PRIVATE Void rgSCHCmnDlAllocRetxRbTM5 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +#endif +PRIVATE Void rgSCHCmnDlAllocRetxRbTM6 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlAllocRetxRbTM7 ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); + +#ifdef LTE_ADV +PRIVATE U8 rgSchGetN1ResCount ARGS (( + RgSchUeCb *ue, + U16 servCellId +)); +PUBLIC Bool rgSchCmnChkDataOnlyOnPcell +( + RgSchUeCb *ue, + RgSchDlSf *dlSf +); +#endif /*LTE_ADV */ +PUBLIC U8 rgSCHCmnCalcPcqiBitSz +( + RgSchUeCb *ueCb, + U8 numTxAnt +); + +#ifndef LTE_ADV +/* Functions specific to each transmission mode for DL Tx RB Allocation*/ +RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[7] = {rgSCHCmnDlAllocTxRbTM1, +rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4, +NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7}; + +/* Functions specific to each transmission mode for DL Retx RB Allocation*/ +RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[7] = {rgSCHCmnDlAllocRetxRbTM1, +rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4, +NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7}; +#else +/* Functions specific to each transmission mode for DL Tx RB Allocation*/ +RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[9] = {rgSCHCmnDlAllocTxRbTM1, +rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4, +NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7, NULLP, NULLP}; + +/* Functions specific to each transmission mode for DL Retx RB Allocation*/ +RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[9] = {rgSCHCmnDlAllocRetxRbTM1, +rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4, +NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7, NULLP, NULLP}; + +#endif + + +PRIVATE U8 rgSCHCmnDlTM3PrecInf2 ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +)); +PRIVATE U8 rgSCHCmnDlTM3PrecInf4 ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +)); +PRIVATE U8 rgSCHCmnDlTM4PrecInf2 ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +)); +PRIVATE U8 rgSCHCmnDlTM4PrecInf4 ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +)); +/* Functions specific to each transmission mode for DL RB Allocation*/ +RgSchCmnDlGetPrecInfFunc getPrecInfoFunc[2][2] = { +{rgSCHCmnDlTM3PrecInf2, rgSCHCmnDlTM3PrecInf4}, +{rgSCHCmnDlTM4PrecInf2, rgSCHCmnDlTM4PrecInf4} +}; + +PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *tbInfo, +U8 noLyr, +U8 *numRb, +U32 *effBo +)); +PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U8 *numRb, +Bool *swpFlg, +U32 *effBo +)); +PRIVATE Void rgSCHCmnDlTM3TxTx ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlTM3TxRetx ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); +PRIVATE Void rgSCHCmnDlTM3RetxRetx ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +)); + +PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +)); +/* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD +PRIVATE Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +)); +#endif +/* LTE_ADV_FLAG_REMOVED_END */ +PRIVATE Void rgSCHCmnDlRbInfoAddUeTx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc +)); +PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +)); +PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst ARGS(( +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc +)); +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *reTxTb, +RgSchDlHqTbCb *txTb, +U8 *numRb, +U32 *effBo +)); +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U32 bo, +U8 *numRb, +U32 *effBo +)); +PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *tbInfo, +U32 bo, +U8 *numRb, +U32 *effBo +)); +#ifndef LTEMAC_SPS +PRIVATE Void rgSCHCmnFillHqPTb ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +U8 tbAllocIdx, +RgSchPdcch *pdcch +)); +#endif +#ifdef LTEMAC_SPS +PRIVATE Void rgSCHCmnDlGetBestFitHole ARGS(( +U32 *allocMask, +U8 numMaskRbs, +U32 *crntAllocMask, +U8 rbsReq, +U8 *allocStart, +U8 *allocNumRbs, +Bool isPartialAlloc +)); +#ifdef RGSCH_SPS_UNUSED +PRIVATE U32 rgSCHCmnGetRaType1Mask ARGS(( +U8 rbIdx, +U8 rbgSize, +U8 *type1Subset +)); +#endif +PRIVATE U32 rgSCHCmnGetRaType0Mask ARGS(( +U8 rbIdx, +U8 rbgSize +)); +PRIVATE U32 rgSCHCmnGetRaType2Mask ARGS(( +U8 rbIdx, +U8 *maskIdx +)); +#endif + +PUBLIC Bool rgSCHCmnRetxAllocAvoid ARGS(( +RgSchDlSf *subFrm, +RgSchCellCb *cell, +RgSchDlHqProcCb *proc +)); + +PUBLIC U16 rgSCHCmnGetSiSetId ARGS(( +U16 sfn, +U8 sf, +U16 minPeriodicity +)); + +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 maxRb, +U32 *numSb, +U8 *iTbs, +U32 hqSz, +U32 stepDownItbs, +U32 effTgt +)); +#endif + +#ifdef RG_5GTF +//TODO_SID: Currenly table is only for 100 Prbs. Need to modify wrt VRBG table 8.1.5.2.1-1 V5G_213 +U32 rgSch5gtfTbSzTbl[MAX_5GTF_MCS] = + {1864, 5256, 8776, 13176, 17576, 21976, 26376, 31656, 35176, 39576, 43976, 47496, 52776, 59376, 66392}; +U32 g5gtfTtiCnt = 0; +U32 gUl5gtfSrRecv = 0; +U32 gUl5gtfBsrRecv = 0; +U32 gUl5gtfUeSchPick = 0; +U32 gUl5gtfPdcchSchd = 0; +U32 gUl5gtfAllocAllocated = 0; +U32 gUl5gtfUeRbAllocDone = 0; +U32 gUl5gtfUeRmvFnlzZeroBo = 0; +U32 gUl5gtfUeFnlzReAdd = 0; +U32 gUl5gtfPdcchSend = 0; +U32 gUl5gtfRbAllocFail = 0; +U32 ul5gtfsidUlMarkUl = 0; +U32 ul5gtfsidDlSchdPass = 0; +U32 ul5gtfsidDlAlreadyMarkUl = 0; +U32 ul5gtfTotSchdCnt = 0; +#endif + +/* CQI Offset Index to Beta CQI Offset value mapping, + * stored as parts per 1000. Reserved is set to 0. + * Refer 36.213 sec 8.6.3 Tbl 8.6.3-3 */ +PUBLIC U32 rgSchCmnBetaCqiOffstTbl[16] = {0, 0, 1125, + 1250, 1375, 1625, 1750, 2000, 2250, 2500, 2875, + 3125, 3500, 4000, 5000, 6250}; +PUBLIC U32 rgSchCmnBetaHqOffstTbl[16] = {2000, 2500, 3125, + 4000, 5000, 6250, 8000,10000, 12625, 15875, 20000, + 31000, 50000,80000,126000,0}; +PUBLIC U32 rgSchCmnBetaRiOffstTbl[16] = {1250, 1625, 2000, + 2500, 3125, 4000, 5000, 6250, 8000, 10000,12625, + 15875,20000,0,0,0}; +PUBLIC S8 rgSchCmnDlCqiDiffOfst[8] = {0, 1, 2, 3, -4, -3, -2, -1}; + +/* Include CRS REs while calculating Efficiency */ +CONSTANT PRIVATE U8 rgSchCmnAntIdx[5] = {0,0,1,0,2}; +CONSTANT PRIVATE U8 rgSchCmnNumResForCrs[5] = {0,6,12,0,16}; +U32 cfiSwitchCnt ; +U32 cfiIncr ; +U32 cfiDecr ; + + +#ifdef TFU_UPGRADE +PUBLIC S8 rgSchCmnApUeSelDiffCqi[4] = {1, 2, 3, 4}; +PUBLIC S8 rgSchCmnApEnbConfDiffCqi[4] = {0, 1, 2, -1}; +#endif + +typedef struct rgSchCmnDlUeDciFrmtOptns +{ + TfuDciFormat spfcDciFrmt; /* TM(Transmission Mode) specific DCI format. + * Search space : UE Specific by C-RNTI only. */ + U8 spfcDciRAType; /* Resource Alloctn(RA) type for spfcDciFrmt */ + TfuDciFormat prfrdDciFrmt; /* Preferred DCI format among the available + * options for TD (Transmit Diversity) */ + U8 prfrdDciRAType; /* Resource Alloctn(RA) type for prfrdDciFrmt */ +}RgSchCmnDlUeDciFrmtOptns; +#ifndef LTE_ADV + +/* DCI Format options for each Transmission Mode */ +RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[7] = { + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2} +}; + +#else +/* DCI Format options for each Transmission Mode */ +RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[9] = { + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}, + {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2} +}; +#endif + + +typedef struct rgSchCmnDlImcsTbl +{ + U8 modOdr; /* Modulation Order */ + U8 iTbs; /* ITBS */ +}RgSchCmnDlImcsTbl[29]; + +CONSTANT struct rgSchCmnMult235Info +{ + U8 match; /* Closest number satisfying 2^a.3^b.5^c, with a bias + * towards the smaller number */ + U8 prvMatch; /* Closest number not greater than array index + * satisfying 2^a.3^b.5^c */ +} rgSchCmnMult235Tbl[110+1] = { + {0, 0}, /* dummy */ + {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {6, 6}, {8, 8}, + {9, 9}, {10, 10}, {10, 10}, {12, 12}, {12, 12}, {15, 12}, {15, 15}, + {16, 16}, {16, 16}, {18, 18}, {18, 18}, {20, 20}, {20, 20}, {20, 20}, + {24, 20}, {24, 24}, {25, 25}, {25, 25}, {27, 27}, {27, 27}, {30, 27}, + {30, 30}, {30, 30}, {32, 32}, {32, 32}, {32, 32}, {36, 32}, {36, 36}, + {36, 36}, {36, 36}, {40, 36}, {40, 40}, {40, 40}, {40, 40}, {45, 40}, + {45, 40}, {45, 45}, {45, 45}, {48, 45}, {48, 48}, {48, 48}, {50, 50}, + {50, 50}, {50, 50}, {54, 50}, {54, 54}, {54, 54}, {54, 54}, {54, 54}, + {60, 54}, {60, 54}, {60, 60}, {60, 60}, {60, 60}, {64, 60}, {64, 64}, + {64, 64}, {64, 64}, {64, 64}, {64, 64}, {72, 64}, {72, 64}, {72, 64}, + {72, 72}, {72, 72}, {75, 72}, {75, 75}, {75, 75}, {75, 75}, {80, 75}, + {80, 75}, {80, 80}, {81, 81}, {81, 81}, {81, 81}, {81, 81}, {81, 81}, + {90, 81}, {90, 81}, {90, 81}, {90, 81}, {90, 90}, {90, 90}, {90, 90}, + {90, 90}, {96, 90}, {96, 90}, {96, 96}, {96, 96}, {96, 96}, {100, 96}, + {100, 100}, {100, 100}, {100, 100}, {100, 100}, {100, 100}, {108, 100}, + {108, 100}, {108, 100}, {108, 108}, {108, 108}, {108, 108} +}; + +/* R8 Upgrade */ +/* BI table from 36.321 Table 7.2.1 */ +CONSTANT PRIVATE S16 rgSchCmnBiTbl[RG_SCH_CMN_NUM_BI_VAL] = { + 0, 10, 20, 30,40,60,80,120,160,240,320,480,960}; +PUBLIC RgSchCmnUlCqiInfo rgSchCmnUlCqiTbl[RG_SCH_CMN_UL_NUM_CQI] = { + { 0, 0 }, + {RGSCH_CMN_QM_CQI_1,RGSCH_CMN_UL_EFF_CQI_1 }, + {RGSCH_CMN_QM_CQI_2,RGSCH_CMN_UL_EFF_CQI_2 }, + {RGSCH_CMN_QM_CQI_3,RGSCH_CMN_UL_EFF_CQI_3 }, + {RGSCH_CMN_QM_CQI_4,RGSCH_CMN_UL_EFF_CQI_4 }, + {RGSCH_CMN_QM_CQI_5,RGSCH_CMN_UL_EFF_CQI_5 }, + {RGSCH_CMN_QM_CQI_6,RGSCH_CMN_UL_EFF_CQI_6 }, + {RGSCH_CMN_QM_CQI_7,RGSCH_CMN_UL_EFF_CQI_7 }, + {RGSCH_CMN_QM_CQI_8,RGSCH_CMN_UL_EFF_CQI_8 }, + {RGSCH_CMN_QM_CQI_9,RGSCH_CMN_UL_EFF_CQI_9 }, + {RGSCH_CMN_QM_CQI_10,RGSCH_CMN_UL_EFF_CQI_10 }, + {RGSCH_CMN_QM_CQI_11,RGSCH_CMN_UL_EFF_CQI_11 }, + {RGSCH_CMN_QM_CQI_12,RGSCH_CMN_UL_EFF_CQI_12 }, + {RGSCH_CMN_QM_CQI_13,RGSCH_CMN_UL_EFF_CQI_13 }, + {RGSCH_CMN_QM_CQI_14,RGSCH_CMN_UL_EFF_CQI_14 }, + {RGSCH_CMN_QM_CQI_15,RGSCH_CMN_UL_EFF_CQI_15 }, +}; + +#ifdef RG_UNUSED +/* This table maps a (delta_offset * 2 + 2) to a (beta * 8) + * where beta is 10^-(delta_offset/10) rounded off to nearest 1/8 + */ +PRIVATE U16 rgSchCmnUlBeta8Tbl[29] = { + 6, RG_SCH_CMN_UL_INVALID_BETA8, 8, 9, 10, 11, 13, 14, 16, 18, 20, 23, + 25, 28, 32, RG_SCH_CMN_UL_INVALID_BETA8, 40, RG_SCH_CMN_UL_INVALID_BETA8, + 50, RG_SCH_CMN_UL_INVALID_BETA8, 64, RG_SCH_CMN_UL_INVALID_BETA8, 80, + RG_SCH_CMN_UL_INVALID_BETA8, 101, RG_SCH_CMN_UL_INVALID_BETA8, 127, + RG_SCH_CMN_UL_INVALID_BETA8, 160 +}; +#endif + +/* QCI to SVC priority mapping. Index specifies the Qci*/ +PRIVATE U8 rgSchCmnDlQciPrio[RG_SCH_CMN_MAX_QCI] = RG_SCH_CMN_QCI_TO_PRIO; + +/* The configuration is efficiency measured per 1024 REs. */ +/* The first element stands for when CQI is not known */ +/* This table is used to translate CQI to its corrospoding */ +/* allocation parameters. These are currently from 36.213 */ +/* Just this talbe needs to be edited for modifying the */ +/* the resource allocation behaviour */ + +/* ADD CQI to MCS mapping correction + * single dimensional array is replaced by 2 dimensions for different CFI*/ +PRIVATE U16 rgSchCmnCqiPdschEff[4][16] = {RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI1, + RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI2,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI3}; + +PRIVATE U16 rgSchCmn2LyrCqiPdschEff[4][16] = {RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI1, + RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI2, RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI3}; + +/* This configuration determines the transalation of a UEs CQI to its */ +/* PDCCH coding efficiency. This may be edited based on the installation */ +PRIVATE U8 rgSchCmnDlRvTbl[4] = {0, 2, 3, 1}; /* RVIdx sequence is corrected*/ + +/* Indexed by [DciFrmt]. + * Considering the following definition in determining the dciFrmt index. + * typedef enum +{ + TFU_DCI_FORMAT_0, + TFU_DCI_FORMAT_1, + TFU_DCI_FORMAT_1A, + TFU_DCI_FORMAT_1B, + TFU_DCI_FORMAT_1C, + TFU_DCI_FORMAT_1D, + TFU_DCI_FORMAT_2, + TFU_DCI_FORMAT_2A, + TFU_DCI_FORMAT_3, + TFU_DCI_FORMAT_3A +} TfuDciFormat; +*/ +PRIVATE U16 rgSchCmnDciFrmtSizes[10]; + + +PRIVATE U16 rgSchCmnCqiPdcchEff[16] = RG_SCH_CMN_CQI_TO_PDCCH_EFF; + +#ifdef LTE_TDD + +PUBLIC RgSchTddUlDlSubfrmTbl rgSchTddUlDlSubfrmTbl = { + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}, + {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME} +}; + +/* SPS_INTG_FIX */ +#ifdef LTEMAC_SPS +PUBLIC U8 rgSchTddSpsDlMaxRetxTbl[RGSCH_MAX_TDD_UL_DL_CFG] = { + /* 0 */ 6, + /* 1 */ 7, + /* 2 */ 8, + /* 3 */ 11, + /* 4 */ 12, + /* 5 */ 13, + /* 6 */ 7}; + +#endif + + +/* Special Subframes in OFDM symbols */ +/* ccpu00134197-MOD-Correct the number of symbols */ +PUBLIC RgSchTddSplSubfrmInfoTbl rgSchTddSplSubfrmInfoTbl = { + {3, 1, 1, 3, 1, 1}, + {9, 1, 1, 8, 1, 1}, + {10, 1, 1, 9, 1, 1}, + {11, 1, 1, 10, 1, 1}, + {12, 1, 1, 3, 2, 2}, + {3, 2, 2, 8, 2, 2}, + {9, 2, 2, 9, 2, 2}, + {10, 2, 2, 0, 0, 0}, + {11, 2, 2, 0, 0, 0} +}; + +/* PHICH 'm' value Table */ +PUBLIC RgSchTddPhichMValTbl rgSchTddPhichMValTbl = { + {2, 1, 0, 0, 0, 2, 1, 0, 0, 0}, + {0, 1, 0, 0, 1, 0, 1, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 1, 0, 0, 0, 1, 1, 0, 0, 1} +}; + +/* PHICH 'K' value Table */ +PUBLIC RgSchTddKPhichTbl rgSchTddKPhichTbl = { + {0, 0, 4, 7, 6, 0, 0, 4, 7, 6}, + {0, 0, 4, 6, 0, 0, 0, 4, 6, 0}, + {0, 0, 6, 0, 0, 0, 0, 6, 0, 0}, + {0, 0, 6, 6, 6, 0, 0, 0, 0, 0}, + {0, 0, 6, 6, 0, 0, 0, 0, 0, 0}, + {0, 0, 6, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 4, 6, 6, 0, 0, 4, 7, 0} +}; + +/* Uplink association index 'K' value Table */ +PUBLIC RgSchTddUlAscIdxKDashTbl rgSchTddUlAscIdxKDashTbl = { + {0, 0, 6, 4, 0, 0, 0, 6, 4, 0}, + {0, 0, 4, 0, 0, 0, 0, 4, 0, 0}, + {0, 0, 4, 4, 4, 0, 0, 0, 0, 0}, + {0, 0, 4, 4, 0, 0, 0, 0, 0, 0}, + {0, 0, 4, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 7, 7, 5, 0, 0, 7, 7, 0} +}; + + +/* PUSCH 'K' value Table */ +PUBLIC RgSchTddPuschTxKTbl rgSchTddPuschTxKTbl = { + {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, + {0, 6, 0, 0, 4, 0, 6, 0, 0, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 4, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 4, 0}, + {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} +}; + +/* PDSCH to PUCCH Table for DL Harq Feed back. Based on the + Downlink association set index 'K' table */ +PUBLIC U8 rgSchTddPucchTxTbl[7][10] = { + {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, + {7, 6, 0, 0, 4, 7, 6, 0, 0, 4}, + {7, 6, 0, 4, 8, 7, 6, 0, 4, 8}, + {4, 11, 0, 0, 0, 7, 6, 6, 5, 5}, + {12, 11, 0, 0, 8, 7, 7, 6, 5, 4}, + {12, 11, 0, 9, 8, 7, 6, 5, 4, 13}, + {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} +}; + +/* Table to fetch the next DL sf idx for applying the + new CFI. The next Dl sf Idx at which the new CFI + is applied is always the starting Sf of the next ACK/NACK + Fdbk bundle. + + Ex: In Cfg-2, sf4 and sf9 are the only subframes at which + a new ACK/NACK bundle of DL subframes can start + + D S U D D D S U D D D S U D D D S U D D + 4 9 + + dlSf Array for Cfg-2: + sfNum: 0 1 3 4 5 6 8 9 0 1 3 4 5 6 8 9 + sfIdx: 0 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 + + If CFI changes at sf0, nearest DL SF bundle >= 4 TTI is sf4 + So at sf4 the new CFI can be applied. To arrive at sf4 from + sf0, the sfIdx has to be increased by 3 */ + +PUBLIC U8 rgSchTddPdcchSfIncTbl[7][10] = { + /* A/N Bundl: 0,1,5,6*/ {2, 1, 0, 0, 0, 2, 1, 0, 0, 0}, + /* A/N Bundl: 0,4,5,9*/ {2, 2, 0, 0, 3, 2, 2, 0, 0, 3}, + /* A/N Bundl: 4,9*/ {3, 6, 0, 5, 4, 3, 6, 0, 5, 4}, + /* A/N Bundl: 1,7,9*/ {4, 3, 0, 0, 0, 4, 5, 4, 6, 5}, + /* A/N Bundl: 0,6*/ {4, 3, 0, 0, 6, 5, 4, 7, 6, 5}, + /* A/N Bundl: 9*/ {8, 7, 0, 6, 5, 4, 12, 11, 10, 9}, + /* A/N Bundl: 0,1,5,6,9*/ {2, 1, 0, 0, 0, 2, 2, 0, 0, 3} +}; + + +/* combine compilation fixes */ +#ifdef LTEMAC_SPS +/* subframe offset values to be used when twoIntervalsConfig is enabled in UL + * SPS for a UE */ +PUBLIC RgSchTddSfOffTbl rgSchTddSfOffTbl = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, -1, 0, 0, 0, 1, -1, 0}, + {0, 0, 5, 0, 0, 0, 0, -5, 0, 0}, + {0, 0, 1, 1, -2, 0, 0, 0, 0, 0}, + {0, 0, 1, -1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +}; + + +/* Table to determine when uplink SPS configured grants should + * explicitly be reserved in a subframe. When enries are same + * as that of Msg3SubfrmTbl, indicates competition with msg3. + * As of now, this is same as Msg3SubfrmTbl (leaving out uldlcfg 2), + * except that all 255s are now zeros. */ +PUBLIC RgSchTddSpsUlRsrvTbl rgSchTddSpsUlRsrvTbl = { + {0, 0, 0, 6, 8, 0, 0, 0, 6, 8}, + {0, 0, 6, 9, 0, 0, 0, 6, 9, 0}, + {0, 0, 10, 0, 0, 0, 0, 10, 0, 0}, + {0, 0, 0, 0, 8, 0, 7, 7, 14, 0}, + {0, 0, 0, 9, 0, 0, 7, 15, 0, 0}, + {0, 0, 10, 0, 0, 0, 16, 0, 0, 0}, + {0, 0, 0, 0, 8, 0, 0, 0, 9, 0} +}; + +/* Inverse DL Assoc Set index Table */ +PUBLIC RgSchTddInvDlAscSetIdxTbl rgSchTddInvDlAscSetIdxTbl = { + {4, 6, 0, 0, 0, 4, 6, 0, 0, 0}, + {7, 6, 0, 0, 4, 7, 6, 0, 0, 4}, + {7, 6, 0, 4, 8, 7, 6, 0, 4, 8}, + {4, 11, 0, 0, 0, 7, 6, 6, 5, 5}, + {12, 11, 0, 0, 8, 7, 7, 6, 5, 4}, + {12, 11, 0, 9, 8, 7, 6, 5, 4, 13}, + {7, 7, 0, 0, 0, 7, 7, 0, 0, 5} +}; + +#endif /* (LTEMAC_SPS ) */ + +/* Number of Uplink subframes Table */ +PRIVATE U8 rgSchTddNumUlSf[] = {6, 4, 2, 3, 2, 1, 5}; + +/* Downlink HARQ processes Table */ +PUBLIC RgSchTddUlNumHarqProcTbl rgSchTddUlNumHarqProcTbl = { 7, 4, 2, 3, 2, 1, 6}; + +/* Uplink HARQ processes Table */ +PUBLIC RgSchTddDlNumHarqProcTbl rgSchTddDlNumHarqProcTbl = { 4, 7, 10, 9, 12, 15, 6}; + +/* Downlink association index set 'K' value Table */ +PUBLIC RgSchTddDlAscSetIdxKTbl rgSchTddDlAscSetIdxKTbl = { + { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} }, + + { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {3, {7, 6, 11}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {4, {12, 8, 7, 11}}, {4, {6, 5, 4, 7}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {9, {13, 12, 9, 8, 7, 5, 4, 11, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} } +}; + + /* ccpu132282-ADD-the table rgSchTddDlAscSetIdxKTbl is rearranged in + * decreasing order of Km, this is used to calculate the NCE used for + * calculating N1Pucch Resource for Harq*/ +PUBLIC RgSchTddDlAscSetIdxKTbl rgSchTddDlHqPucchResCalTbl = { + { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} }, + + { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {3, {11, 7, 6}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {4, {12, 11, 8, 7}}, {4, {7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {9, {13, 12, 11, 9, 8, 7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} }, + + { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} } +}; + +/* Minimum number of Ack/Nack feeback information to be + stored for each UL-DL configuration */ +PUBLIC RgSchTddANFdbkMapTbl rgSchTddANFdbkMapTbl = {4, 4, 2, 3, 2, 1, 5}; + +/* Uplink switch points and number of UL subframes Table */ +PUBLIC RgSchTddMaxUlSubfrmTbl rgSchTddMaxUlSubfrmTbl = { + {2,3,3}, {2,2,2}, {2,1,1}, {1,3,0}, {1,2,0}, {1,1,0}, {2,3,2} +}; + +/* Uplink switch points and number of DL subframes Table */ +PUBLIC RgSchTddMaxDlSubfrmTbl rgSchTddMaxDlSubfrmTbl = { + {2,2,2}, {2,3,3}, {2,4,4}, {1,7,0}, {1,8,0}, {1,9,0}, {2,2,3} +}; + +/* Number of UL subframes present before a particular subframe */ +PUBLIC RgSchTddNumUlSubfrmTbl rgSchTddNumUlSubfrmTbl = { + {0, 0, 1, 2, 3, 3, 3, 4, 5, 6}, + {0, 0, 1, 2, 2, 2, 2, 3, 4, 4}, + {0, 0, 1, 1, 1, 1, 1, 2, 2, 2}, + {0, 0, 1, 2, 3, 3, 3, 3, 3, 3}, + {0, 0, 1, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 1, 2, 3, 3, 3, 4, 5, 5} +}; + +/* Number of DL subframes present till a particular subframe */ +PUBLIC RgSchTddNumDlSubfrmTbl rgSchTddNumDlSubfrmTbl = { + {1, 2, 2, 2, 2, 3, 4, 4, 4, 4}, + {1, 2, 2, 2, 3, 4, 5, 5, 5, 6}, + {1, 2, 2, 3, 4, 5, 6, 6, 7, 8}, + {1, 2, 2, 2, 2, 3, 4, 5, 6, 7}, + {1, 2, 2, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 2, 3, 4, 5, 6, 7, 8, 9}, + {1, 2, 2, 2, 2, 3, 4, 4, 4, 5} +}; + + +/* Nearest possible UL subframe Index from UL subframe + * DL Index < UL Index */ +PUBLIC RgSchTddLowDlSubfrmIdxTbl rgSchTddLowDlSubfrmIdxTbl = { + {0, 1, 1, 1, 1, 5, 6, 6, 6, 6}, + {0, 1, 1, 1, 4, 5, 6, 6, 6, 9}, + {0, 1, 1, 3, 4, 5, 6, 6, 8, 9}, + {0, 1, 1, 1, 1, 5, 6, 7, 8, 9}, + {0, 1, 1, 1, 4, 5, 6, 7, 8, 9}, + {0, 1, 1, 3, 4, 5, 6, 7, 8, 9}, + {0, 1, 1, 1, 1, 5, 6, 6, 6, 9} +}; + +/* Nearest possible DL subframe Index from UL subframe + * DL Index > UL Index + * 10 represents Next SFN low DL Idx */ +PUBLIC RgSchTddHighDlSubfrmIdxTbl rgSchTddHighDlSubfrmIdxTbl = { + {0, 1, 5, 5, 5, 5, 6, 10, 10, 10}, + {0, 1, 4, 4, 4, 5, 6, 9, 9, 9}, + {0, 1, 3, 3, 4, 5, 6, 8, 8, 9}, + {0, 1, 5, 5, 5, 5, 6, 7, 8, 9}, + {0, 1, 4, 4, 4, 5, 6, 7, 8, 9}, + {0, 1, 3, 3, 4, 5, 6, 7, 8, 9}, + {0, 1, 5, 5, 5, 5, 6, 9, 9, 9} +}; + +/* RACH Message3 related information */ +PUBLIC RgSchTddMsg3SubfrmTbl rgSchTddMsg3SubfrmTbl = { + {7, 6, 255, 255, 255, 7, 6, 255, 255, 255}, + {7, 6, 255, 255, 8, 7, 6, 255, 255, 8}, + {7, 6, 255, 9, 8, 7, 6, 255, 9, 8}, + {12, 11, 255, 255, 255, 7, 6, 6, 6, 13}, + {12, 11, 255, 255, 8, 7, 6, 6, 14, 13}, + {12, 11, 255, 9, 8, 7, 6, 15, 14, 13}, + {7, 6, 255, 255, 255, 7, 6, 255, 255, 8} +}; + +/* ccpu00132341-DEL Removed rgSchTddRlsDlSubfrmTbl and used Kset table for + * releasing DL HARQs */ + +/* DwPTS Scheduling Changes Start */ +/* Provides the number of Cell Reference Signals in DwPTS + * region per RB */ +PRIVATE U8 rgSchCmnDwptsCrs[2][3] = {/* [Spl Sf cfg][Ant Port] */ + {4, 8, 16}, /* Spl Sf cfg 1,2,3,6,7,8 */ + {6, 12, 20}, /* Spl Sf cfg 4 */ +}; + +PRIVATE S8 rgSchCmnSplSfDeltaItbs[9] = RG_SCH_DWPTS_ITBS_ADJ; +/* DwPTS Scheduling Changes End */ +#endif + + +PRIVATE U32 rgSchCmnBsrTbl[64] = { + 0, 10, 12, 14, 17, 19, 22, 26, + 31, 36, 42, 49, 57, 67, 78, 91, + 107, 125, 146, 171, 200, 234, 274, 321, + 376, 440, 515, 603, 706, 826, 967, 1132, + 1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995, + 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099, + 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, + 58255, 68201, 79846, 93479, 109439, 128125, 150000, 220000 +}; + +PRIVATE U32 rgSchCmnExtBsrTbl[64] = { + 0, 10, 13, 16, 19, 23, 29, 35, + 43, 53, 65, 80, 98, 120, 147, 181, + 223, 274, 337, 414, 509, 625, 769, 945, + 1162, 1429, 1757, 2161, 2657, 3267, 4017, 4940, + 6074, 7469, 9185, 11294, 13888, 17077, 20999, 25822, + 31752, 39045, 48012, 59039, 72598, 89272, 109774, 134986, + 165989, 204111, 250990, 308634, 379519, 466683, 573866, 705666, + 867737, 1067031, 1312097, 1613447, 1984009, 2439678, 3000000, 3100000 +}; + + +PRIVATE U8 rgSchCmnUlRvIdxToIMcsTbl[4] = {32, 30, 31, 29}; + +PUBLIC U8 rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_MAX_CP][RG_SCH_CMN_UL_NUM_CQI]; + +PUBLIC RgSchTbSzTbl rgTbSzTbl = { + { + {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680, 712, 744, 776, 776, 808, 840, 872, 904, 936, 968, 1000, 1032, 1032, 1064, 1096, 1128, 1160, 1192, 1224, 1256, 1256, 1288, 1320, 1352, 1384, 1416, 1416, 1480, 1480, 1544, 1544, 1608, 1608, 1608, 1672, 1672, 1736, 1736, 1800, 1800, 1800, 1864, 1864, 1928, 1928, 1992, 1992, 2024, 2088, 2088, 2088, 2152, 2152, 2216, 2216, 2280, 2280, 2280, 2344, 2344, 2408, 2408, 2472, 2472, 2536, 2536, 2536, 2600, 2600, 2664, 2664, 2728, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 2984, 2984, 3112}, + {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904, 936, 968, 1000, 1032, 1064, 1128, 1160, 1192, 1224, 1256, 1288, 1352, 1384, 1416, 1416, 1480, 1544, 1544, 1608, 1608, 1672, 1736, 1736, 1800, 1800, 1864, 1864, 1928, 1992, 1992, 2024, 2088, 2088, 2152, 2152, 2216, 2280, 2280, 2344, 2344, 2408, 2472, 2472, 2536, 2536, 2600, 2600, 2664, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008}, + {32, 72, 144, 176, 208, 256, 296, 328, 376, 424, 472, 520, 568, 616, 648, 696, 744, 776, 840, 872, 936, 968, 1000, 1064, 1096, 1160, 1192, 1256, 1288, 1320, 1384, 1416, 1480, 1544, 1544, 1608, 1672, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2024, 2088, 2088, 2152, 2216, 2216, 2280, 2344, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2664, 2728, 2792, 2856, 2856, 2856, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968}, + {40, 104, 176, 208, 256, 328, 392, 440, 504, 568, 616, 680, 744, 808, 872, 904, 968, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 1992, 2024, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6200, 6456, 6456}, + {56, 120, 208, 256, 328, 408, 488, 552, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1288, 1352, 1416, 1480, 1544, 1608, 1736, 1800, 1864, 1928, 1992, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2600, 2664, 2728, 2792, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992}, + {72, 144, 224, 328, 424, 504, 600, 680, 776, 872, 968, 1032, 1128, 1224, 1320, 1384, 1480, 1544, 1672, 1736, 1864, 1928, 2024, 2088, 2216, 2280, 2344, 2472, 2536, 2664, 2728, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4264, 4392, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9528}, + {328, 176, 256, 392, 504, 600, 712, 808, 936, 1032, 1128, 1224, 1352, 1480, 1544, 1672, 1736, 1864, 1992, 2088, 2216, 2280, 2408, 2472, 2600, 2728, 2792, 2984, 2984, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3880, 4008, 4136, 4136, 4264, 4392, 4584, 4584, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448}, + {104, 224, 328, 472, 584, 712, 840, 968, 1096, 1224, 1320, 1480, 1608, 1672, 1800, 1928, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536}, + {120, 256, 392, 536, 680, 808, 968, 1096, 1256, 1384, 1544, 1672, 1800, 1928, 2088, 2216, 2344, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15264}, + {136, 296, 456, 616, 776, 936, 1096, 1256, 1416, 1544, 1736, 1864, 2024, 2216, 2344, 2536, 2664, 2856, 2984, 3112, 3368, 3496, 3624, 3752, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 5160, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568}, + {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080}, + {176, 376, 584, 776, 1000, 1192, 1384, 1608, 1800, 2024, 2216, 2408, 2600, 2792, 2984, 3240, 3496, 3624, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152}, + {208, 440, 680, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2472, 2728, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 23688, 24496, 24496, 24496, 24496, 25456}, + {224, 488, 744, 1000, 1256, 1544, 1800, 2024, 2280, 2536, 2856, 3112, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 26416, 27376, 27376, 27376, 27376, 28336, 28336}, + {256, 552, 840, 1128, 1416, 1736, 1992, 2280, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 5992, 6200, 6456, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704}, + {280, 600, 904, 1224, 1544, 1800, 2152, 2472, 2728, 3112, 3368, 3624, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 6200, 6456, 6712, 6968, 7224, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008}, + {328, 632, 968, 1288, 1608, 1928, 2280, 2600, 2984, 3240, 3624, 3880, 4264, 4584, 4968, 5160, 5544, 5992, 6200, 6456, 6712, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 35160}, + {336, 696, 1064, 1416, 1800, 2152, 2536, 2856, 3240, 3624, 4008, 4392, 4776, 5160, 5352, 5736, 6200, 6456, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 39232}, + {376, 776, 1160, 1544, 1992, 2344, 2792, 3112, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14112, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816}, + {408, 840, 1288, 1736, 2152, 2600, 2984, 3496, 3880, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7736, 8248, 8504, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19080, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888}, + {440, 904, 1384, 1864, 2344, 2792, 3240, 3752, 4136, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 8760, 9144, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 20616, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 48936, 51024, 51024, 51024}, + {488, 1000, 1480, 1992, 2472, 2984, 3496, 4008, 4584, 4968, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 9912, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056}, + {520, 1064, 1608, 2152, 2664, 3240, 3752, 4264, 4776, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 10296, 10680, 11448, 11832, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 19080, 19080, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256}, + {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776}, + {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 22920, 23688, 24496, 25456, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592}, + {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592, 68808, 68808, 68808, 71112}, + {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376} + }, + { + {32, 88, 152, 208, 256, 328, 376, 424, 488, 536, 600, 648, 712, 776, 808, 872, 936, 1000, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2088, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 5992, 6200}, + {56, 144, 208, 256, 344, 424, 488, 568, 632, 712, 776, 872, 936, 1000, 1064, 1160, 1224, 1288, 1384, 1416, 1544, 1608, 1672, 1736, 1800, 1864, 1992, 2024, 2088, 2152, 2280, 2344, 2408, 2472, 2536, 2600, 2728, 2792, 2856, 2856, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5352, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992}, + {72, 176, 256, 328, 424, 520, 616, 696, 776, 872, 968, 1064, 1160, 1256, 1320, 1416, 1544, 1608, 1672, 1800, 1864, 1992, 2088, 2152, 2216, 2344, 2408, 2536, 2600, 2664, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3368, 3496, 3624, 3624, 3752, 3880, 4008, 4008, 4136, 4264, 4264, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912}, + {104, 208, 328, 440, 568, 680, 808, 904, 1032, 1160, 1256, 1384, 1480, 1608, 1736, 1864, 1992, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2856, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4392, 4584, 4776, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12576, 12960, 12960}, + {120, 256, 408, 552, 696, 840, 1000, 1128, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2600, 2728, 2856, 2984, 3112, 3240, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840}, + {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19080}, + {176, 392, 600, 808, 1032, 1224, 1480, 1672, 1864, 2088, 2280, 2472, 2728, 2984, 3112, 3368, 3496, 3752, 4008, 4136, 4392, 4584, 4776, 4968, 5160, 5352, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7992, 8248, 8248, 8504, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920}, + {224, 472, 712, 968, 1224, 1480, 1672, 1928, 2216, 2472, 2664, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376}, + {256, 536, 808, 1096, 1384, 1672, 1928, 2216, 2536, 2792, 3112, 3368, 3624, 3880, 4264, 4584, 4776, 4968, 5352, 5544, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576}, + {296, 616, 936, 1256, 1544, 1864, 2216, 2536, 2856, 3112, 3496, 3752, 4136, 4392, 4776, 5160, 5352, 5736, 5992, 6200, 6712, 6968, 7224, 7480, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160}, + {328, 680, 1032, 1384, 1736, 2088, 2472, 2792, 3112, 3496, 3880, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 6712, 6968, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 21384, 21384, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888}, + {376, 776, 1192, 1608, 2024, 2408, 2792, 3240, 3624, 4008, 4392, 4776, 5352, 5736, 5992, 6456, 6968, 7224, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816}, + {440, 904, 1352, 1800, 2280, 2728, 3240, 3624, 4136, 4584, 4968, 5544, 5992, 6456, 6712, 7224, 7736, 8248, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 17568, 17568, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024}, + {488, 1000, 1544, 2024, 2536, 3112, 3624, 4136, 4584, 5160, 5736, 6200, 6712, 7224, 7736, 8248, 8760, 9144, 9912, 10296, 10680, 11448, 11832, 12216, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336}, + {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776}, + {600, 1224, 1800, 2472, 3112, 3624, 4264, 4968, 5544, 6200, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 23688, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808}, + {632, 1288, 1928, 2600, 3240, 3880, 4584, 5160, 5992, 6456, 7224, 7736, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 68808, 71112, 71112, 71112, 71112}, + {696, 1416, 2152, 2856, 3624, 4392, 5160, 5736, 6456, 7224, 7992, 8760, 9528, 10296, 10680, 11448, 12216, 12960, 13536, 14688, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 71112, 73712, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 78704}, + {776, 1544, 2344, 3112, 4008, 4776, 5544, 6200, 7224, 7992, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 27376, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936}, + {840, 1736, 2600, 3496, 4264, 5160, 5992, 6968, 7736, 8504, 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 16416, 16992, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800}, + {904, 1864, 2792, 3752, 4584, 5544, 6456, 7480, 8248, 9144, 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16992, 17568, 18336, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 42368, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 97896, 101840, 101840, 101840}, + {1000, 1992, 2984, 4008, 4968, 5992, 6968, 7992, 9144, 9912, 11064, 12216, 12960, 14112, 15264, 15840, 16992, 18336, 19080, 19848, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 31704, 32856, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136}, + {1064, 2152, 3240, 4264, 5352, 6456, 7480, 8504, 9528, 10680, 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 20616, 21384, 22920, 23688, 24496, 25456, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816}, + {1128, 2280, 3496, 4584, 5736, 6968, 7992, 9144, 10296, 11448, 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 45352, 45352, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840,101840,101840,101840,105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496}, + {1192, 2408, 3624, 4968, 5992, 7224, 8504, 9912, 11064, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 42368, 43816, 45352, 46888, 46888, 48936, 51024, 51024, 52752, 52752, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208}, + {1256, 2536, 3752, 5160, 6200, 7480, 8760, 10296, 11448, 12576, 14112, 15264, 16416, 17568, 19080, 20616, 21384, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 43816, 43816, 45352, 46888, 48936, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040,115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208, 137792, 137792, 137792, 142248}, + {1480, 2984, 4392, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 29296, 30576, 32856, 34008, 35160, 36696, 37888, 40576, 40576, 42368, 43816, 45352, 46888, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 63776, 63776, 66592, 68808, 68808, 71112, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 81176, 84760, 84760, 87936, 87936, 90816, 90816, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 128496, 128496, 128496, 133208, 133208, 133208, 137792, 137792, 137792, 142248, 142248, 142248, 146856, 146856,149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776} + } +}; +RgSchUlIMcsTbl rgUlIMcsTbl = { + {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, + {2, 6}, {2, 7}, {2, 8}, {2, 9}, {2, 10}, + {4, 10}, {4, 11}, {4, 12}, {4, 13}, {4, 14}, + {4, 15}, {4, 16}, {4, 17}, {4, 18}, {4, 19}, + {6, 19}, {6, 20}, {6, 21}, {6, 22}, {6, 23}, + {6, 24}, {6, 25}, {6, 26} +}; +RgSchUeCatTbl rgUeCatTbl = { + /*Column1:Maximum number of bits of an UL-SCH + transport block transmitted within a TTI + - maxUlBits + Column2:Maximum number of bits of a DLSCH + transport block received within a TTI + - maxDlBits + Column3:Total number of soft channel bits + - maxSftChBits + Column4:Support for 64QAM in UL + - ul64qamSup + Column5:Maximum number of DL-SCH transport + block bits received within a TTI + - maxDlTbBits + Column6:Maximum number of supported layers for + spatial multiplexing in DL + - maxTxLyrs*/ + {5160, {10296,0}, 250368, FALSE, 10296, 1}, + {25456, {51024,0}, 1237248, FALSE, 51024, 2}, + {51024, {75376,0}, 1237248, FALSE, 102048, 2}, + {51024, {75376,0}, 1827072, FALSE, 150752, 2}, + {75376, {149776,0}, 3667200, TRUE, 299552, 4}, + {51024, {75376,149776}, 3654144, FALSE, 301504, 4}, + {51024, {75376,149776}, 3654144, FALSE, 301504, 4}, + {149776,{299856,0}, 35982720,TRUE, 2998560, 8} +}; + +/* [ccpu00138532]-ADD-The below table stores the min HARQ RTT time + in Downlink for TDD and FDD. Indices 0 to 6 map to tdd UL DL config 0-6. + Index 7 map to FDD */ +U8 rgSchCmnHarqRtt[8] = {4,7,10,9,12,15,6,8}; +/* Number of CFI Switchover Index is equals to 7 TDD Indexes + 1 FDD index */ +U8 rgSchCfiSwitchOvrWinLen[] = {7, 4, 2, 3, 2, 1, 6, 8}; + +/* EffTbl is calculated for single layer and two layers. + * CqiToTbs is calculated for single layer and two layers */ +RgSchCmnTbSzEff rgSchCmnNorCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnTbSzEff rgSchCmnNorCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW]; +/* New variable to store UL effiency values for normal and extended CP*/ +RgSchCmnTbSzEff rgSchCmnNorUlEff[1],rgSchCmnExtUlEff[1]; +RgSchCmnCqiToTbs rgSchCmnNorCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnCqiToTbs rgSchCmnNorCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnCqiToTbs *rgSchCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI]; +RgSchCmnTbSzEff rgSchCmnExtCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnTbSzEff rgSchCmnExtCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnCqiToTbs rgSchCmnExtCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; +RgSchCmnCqiToTbs rgSchCmnExtCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW]; +/* Include CRS REs while calculating Efficiency */ +RgSchCmnTbSzEff *rgSchCmnEffTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_ANT_CONF][RG_SCH_CMN_MAX_CFI]; +RgSchCmnTbSzEff *rgSchCmnUlEffTbl[RG_SCH_CMN_MAX_CP]; +#ifdef LTE_TDD +RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3, 1}; +#else +/* Added matrix 'rgRaPrmblToRaFrmTbl'for computation of RA sub-frames from RA preamble */ +RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3}; +#endif + +EXTERN RgUlSchdInits rgSchUlSchdInits; +EXTERN RgDlSchdInits rgSchDlSchdInits; +EXTERN RgDlfsSchdInits rgSchDlfsSchdInits; +#ifdef EMTC_ENABLE +EXTERN RgEmtcUlSchdInits rgSchEmtcUlSchdInits; +EXTERN RgEmtcDlSchdInits rgSchEmtcDlSchdInits; +#endif + +/* RACHO : start */ +PRIVATE S16 rgSCHCmnUeIdleExdThrsld ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PUBLIC RgSchUeCb* rgSCHCmnGetHoUe ARGS(( +RgSchCellCb *cell, +U16 rapId +)); +PRIVATE Void rgSCHCmnDelDedPreamble ARGS(( +RgSchCellCb *cell, +U8 preambleId +)); +PUBLIC RgSchUeCb* rgSCHCmnGetPoUe ARGS(( +RgSchCellCb *cell, +U16 rapId, +CmLteTimingInfo timingInfo +)); +PRIVATE Void rgSCHCmnDelRachInfo ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe ARGS(( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUeCb *ue, +U8 maxRb +)); +PRIVATE Void rgSCHCmnHdlHoPo ARGS(( +RgSchCellCb *cell, +CmLListCp *raRspLst, +RgSchRaReqInfo *raReq +)); +PRIVATE Void rgSCHCmnAllocPoHoGrnt ARGS(( +RgSchCellCb *cell, +CmLListCp *raRspLst, +RgSchUeCb *ue, +RgSchRaReqInfo *raReq +)); +PRIVATE Void rgSCHCmnFillPdcchOdr2Sf ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchPdcch *pdcc, +U8 rapId, +U8 prachMskIdx +)); +PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx ARGS(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHCmnUpdRachParam ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnAllocPOParam ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchUeCb *ue, +RgSchPdcch **pdcch, +U8 *rapId, +U8 *prachMskIdx +)); +PRIVATE Void rgSCHCmnGenPdcchOrder ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf +)); +PRIVATE Void rgSCHCmnCfgRachDedPrm ARGS(( +RgSchCellCb *cell +)); +/* RACHO : end */ + +PRIVATE Void rgSCHCmnHdlUlInactUes ARGS(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHCmnHdlDlInactUes ARGS(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHCmnUlInit ARGS((Void +)); +PRIVATE Void rgSCHCmnDlInit ARGS((Void +)); +PRIVATE Void rgSCHCmnInitDlRbAllocInfo ARGS(( +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnUpdUlCompEffBsr ARGS(( +RgSchUeCb *ue +)); +#if RG_UNUSED +PRIVATE Void rgSCHCmnUlSetAllUnSched ARGS(( +RgSchCmnUlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnUlUpdSf ARGS(( + RgSchCellCb *cell, + RgSchCmnUlRbAllocInfo *allocInfo, + RgSchUlSf *sf + )); +PRIVATE Void rgSCHCmnUlHndlAllocRetx ARGS(( + RgSchCellCb *cell, + RgSchCmnUlRbAllocInfo *allocInfo, + RgSchUlSf *sf, + RgSchUlAlloc *alloc + )); +#endif +PRIVATE Void rgSCHCmnGrpPwrCntrlPucch ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf +)); +PRIVATE Void rgSCHCmnGrpPwrCntrlPusch ARGS(( +RgSchCellCb *cell, +RgSchUlSf *ulSf +)); +PRIVATE Void rgSCHCmnDelUeFrmRefreshQ ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE S16 rgSCHCmnTmrExpiry ARGS(( +PTR cb, /* Pointer to timer control block */ +S16 tmrEvnt /* Timer Event */ +)); +PRIVATE S16 rgSCHCmnTmrProc ARGS(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHCmnAddUeToRefreshQ ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 wait +)); +PRIVATE Void rgSCHCmnDlCcchRetx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnUpdUeMimoInfo ARGS(( +RgrUeCfg *ueCfg, +RgSchCmnDlUe *ueDl, +RgSchCellCb *cell, +RgSchCmnCell *cellSchd +)); +PRIVATE Void rgSCHCmnUpdUeUlCqiInfo ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchCmnUlUe *ueUl, +RgSchCmnUe *ueSchCmn, +RgSchCmnCell *cellSchd, +Bool isEcp +)); +#ifdef RGR_V1 +PRIVATE Void rgSCHCmnDlCcchSduRetx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnDlCcchSduTx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE S16 rgSCHCmnCcchSduAlloc ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE S16 rgSCHCmnCcchSduDedAlloc ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ueCb +)); +PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgSchDlSf *dlSf +)); +#endif +PRIVATE Void rgSCHCmnInitVars ARGS(( + RgSchCellCb *cell + )); + +/*ccpu00117180 - DEL - Moved rgSCHCmnUpdVars to .x as its access is now PUBLIC */ +PRIVATE Void rgSCHCmnUlRbAllocForLst ARGS(( + RgSchCellCb *cell, + RgSchUlSf *sf, + U32 count, + CmLListCp *reqLst, + CmLListCp *schdLst, + CmLListCp *nonSchdLst, + Bool isNewTx + )); +PRIVATE S16 rgSCHCmnUlRbAllocForUe ARGS(( + RgSchCellCb *cell, + RgSchUlSf *sf, + RgSchUeCb *ue, + U8 maxRb, + RgSchUlHole *hole + )); +PRIVATE Void rgSCHCmnMsg3GrntReq ARGS(( + RgSchCellCb *cell, + CmLteRnti rnti, + Bool preamGrpA, + RgSchUlHqProcCb *hqProc, + RgSchUlAlloc **ulAllocRef, + U8 *hqProcIdRef + )); +PRIVATE Void rgSCHCmnUlNonadapRetx ARGS(( + RgSchCmnUlCell *cellUl, + RgSchUlAlloc *alloc, + U8 idx + )); + +PRIVATE Void rgSCHCmnDlCcchRarAlloc ARGS(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHCmnDlCcchTx ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnDlBcchPcch ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgInfSfAlloc *subfrmAlloc +)); +PUBLIC Bool rgSCHCmnChkInWin ARGS(( +CmLteTimingInfo frm, +CmLteTimingInfo start, +CmLteTimingInfo end +)); +PUBLIC Bool rgSCHCmnChkPastWin ARGS(( +CmLteTimingInfo frm, +CmLteTimingInfo end +)); +PRIVATE Void rgSCHCmnClcAlloc ARGS(( +RgSchCellCb *cell, +RgSchDlSf *sf, +RgSchClcDlLcCb *lch, +U16 rnti, +RgSchCmnDlRbAllocInfo *allocInfo +)); +#ifndef LTEMAC_SPS +PRIVATE Void rgSCHCmnClcRbAlloc ARGS(( +RgSchCellCb *cell, +U32 bo, +U8 cqi, +U8 *rb, +U32 *tbs, +U8 *mcs, +RgSchDlSf *sf +)); +#endif + +PRIVATE S16 rgSCHCmnMsg4Alloc ARGS(( +RgSchCellCb *cell, +RgSchRaCb *raCb, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE S16 rgSCHCmnMsg4DedAlloc ARGS(( +RgSchCellCb *cell, +RgSchRaCb *raCb +)); +PRIVATE Void rgSCHCmnDlRaRsp ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE S16 rgSCHCmnRaRspAlloc ARGS(( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +U16 rntiIdx, +U16 rarnti, +U8 noRaRnti, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnUlUeDelAllocs ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); +PRIVATE Void rgSCHCmnDlSetUeAllocLmt ARGS(( +RgSchCellCb *cell, +RgSchCmnDlUe *ueDl, +Bool isEmtcUe +)); +PRIVATE S16 rgSCHCmnDlRgrCellCfg ARGS(( +RgSchCellCb *cell, +RgrCellCfg *cfg, +RgSchErrInfo *err +)); +PRIVATE Void rgSCHCmnUlAdapRetx ARGS(( +RgSchUlAlloc *alloc, +RgSchUlHqProcCb *proc +)); +PRIVATE Void rgSCHCmnUlUpdAllocRetx ARGS(( +RgSchCellCb *cell, +RgSchUlAlloc *alloc +)); +PRIVATE Void rgSCHCmnUlSfReTxAllocs ARGS(( +RgSchCellCb *cell, +RgSchUlSf *sf +)); +/* Fix: syed Adaptive Msg3 Retx crash. */ +PRIVATE Void rgSCHCmnUlSfRlsRetxProcs ARGS(( +RgSchCellCb *cell, +RgSchUlSf *sf +)); + +#ifdef TFU_UPGRADE +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +U8 numTxPorts +)); +#else +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +)); +#endif + + +/* + * DL RB allocation specific functions + */ + +PRIVATE Void rgSCHCmnDlRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE Void rgSCHCmnNonDlfsRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +)); +PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *cmnAllocInfo)); + +#ifndef LTE_TDD +PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj ARGS(( +RgSchCellCb *cell, +RgSchDlRbAlloc *cmnAllocInfo, +U8 pbchSsRsSym, +Bool isBcchPcch +)); +/* Added function to adjust TBSize*/ +PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj ARGS(( +RgSchDlRbAlloc *allocInfo, +U8 numOvrlapgPbchRb, +U8 pbchSsRsSym, +U8 idx, +U32 bytesReq +)); + +/* Added function to find num of overlapping PBCH rb*/ +PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +U8 *numOvrlapgPbchRb +)); + +PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo +)); +#ifdef DEBUGP +PRIVATE Void rgSCHCmnFindCodeRate ARGS(( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +U8 idx +)); +#endif +#endif +PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc ARGS(( +RgSchCellCb *cell, +RgSchCmnMsg4RbAlloc *msg4AllocInfo, +U8 isRetx +)); +PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc ARGS(( +RgSchCellCb *cell, +RgSchRaCb *raCb, +RgSchDlSf *dlSf +)); + +PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *dlSf, +U8 *isDlBwAvail +)); +#ifndef LTEMAC_SPS +PRIVATE U32 rgSCHCmnCalcRiv ARGS(( U8 bw, + U8 rbStart, + U8 numRb)); +#endif + +#ifdef LTE_TDD +PRIVATE Void rgSCHCmnUpdHqAndDai ARGS(( +RgSchDlHqProcCb *hqP, +RgSchDlSf *subFrm, +RgSchDlHqTbCb *tbCb, +U8 tbAllocIdx +)); +PRIVATE S16 rgSCHCmnUlCalcAvailBw ARGS(( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +U8 cfi, +U8 *rbStartRef, +U8 *bwAvailRef +)); +PRIVATE S16 rgSCHCmnDlKdashUlAscInit ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnDlANFdbkInit ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnDlNpValInit ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnDlCreateRachPrmLst ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnDlCpyRachInfo ARGS(( +RgSchCellCb *cell, +RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES], +U8 raArrSz +)); +PRIVATE S16 rgSCHCmnDlRachInfoInit ARGS(( +RgSchCellCb *cell +)); +PRIVATE S16 rgSCHCmnDlPhichOffsetInit ARGS(( +RgSchCellCb *cell +)); +#endif +#ifdef TFU_UPGRADE +PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt ARGS +(( + RgSchCellCb *cell, + RgSchUeCb *ue, + U8 wideCqi + )); + PRIVATE RgSchCmnRank rgSCHCmnComputeRank ARGS +(( + RgrTxMode txMode, + U32 *pmiBitMap, + U8 numTxPorts + )); + + PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3 ARGS +(( + U32 *pmiBitMap + )); + + PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3 ARGS +(( + U32 *pmiBitMap + )); + + PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4 ARGS +(( + U32 *pmiBitMap + )); + + PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4 ARGS +(( + U32 *pmiBitMap + )); + + PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr ARGS +(( + RgSchCellCb *cell, + TfuSrsRpt *srsRpt + )); +#endif + +/* comcodsepa : start */ + +/** + * @brief This function computes efficiency and stores in a table. + * + * @details + * + * Function: rgSCHCmnCompEff + * Purpose: this function computes the efficiency as number of + * bytes per 1024 symbols. The CFI table is also filled + * with the same information such that comparison is valid + * + * Invoked by: Scheduler + * + * @param[in] U8 noPdcchSym + * @param[in] U8 cpType + * @param[in] U8 txAntIdx + * @param[in] RgSchCmnTbSzEff* effTbl + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnCompEff +( +U8 noPdcchSym, +U8 cpType, +U8 txAntIdx, +RgSchCmnTbSzEff *effTbl +) +#else +PRIVATE Void rgSCHCmnCompEff(noPdcchSym, cpType, txAntIdx, effTbl) +U8 noPdcchSym; +U8 cpType; +U8 txAntIdx; +RgSchCmnTbSzEff *effTbl; +#endif +{ + U8 noResPerRb; + U8 noSymPerRb; + U8 resOfCrs; /* Effective REs occupied by CRS */ + U8 i, j; + + TRC2(rgSCHCmnCompEff); + + switch (cpType) + { + case RG_SCH_CMN_NOR_CP: + noSymPerRb = 14; + break; + case RG_SCH_CMN_EXT_CP: + noSymPerRb = 12; + break; + default: + /* Generate a log error. This case should never be executed */ + RETVOID; + } + + /* Depending on the Tx Antenna Index, deduct the + * Resource elements for the CRS */ + switch (txAntIdx) + { + case 0: + resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT; + break; + case 1: + resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT; + break; + case 2: + resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT; + break; + default: + /* Generate a log error. This case should never be executed */ + RETVOID; + } + noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs; + for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) + { + (*effTbl)[i] = 0; + for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) + { + /* This line computes the coding efficiency per 1024 REs */ + (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1)); + } + (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS; + } + RETVOID; +} +/** + * @brief This function computes efficiency and stores in a table. + * + * @details + * + * Function: rgSCHCmnCompUlEff + * Purpose: this function computes the efficiency as number of + * bytes per 1024 symbols. The CFI table is also filled + * with the same information such that comparison is valid + * + * Invoked by: Scheduler + * + * @param[in] U8 noUlRsSym + * @param[in] U8 cpType + * @param[in] U8 txAntIdx + * @param[in] RgSchCmnTbSzEff* effTbl + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnCompUlEff +( +U8 noUlRsSym, +U8 cpType, +RgSchCmnTbSzEff *effTbl +) +#else +PRIVATE Void rgSCHCmnCompUlEff(noUlRsSym, cpType, effTbl) +U8 noUlRsSym; +U8 cpType; +RgSchCmnTbSzEff *effTbl; +#endif +{ + U8 noResPerRb; + U8 noSymPerRb; + U8 i, j; + + TRC2(rgSCHCmnCompUlEff); + + switch (cpType) + { + case RG_SCH_CMN_NOR_CP: + noSymPerRb = 14; + break; + case RG_SCH_CMN_EXT_CP: + noSymPerRb = 12; + break; + default: + /* Generate a log error. This case should never be executed */ + RETVOID; + } + + noResPerRb = ((noSymPerRb - noUlRsSym) * RB_SCH_CMN_NUM_SCS_PER_RB); + for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) + { + (*effTbl)[i] = 0; + for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) + { + /* This line computes the coding efficiency per 1024 REs */ + (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1)); + } + (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS; + } + RETVOID; +} + +/** + * @brief This function computes efficiency for 2 layers and stores in a table. + * + * @details + * + * Function: rgSCHCmn2LyrCompEff + * Purpose: this function computes the efficiency as number of + * bytes per 1024 symbols. The CFI table is also filled + * with the same information such that comparison is valid + * + * Invoked by: Scheduler + * + * @param[in] U8 noPdcchSym + * @param[in] U8 cpType + * @param[in] U8 txAntIdx + * @param[in] RgSchCmnTbSzEff* effTbl2Lyr + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmn2LyrCompEff +( +U8 noPdcchSym, +U8 cpType, +U8 txAntIdx, +RgSchCmnTbSzEff *effTbl2Lyr +) +#else +PRIVATE Void rgSCHCmn2LyrCompEff(noPdcchSym, cpType, txAntIdx, effTbl2Lyr) +U8 noPdcchSym; +U8 cpType; +U8 txAntIdx; +RgSchCmnTbSzEff *effTbl2Lyr; +#endif +{ + U8 noResPerRb; + U8 noSymPerRb; + U8 resOfCrs; /* Effective REs occupied by CRS */ + U8 i, j; + + TRC2(rgSCHCmn2LyrCompEff); + + switch (cpType) + { + case RG_SCH_CMN_NOR_CP: + noSymPerRb = 14; + break; + case RG_SCH_CMN_EXT_CP: + noSymPerRb = 12; + break; + default: + /* Generate a log error. This case should never be executed */ + RETVOID; + } + + /* Depending on the Tx Antenna Index, deduct the + * Resource elements for the CRS */ + switch (txAntIdx) + { + case 0: + resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT; + break; + case 1: + resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT; + break; + case 2: + resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT; + break; + default: + /* Generate a log error. This case should never be executed */ + RETVOID; + } + + noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs; + for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++) + { + (*effTbl2Lyr)[i] = 0; + for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++) + { + /* This line computes the coding efficiency per 1024 REs */ + (*effTbl2Lyr)[i] += (rgTbSzTbl[1][i][j] * 1024) / (noResPerRb * (j+1)); + } + (*effTbl2Lyr)[i] /= RG_SCH_CMN_NUM_RBS; + } + RETVOID; +} + + +/** + * @brief This function initializes the rgSchCmnDciFrmtSizes table. + * + * @details + * + * Function: rgSCHCmnGetDciFrmtSizes + * Purpose: This function determines the sizes of all + * the available DCI Formats. The order of + * bits addition for each format is inaccordance + * with the specs. + * Invoked by: rgSCHCmnRgrCellCfg + * + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGetDciFrmtSizes +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnGetDciFrmtSizes(cell) +RgSchCellCb *cell; +#endif +{ + + TRC2(rgSCHCmnGetDciFrmtSizes); + + /* DCI Format 0 size determination */ + rgSchCmnDciFrmtSizes[0] = 1 + + 1 + + rgSCHUtlLog32bitNbase2((cell->bwCfg.ulTotalBw * \ + (cell->bwCfg.ulTotalBw + 1))/2) + + 5 + + 1 + + 2 + + 3 + +#ifdef LTE_TDD + 2 + + 2 + +#endif + 1; + /* DCI Format 1 size determination */ + rgSchCmnDciFrmtSizes[1] = 1 + + RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + + 5 + +#ifndef LTE_TDD + 3 + +#else + 4 + 2 + /* HqProc Id and DAI */ +#endif + 1 + + 2 + + 2; + + /* DCI Format 1A size determination */ + rgSchCmnDciFrmtSizes[2] = 1 + /* Flag for format0/format1a differentiation */ + 1 + /* Localized/distributed VRB assignment flag */ + 5 + /* For mcs */ +#ifndef LTE_TDD + 3 + /* Harq process Id */ +#else + 4 + /* Harq process Id */ + 2 + /* UL Index or DAI */ +#endif + 1 + /* New Data Indicator */ + 2 + /* For RV */ + 2 + /* For tpc */ + 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ + (cell->bwCfg.dlTotalBw + 1))/2); + /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \ + Since VRB is local */ + + /* DCI Format 1B size determination */ + rgSchCmnDciFrmtSizes[3] = 1 + + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ + (cell->bwCfg.dlTotalBw + 1))/2) + + 5 + + 3 + +#ifdef LTE_TDD + 1 + /* HqP */ + 2 + /* Dai */ +#endif + 1 + + 2 + + 2 + + ((cell->numTxAntPorts == 4)? 4:2) + + 1; + + /* DCI Format 1C size determination */ + /* Approximation: NDLVrbGap1 ~= Nprb for DL */ + rgSchCmnDciFrmtSizes[4] = (cell->bwCfg.dlTotalBw < 50)? 0:1 + + (cell->bwCfg.dlTotalBw < 50)? + (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/2 * \ + (cell->bwCfg.dlTotalBw/2 + 1))/2)) : + (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/4 * \ + (cell->bwCfg.dlTotalBw/4 + 1))/2)) + + 5; + + /* DCI Format 1D size determination */ + rgSchCmnDciFrmtSizes[5] = 1 + + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ + (cell->bwCfg.dlTotalBw + 1))/2) + + 5 + + 3 + +#ifdef LTE_TDD + 1 + 2 + +#endif + 1 + + 2 + + 2 + + ((cell->numTxAntPorts == 4)? 4:2) + + 1; + + /* DCI Format 2 size determination */ + rgSchCmnDciFrmtSizes[6] = ((cell->bwCfg.dlTotalBw < 10)?0:1) + + RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + + 2 + +#ifdef LTE_TDD + 2 + 1 + +#endif + 3 + + 1 + + (5 + 1 + 2)*2 + + ((cell->numTxAntPorts == 4)? 6:3); + + /* DCI Format 2A size determination */ + rgSchCmnDciFrmtSizes[7] = ((cell->bwCfg.dlTotalBw < 10)?0:1) + + RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) + + 2 + +#ifdef LTE_TDD + 2 + 1 + +#endif + 3 + + 1 + + (5 + 1 + 2)*2 + + ((cell->numTxAntPorts == 4)? 2:0); + + /* DCI Format 3 size determination */ + rgSchCmnDciFrmtSizes[8] = rgSchCmnDciFrmtSizes[0]; + + /* DCI Format 3A size determination */ + rgSchCmnDciFrmtSizes[9] = rgSchCmnDciFrmtSizes[0]; + + RETVOID; +} + + +/** + * @brief This function initializes the cmnCell->dciAggrLvl table. + * + * @details + * + * Function: rgSCHCmnGetCqiDciFrmt2AggrLvl + * Purpose: This function determines the Aggregation level + * for each CQI level against each DCI format. + * Invoked by: rgSCHCmnRgrCellCfg + * + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGetCqiDciFrmt2AggrLvl +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnGetCqiDciFrmt2AggrLvl(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 i; + U8 j; + + TRC2(rgSCHCmnGetCqiDciFrmt2AggrLvl); + + for (i = 0; i < RG_SCH_CMN_MAX_CQI; i++) + { + for (j = 0; j < 10; j++) + { + U32 pdcchBits; /* Actual number of phy bits needed for a given DCI Format + * for a given CQI Level */ + pdcchBits = (rgSchCmnDciFrmtSizes[j] * 1024)/rgSchCmnCqiPdcchEff[i]; + /* V5G_211 : 6.6 */ + if (pdcchBits < 192) + { + cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL2; + continue; + } + if (pdcchBits < 384) + { + cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL4; + continue; + } + if (pdcchBits < 768) + { + cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL8; + continue; + } + cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL16; + } + } + RETVOID; +} + +/** + * @brief This function initializes all the data for the scheduler. + * + * @details + * + * Function: rgSCHCmnDlInit + * Purpose: This function initializes the following information: + * 1. Efficiency table + * 2. CQI to table index - It is one row for upto 3 RBs + * and another row for greater than 3 RBs + * currently extended prefix is compiled out. + * Invoked by: MAC intialization code..may be ActvInit + * + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlInit +( +) +#else +PRIVATE Void rgSCHCmnDlInit() +#endif +{ + U8 i; + S16 j; + S16 k; + U8 idx; + RgSchCmnTbSzEff *effTbl; + RgSchCmnCqiToTbs *tbsTbl; + + TRC2(rgSCHCmnDlInit); + + /* 0 corresponds to Single layer case, 1 corresponds to 2 layers case*/ + /* Init Efficiency table for normal cyclic prefix */ + /*Initialize Efficiency table for Layer Index 0 */ + /*Initialize Efficiency table for Tx Antenna Port Index 0 */ + /*Initialize Efficiency table for each of the CFI indices. The + * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[0]; + /*Initialize Efficency table for Tx Antenna Port Index 1 */ + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[0]; + /*Initialize Efficency table for Tx Antenna Port Index 2 */ + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[0]; + + /*Initialize CQI to TBS table for Layer Index 0 for Normal CP */ + rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[0]; + + /*Intialize Efficency table for Layer Index 1 */ + /*Initialize Efficiency table for Tx Antenna Port Index 0 */ + /*Initialize Efficiency table for each of the CFI indices. The + * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[1]; + /*Initialize Efficiency table for Tx Antenna Port Index 1 */ + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[1]; + /*Initialize Efficiency table for Tx Antenna Port Index 2 */ + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[1]; + + /*Initialize CQI to TBS table for Layer Index 1 for Normal CP */ + rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[1]; + + for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) + { + for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) + { + /* EfficiencyTbl calculation incase of 2 layers for normal CP */ + rgSCHCmnCompEff((U8)(i + 1), RG_SCH_CMN_NOR_CP, idx,\ + rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i]); + rgSCHCmn2LyrCompEff((U8)(i + 1), RG_SCH_CMN_NOR_CP, idx, \ + rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i]); + } + } + + for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) + { + for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) + { + effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i]; + tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][i]; + for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; + (j >= 0) && (k > 0); --j) + { + /* ADD CQI to MCS mapping correction + * single dimensional array is replaced by 2 dimensions for different CFI*/ + if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k]) + { + (*tbsTbl)[k--] = (U8)j; + } + } + for (; k > 0; --k) + { + (*tbsTbl)[k] = 0; + } + /* effTbl,tbsTbl calculation incase of 2 layers for normal CP */ + effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i]; + tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][i]; + for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; + (j >= 0) && (k > 0); --j) + { + /* ADD CQI to MCS mapping correction + * single dimensional array is replaced by 2 dimensions for different CFI*/ + if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k]) + { + (*tbsTbl)[k--] = (U8)j; + } + } + for (; k > 0; --k) + { + (*tbsTbl)[k] = 0; + } + } + } + + /* Efficiency Table for Extended CP */ + /*Initialize Efficiency table for Layer Index 0 */ + /*Initialize Efficiency table for Tx Antenna Port Index 0 */ + /*Initialize Efficiency table for each of the CFI indices. The + * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[0]; + /*Initialize Efficency table for Tx Antenna Port Index 1 */ + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[0]; + /*Initialize Efficency table for Tx Antenna Port Index 2 */ + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[0]; + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[0]; + + /*Initialize CQI to TBS table for Layer Index 0 for Extended CP */ + rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[0]; + rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[0]; + + /*Initialize Efficiency table for Layer Index 1 */ + /*Initialize Efficiency table for each of the CFI indices. The + * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/ + /*Initialize Efficency table for Tx Antenna Port Index 0 */ + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[1]; + /*Initialize Efficency table for Tx Antenna Port Index 1 */ + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[1]; + /*Initialize Efficency table for Tx Antenna Port Index 2 */ + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[1]; + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[1]; + + /*Initialize CQI to TBS table for Layer Index 1 for Extended CP */ + rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[1]; + rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[1]; + /* Activate this code when extended cp is supported */ + for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) + { + for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) + { + /* EfficiencyTbl calculation incase of 2 layers for extendedl CP */ + rgSCHCmnCompEff( (U8)(i + 1 ), (U8)RG_SCH_CMN_EXT_CP, idx,\ + rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i]); + rgSCHCmn2LyrCompEff((U8)(i + 1), (U8) RG_SCH_CMN_EXT_CP,idx, \ + rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i]); + } + } + + for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++) + { + for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++) + { + effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i]; + tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][i]; + for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; + (j >= 0) && (k > 0); --j) + { + /* ADD CQI to MCS mapping correction + * single dimensional array is replaced by 2 dimensions for different CFI*/ + if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k]) + { + (*tbsTbl)[k--] = (U8)j; + } + } + for (; k > 0; --k) + { + (*tbsTbl)[k] = 0; + } + /* effTbl,tbsTbl calculation incase of 2 layers for extended CP */ + effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i]; + tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][i]; + for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1; + (j >= 0) && (k > 0); --j) + { + /* ADD CQI to MCS mapping correction + * single dimensional array is replaced by 2 dimensions for different CFI*/ + if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k]) + { + (*tbsTbl)[k--] = (U8)j; + } + } + for (; k > 0; --k) + { + (*tbsTbl)[k] = 0; + } + } + } + RETVOID; +} + +/** + * @brief This function initializes all the data for the scheduler. + * + * @details + * + * Function: rgSCHCmnUlInit + * Purpose: This function initializes the following information: + * 1. Efficiency table + * 2. CQI to table index - It is one row for upto 3 RBs + * and another row for greater than 3 RBs + * currently extended prefix is compiled out. + * Invoked by: MAC intialization code..may be ActvInit + * + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlInit +( +) +#else +PRIVATE Void rgSCHCmnUlInit() +#endif +{ + U8 *mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_NOR_CP][0]; + RgSchCmnTbSzEff *effTbl = &rgSchCmnNorUlEff[0]; + CONSTANT RgSchCmnUlCqiInfo *cqiTbl = &rgSchCmnUlCqiTbl[0]; + S16 i; + S16 j; + TRC2(rgSCHCmnUlInit); + + /* Initaializing new variable added for UL eff */ + rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP] = &rgSchCmnNorUlEff[0]; + /* Reason behind using 3 as the number of symbols to rule out for + * efficiency table computation would be that we are using 2 symbols for + * DMRS(1 in each slot) and 1 symbol for SRS*/ + rgSCHCmnCompUlEff(RGSCH_UL_SYM_DMRS_SRS,RG_SCH_CMN_NOR_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP]); + + for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1; + i >= 0 && j > 0; --i) + { + if ((*effTbl)[i] <= cqiTbl[j].eff) + { + mapTbl[j--] = (U8)i; + } + } + for (; j > 0; --j) + { + mapTbl[j] = 0; + } + effTbl = &rgSchCmnExtUlEff[0]; + mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_EXT_CP][0]; + + /* Initaializing new variable added for UL eff */ + rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP] = &rgSchCmnExtUlEff[0]; + /* Reason behind using 3 as the number of symbols to rule out for + * efficiency table computation would be that we are using 2 symbols for + * DMRS(1 in each slot) and 1 symbol for SRS*/ + rgSCHCmnCompUlEff(3,RG_SCH_CMN_EXT_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP]); + + for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1; + i >= 0 && j > 0; --i) + { + if ((*effTbl)[i] <= cqiTbl[j].eff) + { + mapTbl[j--] = (U8)i; + } + } + for (; j > 0; --j) + { + mapTbl[j] = 0; + } + rgSCHPwrInit(); + RETVOID; +} + +/** + * @brief This function initializes all the data for the scheduler. + * + * @details + * + * Function: rgSCHCmnInit + * Purpose: This function initializes the following information: + * 1. Efficiency table + * 2. CQI to table index - It is one row for upto 3 RBs + * and another row for greater than 3 RBs + * currently extended prefix is compiled out. + * Invoked by: MAC intialization code..may be ActvInit + * + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnInit +( +) +#else +PUBLIC Void rgSCHCmnInit() +#endif +{ + U8 idx; + TRC2(rgSCHCmnInit); + + rgSCHCmnDlInit(); + rgSCHCmnUlInit(); +#ifdef EMTC_ENABLE + rgSCHEmtcCmnDlInit(); + rgSCHEmtcCmnUlInit(); +#endif +#ifdef LTEMAC_SPS + rgSCHCmnSpsInit(); +#endif + + /* Init the function pointers */ + rgSchCmnApis.rgSCHRgrUeCfg = rgSCHCmnRgrUeCfg; + rgSchCmnApis.rgSCHRgrUeRecfg = rgSCHCmnRgrUeRecfg; + rgSchCmnApis.rgSCHFreeUe = rgSCHCmnUeDel; + rgSchCmnApis.rgSCHRgrCellCfg = rgSCHCmnRgrCellCfg; + rgSchCmnApis.rgSCHRgrCellRecfg = rgSCHCmnRgrCellRecfg; + rgSchCmnApis.rgSCHFreeCell = rgSCHCmnCellDel; + rgSchCmnApis.rgSCHRgrLchCfg = rgSCHCmnRgrLchCfg; + rgSchCmnApis.rgSCHRgrLcgCfg = rgSCHCmnRgrLcgCfg; + rgSchCmnApis.rgSCHRgrLchRecfg = rgSCHCmnRgrLchRecfg; + rgSchCmnApis.rgSCHRgrLcgRecfg = rgSCHCmnRgrLcgRecfg; + rgSchCmnApis.rgSCHFreeDlLc = rgSCHCmnFreeDlLc; + rgSchCmnApis.rgSCHFreeLcg = rgSCHCmnLcgDel; + rgSchCmnApis.rgSCHRgrLchDel = rgSCHCmnRgrLchDel; + rgSchCmnApis.rgSCHActvtUlUe = rgSCHCmnActvtUlUe; + rgSchCmnApis.rgSCHActvtDlUe = rgSCHCmnActvtDlUe; + rgSchCmnApis.rgSCHHdlUlTransInd = rgSCHCmnHdlUlTransInd; + rgSchCmnApis.rgSCHDlDedBoUpd = rgSCHCmnDlDedBoUpd; + rgSchCmnApis.rgSCHUlRecMsg3Alloc = rgSCHCmnUlRecMsg3Alloc; + rgSchCmnApis.rgSCHUlCqiInd = rgSCHCmnUlCqiInd; + rgSchCmnApis.rgSCHPucchDeltaPwrInd = rgSCHPwrPucchDeltaInd; + rgSchCmnApis.rgSCHUlHqProcForUe = rgSCHCmnUlHqProcForUe; +#ifdef RG_UNUSED + rgSchCmnApis.rgSCHUpdUlHqProc = rgSCHCmnUpdUlHqProc; +#endif + rgSchCmnApis.rgSCHUpdBsrShort = rgSCHCmnUpdBsrShort; + rgSchCmnApis.rgSCHUpdBsrTrunc = rgSCHCmnUpdBsrTrunc; + rgSchCmnApis.rgSCHUpdBsrLong = rgSCHCmnUpdBsrLong; + rgSchCmnApis.rgSCHUpdPhr = rgSCHCmnUpdPhr; + rgSchCmnApis.rgSCHUpdExtPhr = rgSCHCmnUpdExtPhr; + rgSchCmnApis.rgSCHContResUlGrant = rgSCHCmnContResUlGrant; + rgSchCmnApis.rgSCHSrRcvd = rgSCHCmnSrRcvd; + rgSchCmnApis.rgSCHFirstRcptnReq = rgSCHCmnFirstRcptnReq; + rgSchCmnApis.rgSCHNextRcptnReq = rgSCHCmnNextRcptnReq; + rgSchCmnApis.rgSCHFirstHqFdbkAlloc = rgSCHCmnFirstHqFdbkAlloc; + rgSchCmnApis.rgSCHNextHqFdbkAlloc = rgSCHCmnNextHqFdbkAlloc; + rgSchCmnApis.rgSCHDlProcAddToRetx = rgSCHCmnDlProcAddToRetx; + rgSchCmnApis.rgSCHDlCqiInd = rgSCHCmnDlCqiInd; +#ifdef EMTC_ENABLE + rgSchCmnApis.rgSCHUlProcAddToRetx = rgSCHCmnEmtcUlProcAddToRetx; +#endif +#ifdef TFU_UPGRADE + rgSchCmnApis.rgSCHSrsInd = rgSCHCmnSrsInd; +#endif + rgSchCmnApis.rgSCHDlTARpt = rgSCHCmnDlTARpt; + rgSchCmnApis.rgSCHDlRlsSubFrm = rgSCHCmnDlRlsSubFrm; + rgSchCmnApis.rgSCHUeReset = rgSCHCmnUeReset; +#ifdef LTEMAC_SPS + rgSchCmnApis.rgSCHHdlCrntiCE = rgSCHCmnHdlCrntiCE; + rgSchCmnApis.rgSCHDlProcAck = rgSCHCmnDlProcAck; + rgSchCmnApis.rgSCHDlRelPdcchFbk = rgSCHCmnDlRelPdcchFbk; + rgSchCmnApis.rgSCHUlSpsRelInd = rgSCHCmnUlSpsRelInd; + rgSchCmnApis.rgSCHUlSpsActInd = rgSCHCmnUlSpsActInd; + rgSchCmnApis.rgSCHUlCrcFailInd = rgSCHCmnUlCrcFailInd; + rgSchCmnApis.rgSCHUlCrcInd = rgSCHCmnUlCrcInd; +#endif + rgSchCmnApis.rgSCHDrxStrtInActvTmrInUl = rgSCHCmnDrxStrtInActvTmrInUl; + rgSchCmnApis.rgSCHUpdUeDataIndLcg = rgSCHCmnUpdUeDataIndLcg; + + for (idx = 0; idx < RGSCH_NUM_SCHEDULERS; ++idx) + { + rgSchUlSchdInits[idx](&rgSchUlSchdTbl[idx]); + rgSchDlSchdInits[idx](&rgSchDlSchdTbl[idx]); + } +#ifdef EMTC_ENABLE + for (idx = 0; idx < RGSCH_NUM_EMTC_SCHEDULERS; ++idx) + { + rgSchEmtcUlSchdInits[idx](&rgSchEmtcUlSchdTbl[idx]); + rgSchEmtcDlSchdInits[idx](&rgSchEmtcDlSchdTbl[idx]); + } +#endif +#if (defined (RG_PHASE2_SCHED) && defined(TFU_UPGRADE)) + for (idx = 0; idx < RGSCH_NUM_DLFS_SCHEDULERS; ++idx) + { + rgSchDlfsSchdInits[idx](&rgSchDlfsSchdTbl[idx]); + } +#endif +#ifdef LTE_ADV + rgSchCmnApis.rgSCHRgrSCellUeCfg = rgSCHCmnRgrSCellUeCfg; + rgSchCmnApis.rgSCHRgrSCellUeDel = rgSCHCmnRgrSCellUeDel; +#endif + RETVOID; +} + + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHCmnDlRlsSubFrm + * Purpose: Releases scheduler Information from DL SubFrm. + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[out] CmLteTimingInfo frm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlRlsSubFrm +( +RgSchCellCb *cell, +CmLteTimingInfo frm +) +#else +PUBLIC Void rgSCHCmnDlRlsSubFrm(cell, frm) +RgSchCellCb *cell; +CmLteTimingInfo frm; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchDlSf *sf; + + TRC2(rgSCHCmnDlRlsSubFrm); + + /* Get the pointer to the subframe */ + sf = rgSCHUtlSubFrmGet(cell, frm); + + rgSCHUtlSubFrmPut(cell, sf); + if (sf->dlfsSf) + { + /* Re-initialize DLFS specific information for the sub-frame */ + cellSch->apisDlfs->rgSCHDlfsReinitSf(cell, sf); + } + RETVOID; +} + + + +/** + * @brief This function is the starting function for DL allocation. + * + * @details + * + * Function: rgSCHCmnDlCmnChAlloc + * Purpose: Scheduling for downlink. It performs allocation in the order + * of priority wich BCCH/PCH first, CCCH, Random Access and TA. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[out] RgSchCmnDlRbAllocInfo* allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchRarAlloc +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnDlCcchRarAlloc(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnDlCcchRarAlloc); + + rgSCHCmnDlCcchRetx(cell, &cellSch->allocInfo); + /* LTE_ADV_FLAG_REMOVED_START */ + if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) + { + if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) + { + /*eNodeB need to blank the subframe */ + } + else + { + rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo); + } + } + else + { + rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo); + } + /* LTE_ADV_FLAG_REMOVED_END */ + +#ifdef RGR_V1 + + /*Added these function calls for processing CCCH SDU arriving + * after guard timer expiry.Functions differ from above two functions + * in using ueCb instead of raCb.*/ + rgSCHCmnDlCcchSduRetx(cell, &cellSch->allocInfo); + /* LTE_ADV_FLAG_REMOVED_START */ + if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) + { + if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) + { + /*eNodeB need to blank the subframe */ + } + else + { + rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo); + } + } + else + { + rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo); + } + /* LTE_ADV_FLAG_REMOVED_END */ +#endif + +#ifdef LTE_TDD + if(cellSch->ul.msg3SchdIdx != RGSCH_INVALID_INFO) + { + /* Do not schedule msg3 if there is a CFI change ongoing */ + if (cellSch->dl.currCfi == cellSch->dl.newCfi) + { + rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); + } + } +#else + /* LTE_ADV_FLAG_REMOVED_START */ + if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo) + { + if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) + { + /*eNodeB need to blank the subframe */ + } + else + { + /* Do not schedule msg3 if there is a CFI change ongoing */ + if (cellSch->dl.currCfi == cellSch->dl.newCfi) + { + rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); + } + } + } + else + { + /* Do not schedule msg3 if there is a CFI change ongoing */ + if (cellSch->dl.currCfi == cellSch->dl.newCfi) + { + rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo); + } + } + /* LTE_ADV_FLAG_REMOVED_END */ +#endif + + RETVOID; +} + +#ifdef RGR_V1 +/** + * @brief Scheduling for CCCH SDU. + * + * @details + * + * Function: rgSCHCmnCcchSduAlloc + * Purpose: Scheduling for CCCH SDU + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ueCb + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnCcchSduAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE S16 rgSCHCmnCcchSduAlloc(cell, ueCb, allocInfo) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchDlRbAlloc *rbAllocInfo; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); + + TRC2(rgSCHCmnCcchSduAlloc); + + /* Return if subframe BW exhausted */ + if (allocInfo->ccchSduAlloc.ccchSduDlSf->bw <= + allocInfo->ccchSduAlloc.ccchSduDlSf->bwAssigned) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "bw<=bwAssigned for UEID:%d",ueCb->ueId); + RETVALUE(RFAILED); + } + + if (rgSCHDhmGetCcchSduHqProc(ueCb, cellSch->dl.time, &(ueDl->proc)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHDhmGetCcchSduHqProc failed UEID:%d",ueCb->ueId); + RETVALUE(RFAILED); + } + + rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); + rbAllocInfo->dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; + + if (rgSCHCmnCcchSduDedAlloc(cell, ueCb) != ROK) + { + /* Fix : syed Minor failure handling, release hqP if Unsuccessful */ + rgSCHDhmRlsHqpTb(ueDl->proc, 0, FALSE); + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnCcchSduDedAlloc failed UEID:%d",ueCb->ueId); + RETVALUE(RFAILED); + } + cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduTxLst, &ueDl->proc->reqLnk); + ueDl->proc->reqLnk.node = (PTR)ueDl->proc; + allocInfo->ccchSduAlloc.ccchSduDlSf->schdCcchUe++; + + RETVALUE(ROK); +} +/** + * @brief This function scheduler for downlink CCCH messages. + * + * @details + * + * Function: rgSCHCmnDlCcchSduTx + * Purpose: Scheduling for downlink CCCH + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchSduTx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchSduTx(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchUeCb *ueCb; + RgSchCmnDlUe *ueCmnDl; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; + + TRC2(rgSCHCmnDlCcchSduTx); + + node = cell->ccchSduUeLst.first; + while(node) + { + if(cellSch->dl.maxCcchPerDlSf && + dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) + { + break; + } + else + { + ueCb = (RgSchUeCb *)(node->node); + ueCmnDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); + node = node->next; + /* Fix : syed postpone scheduling for this + * until msg4 is done */ + /* Fix : syed RLC can erroneously send CCCH SDU BO + * twice. Hence an extra guard to avoid if already + * scheduled for RETX */ + if ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) && + (!ueCmnDl->proc)) + { + if ((rgSCHCmnCcchSduAlloc(cell, ueCb, allocInfo)) != ROK) + { + break; + } + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"ERROR!! THIS SHOULD " + "NEVER HAPPEN for UEID:%d", ueCb->ueId); + continue; + } + } + } + RETVOID; +} +#endif + +/** + * @brief This function scheduler for downlink CCCH messages. + * + * @details + * + * Function: rgSCHCmnDlCcchTx + * Purpose: Scheduling for downlink CCCH + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchTx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchTx(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchRaCb *raCb; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf; + + TRC2(rgSCHCmnDlCcchTx); + + node = cell->raInfo.toBeSchdLst.first; + while(node) + { + if(cellSch->dl.maxCcchPerDlSf && + dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) + { + break; + } + else + { + + raCb = (RgSchRaCb *)(node->node); + node = node->next; + /* Address allocation for this UE for MSG 4 */ + /* Allocation for Msg4 */ + if ((rgSCHCmnMsg4Alloc(cell, raCb, allocInfo)) != ROK) + { + break; + } + } + } + RETVOID; +} + +#ifdef RGR_V1 +/** + * @brief This function scheduler for downlink CCCH messages. + * + * @details + * + * Function: rgSCHCmnDlCcchSduRetx + * Purpose: Scheduling for downlink CCCH + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchSduRetx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchSduRetx(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchDlRbAlloc *rbAllocInfo; + CmLList *node; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchUeCb *ueCb; + RgSchDlHqProcCb *hqP; + U8 retxBw = 0; + RgSchCmnDlUe *ueDl; + RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf; + + TRC2(rgSCHCmnDlCcchSduRetx); + + node = cellSch->dl.ccchSduRetxLst.first; + while(node) + { + if(cellSch->dl.maxCcchPerDlSf && + dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) + { + break; + } + else + { + + hqP = (RgSchDlHqProcCb *)(node->node); + node = node->next; + + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if (rgSCHCmnRetxAvoidTdd(allocInfo->ccchSduAlloc.ccchSduDlSf, + cell, hqP) == TRUE) + { + continue; + } +#endif + /* DwPts Scheduling Changes End */ + + if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned)) + { + break; + } + ueCb = (RgSchUeCb*)(hqP->hqE->ue); + ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); + + rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); + /* Fill RB Alloc Info */ + rbAllocInfo->dlSf = dlSf; + rbAllocInfo->tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes; + rbAllocInfo->rbsReq = hqP->tbInfo[0].dlGrnt.numRb; + /* Fix : syed iMcs setting did not correspond to RETX */ + RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]), + rbAllocInfo->tbInfo[0].imcs); + rbAllocInfo->rnti = ueCb->ueId; + rbAllocInfo->tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs; + /* Fix : syed Copying info in entirety without depending on stale TX information */ + rbAllocInfo->tbInfo[0].tbCb = &hqP->tbInfo[0]; + rbAllocInfo->tbInfo[0].schdlngForTb = TRUE; + /* Fix : syed Assigning proc to scratchpad */ + ueDl->proc = hqP; + + retxBw += rbAllocInfo->rbsReq; + + cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduRetxLst, \ + &hqP->reqLnk); + hqP->reqLnk.node = (PTR)hqP; + dlSf->schdCcchUe++; + } + } + dlSf->bwAssigned += retxBw; + RETVOID; +} +#endif + +/** + * @brief This function scheduler for downlink CCCH messages. + * + * @details + * + * Function: rgSCHCmnDlCcchRetx + * Purpose: Scheduling for downlink CCCH + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchRetx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchRetx(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchRaCb *raCb; + RgSchDlHqProcCb *hqP; + U8 retxBw = 0; + RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf; + + TRC2(rgSCHCmnDlCcchRetx); + + node = cellSch->dl.msg4RetxLst.first; + while(node) + { + if(cellSch->dl.maxCcchPerDlSf && + dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf) + { + break; + } + else + { + hqP = (RgSchDlHqProcCb *)(node->node); + + node = node->next; + + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if (rgSCHCmnRetxAvoidTdd(allocInfo->msg4Alloc.msg4DlSf, + cell, hqP) == TRUE) + { + continue; + } +#endif + /* DwPts Scheduling Changes End */ + + if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned)) + { + break; + } + raCb = (RgSchRaCb*)(hqP->hqE->raCb); + /* Fill RB Alloc Info */ + raCb->rbAllocInfo.dlSf = dlSf; + raCb->rbAllocInfo.tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes; + raCb->rbAllocInfo.rbsReq = hqP->tbInfo[0].dlGrnt.numRb; + /* Fix : syed iMcs setting did not correspond to RETX */ + RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]), + raCb->rbAllocInfo.tbInfo[0].imcs); + raCb->rbAllocInfo.rnti = raCb->tmpCrnti; + raCb->rbAllocInfo.tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs; + /* Fix; syed Copying info in entirety without depending on stale TX information */ + raCb->rbAllocInfo.tbInfo[0].tbCb = &hqP->tbInfo[0]; + raCb->rbAllocInfo.tbInfo[0].schdlngForTb = TRUE; + + retxBw += raCb->rbAllocInfo.rbsReq; + + cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4RetxLst, \ + &hqP->reqLnk); + hqP->reqLnk.node = (PTR)hqP; + dlSf->schdCcchUe++; + } + } + dlSf->bwAssigned += retxBw; + RETVOID; +} + + +/** + * @brief This function implements scheduler DL allocation for + * for broadcast (on PDSCH) and paging. + * + * @details + * + * Function: rgSCHCmnDlBcchPcch + * Purpose: This function implements scheduler for DL allocation + * for broadcast (on PDSCH) and paging. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlBcchPcch +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgInfSfAlloc *subfrmAlloc +) +#else +PRIVATE Void rgSCHCmnDlBcchPcch(cell, allocInfo, subfrmAlloc) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +RgInfSfAlloc *subfrmAlloc; +#endif +{ + CmLteTimingInfo frm; + RgSchDlSf *sf; + RgSchClcDlLcCb *pcch; + RgSchClcBoRpt *bo; +#ifndef RGR_SI_SCH + Bool valid; + RgSchClcDlLcCb *bcch, *bch; +#endif/*RGR_SI_SCH*/ + + + TRC2(rgSCHCmnDlBcchPcch); + + frm = cell->crntTime; +#ifdef LTEMAC_HDFDD + /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA + + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); +#else + RGSCH_SUBFRAME_INDEX(frm); + //RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); +#endif + + /* Compute the subframe for which allocation is being made */ + /* essentially, we need pointer to the dl frame for this subframe */ + sf = rgSCHUtlSubFrmGet(cell, frm); + + +#ifndef RGR_SI_SCH + bch = rgSCHDbmGetBcchOnBch(cell); +#if (ERRCLASS & ERRCLS_DEBUG) + if (bch == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on BCH is not configured"); + RETVOID; + } +#endif + if (bch->boLst.first != NULLP) + { + bo = (RgSchClcBoRpt *)(bch->boLst.first->node); + if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) + { + sf->bch.tbSize = bo->bo; + cmLListDelFrm(&bch->boLst, bch->boLst.first); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(*bo)); + rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, bch->lcId,TRUE); + } + } + else + { + if ((frm.sfn % 4 == 0) && (frm.subframe == 0)) + { + } + } + + allocInfo->bcchAlloc.schdFirst = FALSE; + bcch = rgSCHDbmGetFirstBcchOnDlsch(cell); +#if (ERRCLASS & ERRCLS_DEBUG) + if (bcch == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on DLSCH is not configured"); + RETVOID; + } +#endif + if (bcch->boLst.first != NULLP) + { + bo = (RgSchClcBoRpt *)(bcch->boLst.first->node); + + if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) + { + allocInfo->bcchAlloc.schdFirst = TRUE; + /* Time to perform allocation for this BCCH transmission */ + rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo); + } + } + + if(!allocInfo->bcchAlloc.schdFirst) + { + CmLList *lnk; + bcch = rgSCHDbmGetSecondBcchOnDlsch(cell); +#if (ERRCLASS & ERRCLS_DEBUG) + if (bcch == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"BCCH on DLSCH is not configured"); + RETVOID; + } +#endif + lnk = bcch->boLst.first; + while (lnk != NULLP) + { + bo = (RgSchClcBoRpt *)(lnk->node); + lnk = lnk->next; + valid = rgSCHCmnChkInWin(frm, bo->timeToTx, bo->maxTimeToTx); + + if(valid) + { + bo->i = RGSCH_CALC_SF_DIFF(frm, bo->timeToTx); + /* Time to perform allocation for this BCCH transmission */ + rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo); + break; + } + else + { + valid = rgSCHCmnChkPastWin(frm, bo->maxTimeToTx); + if(valid) + { + cmLListDelFrm(&bcch->boLst, &bo->boLstEnt); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, + sizeof(RgSchClcBoRpt)); + } + } + } + } +#else + rgSCHDlSiSched(cell, allocInfo, subfrmAlloc); +#endif/*RGR_SI_SCH*/ + + pcch = rgSCHDbmGetPcch(cell); +#ifdef ERRCLS_KW + if (pcch == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"PCCH on DLSCH is not configured"); + RETVOID; + } +#endif + if (pcch->boLst.first != NULLP) + { + bo = (RgSchClcBoRpt *)(pcch->boLst.first->node); + + if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx)) + { + /* Time to perform allocation for this PCCH transmission */ + rgSCHCmnClcAlloc(cell, sf, pcch, RGSCH_P_RNTI, allocInfo); + } + } + RETVOID; +} + +/* +* +* Fun: rgSCHCmnChkInWin +* +* Desc: This function checks if frm occurs in window +* +* Ret: TRUE - if in window +* FALSE - otherwise +* +* Notes: None +* +* File: rg_sch_cmn.c +* +*/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnChkInWin +( +CmLteTimingInfo frm, +CmLteTimingInfo start, +CmLteTimingInfo end +) +#else +PUBLIC Bool rgSCHCmnChkInWin(frm, start, end) +CmLteTimingInfo frm; +CmLteTimingInfo start; +CmLteTimingInfo end; +#endif +{ + Bool inWin = FALSE; + + TRC2(rgSCHCmnChkInWin); + + if (end.sfn > start.sfn) + { + if (frm.sfn > start.sfn + || (frm.sfn == start.sfn && frm.subframe >= start.subframe)) + { + if (frm.sfn < end.sfn +#ifdef EMTC_ENABLE + || (frm.sfn == end.sfn && frm.subframe <= end.subframe)) +#else + || (frm.sfn == end.sfn && frm.subframe <= start.subframe)) +#endif + { + inWin = TRUE; + } + } + } + /* Testing for wrap around, sfn wraparound check should be enough */ + else if (end.sfn < start.sfn) + { + if (frm.sfn > start.sfn + || (frm.sfn == start.sfn && frm.subframe >= start.subframe)) + { + inWin = TRUE; + } + else + { + if (frm.sfn < end.sfn + || (frm.sfn == end.sfn && frm.subframe <= end.subframe)) + { + inWin = TRUE; + } + } + } + else /* start.sfn == end.sfn */ + { + if (frm.sfn == start.sfn + && (frm.subframe >= start.subframe + && frm.subframe <= end.subframe)) + { + inWin = TRUE; + } + } + + RETVALUE(inWin); +} /* end of rgSCHCmnChkInWin*/ + +/* +* +* Fun: rgSCHCmnChkPastWin +* +* Desc: This function checks if frm has gone past window edge +* +* Ret: TRUE - if past window edge +* FALSE - otherwise +* +* Notes: None +* +* File: rg_sch_cmn.c +* +*/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnChkPastWin +( +CmLteTimingInfo frm, +CmLteTimingInfo end +) +#else +PUBLIC Bool rgSCHCmnChkPastWin(frm, end) +CmLteTimingInfo frm; +CmLteTimingInfo end; +#endif +{ + CmLteTimingInfo refFrm = end; + Bool pastWin; + + TRC2(rgSCHCmnChkPastWin); + + RGSCH_INCR_FRAME(refFrm.sfn); + RGSCH_INCR_SUB_FRAME(end, 1); + pastWin = rgSCHCmnChkInWin(frm, end, refFrm); + + RETVALUE(pastWin); +} /* end of rgSCHCmnChkPastWin*/ + +/** + * @brief This function implements allocation of the resources for common + * channels BCCH, PCCH. + * + * @details + * + * Function: rgSCHCmnClcAlloc + * Purpose: This function implements selection of number of RBs based + * the allowed grant for the service. It is also responsible + * for selection of MCS for the transmission. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell, + * @param[in] RgSchDlSf *sf, + * @param[in] RgSchClcDlLcCb *lch, + * @param[in] U16 rnti, + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnClcAlloc +( +RgSchCellCb *cell, +RgSchDlSf *sf, +RgSchClcDlLcCb *lch, +U16 rnti, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnClcAlloc(cell, sf, lch, rnti, allocInfo) +RgSchCellCb *cell; +RgSchDlSf *sf; +RgSchClcDlLcCb *lch; +U16 rnti; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchClcBoRpt *bo; + U32 rb=0; + U8 mcs; + U32 tbs; +#ifdef LTE_TDD + U8 lostRe; + U8 cfi = cellDl->currCfi; +#endif + + TRC2(rgSCHCmnClcAlloc); + + bo = (RgSchClcBoRpt *)(lch->boLst.first->node); + + mcs = bo->mcs; + tbs = bo->bo; + /* rgSCHCmnClcRbAllocForFxdTb(cell, bo->bo, cellDl->ccchCqi, &rb);*/ + if(cellDl->bitsPerRb==0) + { + while ((rgTbSzTbl[0][0][rb]) < (tbs*8)) + { + rb++; + } + rb = rb+1; + } + else + { + rb = RGSCH_CEIL((tbs*8), cellDl->bitsPerRb); + } + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + if(sf->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); + + /* Calculate the less RE's because of DwPTS */ + lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]); + + /* Increase number of RBs in Spl SF to compensate for lost REs */ + rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); + } +#endif + /* DwPTS Scheduling Changes End */ + /*ccpu00115595- end*/ + /* additional check to see if required RBs + * exceeds the available */ + if (rb > sf->bw - sf->bwAssigned) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"BW allocation " + "failed for CRNTI:%d",rnti); + RETVOID; + } + + /* Update the subframe Allocated BW field */ + sf->bwAssigned = sf->bwAssigned + rb; + /* Fill in the BCCH/PCCH transmission info to the RBAllocInfo struct */ + if (rnti == RGSCH_SI_RNTI) + { + allocInfo->bcchAlloc.rnti = rnti; + allocInfo->bcchAlloc.dlSf = sf; + allocInfo->bcchAlloc.tbInfo[0].bytesReq = tbs; + allocInfo->bcchAlloc.rbsReq = rb; + allocInfo->bcchAlloc.tbInfo[0].imcs = mcs; + allocInfo->bcchAlloc.tbInfo[0].noLyr = 1; + /* Nprb indication at PHY for common Ch */ + allocInfo->bcchAlloc.nPrb = bo->nPrb; + } + else + { + allocInfo->pcchAlloc.rnti = rnti; + allocInfo->pcchAlloc.dlSf = sf; + allocInfo->pcchAlloc.tbInfo[0].bytesReq = tbs; + allocInfo->pcchAlloc.rbsReq = rb; + allocInfo->pcchAlloc.tbInfo[0].imcs = mcs; + allocInfo->pcchAlloc.tbInfo[0].noLyr = 1; + allocInfo->pcchAlloc.nPrb = bo->nPrb; + } + RETVOID; +} + + +/** + * @brief This function implements PDCCH allocation for common channels. + * + * @details + * + * Function: rgSCHCmnCmnPdcchAlloc + * Purpose: This function implements allocation of PDCCH for a UE. + * 1. This uses index 0 of PDCCH table for efficiency. + * 2. Uses he candidate PDCCH count for the aggr level. + * 3. Look for availability for each candidate and choose + * the first one available. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *sf + * @return RgSchPdcch * + * -# NULLP when unsuccessful + * + **/ +#ifdef ANSI +PUBLIC RgSchPdcch *rgSCHCmnCmnPdcchAlloc +( +RgSchCellCb *cell, +RgSchDlSf *subFrm +) +#else +PUBLIC RgSchPdcch *rgSCHCmnCmnPdcchAlloc(cell, subFrm) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +#endif +{ + CmLteAggrLvl aggrLvl; + RgSchPdcchInfo *pdcchInfo; + RgSchPdcch *pdcch; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 numCce; /*store num CCEs based on + aggregation level */ + TRC2(rgSCHCmnCmnPdcchAlloc); + + aggrLvl = cellSch->dl.cmnChAggrLvl; + + pdcchInfo = &(subFrm->pdcchInfo); + + /* Updating the no. of nCce in pdcchInfo, in case if CFI + * was changed */ +#ifdef LTE_TDD + if(subFrm->nCce != pdcchInfo->nCce) + { + rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce); + } +#else + if(cell->nCce != pdcchInfo->nCce) + { + rgSCHUtlPdcchInit(cell, subFrm, cell->nCce); + } +#endif + + switch (aggrLvl) + { + case CM_LTE_AGGR_LVL4: + numCce = 4; + break; + case CM_LTE_AGGR_LVL8: + numCce = 8; + break; + case CM_LTE_AGGR_LVL16: + numCce = 16; + break; + default: + RETVALUE(NULLP); + } + + if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE) + { +#ifdef LTEMAC_SPS + pdcch->isSpsRnti = FALSE; +#endif + /* Increment the CCE used counter in the current subframe */ + subFrm->cceCnt += numCce; + pdcch->pdcchSearchSpace = RG_SCH_CMN_SEARCH_SPACE; + + RETVALUE(pdcch); + } + + /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ + subFrm->isCceFailure = TRUE; + + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "PDCCH ERR: NO PDDCH AVAIL IN COMMON SEARCH SPACE aggr:%u", + aggrLvl); + RETVALUE(NULLP); +} + + +/** + * @brief This function implements bandwidth allocation for common channels. + * + * @details + * + * Function: rgSCHCmnClcRbAlloc + * Purpose: This function implements bandwith allocation logic + * for common control channels. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] U32 bo + * @param[in] U8 cqi + * @param[in] U8 *rb + * @param[in] U32 *tbs + * @param[in] U8 *mcs + * @param[in] RgSchDlSf *sf + * @return Void + * + **/ +#ifdef LTEMAC_SPS +#ifdef ANSI +PUBLIC Void rgSCHCmnClcRbAlloc +( +RgSchCellCb *cell, +U32 bo, +U8 cqi, +U8 *rb, +U32 *tbs, +U8 *mcs, +U8 *iTbs, +Bool isSpsBo, +RgSchDlSf *sf +) +#else +PUBLIC Void rgSCHCmnClcRbAlloc(cell, bo, cqi, rb, tbs, mcs, iTbs, isSpsBo) +RgSchCellCb *cell; +U32 bo; +U8 cqi; +U8 *rb; +U32 *tbs; +U8 *mcs; +U8 *iTbs; +Bool isSpsBo; +RgSchDlSf *sf; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSCHCmnClcRbAlloc +( +RgSchCellCb *cell, +U32 bo, +U8 cqi, +U8 *rb, +U32 *tbs, +U8 *mcs, +RgSchDlSf *sf +) +#else +PRIVATE Void rgSCHCmnClcRbAlloc(cell, bo, cqi, rb, tbs, mcs, sf) +RgSchCellCb *cell; +U32 bo; +U8 cqi; +U8 *rb; +U32 *tbs; +U8 *mcs; +RgSchDlSf *sf; +#endif +#endif /* LTEMAC_SPS */ +{ + U8 iTbsVal; + RgSchCmnTbSzEff *effTbl; + U32 eff; + U32 noRes; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 cfi = cellSch->dl.currCfi; + U32 tmpRb=0; + TRC2(rgSCHCmnClcRbAlloc); + + /* first get the CQI to MCS table and determine the number of RBs */ + effTbl = (RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]); + iTbsVal = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[cqi]; + RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs); + + /* Efficiency is number of bits per 1024 REs */ + eff = (*effTbl)[iTbsVal]; + + /* Get the number of REs needed for this bo */ + noRes = ((bo * 8 * 1024) / eff ); + + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + tmpRb = RGSCH_CEIL(noRes, cellSch->dl.noResPerRb[cfi]); + /* KWORK_FIX: added check to see if rb has crossed maxRb*/ + RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1)); + if (tmpRb > cellSch->dl.maxDlBwPerUe) + { + tmpRb = cellSch->dl.maxDlBwPerUe; + } + while ((rgTbSzTbl[0][iTbsVal][tmpRb-1]/8) < bo && + (tmpRb < cellSch->dl.maxDlBwPerUe)) + { + tmpRb++; + RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1)); + } + *tbs = rgTbSzTbl[0][iTbsVal][tmpRb-1]/8; + *rb = (U8)tmpRb; + RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs); + + RETVOID; +} + + + +/** + * @brief Scheduling for MSG4. + * + * @details + * + * Function: rgSCHCmnMsg4Alloc + * Purpose: Scheduling for MSG4 + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchRaCb* raCb + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnMsg4Alloc +( +RgSchCellCb *cell, +RgSchRaCb *raCb, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE S16 rgSCHCmnMsg4Alloc(cell, raCb, allocInfo) +RgSchCellCb *cell; +RgSchRaCb *raCb; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnMsg4Alloc); + + /* SR_RACH_STATS : MSG4 TO BE TXED */ + rgNumMsg4ToBeTx++; + /* Return if subframe BW exhausted */ + if (allocInfo->msg4Alloc.msg4DlSf->bw <= + allocInfo->msg4Alloc.msg4DlSf->bwAssigned) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId , + "bw<=bwAssigned"); + RETVALUE(RFAILED); + } + + if (rgSCHDhmGetMsg4HqProc(raCb, cellSch->dl.time) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHDhmGetMsg4HqProc failed"); + RETVALUE(RFAILED); + } + + raCb->rbAllocInfo.dlSf = allocInfo->msg4Alloc.msg4DlSf; + + if (rgSCHCmnMsg4DedAlloc(cell, raCb) != ROK) + { + /* Fix : syed Minor failure handling, release hqP if Unsuccessful */ + rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, FALSE); + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnMsg4DedAlloc failed."); + RETVALUE(RFAILED); + } + cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4TxLst, &raCb->dlHqE->msg4Proc->reqLnk); + raCb->dlHqE->msg4Proc->reqLnk.node = (PTR)raCb->dlHqE->msg4Proc; + allocInfo->msg4Alloc.msg4DlSf->schdCcchUe++; + + RETVALUE(ROK); +} + + +/** + * @brief This function implements PDCCH allocation for an UE. + * + * @details + * + * Function: PdcchAlloc + * Purpose: This function implements allocation of PDCCH for an UE. + * 1. Get the aggregation level for the CQI of the UE. + * 2. Get the candidate PDCCH count for the aggr level. + * 3. Look for availability for each candidate and choose + * the first one available. + * + * Invoked by: Scheduler + * + * @param[in] cell + * @param[in] subFrm + * @param[in] cqi + * @param[in] dciFrmt + * @return RgSchPdcch * + * -# NULLP when unsuccessful + * + **/ +#ifdef ANSI +PUBLIC RgSchPdcch *rgSCHCmnPdcchAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *subFrm, +U8 cqi, +TfuDciFormat dciFrmt, +Bool isDtx +) +#else +PUBLIC RgSchPdcch *rgSCHCmnPdcchAlloc(cell, subFrm, cqi, dciFrmt, isDtx) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlSf *subFrm; +U8 cqi; +TfuDciFormat dciFrmt; +Bool isDtx; +#endif +{ + CmLteAggrLvl aggrLvl; + RgSchPdcchInfo *pdcchInfo; + RgSchPdcch *pdcch; + + TRC2(rgSCHCmnPdcchAlloc); + + /* 3.1 consider the selected DCI format size in determining the + * aggregation level */ + //TODO_SID Need to update. Currently using 4 aggregation level + aggrLvl = CM_LTE_AGGR_LVL2;//cellSch->dciAggrLvl[cqi][dciFrmt]; + +#ifdef LTE_ADV + if((dciFrmt == TFU_DCI_FORMAT_1A) && + ((ue) && (ue->allocCmnUlPdcch)) ) + { + pdcch = rgSCHCmnCmnPdcchAlloc(cell, subFrm); + /* Since CRNTI Scrambled */ + if(NULLP != pdcch) + { + pdcch->dciNumOfBits = ue->dciSize.cmnSize[dciFrmt]; + // prc_trace_format_string(PRC_TRACE_GROUP_PS, PRC_TRACE_INFO_LOW,"Forcing alloc in CMN search spc size %d fmt %d \n", + // pdcch->dciNumOfBits, dciFrmt); + } + RETVALUE(pdcch); + } +#endif + + /* Incrementing aggrLvl by 1 if it not AGGR_LVL8(MAX SIZE) + * inorder to increse the redudancy bits for better decoding of UE */ + if (isDtx) + { + if (aggrLvl != CM_LTE_AGGR_LVL16) + { + switch(aggrLvl) + { + case CM_LTE_AGGR_LVL2: + aggrLvl = CM_LTE_AGGR_LVL4; + break; + case CM_LTE_AGGR_LVL4: + aggrLvl = CM_LTE_AGGR_LVL8; + break; + case CM_LTE_AGGR_LVL8: + aggrLvl = CM_LTE_AGGR_LVL16; + break; + default: + break; + } + /* aggrLvl += 1; */ + } + } + + pdcchInfo = &subFrm->pdcchInfo; + + /* Updating the no. of nCce in pdcchInfo, in case if CFI + * was changed */ +#ifdef LTE_TDD + if(subFrm->nCce != pdcchInfo->nCce) + { + rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce); + } +#else + if(cell->nCce != pdcchInfo->nCce) + { + rgSCHUtlPdcchInit(cell, subFrm, cell->nCce); + } +#endif + + if (pdcchInfo->nCce < (1 << (aggrLvl - 1))) + { + /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ + subFrm->isCceFailure = TRUE; + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)", + aggrLvl); + + RETVALUE(NULLP); + } + + if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE) + { + /* SR_RACH_STATS : Reset isTBMsg4 */ + pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4= FALSE; + pdcch->dci.u.format0Info.isSrGrant = FALSE; +#ifdef LTEMAC_SPS + pdcch->isSpsRnti = FALSE; +#endif + /* Increment the CCE used counter in the current subframe */ + subFrm->cceCnt += aggrLvl; + pdcch->pdcchSearchSpace = RG_SCH_UE_SPECIFIC_SEARCH_SPACE; + if (ue != NULLP) + { +#ifdef LTE_ADV + if (ue->cell != cell) + { + /* Secondary Cell */ + //pdcch->dciNumOfBits = ue->dciSize.noUlCcSize[dciFrmt]; + pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE; + } + else +#endif + { + //pdcch->dciNumOfBits = ue->dciSize.dedSize[dciFrmt]; + //TODO_SID Need to update dci size. + pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE; + } + } + else + { + /* MSG4 */ + pdcch->dciNumOfBits = cell->dciSize.size[dciFrmt]; + } + RETVALUE(pdcch); + } + + /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */ + subFrm->isCceFailure = TRUE; + + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)", + aggrLvl); + RETVALUE(NULLP); +} + +#ifdef RGR_V1 +/** + * @brief This function implements BW allocation for CCCH SDU + * + * @details + * + * Function: rgSCHCmnCcchSduDedAlloc + * Purpose: Downlink bandwidth Allocation for CCCH SDU. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[out] RgSchUeCb *ueCb + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnCcchSduDedAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ueCb +) +#else +PRIVATE S16 rgSCHCmnCcchSduDedAlloc(cell, ueCb) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +#endif +{ + RgSchDlHqEnt *hqE = NULLP; + U32 effBo; + RgSchDlRbAlloc *rbAllocinfo = NULLP; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 iTbs; + U8 numRb; +#ifdef LTE_TDD + U8 cfi = cellDl->currCfi; +#endif + + TRC2(rgSCHCmnCcchSduDedAlloc); + + rbAllocinfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); + + effBo = ueCb->dlCcchInfo.bo + RGSCH_CCCH_SDU_HDRSIZE; + +#ifndef LTEMAC_SPS + rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \ + &rbAllocinfo->tbInfo[0].bytesReq, + &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf); +#else /* LTEMAC_SPS */ + rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \ + &rbAllocinfo->tbInfo[0].bytesReq,\ + &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE, + rbAllocinfo->dlSf); +#endif /* LTEMAC_SPS */ + + iTbs = 0; + /* Cannot exceed the total number of RBs in the cell */ + if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \ + rbAllocinfo->dlSf->bwAssigned))) + { + /* Check if atleast one allocation was possible. + This may be the case where the Bw is very less and + with the configured CCCH CQI, CCCH SDU exceeds the min Bw */ + if (rbAllocinfo->dlSf->bwAssigned == 0) + { + numRb = rbAllocinfo->dlSf->bw; + RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs); + while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo) + { + iTbs++; + } + rbAllocinfo->rbsReq = numRb; + rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8; + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + rbAllocinfo->tbInfo[0].bytesReq = + rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1,cfi); + } +#endif + /* DwPTS Scheduling Changes End */ + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs); + } + else + { + RETVALUE(RFAILED); + } + } + + /* Update the subframe Allocated BW field */ + rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \ + rbAllocinfo->rbsReq; + hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell); + rbAllocinfo->tbInfo[0].tbCb = &hqE->ccchSduProc->tbInfo[0]; + rbAllocinfo->rnti = ueCb->ueId; + rbAllocinfo->tbInfo[0].noLyr = 1; + + RETVALUE(ROK); +} +#endif + +/** + * @brief This function implements BW allocation for MSG4 + * + * @details + * + * Function: rgSCHCmnMsg4DedAlloc + * Purpose: Downlink bandwidth Allocation for MSG4. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[out] RgSchRaCb *raCb + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnMsg4DedAlloc +( +RgSchCellCb *cell, +RgSchRaCb *raCb +) +#else +PRIVATE S16 rgSCHCmnMsg4DedAlloc(cell, raCb) +RgSchCellCb *cell; +RgSchRaCb *raCb; +#endif +{ + U32 effBo; + RgSchDlRbAlloc *rbAllocinfo = &raCb->rbAllocInfo; + U8 iTbs; + U8 numRb; +#ifdef LTE_TDD + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 cfi = cellDl->currCfi; +#endif + + TRC2(rgSCHCmnMsg4DedAlloc); + + effBo = raCb->dlCcchInfo.bo + RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE; + +#ifndef LTEMAC_SPS + rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \ + &rbAllocinfo->tbInfo[0].bytesReq,\ + &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf); +#else /* LTEMAC_SPS */ + rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \ + &rbAllocinfo->tbInfo[0].bytesReq,\ + &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE, + rbAllocinfo->dlSf); +#endif /* LTEMAC_SPS */ + + iTbs = 0; + /* Cannot exceed the total number of RBs in the cell */ + if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \ + rbAllocinfo->dlSf->bwAssigned))) + { + /* Check if atleast one allocation was possible. + This may be the case where the Bw is very less and + with the configured CCCH CQI, CCCH SDU exceeds the min Bw */ + if (rbAllocinfo->dlSf->bwAssigned == 0) + { + numRb = rbAllocinfo->dlSf->bw; + RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs); + while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo) + { + iTbs++; + } + rbAllocinfo->rbsReq = numRb; + rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8; + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + rbAllocinfo->tbInfo[0].bytesReq = + rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1, cfi); + } +#endif + /* DwPTS Scheduling Changes End */ + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs); + } + else + { + RETVALUE(RFAILED); + } + } + + /* Update the subframe Allocated BW field */ + rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \ + rbAllocinfo->rbsReq; + rbAllocinfo->rnti = raCb->tmpCrnti; + rbAllocinfo->tbInfo[0].tbCb = &raCb->dlHqE->msg4Proc->tbInfo[0]; + rbAllocinfo->tbInfo[0].schdlngForTb = TRUE; + rbAllocinfo->tbInfo[0].noLyr = 1; + + RETVALUE(ROK); +} + +#ifdef LTE_TDD +/** + * @brief This function implements scheduling for RA Response. + * + * @details + * + * Function: rgSCHCmnDlRaRsp + * Purpose: Downlink scheduling for RA responses. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRaRsp +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlRaRsp(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLteTimingInfo frm; + CmLteTimingInfo schFrm; + RgSchDlSf *subFrm; + U16 rarnti; + U8 i; + U8 noRaRnti=0; + U8 raIdx; + RgSchTddRachRspLst *rachRsp; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 sfnIdx; + U8 subfrmIdx; + U16 rntiIdx=0; + TRC2(rgSCHCmnDlRaRsp); + + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + + /* Compute the subframe for which allocation is being made */ + /* essentially, we need pointer to the dl frame for this subframe */ + subFrm = rgSCHUtlSubFrmGet(cell, frm); + + /* Get the RACH Response scheduling related information + * for the subframe with RA index */ + raIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][frm.subframe]-1; + + rachRsp = &cell->rachRspLst[raIdx]; + + for(sfnIdx = 0; sfnIdx < rachRsp->numRadiofrms; sfnIdx++) + { + /* For all scheduled RACH Responses in SFNs */ + schFrm = frm; + RG_SCH_CMN_DECR_FRAME(schFrm.sfn, rachRsp->rachRsp[sfnIdx].sfnOffset); + /* For all scheduled RACH Responses in subframes */ + for(subfrmIdx = 0; + subfrmIdx < rachRsp->rachRsp[sfnIdx].numSubfrms; subfrmIdx++) + { + schFrm.subframe = rachRsp->rachRsp[sfnIdx].subframe[subfrmIdx]; + /* compute the last RA RNTI used in the previous subframe */ + raIdx = (((schFrm.sfn % cell->raInfo.maxRaSize) * \ + RGSCH_NUM_SUB_FRAMES * RGSCH_MAX_RA_RNTI_PER_SUBFRM) \ + + schFrm.subframe); + + /* For all RA RNTIs within a subframe */ + + for(i=0; (i < RGSCH_MAX_RA_RNTI_PER_SUBFRM) && \ + (noRaRnti < RGSCH_MAX_TDD_RA_RSP_ALLOC); i++) + { + rarnti = (schFrm.subframe + RGSCH_NUM_SUB_FRAMES*i + 1); + rntiIdx = (raIdx + RGSCH_NUM_SUB_FRAMES*i); + + if (cell->raInfo.raReqLst[rntiIdx].first != NULLP) + { + /* compute the next RA RNTI */ + if (rgSCHCmnRaRspAlloc(cell, subFrm, rntiIdx, + rarnti, noRaRnti, allocInfo) != ROK) + { + /* The resources are exhausted */ + break; + } + noRaRnti++; + } + } + noRaRnti=0; + } + } + + RETVOID; +} +#else +/** + * @brief This function implements scheduling for RA Response. + * + * @details + * + * Function: rgSCHCmnDlRaRsp + * Purpose: Downlink scheduling for RA responses. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRaRsp //FDD +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlRaRsp(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLteTimingInfo frm; + CmLteTimingInfo winStartFrm; + RgSchDlSf *subFrm; + U8 winStartIdx; + U8 winGap; + U8 rarnti; + U8 raIdx; + RgSchCmnCell *sched; + U8 i,noRaRnti=0; + TRC2(rgSCHCmnDlRaRsp); + + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + + /* Compute the subframe for which allocation is being made */ + /* essentially, we need pointer to the dl frame for this subframe */ + subFrm = rgSCHUtlSubFrmGet(cell, frm); + sched = RG_SCH_CMN_GET_CELL(cell); + + /* ccpu00132523 - Window Start calculated by considering RAR window size, + * RAR Wait period, Subframes occuppied for respective preamble format*/ + winGap = (sched->dl.numRaSubFrms-1) + (cell->rachCfg.raWinSize-1) + +RGSCH_RARSP_WAIT_PERIOD; + + /* Window starting occassion is retrieved using the gap and tried to + * fit to the size of raReqLst array*/ + RGSCHDECRFRMCRNTTIME(frm, winStartFrm, winGap); + + //5G_TODO TIMING update. Need to check + winStartIdx = (winStartFrm.sfn & 1) * RGSCH_MAX_RA_RNTI+ winStartFrm.subframe; + + for(i = 0; ((i < cell->rachCfg.raWinSize) && (noRaRnti < RG_SCH_CMN_MAX_CMN_PDCCH)); i++) + { + raIdx = (winStartIdx + i) % RGSCH_RAREQ_ARRAY_SIZE; + + if (cell->raInfo.raReqLst[raIdx].first != NULLP) + { + allocInfo->raRspAlloc[noRaRnti].biEstmt = \ + (!i * RGSCH_ONE_BIHDR_SIZE); + rarnti = raIdx % RGSCH_MAX_RA_RNTI+ 1; + if (rgSCHCmnRaRspAlloc(cell, subFrm, raIdx, + rarnti, noRaRnti, allocInfo) != ROK) + { + /* The resources are exhausted */ + break; + } + /* ccpu00132523- If all the RAP ids are not scheduled then need not + * proceed for next RA RNTIs*/ + if(allocInfo->raRspAlloc[noRaRnti].numRapids < cell->raInfo.raReqLst[raIdx].count) + { + break; + } + noRaRnti++; /* Max of RG_SCH_CMN_MAX_CMN_PDCCH RARNTIs + for response allocation */ + } + } + RETVOID; +} +#endif + + +/** + * @brief This function allocates the resources for an RARNTI. + * + * @details + * + * Function: rgSCHCmnRaRspAlloc + * Purpose: Allocate resources to a RARNTI. + * 0. Allocate PDCCH for sending the response. + * 1. Locate the number of RA requests pending for the RARNTI. + * 2. Compute the size of data to be built. + * 3. Using common channel CQI, compute the number of RBs. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell, + * @param[in] RgSchDlSf *subFrm, + * @param[in] U16 rarnti, + * @param[in] U8 noRaRnti + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnRaRspAlloc +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +U16 raIndex, +U16 rarnti, +U8 noRaRnti, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE S16 rgSCHCmnRaRspAlloc(cell,subFrm,raIndex,rarnti,noRaRnti,allocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +U16 raIndex; +U16 rarnti; +U8 noRaRnti; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + U16 noBytes; + U32 rb = 0; + U32 tbs; + /*ccpu00116700,ccpu00116708- Corrected the wrong type for mcs*/ + U8 mcs; + CmLListCp *reqLst; + /* RACH handling related changes */ + Bool isAlloc = FALSE; + static U8 schdNumRapid = 0; + U8 remNumRapid = 0; + U8 nPrb = 0; + S32 allwdTbSz = 0; +#ifdef LTE_TDD + U16 lostRe; + U8 cfi = cellDl->currCfi; +#endif + + TRC2(rgSCHCmnRaRspAlloc); +#ifndef RGR_V1 + UNUSED(cellUl); +#endif + + /* ccpu00132523: Resetting the schdRap Id count in every scheduling subframe*/ + if(noRaRnti == 0) + { + schdNumRapid = 0; + } + + + if (subFrm->bw == subFrm->bwAssigned) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "bw == bwAssigned RARNTI:%d",rarnti); + RETVALUE(RFAILED); + } + + reqLst = &cell->raInfo.raReqLst[raIndex]; + if (reqLst->count == 0) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "reqLst Count=0 RARNTI:%d",rarnti); + RETVALUE(RFAILED); + } + remNumRapid = reqLst->count; + +#ifdef RGR_V1 + /* Limit number of rach rsps to maxMsg3PerUlsf */ + if ( schdNumRapid+remNumRapid > cellUl->maxMsg3PerUlSf ) + { + remNumRapid = cellUl->maxMsg3PerUlSf-schdNumRapid; + } +#endif + + while (remNumRapid) + { + /* Try allocating for as many RAPIDs as possible */ + /* BI sub-header size to the tbSize requirement */ + noBytes = RGSCH_GET_RAR_BYTES(remNumRapid) +\ + allocInfo->raRspAlloc[noRaRnti].biEstmt; + if ((allwdTbSz = rgSCHUtlGetAllwdCchTbSz(noBytes*8, &nPrb, &mcs)) == -1) + { + remNumRapid--; + continue; + } + + /* rgSCHCmnClcRbAllocForFxdTb(cell, allwdTbSz/8, cellDl->ccchCqi, &rb);*/ + if(cellDl->bitsPerRb==0) + { + while ((rgTbSzTbl[0][0][rb]) <(U32) allwdTbSz) + { + rb++; + } + rb = rb+1; + } + else + { + rb = RGSCH_CEIL(allwdTbSz, cellDl->bitsPerRb); + } + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + if (subFrm->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); + + /* Calculate the less RE's because of DwPTS */ + lostRe = rb * (cellDl->noResPerRb[cfi] - + cellDl->numReDwPts[cfi]); + + /* Increase number of RBs in Spl SF to compensate for lost REs */ + rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); + } +#endif + /* DwPTS Scheduling Changes End */ + + /*ccpu00115595- end*/ + if (rb > subFrm->bw - subFrm->bwAssigned) + { + remNumRapid--; + continue; + } + /* Allocation succeeded for 'remNumRapid' */ + isAlloc = TRUE; + tbs = allwdTbSz/8; + printf("\n!!!RAR alloc noBytes:%u,allwdTbSz:%u,tbs:%u,rb:%u\n", + noBytes,allwdTbSz,tbs,rb); + break; + } + if (!isAlloc) + { + RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"BW alloc Failed"); + RETVALUE(RFAILED); + } + + subFrm->bwAssigned = subFrm->bwAssigned + rb; + + /* Fill AllocInfo structure */ + allocInfo->raRspAlloc[noRaRnti].rnti = rarnti; + allocInfo->raRspAlloc[noRaRnti].tbInfo[0].bytesReq = tbs; + allocInfo->raRspAlloc[noRaRnti].rbsReq = rb; + allocInfo->raRspAlloc[noRaRnti].dlSf = subFrm; + allocInfo->raRspAlloc[noRaRnti].tbInfo[0].imcs = mcs; + allocInfo->raRspAlloc[noRaRnti].raIndex = raIndex; + /* RACH changes for multiple RAPID handling */ + allocInfo->raRspAlloc[noRaRnti].numRapids = remNumRapid; + allocInfo->raRspAlloc[noRaRnti].nPrb = nPrb; + allocInfo->raRspAlloc[noRaRnti].tbInfo[0].noLyr = 1; + allocInfo->raRspAlloc[noRaRnti].vrbgReq = RGSCH_CEIL(nPrb,MAX_5GTF_VRBG_SIZE); + schdNumRapid += remNumRapid; + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlAllocFillRbInfo + * + * Desc : Fills the start RB and the number of RBs for + * uplink allocation. + * + * Ret : void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAllocFillRbInfo +( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc) +RgSchCellCb *cell; +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 cfi = cellDl->currCfi; + + + TRC2(rgSCHCmnUlAllocFillRbInfo); + alloc->grnt.rbStart = (alloc->sbStart * cellUl->sbSize) + + cell->dynCfiCb.bwInfo[cfi].startRb; + + /* Num RBs = numSbAllocated * sbSize - less RBs in the last SB */ + alloc->grnt.numRb = (alloc->numSb * cellUl->sbSize); + + RETVOID; +} + +/** + * @brief Grant request for Msg3. + * + * @details + * + * Function : rgSCHCmnMsg3GrntReq + * + * This is invoked by downlink scheduler to request allocation + * for msg3. + * Steps: + * - Attempt to allocate msg3 in the current msg3 subframe + * Allocation attempt based on whether preamble is from group A + * and the value of MESSAGE_SIZE_GROUP_A + * - Link allocation with passed RNTI and msg3 HARQ process + * - Set the HARQ process ID (*hqProcIdRef) + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteRnti rnti + * @param[in] Bool preamGrpA + * @param[in] RgSchUlHqProcCb *hqProc + * @param[out] RgSchUlAlloc **ulAllocRef + * @param[out] U8 *hqProcIdRef + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnMsg3GrntReq +( +RgSchCellCb *cell, +CmLteRnti rnti, +Bool preamGrpA, +RgSchUlHqProcCb *hqProc, +RgSchUlAlloc **ulAllocRef, +U8 *hqProcIdRef +) +#else +PRIVATE Void rgSCHCmnMsg3GrntReq(cell, rnti, preamGrpA, hqProc, + ulAllocRef, hqProcIdRef) +RgSchCellCb *cell; +CmLteRnti rnti; +Bool preamGrpA; +RgSchUlHqProcCb *hqProc; +RgSchUlAlloc **ulAllocRef; +U8 *hqProcIdRef; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx]; + RgSchUlHole *hole; + RgSchUlAlloc *alloc; + U8 iMcs; + U8 numSb; + + TRC2(rgSCHCmnMsg3GrntReq); + + *ulAllocRef = NULLP; + + /* Fix: ccpu00120610 Use remAllocs from subframe during msg3 allocation */ + if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf) + { + RETVOID; + } + if (preamGrpA == FALSE) + { + numSb = cellUl->ra.prmblBNumSb; + iMcs = cellUl->ra.prmblBIMcs; + } + else + { + numSb = cellUl->ra.prmblANumSb; + iMcs = cellUl->ra.prmblAIMcs; + } + + if ((hole = rgSCHUtlUlHoleFirst(sf)) != NULLP) + { + if(*sf->allocCountRef == 0) + { + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + /* Reinitialize the hole */ + if (sf->holeDb->count == 1 && (hole->start == 0)) /* Sanity check of holeDb */ + { + hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; + /* Re-Initialize available subbands because of CFI change*/ + hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Error! holeDb sanity check failed RNTI:%d",rnti); + } + } + if (numSb <= hole->num) + { + U8 iTbs; + alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole); + rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); + alloc->grnt.iMcs = iMcs; + alloc->grnt.iMcsCrnt = iMcs; + iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs); + /* To include the length and ModOrder in DataRecp Req.*/ + alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; + RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr); + /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/ + alloc->grnt.nDmrs = 0; + alloc->grnt.hop = 0; + alloc->grnt.delayBit = 0; + alloc->grnt.isRtx = FALSE; + *ulAllocRef = alloc; + *hqProcIdRef = (cellUl->msg3SchdHqProcIdx); + hqProc->procId = *hqProcIdRef; + hqProc->ulSfIdx = (cellUl->msg3SchdIdx); + alloc->rnti = rnti; + alloc->ue = NULLP; + alloc->pdcch = FALSE; + alloc->forMsg3 = TRUE; + alloc->hqProc = hqProc; + rgSCHUhmNewTx(hqProc, (U8)(cell->rachCfg.maxMsg3Tx - 1), alloc); + //RLOG_ARG4(L_DEBUG,DBG_CELLID,cell->cellId, + printf( + "\nRNTI:%d MSG3 ALLOC proc(%p)procId(%d)schdIdx(%d)\n", + alloc->rnti, + ((PTR)alloc->hqProc), + alloc->hqProc->procId, + alloc->hqProc->ulSfIdx); + RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId, + "alloc(%p)maxMsg3Tx(%d)", + ((PTR)alloc), + cell->rachCfg.maxMsg3Tx); + } + } + + RETVOID; +} + + +/** + * @brief This function determines the allocation limits and + * parameters that aid in DL scheduling. + * + * @details + * + * Function: rgSCHCmnDlSetUeAllocLmt + * Purpose: This function determines the Maximum RBs + * a UE is eligible to get based on softbuffer + * limitation and cell->>>maxDlBwPerUe. The Codeword + * specific parameters like iTbs, eff and noLyrs + * are also set in this function. This function + * is called while UE configuration and UeDlCqiInd. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgSchCmnDlUe *ueDl + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlSetUeAllocLmt +( +RgSchCellCb *cell, +RgSchCmnDlUe *ueDl, +Bool isEmtcUe +) +#else +PRIVATE Void rgSCHCmnDlSetUeAllocLmt(cell, ueDl, isEmtcUe) +RgSchCellCb *cell; +RgSchCmnDlUe *ueDl; +Bool isEmtcUe; +#endif +{ + U8 modOrder; + U32 maxRb; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 cfi = cellSch->dl.currCfi; + + TRC2(rgSCHCmnDlSetUeAllocLmt); + +#ifdef EMTC_ENABLE + if(TRUE == isEmtcUe) + { + /* ITbs for CW0 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].cqi]; + /* ITbs for CW0 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].cqi]; + /* Eff for CW0 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].iTbs[0]]; + /* Eff for CW0 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].iTbs[1]]; + + /* ITbs for CW1 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].cqi]; + /* ITbs for CW1 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].cqi]; + /* Eff for CW1 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].iTbs[0]]; + /* Eff for CW1 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].iTbs[1]]; + } + else +#endif + { + /* ITbs for CW0 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].cqi]; + /* ITbs for CW0 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].cqi]; + /* Eff for CW0 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].iTbs[0]]; + /* Eff for CW0 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[0].iTbs[1]]; + + /* ITbs for CW1 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].cqi]; + /* ITbs for CW1 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].cqi]; + /* Eff for CW1 for 1 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].iTbs[0]]; + /* Eff for CW1 for 2 Layer Tx */ + ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\ + [ueDl->mimoInfo.cwInfo[1].iTbs[1]]; + } + +//#ifdef DL_LA + // ueDl->laCb.cqiBasediTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0] * 100; +//#endif + /* Assigning noLyrs to each CW assuming optimal Spatial multiplexing + * capability */ + (ueDl->mimoInfo.ri/2 == 0)? (ueDl->mimoInfo.cwInfo[0].noLyr = 1) : \ + (ueDl->mimoInfo.cwInfo[0].noLyr = ueDl->mimoInfo.ri/2); + ueDl->mimoInfo.cwInfo[1].noLyr = ueDl->mimoInfo.ri - ueDl->mimoInfo.cwInfo[0].noLyr; + /* rg002.101:ccpu00102106: correcting DL harq softbuffer limitation logic. + * The maxTbSz is the maximum number of PHY bits a harq process can + * hold. Hence we limit our allocation per harq process based on this. + * Earlier implementation we misinterpreted the maxTbSz to be per UE + * per TTI, but in fact it is per Harq per TTI. */ + /* rg002.101:ccpu00102106: cannot exceed the harq Tb Size + * and harq Soft Bits limit.*/ + + /* Considering iTbs corresponding to 2 layer transmission for + * codeword0(approximation) and the maxLayers supported by + * this UE at this point of time. */ + RG_SCH_CMN_TBS_TO_MODODR(ueDl->mimoInfo.cwInfo[0].iTbs[1], modOrder); + + /* Bits/modOrder gives #REs, #REs/noResPerRb gives #RBs */ + /* rg001.301 -MOD- [ccpu00119213] : avoiding wraparound */ + maxRb = ((ueDl->maxSbSz)/(cellSch->dl.noResPerRb[cfi] * modOrder *\ + ueDl->mimoInfo.ri)); + if (cellSch->dl.isDlFreqSel) + { + /* Rounding off to left nearest multiple of RBG size */ + maxRb -= maxRb % cell->rbgSize; + } + ueDl->maxRb = RGSCH_MIN(maxRb, cellSch->dl.maxDlBwPerUe); + if (cellSch->dl.isDlFreqSel) + { + /* Rounding off to right nearest multiple of RBG size */ + if (ueDl->maxRb % cell->rbgSize) + { + ueDl->maxRb += (cell->rbgSize - + (ueDl->maxRb % cell->rbgSize)); + } + } + + /* Set the index of the cwInfo, which is better in terms of + * efficiency. If RI<2, only 1 CW, hence btrCwIdx shall be 0 */ + if (ueDl->mimoInfo.ri < 2) + { + ueDl->mimoInfo.btrCwIdx = 0; + } + else + { + if (ueDl->mimoInfo.cwInfo[0].eff[ueDl->mimoInfo.cwInfo[0].noLyr-1] <\ + ueDl->mimoInfo.cwInfo[1].eff[ueDl->mimoInfo.cwInfo[1].noLyr-1]) + { + ueDl->mimoInfo.btrCwIdx = 1; + } + else + { + ueDl->mimoInfo.btrCwIdx = 0; + } + } + + RETVOID; + } + +#ifdef DL_LA + +/** + * @brief This function updates TX Scheme. + * + * @details + * + * Function: rgSCHCheckAndSetTxScheme + * Purpose: This function determines the Maximum RBs + * a UE is eligible to get based on softbuffer + * limitation and cell->>>maxDlBwPerUe. The Codeword + * specific parameters like iTbs, eff and noLyrs + * are also set in this function. This function + * is called while UE configuration and UeDlCqiInd. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCheckAndSetTxScheme +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCheckAndSetTxScheme(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue ,cell); + U8 cfi = cellSch->dl.currCfi; + U8 maxiTbs; + U8 cqiBasediTbs; + U8 actualiTbs; + + TRC2(rgSCHCheckAndSetTxScheme); + + maxiTbs = (*(RgSchCmnCqiToTbs*)(cellSch->dl.cqiToTbsTbl[0][cfi]))\ + [RG_SCH_CMN_MAX_CQI - 1]; + cqiBasediTbs = (ueDl->laCb[0].cqiBasediTbs)/100; + actualiTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0]; + + if((actualiTbs < RG_SCH_TXSCHEME_CHNG_ITBS_FACTOR) && (cqiBasediTbs > + actualiTbs) && ((cqiBasediTbs - actualiTbs) > RG_SCH_TXSCHEME_CHNG_THRSHD)) + { + RG_SCH_CMN_SET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG); + } + + if(actualiTbs >= maxiTbs) + { + RG_SCH_CMN_UNSET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG); + } + + RETVOID; +} + +/** + * @brief This function determines the allocation limits and + * parameters that aid in DL scheduling. + * + * @details + * + * Function: rgSCHCmnDlSetUeAllocLmtLa + * Purpose: This function determines the Maximum RBs + * a UE is eligible to get based on softbuffer + * limitation and cell->>>maxDlBwPerUe. The Codeword + * specific parameters like iTbs, eff and noLyrs + * are also set in this function. This function + * is called while UE configuration and UeDlCqiInd. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnDlSetUeAllocLmtLa(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + U8 modOrder; + U32 maxRb; + U8 reportediTbs; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 cfi = cellSch->dl.currCfi; + U8 maxiTbs; + U8 cwIdx = 0; + + TRC2(rgSCHCmnDlSetUeAllocLmtLa); + + maxiTbs = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[RG_SCH_CMN_MAX_CQI - 1]; + if(ueDl->cqiFlag == TRUE) + { + for(cwIdx=0; cwIdx < RG_SCH_CMN_MAX_CW_PER_UE; cwIdx++) + { + S32 iTbsNew; + + /* Calcluating the reported iTbs for code word 0 */ + reportediTbs = ue->ue5gtfCb.mcs; + + iTbsNew = (S32) reportediTbs; + + if(!ueDl->laCb[cwIdx].notFirstCqi) + { + /* This is the first CQI report from UE */ + ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100); + ueDl->laCb[cwIdx].notFirstCqi = TRUE; + } + else if ((RG_ITBS_DIFF(reportediTbs, ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0])) > 5) + { + /* Ignore this iTBS report and mark that last iTBS report was */ + /* ignored so that subsequently we reset the LA algorithm */ + ueDl->laCb[cwIdx].lastiTbsIgnored = TRUE; + ueDl->laCb[cwIdx].numLastiTbsIgnored++; + if( ueDl->laCb[cwIdx].numLastiTbsIgnored > 10) + { + /* CQI reported by UE is not catching up. Reset the LA algorithm */ + ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100); + ueDl->laCb[cwIdx].deltaiTbs = 0; + ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE; + ueDl->laCb[cwIdx].numLastiTbsIgnored = 0; + } + } + else + { + if (ueDl->laCb[cwIdx].lastiTbsIgnored != TRUE) + { + ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) + + (80 * ueDl->laCb[cwIdx].cqiBasediTbs))/100; + } + else + { + /* Reset the LA as iTbs in use caught up with the value */ + /* reported by UE. */ + ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) + + (80 * ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] * 100))/100; + ueDl->laCb[cwIdx].deltaiTbs = 0; + ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE; + } + } + + iTbsNew = (ueDl->laCb[cwIdx].cqiBasediTbs + ueDl->laCb[cwIdx].deltaiTbs)/100; + + RG_SCH_CHK_ITBS_RANGE(iTbsNew, maxiTbs); + + ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] = RGSCH_MIN(iTbsNew, cell->thresholds.maxDlItbs); + //ueDl->mimoInfo.cwInfo[cwIdx].iTbs[1] = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0]; +#ifdef RG_5GTF + ue->ue5gtfCb.mcs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0]; + /* + printf("reportediTbs[%d] cqiBasediTbs[%d] deltaiTbs[%d] iTbsNew[%d] mcs[%d] cwIdx[%d]\n", + reportediTbs, ueDl->laCb[cwIdx].cqiBasediTbs, ueDl->laCb[cwIdx].deltaiTbs, + iTbsNew, ue->ue5gtfCb.mcs, cwIdx); + */ +#endif + + if((ue->mimoInfo.txMode != RGR_UE_TM_3) && (ue->mimoInfo.txMode != RGR_UE_TM_4)) + { + break; + } + } + ueDl->cqiFlag = FALSE; + } + + + RETVOID; +} +#endif +/*********************************************************** + * + * Func : rgSCHCmnDlUeResetTemp + * + * Desc : Reset whatever variables where temporarily used + * during UE scheduling. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlHqPResetTemp +( +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnDlHqPResetTemp(hqP) +RgSchDlHqProcCb *hqP; +#endif +{ + + TRC2(rgSCHCmnDlHqPResetTemp); + + /* Fix: syed having a hqP added to Lists for RB assignment rather than + * a UE, as adding UE was limiting handling some scenarios */ + hqP->reqLnk.node = (PTR)NULLP; + hqP->schdLstLnk.node = (PTR)NULLP; + + RETVOID; +} /* rgSCHCmnDlHqPResetTemp */ + +/*********************************************************** + * + * Func : rgSCHCmnDlUeResetTemp + * + * Desc : Reset whatever variables where temporarily used + * during UE scheduling. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlUeResetTemp +( +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnDlUeResetTemp(ue, hqP) +RgSchUeCb *ue; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *cmnUe = RG_SCH_CMN_GET_DL_UE(ue,hqP->hqE->cell); +#ifdef LTE_ADV + Void *tmpCb; +#endif + + TRC2(rgSCHCmnDlUeResetTemp); + + /* Fix : syed check for UE's existence was useless. + * Instead we need to check that reset is done only for the + * information of a scheduled harq proc, which is cmnUe->proc. + * Reset should not be done for non-scheduled hqP */ + if((cmnUe->proc == hqP) || (cmnUe->proc == NULLP)) + { + cmnUe->proc = NULLP; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, hqP->hqE->cell); +#ifdef LTE_ADV + tmpCb = allocInfo->laaCb; +#endif + cmMemset((U8 *)allocInfo, (U8)0, sizeof(RgSchDlRbAlloc)); + allocInfo->rnti = ue->ueId; +#ifdef LTE_ADV + allocInfo->laaCb = tmpCb; +#endif + /* Fix: syed moving this to a common function for both scheduled + * and non-scheduled UEs */ + cmnUe->outStndAlloc = 0; + } + rgSCHCmnDlHqPResetTemp(hqP); + + RETVOID; +} /* rgSCHCmnDlUeResetTemp */ + +/*********************************************************** + * + * Func : rgSCHCmnUlUeResetTemp + * + * Desc : Reset whatever variables where temporarily used + * during UE scheduling. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlUeResetTemp +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlUeResetTemp(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUlUe *cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue,cell); + + TRC2(rgSCHCmnUlUeResetTemp); + + cmMemset((U8 *)&cmnUlUe->alloc, (U8)0, sizeof(cmnUlUe->alloc)); + + RETVOID; +} /* rgSCHCmnUlUeResetTemp */ + + + +/** + * @brief This function fills the PDCCH information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillPdcch + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlRbAlloc + * during common channel scheduling(P, SI, RA - RNTI's). + * + * Invoked by: Downlink Scheduler + * + * @param[out] RgSchPdcch* pdcch + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnFillPdcch +( +RgSchCellCb *cell, +RgSchPdcch *pdcch, +RgSchDlRbAlloc *rbAllocInfo +) +#else +PUBLIC Void rgSCHCmnFillPdcch(cell, pdcch, rbAllocInfo) +RgSchCellCb *cell; +RgSchPdcch *pdcch; +RgSchDlRbAlloc *rbAllocInfo; +#endif +{ + + TRC2(rgSCHCmnFillPdcch); + + /* common channel pdcch filling, + * only 1A and Local is supported */ + pdcch->rnti = rbAllocInfo->rnti; + pdcch->dci.dciFormat = rbAllocInfo->dciFormat; + switch(rbAllocInfo->dciFormat) + { +#ifdef RG_5GTF /* ANOOP: ToDo: DCI format B1/B2 filling */ + case TFU_DCI_FORMAT_B1: + { + /* ToDo: Anoop */ + pdcch->dci.u.formatB1Info.formatType = 0; + pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].cmnGrnt.xPDSCHRange; + pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].cmnGrnt.rbAssign; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = 0; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = 0; + //pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].ndi; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].cmnGrnt.rv; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0; + pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0; + pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0; + //TODO_SID: Need to update + pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0; + pdcch->dci.u.formatB1Info.beamSwitch = 0; + pdcch->dci.u.formatB1Info.SRS_Config = 0; + pdcch->dci.u.formatB1Info.SRS_Symbol = 0; + //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC). + pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0; + pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].cmnGrnt.SCID; + //TODO_SID: Hardcoding TPC command to 1 i.e. No change + pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc; + pdcch->dci.u.formatB1Info.DL_PCRS = 0; + + break; /* case TFU_DCI_FORMAT_B1: */ + } + + case TFU_DCI_FORMAT_B2: + { + //printf(" RG_5GTF:: Pdcch filling with DCI format B2\n"); + /* ToDo: Anoop */ + break; /* case TFU_DCI_FORMAT_B2: */ + } +#endif + case TFU_DCI_FORMAT_1A: + pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE; + + /*Nprb indication at PHY for common Ch + *setting least significant bit of tpc field to 1 if + nPrb=3 and 0 otherwise. */ + if (rbAllocInfo->nPrb == 3) + { + pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 1; + } + else + { + pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 0; + } + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \ + rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = 0; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = 0; + /* Add RIV CALC */ + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type = + TFU_ALLOC_TYPE_RIV; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv = + rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, + rbAllocInfo->allocInfo.raType2.rbStart, + rbAllocInfo->allocInfo.raType2.numRb); + +#ifdef LTE_TDD + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = \ + FALSE; +#ifdef TFU_TDD + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1; +#endif +#endif + break; /* case TFU_DCI_FORMAT_1A: */ + case TFU_DCI_FORMAT_1: + pdcch->dci.u.format1Info.tpcCmd = 0; + /* Avoiding this check,as we dont support Type1 RA */ +#ifdef RG_UNUSED + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { +#endif + pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE; + pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) + & 0xff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) + & 0x00ff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) + & 0x0000ff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); +#ifdef RG_UNUSED + } +#endif + pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; + pdcch->dci.u.format1Info.allocInfo.ndi = 0; + pdcch->dci.u.format1Info.allocInfo.mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format1Info.allocInfo.rv = 0; +#ifdef TFU_TDD + pdcch->dci.u.format1Info.dai = 1; +#endif + break; + default: + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Allocator's icorrect " + "dciForamt Fill RNTI:%d",rbAllocInfo->rnti); + break; + } + RETVOID; +} + +#ifdef LTE_TDD +/** + * @brief This function finds whether the subframe is special subframe or not. + * + * @details + * + * Function: rgSCHCmnIsSplSubfrm + * Purpose: This function finds the subframe index of the special subframe + * and finds whether the current DL index matches it or not. + * + * Invoked by: Scheduler + * + * @param[in] U8 splfrmCnt + * @param[in] U8 curSubfrmIdx + * @param[in] U8 periodicity + * @param[in] RgSchTddSubfrmInfo *subfrmInfo + * @return Bool + * + **/ +#ifdef ANSI +PRIVATE Bool rgSCHCmnIsSplSubfrm +( +U8 splfrmCnt, +U8 curSubfrmIdx, +U8 periodicity, +RgSchTddSubfrmInfo *subfrmInfo +) +#else +PRIVATE Bool rgSCHCmnIsSplSubfrm(splfrmCnt, curSubfrmIdx, periodicity, subfrmInfo) +U8 splfrmCnt; +U8 curSubfrmIdx; +U8 periodicity; +RgSchTddSubfrmInfo *subfrmInfo; +#endif +{ + U8 dlSfCnt = 0; + U8 splfrmIdx = 0; + + TRC2(rgSCHCmnIsSplSubfrm); + + if(splfrmCnt > 0) + { + if(periodicity == RG_SCH_CMN_5_MS_PRD) + { + if(splfrmCnt%2) + { + dlSfCnt = ((splfrmCnt-1)/2) *\ + (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2); + dlSfCnt = dlSfCnt + subfrmInfo->numFrmHf1; + } + else + { + dlSfCnt = (splfrmCnt/2) * \ + (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2); + } + } + else + { + dlSfCnt = splfrmCnt * subfrmInfo->numFrmHf1; + } + splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1 +\ + (periodicity*splfrmCnt - dlSfCnt); + } + else + { + splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1; + } + + if(splfrmIdx == curSubfrmIdx) + { + RETVALUE(TRUE); + } + + RETVALUE(FALSE); +} + +/** + * @brief This function updates DAI or UL index. + * + * @details + * + * Function: rgSCHCmnUpdHqAndDai + * Purpose: Updates the DAI based on UL-DL Configuration + * index and UE. It also updates the HARQ feedback + * time and 'm' index. + * + * Invoked by: TOM + * + * @param[in] RgDlHqProcCb *hqP + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchDlHqTbCb *tbCb + * @param[in] U8 tbAllocIdx + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdHqAndDai +( +RgSchDlHqProcCb *hqP, +RgSchDlSf *subFrm, +RgSchDlHqTbCb *tbCb, +U8 tbAllocIdx +) +#else +PRIVATE Void rgSCHCmnUpdHqAndDai(hqP, subFrm, tbCb,tbAllocIdx) +RgSchDlHqProcCb *hqP; +RgSchDlSf *subFrm; +RgSchDlHqTbCb *tbCb; +U8 tbAllocIdx; +#endif +{ + RgSchUeCb *ue = hqP->hqE->ue; + + TRC2(rgSCHCmnUpdHqAndDai); + + if(subFrm != NULLP) + { + /* set the time at which UE shall send the feedback + * for this process */ + tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \ + subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN; + tbCb->fdbkTime.subframe = subFrm->dlFdbkInfo.subframe; + tbCb->m = subFrm->dlFdbkInfo.m; + } + else + { + /* set the time at which UE shall send the feedback + * for this process */ + tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \ + hqP->subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN; + tbCb->fdbkTime.subframe = hqP->subFrm->dlFdbkInfo.subframe; + tbCb->m = hqP->subFrm->dlFdbkInfo.m; + } + + /* ccpu00132340-MOD- DAI need to be updated for first TB only*/ + if(ue && !tbAllocIdx) + { + Bool havePdcch = (tbCb->hqP->pdcch ? TRUE : FALSE); + U8 dlDai; + + dlDai = rgSCHCmnUpdDai(ue, &tbCb->fdbkTime, tbCb->m, havePdcch,tbCb->hqP, + &tbCb->dai); + if(havePdcch) + {/* Non SPS occasions */ + tbCb->hqP->pdcch->dlDai = dlDai; + /* hqP->ulDai is used for N1 resource filling + * when SPS occaions present in a bundle */ + tbCb->hqP->ulDai = tbCb->dai; + tbCb->hqP->dlDai = dlDai; + } + } + + /* Updatijng pucchFdbkIdx for both PUCCH or PUSCH + fdbk reception */ + tbCb->pucchFdbkIdx = tbCb->hqP->ulDai; + + RETVOID; +} + + +/** + * @brief This function updates DAI or UL index. + * + * @details + * + * Function: rgSCHCmnUpdDai + * Purpose: Updates the DAI in the ack-nack info, a valid + * ue should be passed + * + * Invoked by: TOM + * + * @param[in] RgDlHqProcCb *hqP + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchDlHqTbCb *tbCb + * @return U8 dlDai + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUpdDai +( +RgSchUeCb *ue, +CmLteTimingInfo *fdbkTime, +U8 m, +Bool havePdcch, +RgSchDlHqProcCb *hqP, +U8 *ulDai +) +#else +PUBLIC U8 rgSCHCmnUpdDai(ue, fdbkTime, m, havePdcch,tbCb,servCellId,hqP,ulDai) +RgSchUeCb *ue; +CmLteTimingInfo *fdbkTime; +U8 m; +Bool havePdcch; +RgSchDlHqProcCb *hqP; +U8 *ulDai; +#endif +{ + RgSchTddANInfo *anInfo; + U8 servCellIdx; + U8 ackNackFdbkArrSize; + + + TRC2(rgSCHCmnUpdDai); + + if(hqP != NULLP) + {/* Non SPS */ +#ifdef LTE_ADV + servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + ue); +#else + servCellIdx = RGSCH_PCELL_INDEX; +#endif + ackNackFdbkArrSize = hqP->hqE->cell->ackNackFdbkArrSize; + }else + {/* SPS on primary cell */ + servCellIdx = RGSCH_PCELL_INDEX; + ackNackFdbkArrSize = ue->cell->ackNackFdbkArrSize; + } + + + anInfo = rgSCHUtlGetUeANFdbkInfo(ue, fdbkTime,servCellIdx); + + /* If no ACK/NACK feedback already present, create a new one */ + if(NULLP == anInfo) + { + anInfo = &ue->cellInfo[servCellIdx]->anInfo[ue->cellInfo[servCellIdx]->nextFreeANIdx]; + anInfo->sfn = fdbkTime->sfn; + anInfo->subframe = fdbkTime->subframe; + anInfo->latestMIdx = m; + /* Fixing DAI value - ccpu00109162 */ + /* Handle TDD case as in MIMO definition of the function */ + anInfo->ulDai = 1; + if (havePdcch) + { + anInfo->dlDai = 1; + } + anInfo->isSpsOccasion = FALSE; + /* set the free Index to store Ack/Nack Information*/ + ue->cellInfo[servCellIdx]->nextFreeANIdx = (ue->cellInfo[servCellIdx]->nextFreeANIdx + 1) % + ackNackFdbkArrSize; + + } + else + { + anInfo->latestMIdx = m; + /* Fixing DAI value - ccpu00109162 */ + /* Handle TDD case as in MIMO definition of the function */ + anInfo->ulDai = anInfo->ulDai + 1; + if (havePdcch) + { + anInfo->dlDai = anInfo->dlDai + 1; + } + } +#ifdef LTE_ADV + /* ignoring the Scell check, + * for primary cell this field is unused*/ + if(hqP != NULLP) + {/* SPS*/ + anInfo->n1ResTpcIdx = hqP->tpc; + } + + if(ulDai) + {/* As this not required for release pdcch */ + *ulDai = anInfo->ulDai; + } +#endif + RETVALUE(anInfo->dlDai); + +} +#endif /* ifdef LTE_TDD */ + +PUBLIC U32 rgHqRvRetxCnt[4][2]; +PUBLIC U32 rgUlrate_grant; + +/** + * @brief This function fills the HqP TB with rbAllocInfo. + * + * @details + * + * Function: rgSCHCmnFillHqPTb + * Purpose: This function fills in the HqP TB with rbAllocInfo. + * + * Invoked by: rgSCHCmnFillHqPTb + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc *rbAllocInfo, + * @param[in] U8 tbAllocIdx + * @param[in] RgSchPdcch *pdcch + * @return Void + * + **/ +#ifdef LTEMAC_SPS +#ifdef ANSI +PUBLIC Void rgSCHCmnFillHqPTb +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +U8 tbAllocIdx, +RgSchPdcch *pdcch +) +#else +PUBLIC Void rgSCHCmnFillHqPTb(cell, rbAllocInfo, tbAllocIdx, pdcch) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +U8 tbAllocIdx; +RgSchPdcch *pdcch; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPTb +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +U8 tbAllocIdx, +RgSchPdcch *pdcch +) +#else +PRIVATE Void rgSCHCmnFillHqPTb(cell, rbAllocInfo, tbAllocIdx, pdcch) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +U8 tbAllocIdx; +RgSchPdcch *pdcch; +#endif +#endif /* LTEMAC_SPS */ +{ + RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchDlTbAllocInfo *tbAllocInfo = &rbAllocInfo->tbInfo[tbAllocIdx]; + RgSchDlHqTbCb *tbInfo = tbAllocInfo->tbCb; + RgSchDlHqProcCb *hqP = tbInfo->hqP; + + TRC2(rgSCHCmnFillHqPTb); + + /*ccpu00120365-ADD-if tb is disabled, set mcs=0,rv=1. + * Relevant for DCI format 2 & 2A as per 36.213-7.1.7.2 + */ + if ( tbAllocInfo->isDisabled) + { + + tbInfo->dlGrnt.iMcs = 0; + tbInfo->dlGrnt.rv = 1; + } + /* Fill for TB retransmission */ + else if (tbInfo->txCntr > 0) + { + + tbInfo->timingInfo = cmnCellDl->time; + /* Fix */ + if ((tbInfo->isAckNackDtx == TFU_HQFDB_DTX)) + { + tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs; + rgHqRvRetxCnt[tbInfo->dlGrnt.rv][tbInfo->tbIdx]++; + } + else + { + tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[++(tbInfo->ccchSchdInfo.rvIdx) & 0x03]; + } + + /* fill the scheduler information of hqProc */ + tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc; + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx,hqP->tbInfo,tbInfo->tbIdx ); + rgSCHDhmHqTbRetx(hqP->hqE, tbInfo->timingInfo, hqP, tbInfo->tbIdx); + } + /* Fill for TB transmission */ + else + { + /* Fill the HqProc */ + tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs; + tbInfo->tbSz = tbAllocInfo->bytesAlloc; + tbInfo->timingInfo = cmnCellDl->time; + + tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[0]; + /* fill the scheduler information of hqProc */ + tbInfo->ccchSchdInfo.rvIdx = 0; + tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc; + /* DwPts Scheduling Changes Start */ + /* DwPts Scheduling Changes End */ + cell->measurements.dlBytesCnt += tbAllocInfo->bytesAlloc; + } + + /*ccpu00120365:-ADD-only add to subFrm list if tb is not disabled */ + if ( tbAllocInfo->isDisabled == FALSE ) + { + /* Set the number of transmitting SM layers for this TB */ + tbInfo->numLyrs = tbAllocInfo->noLyr; + /* Set the TB state as WAITING to indicate TB has been + * considered for transmission */ + tbInfo->state = HQ_TB_WAITING; + hqP->subFrm = rbAllocInfo->dlSf; + tbInfo->hqP->pdcch = pdcch; + //tbInfo->dlGrnt.numRb = rbAllocInfo->rbsAlloc; + rgSCHUtlDlHqPTbAddToTx(hqP->subFrm, hqP, tbInfo->tbIdx); + } + RETVOID; +} + +/** + * @brief This function fills the PDCCH DCI format 2 information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt2 + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmtB1B2 +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmtB1B2(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ + + TRC2(rgSCHCmnFillHqPPdcchDciFrmtB1B2) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + //Currently hardcoding values here. + //printf("Filling 5GTF UL DCI for rnti %d \n",alloc->rnti); + switch(rbAllocInfo->dciFormat) + { + case TFU_DCI_FORMAT_B1: + { + pdcch->dci.u.formatB1Info.formatType = 0; + pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange; + pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = hqP->procId; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0; + pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0; + pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0; + pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0; + //TODO_SID: Need to update + pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0; + pdcch->dci.u.formatB1Info.beamSwitch = 0; + pdcch->dci.u.formatB1Info.SRS_Config = 0; + pdcch->dci.u.formatB1Info.SRS_Symbol = 0; + //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC). + pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0; + pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID; + //TODO_SID: Hardcoding TPC command to 1 i.e. No change + pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc; + pdcch->dci.u.formatB1Info.DL_PCRS = 0; + break; + } + case TFU_DCI_FORMAT_B2: + { + pdcch->dci.u.formatB2Info.formatType = 1; + pdcch->dci.u.formatB2Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange; + pdcch->dci.u.formatB2Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign; + pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.hqProcId = hqP->procId; + pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.bmiHqAckNack = 0; + pdcch->dci.u.formatB2Info.CSI_BSI_BRI_Req = 0; + pdcch->dci.u.formatB2Info.CSIRS_BRRS_TxTiming = 0; + pdcch->dci.u.formatB2Info.CSIRS_BRRS_SymbIdx = 0; + pdcch->dci.u.formatB2Info.CSIRS_BRRS_ProcInd = 0; + pdcch->dci.u.formatB2Info.xPUCCH_TxTiming = 0; + //TODO_SID: Need to update + pdcch->dci.u.formatB2Info.freqResIdx_xPUCCH = 0; + pdcch->dci.u.formatB2Info.beamSwitch = 0; + pdcch->dci.u.formatB2Info.SRS_Config = 0; + pdcch->dci.u.formatB2Info.SRS_Symbol = 0; + //TODO_SID: Need to check.Currently setting 4(2 layer, ports(8,9) w/o OCC). + pdcch->dci.u.formatB2Info.AntPorts_numLayers = 4; + pdcch->dci.u.formatB2Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID; + //TODO_SID: Hardcoding TPC command to 1 i.e. No change + pdcch->dci.u.formatB2Info.tpcCmd = 1; //tpc; + pdcch->dci.u.formatB2Info.DL_PCRS = 0; + break; + } + default: + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId," 5GTF_ERROR Allocator's icorrect " + "dciForamt Fill RNTI:%d",rbAllocInfo->rnti); + break; + } + + RETVOID; +} + +extern U32 totPcellSCell; +extern U32 addedForScell; +extern U32 addedForScell1; +extern U32 addedForScell2; +/** + * @brief This function fills the PDCCH information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcch + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnFillHqPPdcch +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnDlCell *cmnCell = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchPdcch *pdcch = rbAllocInfo->pdcch; + U8 tpc = 1; + + TRC2(rgSCHCmnFillHqPPdcch); + + if (hqP->hqE->ue) + { +#ifdef LTE_ADV + if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) + { + tpc = hqP->tpc; + } + else +#endif + { + tpc = rgSCHPwrPucchTpcForUe(cell, hqP->hqE->ue); + } + /* Fix: syed moving this to a common function for both scheduled + * and non-scheduled UEs */ + + pdcch->ue = hqP->hqE->ue; + if (hqP->hqE->ue->csgMmbrSta == FALSE) + { + cmnCell->ncsgPrbCnt += rbAllocInfo->rbsAlloc; + } + cmnCell->totPrbCnt += rbAllocInfo->rbsAlloc; +#ifdef TENB_STATS + { + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlPrbUsg += + rbAllocInfo->rbsAlloc; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw0iTbs += + rbAllocInfo->tbInfo[0].iTbs; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw0iTbs ++; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt += + (rbAllocInfo->tbInfo[0].bytesAlloc << 3); + +#ifdef LTE_ADV + totPcellSCell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); + if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) + { + addedForScell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); + addedForScell1 += (rbAllocInfo->tbInfo[0].bytesAlloc << 3); +/* + printf (" Hqp %d cell %d addedForScell %lu addedForScell1 %lu sfn:sf %d:%d \n", + hqP->procId, + hqP->hqE->cell->cellId, + addedForScell, + addedForScell1, + cell->crntTime.sfn, + cell->crntTime.subframe); + */ + } +#endif + hqP->hqE->cell->tenbStats->sch.dlPrbUsage[0] += + rbAllocInfo->rbsAlloc; + hqP->hqE->cell->tenbStats->sch.dlSumCw0iTbs += + rbAllocInfo->tbInfo[0].iTbs; + hqP->hqE->cell->tenbStats->sch.dlNumCw0iTbs ++; + hqP->hqE->cell->tenbStats->sch.dlTtlTpt += + (rbAllocInfo->tbInfo[0].bytesAlloc << 3); + if (rbAllocInfo->tbInfo[1].schdlngForTb) + { + hqP->hqE->cell->tenbStats->sch.dlSumCw1iTbs += + rbAllocInfo->tbInfo[1].iTbs; + hqP->hqE->cell->tenbStats->sch.dlNumCw1iTbs ++; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw1iTbs += + rbAllocInfo->tbInfo[1].iTbs; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw1iTbs ++; + hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt += + (rbAllocInfo->tbInfo[1].bytesAlloc << 3); + + +#ifdef LTE_ADV + if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell)) + { + addedForScell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); + addedForScell2 += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); +/* + printf (" Hqp %d cell %d addedForScell %lu addedForScell2 %lu \n", + hqP->procId, + hqP->hqE->cell->cellId, + addedForScell, + addedForScell2); + */ + } + totPcellSCell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3); +#endif + + + hqP->hqE->cell->tenbStats->sch.dlTtlTpt += + (rbAllocInfo->tbInfo[1].bytesAlloc << 3); + } + /* + printf ("add DL TPT is %lu sfn:sf %d:%d \n", hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt , + cell->crntTime.sfn, + cell->crntTime.subframe); + */ + } +#endif + } + + pdcch->rnti = rbAllocInfo->rnti; + pdcch->dci.dciFormat = rbAllocInfo->dciFormat; + /* Update subframe and pdcch info in HqTb control block */ + switch(rbAllocInfo->dciFormat) + { +#ifdef RG_5GTF + case TFU_DCI_FORMAT_B1: + case TFU_DCI_FORMAT_B2: + { + // printf(" RG_5GTF:: Pdcch filling with DCI format B1/B2\n"); + rgSCHCmnFillHqPPdcchDciFrmtB1B2(cell, rbAllocInfo, hqP, \ + pdcch, tpc); + break; + } +#endif + default: + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Allocator's incorrect dciForamt Fill for RNTI:%d",rbAllocInfo->rnti); + break; + } + RETVOID; +} + +/** + * @brief This function fills the PDCCH DCI format 1 information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt1 + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1 +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ + +#ifdef LTE_TDD + RgSchTddANInfo *anInfo; +#endif + +#ifdef LTEMAC_SPS +/* For activation or reactivation, + * Harq ProcId should be 0 */ + RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); +#endif + + TRC2(rgSCHCmnFillHqPPdcchDciFrmt1) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + pdcch->dci.u.format1Info.tpcCmd = tpc; + /* Avoiding this check,as we dont support Type1 RA */ +#ifdef RG_UNUSED + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { +#endif + pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE; + pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) + & 0xff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) + & 0x00ff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) + & 0x0000ff); + pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); +#ifdef RG_UNUSED + } +#endif +#ifdef LTEMAC_SPS + if ((!(hqP->tbInfo[0].txCntr)) && + (cmnHqDl != (RgSchCmnDlHqProc*)NULLP && + ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || + (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))) + ) + { + pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; + } + else + { + pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId; + } +#else + pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId; +#endif + + pdcch->dci.u.format1Info.allocInfo.ndi = + rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.format1Info.allocInfo.mcs = + rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format1Info.allocInfo.rv = + rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; +#ifdef LTE_TDD + if(hqP->hqE->ue != NULLP) + { +#ifdef LTE_ADV + U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + hqP->hqE->ue); + + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); +#else + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); +#endif +#ifdef TFU_TDD + if(anInfo) + { + pdcch->dci.u.format1Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); + } + else + { + /* Fixing DAI value - ccpu00109162 */ + pdcch->dci.u.format1Info.dai = RG_SCH_MAX_DAI_IDX; + } +#endif + } + else + { + /* always 0 for RACH */ + pdcch->dci.u.format1Info.allocInfo.harqProcId = 0; +#ifdef TFU_TDD + /* Fixing DAI value - ccpu00109162 */ + pdcch->dci.u.format1Info.dai = 1; +#endif + } +#endif + + + RETVOID; +} +/** + * @brief This function fills the PDCCH DCI format 1A information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt1A + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1A(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ + +#ifdef LTE_TDD + RgSchTddANInfo *anInfo; +#endif + +#ifdef LTEMAC_SPS + RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); +#endif + + TRC2(rgSCHCmnFillHqPPdcchDciFrmt1A) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE; + pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = tpc; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \ + rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = TRUE; +#ifdef LTEMAC_SPS + if ((!(hqP->tbInfo[0].txCntr)) && + ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && + ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || + (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) + )) + { + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val = 0; + } + else + { + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val + = hqP->procId; + } +#else + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val = + hqP->procId; +#endif + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = \ + rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = \ + rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + /* As of now, we do not support Distributed allocations */ + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type = + TFU_ALLOC_TYPE_RIV; + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv = + rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, + rbAllocInfo->allocInfo.raType2.rbStart, + rbAllocInfo->allocInfo.raType2.numRb); +#ifdef LTE_TDD + if(hqP->hqE->ue != NULLP) + { +#ifdef LTE_ADV + U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + hqP->hqE->ue); + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); +#else + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); +#endif +#ifdef TFU_TDD + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; + if(anInfo) + { + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = + RG_SCH_GET_DAI_VALUE(anInfo->dlDai); + } + else + { + /* Fixing DAI value - ccpu00109162 */ + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = RG_SCH_MAX_DAI_IDX; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "PDCCH is been scheduled without updating anInfo RNTI:%d", + rbAllocInfo->rnti); + } +#endif + } + else + { + /* always 0 for RACH */ + pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres + = FALSE; +#ifdef TFU_TDD + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE; + /* Fixing DAI value - ccpu00109162 */ + pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1; +#endif + } +#endif + + RETVOID; +} +/** + * @brief This function fills the PDCCH DCI format 1B information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt1B + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt1B(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ + +#ifdef LTE_TDD + RgSchTddANInfo *anInfo; +#endif + +#ifdef LTEMAC_SPS + RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); +#endif + + TRC2(rgSCHCmnFillHqPPdcchDciFrmt1B) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + pdcch->dci.u.format1bInfo.tpcCmd = tpc; + pdcch->dci.u.format1bInfo.allocInfo.mcs = \ + rbAllocInfo->tbInfo[0].imcs; +#ifdef LTEMAC_SPS + if ((!(hqP->tbInfo[0].txCntr)) && + ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && + ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || + (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) + )) + { + pdcch->dci.u.format1bInfo.allocInfo.harqProcId = 0; + } + else + { + pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId; + } +#else + pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId; +#endif + pdcch->dci.u.format1bInfo.allocInfo.ndi = \ + rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.format1bInfo.allocInfo.rv = \ + rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + /* As of now, we do not support Distributed allocations */ + pdcch->dci.u.format1bInfo.allocInfo.isLocal = TRUE; + pdcch->dci.u.format1bInfo.allocInfo.nGap2.pres = NOTPRSNT; + pdcch->dci.u.format1bInfo.allocInfo.alloc.type = + TFU_ALLOC_TYPE_RIV; + pdcch->dci.u.format1bInfo.allocInfo.alloc.u.riv = + rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw, + rbAllocInfo->allocInfo.raType2.rbStart, + rbAllocInfo->allocInfo.raType2.numRb); + /* Fill precoding Info */ + pdcch->dci.u.format1bInfo.allocInfo.pmiCfm = \ + rbAllocInfo->mimoAllocInfo.precIdxInfo >> 4; + pdcch->dci.u.format1bInfo.allocInfo.tPmi = \ + rbAllocInfo->mimoAllocInfo.precIdxInfo & 0x0F; +#ifdef LTE_TDD + if(hqP->hqE->ue != NULLP) + { +#ifdef LTE_ADV + U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + hqP->hqE->ue); + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); +#else + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); +#endif +#ifdef TFU_TDD + if(anInfo) + { + pdcch->dci.u.format1bInfo.dai = + RG_SCH_GET_DAI_VALUE(anInfo->dlDai); + } + else + { + pdcch->dci.u.format1bInfo.dai = RG_SCH_MAX_DAI_IDX; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "PDCCH is been scheduled without updating anInfo RNTI:%d", + rbAllocInfo->rnti); + } +#endif + } +#endif + + RETVOID; + +} +/** + * @brief This function fills the PDCCH DCI format 2 information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt2 + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2 +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ + +#ifdef LTE_TDD + RgSchTddANInfo *anInfo; +#endif + +#ifdef LTEMAC_SPS +/* ccpu00119023-ADD-For activation or reactivation, + * Harq ProcId should be 0 */ + RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); +#endif + + TRC2(rgSCHCmnFillHqPPdcchDciFrmt2) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + /*ccpu00120365:-ADD-call also if tb is disabled */ + if (rbAllocInfo->tbInfo[1].schdlngForTb || + rbAllocInfo->tbInfo[1].isDisabled) + { + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch); + } + pdcch->dci.u.format2Info.tpcCmd = tpc; + /* Avoiding this check,as we dont support Type1 RA */ +#ifdef RG_UNUSED + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { +#endif + pdcch->dci.u.format2Info.allocInfo.isAllocType0 = TRUE; + pdcch->dci.u.format2Info.allocInfo.resAllocMap[0] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) + & 0xff); + pdcch->dci.u.format2Info.allocInfo.resAllocMap[1] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) + & 0x00ff); + pdcch->dci.u.format2Info.allocInfo.resAllocMap[2] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) + & 0x0000ff); + pdcch->dci.u.format2Info.allocInfo.resAllocMap[3] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); +#ifdef RG_UNUSED + } +#endif +#ifdef LTEMAC_SPS + if ((!(hqP->tbInfo[0].txCntr)) && + ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && + ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || + (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) + )) + { + pdcch->dci.u.format2Info.allocInfo.harqProcId = 0; + } + else + { + pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId; + } +#else + pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId; +#endif + /* Initialize the TB info for both the TBs */ + pdcch->dci.u.format2Info.allocInfo.tbInfo[0].mcs = 0; + pdcch->dci.u.format2Info.allocInfo.tbInfo[0].rv = 1; + pdcch->dci.u.format2Info.allocInfo.tbInfo[1].mcs = 0; + pdcch->dci.u.format2Info.allocInfo.tbInfo[1].rv = 1; + /* Fill tbInfo for scheduled TBs */ + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + /* If we reach this function. It is safely assumed that + * rbAllocInfo->tbInfo[0] always has non default valid values. + * rbAllocInfo->tbInfo[1]'s scheduling is optional */ + if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE) + { + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi; + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs; + pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv; + } + pdcch->dci.u.format2Info.allocInfo.transSwap = + rbAllocInfo->mimoAllocInfo.swpFlg; + pdcch->dci.u.format2Info.allocInfo.precoding = + rbAllocInfo->mimoAllocInfo.precIdxInfo; +#ifdef LTE_TDD + if(hqP->hqE->ue != NULLP) + { + +#ifdef LTE_ADV + U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + hqP->hqE->ue); + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); +#else + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); +#endif +#ifdef TFU_TDD + if(anInfo) + { + pdcch->dci.u.format2Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); + } + else + { + pdcch->dci.u.format2Info.dai = RG_SCH_MAX_DAI_IDX; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "PDCCH is been scheduled without updating anInfo RNTI:%d", + rbAllocInfo->rnti); + } +#endif + } +#endif + + RETVOID; +} +/** + * @brief This function fills the PDCCH DCI format 2A information from dlProc. + * + * @details + * + * Function: rgSCHCmnFillHqPPdcchDciFrmt2A + * Purpose: This function fills in the PDCCH information + * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc + * for dedicated service scheduling. It also + * obtains TPC to be filled in from the power module. + * Assign the PDCCH to HQProc. + * + * Invoked by: Downlink Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlRbAlloc* rbAllocInfo + * @param[in] RgDlHqProc* hqP + * @param[out] RgSchPdcch *pdcch + * @param[in] U8 tpc + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A +( +RgSchCellCb *cell, +RgSchDlRbAlloc *rbAllocInfo, +RgSchDlHqProcCb *hqP, +RgSchPdcch *pdcch, +U8 tpc +) +#else +PRIVATE Void rgSCHCmnFillHqPPdcchDciFrmt2A(cell, rbAllocInfo, hqP, pdcch, tpc) +RgSchCellCb *cell; +RgSchDlRbAlloc *rbAllocInfo; +RgSchDlHqProcCb *hqP; +RgSchPdcch *pdcch; +U8 tpc; +#endif +{ +#ifdef LTE_TDD + RgSchTddANInfo *anInfo; +#endif + +#ifdef LTEMAC_SPS + RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP); +#endif + + TRC2(rgSCHCmnFillHqPPdcchDciFrmt2A) + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch); + /*ccpu00120365:-ADD-call also if tb is disabled */ + if (rbAllocInfo->tbInfo[1].schdlngForTb || + rbAllocInfo->tbInfo[1].isDisabled) + { + + rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch); + } + + pdcch->dci.u.format2AInfo.tpcCmd = tpc; + /* Avoiding this check,as we dont support Type1 RA */ +#ifdef RG_UNUSED + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { +#endif + pdcch->dci.u.format2AInfo.allocInfo.isAllocType0 = TRUE; + pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[0] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24) + & 0xff); + pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[1] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16) + & 0x00ff); + pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[2] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8) + & 0x0000ff); + pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[3] = + ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff)); +#ifdef RG_UNUSED + } +#endif +#ifdef LTEMAC_SPS + if ((!(hqP->tbInfo[0].txCntr)) && + ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP && + ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) || + (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)) + )) + { + pdcch->dci.u.format2AInfo.allocInfo.harqProcId = 0; + } + else + { + pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId; + } +#else + pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId; +#endif + /* Initialize the TB info for both the TBs */ + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].mcs = 0; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].rv = 1; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].mcs = 0; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].rv = 1; + /* Fill tbInfo for scheduled TBs */ + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\ + tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv; + /* If we reach this function. It is safely assumed that + * rbAllocInfo->tbInfo[0] always has non default valid values. + * rbAllocInfo->tbInfo[1]'s scheduling is optional */ + + if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE) + { + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs; + pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\ + tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv; + + } + pdcch->dci.u.format2AInfo.allocInfo.transSwap = + rbAllocInfo->mimoAllocInfo.swpFlg; + pdcch->dci.u.format2AInfo.allocInfo.precoding = + rbAllocInfo->mimoAllocInfo.precIdxInfo; +#ifdef LTE_TDD + if(hqP->hqE->ue != NULLP) + { +#ifdef LTE_ADV + U8 servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx, + hqP->hqE->cell->cellId, + hqP->hqE->ue); + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx); +#else + anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue, + &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0); +#endif +#ifdef TFU_TDD + if(anInfo) + { + pdcch->dci.u.format2AInfo.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai); + } + else + { + pdcch->dci.u.format2AInfo.dai = RG_SCH_MAX_DAI_IDX; + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "PDCCH is been scheduled without updating anInfo RNTI:%d", + rbAllocInfo->rnti); + } +#endif + } +#endif + + + RETVOID; +} + +/** + * @brief init of Sch vars. + * + * @details + * + * Function: rgSCHCmnInitVars + Purpose: Initialization of various UL subframe indices + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnInitVars +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnInitVars(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + + TRC2(rgSCHCmnInitVars); + + cellUl->idx = RGSCH_INVALID_INFO; + cellUl->schdIdx = RGSCH_INVALID_INFO; + cellUl->schdHqProcIdx = RGSCH_INVALID_INFO; + cellUl->msg3SchdIdx = RGSCH_INVALID_INFO; +#ifdef EMTC_ENBLE + cellUl->emtcMsg3SchdIdx = RGSCH_INVALID_INFO; +#endif + cellUl->msg3SchdHqProcIdx = RGSCH_INVALID_INFO; + cellUl->rcpReqIdx = RGSCH_INVALID_INFO; + cellUl->hqFdbkIdx[0] = RGSCH_INVALID_INFO; + cellUl->hqFdbkIdx[1] = RGSCH_INVALID_INFO; + cellUl->reTxIdx[0] = RGSCH_INVALID_INFO; + cellUl->reTxIdx[1] = RGSCH_INVALID_INFO; + /* Stack Crash problem for TRACE5 Changes. Added the return below */ + RETVOID; + +} + +#ifndef LTE_TDD +/** + * @brief Updation of Sch vars per TTI. + * + * @details + * + * Function: rgSCHCmnUpdVars + * Purpose: Updation of Sch vars per TTI. + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUpdVars +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnUpdVars(cell) +RgSchCellCb *cell; +#endif +{ + CmLteTimingInfo timeInfo; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + U16 idx; + + TRC2(rgSCHCmnUpdVars); + + idx = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.subframe); + cellUl->idx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); +#ifdef UL_ADPT_DBG + printf("idx %d cellUl->idx %d RGSCH_NUM_SUB_FRAMES_5G %d time(%d %d) \n",idx,cellUl->idx ,RGSCH_NUM_SUB_FRAMES_5G,cell->crntTime.sfn,cell->crntTime.subframe); +#endif + /* Need to scheduler for after SCHED_DELTA */ + /* UL allocation has been advanced by 1 subframe + * so that we do not wrap around and send feedback + * before the data is even received by the PHY */ + /* Introduced timing delta for UL control */ + idx = (cellUl->idx + TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA); + cellUl->schdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); + + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, + TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA) + cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); + + /* ccpu00127193 filling schdTime for logging and enhancement purpose*/ + cellUl->schdTime = timeInfo; + + /* msg3 scheduling two subframes after general scheduling */ + idx = (cellUl->idx + RG_SCH_CMN_DL_DELTA + RGSCH_RARSP_MSG3_DELTA); + cellUl->msg3SchdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); + + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, + RG_SCH_CMN_DL_DELTA+ RGSCH_RARSP_MSG3_DELTA) + cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); + + idx = (cellUl->idx + TFU_RECPREQ_DLDELTA); + + cellUl->rcpReqIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF)); + + /* Downlink harq feedback is sometime after data reception / harq failure */ + /* Since feedback happens prior to scheduling being called, we add 1 to */ + /* take care of getting the correct subframe for feedback */ + idx = (cellUl->idx - TFU_CRCIND_ULDELTA + RG_SCH_CMN_UL_NUM_SF); +#ifdef UL_ADPT_DBG + printf("Finally setting cellUl->hqFdbkIdx[0] = %d TFU_CRCIND_ULDELTA %d RG_SCH_CMN_UL_NUM_SF %d\n",idx,TFU_CRCIND_ULDELTA,RG_SCH_CMN_UL_NUM_SF); +#endif + cellUl->hqFdbkIdx[0] = (idx % (RG_SCH_CMN_UL_NUM_SF)); + + idx = ((cellUl->schdIdx) % (RG_SCH_CMN_UL_NUM_SF)); + + cellUl->reTxIdx[0] = (U8) idx; +#ifdef UL_ADPT_DBG + printf("cellUl->hqFdbkIdx[0] %d cellUl->reTxIdx[0] %d \n",cellUl->hqFdbkIdx[0], cellUl->reTxIdx[0] ); +#endif + /* RACHO: update cmn sched specific RACH variables, + * mainly the prachMaskIndex */ + rgSCHCmnUpdRachParam(cell); + + RETVOID; +} +#endif + +#ifdef LTE_TDD + +/** + * @brief To get uplink subframe index associated with current PHICH + * transmission. + * + * @details + * + * Function: rgSCHCmnGetPhichUlSfIdx + * Purpose: Gets uplink subframe index associated with current PHICH + * transmission based on SFN and subframe no + * + * @param[in] CmLteTimingInfo *timeInfo + * @param[in] RgSchCellCb *cell + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnGetPhichUlSfIdx +( +CmLteTimingInfo *timeInfo, +RgSchCellCb *cell +) +#else +PUBLIC U8 rgSCHCmnGetPhichUlSfIdx(timeInfo, cell) +CmLteTimingInfo *timeInfo; +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchDlSf *dlsf; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 idx; + U16 numUlSf; + U16 sfn; + U8 subframe; + + TRC2(rgSCHCmnGetPhichUlSfIdx); + + dlsf = rgSCHUtlSubFrmGet(cell, *timeInfo); + + if(dlsf->phichOffInfo.sfnOffset == RGSCH_INVALID_INFO) + { + RETVALUE(RGSCH_INVALID_INFO); + } + subframe = dlsf->phichOffInfo.subframe; + + sfn = (RGSCH_MAX_SFN + timeInfo->sfn - + dlsf->phichOffInfo.sfnOffset) % RGSCH_MAX_SFN; + + /* ccpu00130980: numUlSf(U16) parameter added to avoid integer + * wrap case such that idx will be proper*/ + numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + numUlSf = ((numUlSf * sfn) + rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subframe]) - 1; + idx = numUlSf % (cellUl->numUlSubfrms); + + RETVALUE(idx); +} + +/** + * @brief To get uplink subframe index. + * + * @details + * + * + * Function: rgSCHCmnGetUlSfIdx + * Purpose: Gets uplink subframe index based on SFN and subframe number. + * + * @param[in] CmLteTimingInfo *timeInfo + * @param[in] U8 ulDlCfgIdx + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnGetUlSfIdx +( +CmLteTimingInfo *timeInfo, +RgSchCellCb *cell +) +#else +PUBLIC U8 rgSCHCmnGetUlSfIdx(timeInfo, cell) +CmLteTimingInfo *timeInfo; +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 idx = 0; + U16 numUlSf; + + TRC2(rgSCHCmnGetUlSfIdx); + + /* ccpu00130980: numUlSf(U16) parameter added to avoid integer + * wrap case such that idx will be proper*/ + numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + numUlSf = ((numUlSf * timeInfo->sfn) + \ + rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->subframe]) - 1; + idx = numUlSf % (cellUl->numUlSubfrms); + + RETVALUE(idx); +} + +#endif + +/** + * @brief To get uplink hq index. + * + * @details + * + * + * Function: rgSCHCmnGetUlHqProcIdx + * Purpose: Gets uplink subframe index based on SFN and subframe number. + * + * @param[in] CmLteTimingInfo *timeInfo + * @param[in] U8 ulDlCfgIdx + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnGetUlHqProcIdx +( +CmLteTimingInfo *timeInfo, +RgSchCellCb *cell +) +#else +PUBLIC U8 rgSCHCmnGetUlHqProcIdx(timeInfo, cell) +CmLteTimingInfo *timeInfo; +RgSchCellCb *cell; +#endif +{ + U8 procId; + U32 numUlSf; + +#ifndef LTE_TDD + numUlSf = (timeInfo->sfn * RGSCH_NUM_SUB_FRAMES_5G + timeInfo->subframe); + procId = numUlSf % RGSCH_NUM_UL_HQ_PROC; +#else + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + /*ccpu00130639 - MOD - To get correct UL HARQ Proc IDs for all UL/DL Configs*/ + U8 numUlSfInSfn; + S8 sfnCycle = cell->tddHqSfnCycle; + U8 numUlHarq = rgSchTddUlNumHarqProcTbl[ulDlCfgIdx] + + /* TRACE 5 Changes */ + TRC2(rgSCHCmnGetUlHqProcIdx); + + /* Calculate the number of UL SF in one SFN */ + numUlSfInSfn = RGSCH_NUM_SUB_FRAMES - + rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + + /* Check for the SFN wrap around case */ + if(cell->crntTime.sfn == 1023 && timeInfo->sfn == 0) + { + sfnCycle++; + } + else if(cell->crntTime.sfn == 0 && timeInfo->sfn == 1023) + { + /* sfnCycle decremented by 1 */ + sfnCycle = (sfnCycle + numUlHarq-1) % numUlHarq; + } + /* Calculate the total number of UL sf */ + /* -1 is done since uplink sf are counted from 0 */ + numUlSf = numUlSfInSfn * (timeInfo->sfn + (sfnCycle*1024)) + + rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->subframe] - 1; + + procId = numUlSf % numUlHarq; +#endif + RETVALUE(procId); +} + + +/* UL_ALLOC_CHANGES */ +/*********************************************************** + * + * Func : rgSCHCmnUlFreeAlloc + * + * Desc : Free an allocation - invokes UHM and releases + * alloc for the scheduler + * Doest need subframe as argument + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlFreeAlloc +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHCmnUlFreeAlloc(cell, alloc) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +#endif +{ + RgSchUlHqProcCb *hqProc; + TRC2(rgSCHCmnUlFreeAllocation); + + if (alloc->forMsg3) + { + /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */ + if ((alloc->hqProc->remTx == 0) && + (alloc->hqProc->rcvdCrcInd == FALSE) && + (alloc->raCb)) + { + RgSchRaCb *raCb = alloc->raCb; + rgSCHUhmFreeProc(alloc->hqProc, cell); + rgSCHUtlUlAllocRelease(alloc); + rgSCHRamDelRaCb(cell, raCb, TRUE); + RETVOID; + } + } + + hqProc = alloc->hqProc; + rgSCHUtlUlAllocRelease(alloc); + rgSCHUhmFreeProc(hqProc, cell); + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHCmnUlFreeAllocation + * + * Desc : Free an allocation - invokes UHM and releases + * alloc for the scheduler + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlFreeAllocation +( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHCmnUlFreeAllocation(cell, sf, alloc) +RgSchCellCb *cell; +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + RgSchUlHqProcCb *hqProc; + + TRC2(rgSCHCmnUlFreeAllocation); + + if (alloc->forMsg3) + { + /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */ + if ((alloc->hqProc->remTx == 0) && + (alloc->hqProc->rcvdCrcInd == FALSE) && + (alloc->raCb)) + { + RgSchRaCb *raCb = alloc->raCb; + rgSCHUhmFreeProc(alloc->hqProc, cell); + rgSCHUtlUlAllocRls(sf, alloc); + rgSCHRamDelRaCb(cell, raCb, TRUE); + RETVOID; + } + } + + hqProc = alloc->hqProc; + rgSCHUhmFreeProc(hqProc, cell); +#ifdef LTE_L2_MEAS + /* re-setting the PRB count while freeing the allocations */ + sf->totPrb = 0; +#endif + rgSCHUtlUlAllocRls(sf, alloc); + + RETVOID; +} + +/** + * @brief This function implements PDCCH allocation for an UE + * in the currently running subframe. + * + * @details + * + * Function: rgSCHCmnPdcchAllocCrntSf + * Purpose: This function determines current DL subframe + * and UE DL CQI to call the actual pdcch allocator + * function. + * Note that this function is called only + * when PDCCH request needs to be made during + * uplink scheduling. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return RgSchPdcch * + * -# NULLP when unsuccessful + **/ +#ifdef ANSI +PUBLIC RgSchPdcch *rgSCHCmnPdcchAllocCrntSf +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC RgSchPdcch *rgSCHCmnPdcchAllocCrntSf(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + CmLteTimingInfo frm = cell->crntTime; + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgSchDlSf *sf; + RgSchPdcch *pdcch = NULLP; + + TRC2(rgSCHCmnPdcchAllocCrntSf); + RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); + sf = rgSCHUtlSubFrmGet(cell, frm); + +#ifdef LTE_ADV + if (ue->allocCmnUlPdcch) + { + pdcch = rgSCHCmnCmnPdcchAlloc(cell, sf); + /* Since CRNTI Scrambled */ + if(NULLP != pdcch) + { + pdcch->dciNumOfBits = ue->dciSize.cmnSize[TFU_DCI_FORMAT_0]; + } + } + else +#endif + { + //pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, y, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_0, FALSE); + pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_A1, FALSE); + } + RETVALUE(pdcch); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlAllocFillNdmrs + * + * Desc : Determines and fills N_dmrs for a UE uplink + * allocation. + * + * Ret : + * + * Notes: N_dmrs determination is straightforward, so + * it is configured per subband + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAllocFillNdmrs +( +RgSchCmnUlCell *cellUl, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHCmnUlAllocFillNdmrs(cellUl, alloc) +RgSchCmnUlCell *cellUl; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHCmnUlAllocFillNdmrs); + alloc->grnt.nDmrs = cellUl->dmrsArr[alloc->sbStart]; + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnUlAllocLnkHqProc + * + * Desc : Links a new allocation for an UE with the + * appropriate HARQ process of the UE. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAllocLnkHqProc +( +RgSchUeCb *ue, +RgSchUlAlloc *alloc, +RgSchUlHqProcCb *proc, +Bool isRetx +) +#else +PUBLIC Void rgSCHCmnUlAllocLnkHqProc(ue, alloc, proc, isRetx) +RgSchUeCb *ue; +RgSchUlAlloc *alloc; +RgSchUlHqProcCb *proc; +Bool isRetx; +#endif +{ + TRC2(rgSCHCmnUlAllocLnkHqProc); + + if(TRUE == isRetx) + { + rgSCHCmnUlAdapRetx(alloc, proc); + } + else + { +#ifdef LTE_L2_MEAS /* L2_COUNTERS */ + alloc->ue = ue; +#endif + rgSCHUhmNewTx(proc, (((RgUeUlHqCb*)proc->hqEnt)->maxHqRetx), alloc); + } + RETVOID; +} + +/** + * @brief This function releases a PDCCH in the subframe that is + * currently being allocated for. + * + * @details + * + * Function: rgSCHCmnPdcchRlsCrntSf + * Purpose: This function determines current DL subframe + * which is considered for PDCCH allocation, + * and then calls the actual function that + * releases a PDCCH in a specific subframe. + * Note that this function is called only + * when PDCCH release needs to be made during + * uplink scheduling. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchPdcch *pdcch + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnPdcchRlsCrntSf +( +RgSchCellCb *cell, +RgSchPdcch *pdcch +) +#else +PUBLIC Void rgSCHCmnPdcchRlsCrntSf(cell, pdcch) +RgSchCellCb *cell; +RgSchPdcch *pdcch; +#endif +{ + CmLteTimingInfo frm = cell->crntTime; + RgSchDlSf *sf; + + TRC2(rgSCHCmnPdcchRlsCrntSf); + + RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); + sf = rgSCHUtlSubFrmGet(cell, frm); + rgSCHUtlPdcchPut(cell, &sf->pdcchInfo, pdcch); + RETVOID; +} +/*********************************************************** + * + * Func : rgSCHCmnUlFillPdcchWithAlloc + * + * Desc : Fills a PDCCH with format 0 information. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlFillPdcchWithAlloc +( +RgSchPdcch *pdcch, +RgSchUlAlloc *alloc, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlFillPdcchWithAlloc(pdcch, alloc, ue) +RgSchPdcch *pdcch; +RgSchUlAlloc *alloc; +RgSchUeCb *ue; +#endif +{ + + TRC2(rgSCHCmnUlFillPdcchWithAlloc); + + pdcch->ue = ue; + pdcch->rnti = alloc->rnti; + //pdcch->dci.dciFormat = TFU_DCI_FORMAT_A2; + pdcch->dci.dciFormat = alloc->grnt.dciFrmt; + + //Currently hardcoding values here. + //printf("Filling 5GTF UL DCI for rnti %d \n",alloc->rnti); + switch(pdcch->dci.dciFormat) + { + case TFU_DCI_FORMAT_A1: + { + pdcch->dci.u.formatA1Info.formatType = 0; + pdcch->dci.u.formatA1Info.xPUSCHRange = alloc->grnt.xPUSCHRange; + pdcch->dci.u.formatA1Info.xPUSCH_TxTiming = 0; + pdcch->dci.u.formatA1Info.RBAssign = alloc->grnt.rbAssign; + pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId; + pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt; + pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi; + pdcch->dci.u.formatA1Info.CSI_BSI_BRI_Req = 0; + pdcch->dci.u.formatA1Info.CSIRS_BRRS_TxTiming = 0; + pdcch->dci.u.formatA1Info.CSIRS_BRRS_SymbIdx = 0; + pdcch->dci.u.formatA1Info.CSIRS_BRRS_ProcInd = 0; + pdcch->dci.u.formatA1Info.numBSI_Reports = 0; + pdcch->dci.u.formatA1Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH; + pdcch->dci.u.formatA1Info.beamSwitch = 0; + pdcch->dci.u.formatA1Info.SRS_Config = 0; + pdcch->dci.u.formatA1Info.SRS_Symbol = 0; + pdcch->dci.u.formatA1Info.REMapIdx_DMRS_PCRS_numLayers = 0; + pdcch->dci.u.formatA1Info.SCID = alloc->grnt.SCID; + pdcch->dci.u.formatA1Info.PMI = alloc->grnt.PMI; + pdcch->dci.u.formatA1Info.UL_PCRS = 0; + pdcch->dci.u.formatA1Info.tpcCmd = alloc->grnt.tpc; + break; + } + case TFU_DCI_FORMAT_A2: + { + pdcch->dci.u.formatA2Info.formatType = 1; + pdcch->dci.u.formatA2Info.xPUSCHRange = alloc->grnt.xPUSCHRange; + pdcch->dci.u.formatA2Info.xPUSCH_TxTiming = 0; + pdcch->dci.u.formatA2Info.RBAssign = alloc->grnt.rbAssign; + pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId; + pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt; + pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi; + pdcch->dci.u.formatA2Info.CSI_BSI_BRI_Req = 0; + pdcch->dci.u.formatA2Info.CSIRS_BRRS_TxTiming = 0; + pdcch->dci.u.formatA2Info.CSIRS_BRRS_SymbIdx = 0; + pdcch->dci.u.formatA2Info.CSIRS_BRRS_ProcInd = 0; + pdcch->dci.u.formatA2Info.numBSI_Reports = 0; + pdcch->dci.u.formatA2Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH; + pdcch->dci.u.formatA2Info.beamSwitch = 0; + pdcch->dci.u.formatA2Info.SRS_Config = 0; + pdcch->dci.u.formatA2Info.SRS_Symbol = 0; + pdcch->dci.u.formatA2Info.REMapIdx_DMRS_PCRS_numLayers = 0; + pdcch->dci.u.formatA2Info.SCID = alloc->grnt.SCID; + pdcch->dci.u.formatA2Info.PMI = alloc->grnt.PMI; + pdcch->dci.u.formatA2Info.UL_PCRS = 0; + pdcch->dci.u.formatA2Info.tpcCmd = alloc->grnt.tpc; + break; + } + default: + RLOG1(L_ERROR," 5GTF_ERROR UL Allocator's icorrect " + "dciForamt Fill RNTI:%d",alloc->rnti); + break; + } + + + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnUlAllocFillTpc + * + * Desc : Determines and fills TPC for an UE allocation. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAllocFillTpc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHCmnUlAllocFillTpc(cell, ue, alloc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHCmnUlAllocFillTpc); + alloc->grnt.tpc = rgSCHPwrPuschTpcForUe(cell, ue); + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHCmnAddUeToRefreshQ + * + * Desc : Adds a UE to refresh queue, so that the UE is + * periodically triggered to refresh it's GBR and + * AMBR values. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnAddUeToRefreshQ +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 wait +) +#else +PRIVATE Void rgSCHCmnAddUeToRefreshQ(cell, ue, wait) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 wait; +#endif +{ + RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); + CmTmrArg arg; + RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue); + + TRC2(rgSCHCmnAddUeToRefreshQ); + UNUSED(cell); + + cmMemset((U8 *)&arg, 0, sizeof(arg)); + arg.tqCp = &sched->tmrTqCp; + arg.tq = sched->tmrTq; + arg.timers = &ueSchd->tmr; + arg.cb = (PTR)ue; + arg.tNum = 0; + arg.max = 1; + arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH; + arg.wait = wait; + cmPlcCbTq(&arg); + RETVOID; +} + +/** + * @brief Perform UE reset procedure. + * + * @details + * + * Function : rgSCHCmnUlUeReset + * + * This functions performs BSR resetting and + * triggers UL specific scheduler + * to Perform UE reset procedure. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlUeReset +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnUlUeReset(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + U8 lcgCnt=0; + RgSchCmnLcg *lcgCmn; + CmLList *node; + RgSchCmnAllocRecord *allRcd; + TRC2(rgSCHCmnUlUeReset); + + ue->ul.minReqBytes = 0; + ue->ul.totalBsr = 0; + ue->ul.effBsr = 0; + ue->ul.nonGbrLcgBs = 0; + ue->ul.effAmbr = ue->ul.cfgdAmbr; + + node = ueUl->ulAllocLst.first; + while (node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + allRcd->alloc = 0; + node = node->next; + } + for(lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++) + { + lcgCmn = RG_SCH_CMN_GET_UL_LCG(&ue->ul.lcgArr[lcgCnt]); + lcgCmn->bs = 0; + lcgCmn->reportedBs = 0; + lcgCmn->effGbr = lcgCmn->cfgdGbr; + lcgCmn->effDeltaMbr = lcgCmn->deltaMbr; + } + rgSCHCmnUlUeDelAllocs(cell, ue); + + ue->isSrGrant = FALSE; + + cellSchd->apisUl->rgSCHUlUeReset(cell, ue); + + /* Stack Crash problem for TRACE5 changes. Added the return below */ + RETVOID; + +} + +/** + * @brief RESET UL CQI and DL CQI&RI to conservative values + * for a reestablishing UE. + * + * @details + * + * Function : rgSCHCmnResetRiCqi + * + * RESET UL CQI and DL CQI&RI to conservative values + * for a reestablishing UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnResetRiCqi +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnResetRiCqi(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + + TRC2(rgSCHCmnResetRiCqi); + + rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, + cell->isCpUlExtend); + + ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi; + ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi; + ueDl->mimoInfo.ri = 1; + if ((ue->mimoInfo.txMode == RGR_UE_TM_4) || + (ue->mimoInfo.txMode == RGR_UE_TM_6)) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); + } + if (ue->mimoInfo.txMode == RGR_UE_TM_3) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } +#ifdef EMTC_ENABLE + rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe); +#else + rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE); +#endif + +#ifdef TFU_UPGRADE + /* Request for an early Aper CQI in case of reest */ + RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell); + if(acqiCb && acqiCb->aCqiCfg.pres) + { + acqiCb->aCqiTrigWt = 0; + } +#endif + + RETVOID; +} + +/** + * @brief Perform UE reset procedure. + * + * @details + * + * Function : rgSCHCmnDlUeReset + * + * This functions performs BO resetting and + * triggers DL specific scheduler + * to Perform UE reset procedure. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlUeReset +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnDlUeReset(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnDlUeReset); + + if (ueDl->rachInfo.poLnk.node != NULLP) + { + rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); + } + + /* Fix: syed Remove from TA List if this UE is there. + * If TA Timer is running. Stop it */ + if (ue->dlTaLnk.node) + { + cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk); + ue->dlTaLnk.node = (PTR)NULLP; + } + else if (ue->taTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, ue->taTmr.tmrEvnt, ue); + } + + cellSchd->apisDl->rgSCHDlUeReset(cell, ue); +#ifdef LTE_ADV + if (ue->numSCells) + { + rgSCHSCellDlUeReset(cell,ue); + } +#endif +} + +/** + * @brief Perform UE reset procedure. + * + * @details + * + * Function : rgSCHCmnUeReset + * + * This functions triggers specific scheduler + * to Perform UE reset procedure. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUeReset +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUeReset(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + U8 idx; + Pst pst; + RgInfResetHqEnt hqEntRstInfo; + + TRC2(rgSCHCmnUeReset); + /* RACHO: remove UE from pdcch, handover and rapId assoc Qs */ + rgSCHCmnDelRachInfo(cell, ue); + + rgSCHPwrUeReset(cell, ue); + + rgSCHCmnUlUeReset(cell, ue); + rgSCHCmnDlUeReset(cell, ue); + +#ifdef LTE_ADV + /* Making allocCmnUlPdcch TRUE to allocate DCI0/1A from Common search space. + As because multiple cells are added hence 2 bits CqiReq is there + This flag will be set to FALSE once we will get Scell READY */ + ue->allocCmnUlPdcch = TRUE; +#endif + + /* Fix : syed RESET UL CQI and DL CQI&RI to conservative values + * for a reestablishing UE */ + /*Reset Cqi Config for all the configured cells*/ + for (idx = 0;idx < CM_LTE_MAX_CELLS; idx++) + { + if (ue->cellInfo[idx] != NULLP) + { + rgSCHCmnResetRiCqi(ue->cellInfo[idx]->cell, ue); + } + } + /*After Reset Trigger APCQI for Pcell*/ + RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); + if(pCellInfo->acqiCb.aCqiCfg.pres) + { + ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; + } + +/* sending HqEnt reset to MAC */ + hqEntRstInfo.cellId = cell->cellId; + hqEntRstInfo.crnti = ue->ueId; + + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); + RgSchMacRstHqEnt(&pst,&hqEntRstInfo); + + RETVOID; +} + +/** + * @brief UE out of MeasGap or AckNackReptn. + * + * @details + * + * Function : rgSCHCmnActvtUlUe + * + * This functions triggers specific scheduler + * to start considering it for scheduling. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnActvtUlUe +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnActvtUlUe(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnActvtUlUe); + + /* : take care of this in UL retransmission */ + cellSchd->apisUl->rgSCHUlActvtUe(cell, ue); + RETVOID; +} + +/** + * @brief UE out of MeasGap or AckNackReptn. + * + * @details + * + * Function : rgSCHCmnActvtDlUe + * + * This functions triggers specific scheduler + * to start considering it for scheduling. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnActvtDlUe +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnActvtDlUe(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnActvtDlUe); + + cellSchd->apisDl->rgSCHDlActvtUe(cell, ue); + RETVOID; +} + +/** + * @brief This API is invoked to indicate scheduler of a CRC indication. + * + * @details + * + * Function : rgSCHCmnHdlUlTransInd + * This API is invoked to indicate scheduler of a CRC indication. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo timingInfo + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnHdlUlTransInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHCmnHdlUlTransInd(cell, ue, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo timingInfo; +#endif +{ + TRC2(rgSCHCmnHdlUlTransInd); + + /* Update the latest UL dat/sig transmission time */ + RGSCHCPYTIMEINFO(timingInfo, ue->ul.ulTransTime); + if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) + { + /* Some UL Transmission from this UE. + * Activate this UE if it was inactive */ + RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); + RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); + } + RETVOID; +} + +#ifdef TFU_UPGRADE + +/** + * @brief Compute the minimum Rank based on Codebook subset + * restriction configuration for 4 Tx Ports and Tx Mode 4. + * + * @details + * + * Function : rgSCHCmnComp4TxMode4 + * + * Depending on BitMap set at CBSR during Configuration + * - return the least possible Rank + * + * + * @param[in] U32 *pmiBitMap + * @return RgSchCmnRank + **/ +#ifdef ANSI +PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4 +( + U32 *pmiBitMap + ) +#else +PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode4(pmiBitMap) + U32 *pmiBitMap; +#endif +{ + U32 bitMap0, bitMap1; + TRC2(rgSCHCmnComp4TxMode4); + bitMap0 = pmiBitMap[0]; + bitMap1 = pmiBitMap[1]; + if((bitMap1) & 0xFFFF) + { + RETVALUE (RG_SCH_CMN_RANK_1); + } + else if((bitMap1>>16) & 0xFFFF) + { + RETVALUE (RG_SCH_CMN_RANK_2); + } + else if((bitMap0) & 0xFFFF) + { + RETVALUE (RG_SCH_CMN_RANK_3); + } + else if((bitMap0>>16) & 0xFFFF) + { + RETVALUE (RG_SCH_CMN_RANK_4); + } + else + { + RETVALUE (RG_SCH_CMN_RANK_1); + } +} + + +/** + * @brief Compute the minimum Rank based on Codebook subset + * restriction configuration for 2 Tx Ports and Tx Mode 4. + * + * @details + * + * Function : rgSCHCmnComp2TxMode4 + * + * Depending on BitMap set at CBSR during Configuration + * - return the least possible Rank + * + * + * @param[in] U32 *pmiBitMap + * @return RgSchCmnRank + **/ +#ifdef ANSI +PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4 +( + U32 *pmiBitMap + ) +#else +PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode4(pmiBitMap) + U32 *pmiBitMap; +#endif +{ + U32 bitMap0; + TRC2(rgSCHCmnComp2TxMode4); + bitMap0 = pmiBitMap[0]; + if((bitMap0>>26)& 0x0F) + { + RETVALUE (RG_SCH_CMN_RANK_1); + } + else if((bitMap0>>30) & 3) + { + RETVALUE (RG_SCH_CMN_RANK_2); + } + else + { + RETVALUE (RG_SCH_CMN_RANK_1); + } +} + +/** + * @brief Compute the minimum Rank based on Codebook subset + * restriction configuration for 4 Tx Ports and Tx Mode 3. + * + * @details + * + * Function : rgSCHCmnComp4TxMode3 + * + * Depending on BitMap set at CBSR during Configuration + * - return the least possible Rank + * + * + * @param[in] U32 *pmiBitMap + * @return RgSchCmnRank + **/ +#ifdef ANSI +PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3 +( + U32 *pmiBitMap + ) +#else +PRIVATE RgSchCmnRank rgSCHCmnComp4TxMode3(pmiBitMap) + U32 *pmiBitMap; +#endif +{ + U32 bitMap0; + TRC2(rgSCHCmnComp4TxMode3); + bitMap0 = pmiBitMap[0]; + if((bitMap0>>28)& 1) + { + RETVALUE (RG_SCH_CMN_RANK_1); + } + else if((bitMap0>>29) &1) + { + RETVALUE (RG_SCH_CMN_RANK_2); + } + else if((bitMap0>>30) &1) + { + RETVALUE (RG_SCH_CMN_RANK_3); + } + else if((bitMap0>>31) &1) + { + RETVALUE (RG_SCH_CMN_RANK_4); + } + else + { + RETVALUE (RG_SCH_CMN_RANK_1); + } +} + +/** + * @brief Compute the minimum Rank based on Codebook subset + * restriction configuration for 2 Tx Ports and Tx Mode 3. + * + * @details + * + * Function : rgSCHCmnComp2TxMode3 + * + * Depending on BitMap set at CBSR during Configuration + * - return the least possible Rank + * + * + * @param[in] U32 *pmiBitMap + * @return RgSchCmnRank + **/ +#ifdef ANSI +PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3 +( + U32 *pmiBitMap + ) +#else +PRIVATE RgSchCmnRank rgSCHCmnComp2TxMode3(pmiBitMap) + U32 *pmiBitMap; +#endif +{ + U32 bitMap0; + TRC2(rgSCHCmnComp2TxMode3); + bitMap0 = pmiBitMap[0]; + if((bitMap0>>30)& 1) + { + RETVALUE (RG_SCH_CMN_RANK_1); + } + else if((bitMap0>>31) &1) + { + RETVALUE (RG_SCH_CMN_RANK_2); + } + else + { + RETVALUE (RG_SCH_CMN_RANK_1); + } +} + +/** + * @brief Compute the minimum Rank based on Codebook subset + * restriction configuration. + * + * @details + * + * Function : rgSCHCmnComputeRank + * + * Depending on Num Tx Ports and Transmission mode + * - return the least possible Rank + * + * + * @param[in] RgrTxMode txMode + * @param[in] U32 *pmiBitMap + * @param[in] U8 numTxPorts + * @return RgSchCmnRank + **/ +#ifdef ANSI +PRIVATE RgSchCmnRank rgSCHCmnComputeRank +( + RgrTxMode txMode, + U32 *pmiBitMap, + U8 numTxPorts + ) +#else +PRIVATE RgSchCmnRank rgSCHCmnComputeRank(txMode, pmiBitMap, numTxPorts) + RgrTxMode txMode; + U32 *pmiBitMap; + U8 numTxPorts; +#endif +{ + TRC2(rgSCHCmnComputeRank); + + if (numTxPorts ==2 && txMode == RGR_UE_TM_3) + { + RETVALUE (rgSCHCmnComp2TxMode3(pmiBitMap)); + } + else if (numTxPorts ==4 && txMode == RGR_UE_TM_3) + { + RETVALUE (rgSCHCmnComp4TxMode3(pmiBitMap)); + } + else if (numTxPorts ==2 && txMode == RGR_UE_TM_4) + { + RETVALUE (rgSCHCmnComp2TxMode4(pmiBitMap)); + } + else if (numTxPorts ==4 && txMode == RGR_UE_TM_4) + { + RETVALUE (rgSCHCmnComp4TxMode4(pmiBitMap)); + } + else + { + RETVALUE (RG_SCH_CMN_RANK_1); + } +} + +#endif + +/** + * @brief Harq Entity Deinitialization for CMN SCH. + * + * @details + * + * Function : rgSCHCmnDlDeInitHqEnt + * + * Harq Entity Deinitialization for CMN SCH + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlHqEnt *hqE + * @return VOID + **/ +/*KWORK_FIX:Changed function return type to void */ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlDeInitHqEnt +( +RgSchCellCb *cell, +RgSchDlHqEnt *hqE +) +#else +PUBLIC Void rgSCHCmnDlDeInitHqEnt(cell, hqE) +RgSchCellCb *cell; +RgSchDlHqEnt *hqE; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + RgSchDlHqProcCb *hqP; + U8 cnt; + S16 ret; + + TRC2(rgSCHCmnDlDeInitHqEnt); + + ret = cellSchd->apisDl->rgSCHDlUeHqEntDeInit(cell, hqE); + /* Free only If the Harq proc are created*/ + if(RFAILED == ret) + { + } + + for(cnt = 0; cnt < hqE->numHqPrcs; cnt++) + { + hqP = &hqE->procs[cnt]; + if ((RG_SCH_CMN_GET_DL_HQP(hqP))) + { + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(hqP->sch)), (sizeof(RgSchCmnDlHqProc))); + } + } +#ifdef LTE_ADV + rgSCHLaaDeInitDlHqProcCb (cell, hqE); +#endif + + RETVOID; +} + +/** + * @brief Harq Entity initialization for CMN SCH. + * + * @details + * + * Function : rgSCHCmnDlInitHqEnt + * + * Harq Entity initialization for CMN SCH + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnDlInitHqEnt +( +RgSchCellCb *cell, +RgSchDlHqEnt *hqEnt +) +#else +PUBLIC S16 rgSCHCmnDlInitHqEnt(cell, hqEnt) +RgSchCellCb *cell; +RgSchDlHqEnt *hqEnt; +#endif + +{ + RgSchDlHqProcCb *hqP; + U8 cnt; + + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnDlInitHqEnt); + + for(cnt = 0; cnt < hqEnt->numHqPrcs; cnt++) + { + hqP = &hqEnt->procs[cnt]; + if (rgSCHUtlAllocSBuf(cell->instIdx, + (Data**)&(hqP->sch), (sizeof(RgSchCmnDlHqProc))) != ROK) + { + RETVALUE(RFAILED); + } + } +#ifdef EMTC_ENABLE + if((cell->emtcEnable) &&(hqEnt->ue->isEmtcUe)) + { + if(ROK != cellSchd->apisEmtcDl->rgSCHDlUeHqEntInit(cell, hqEnt)) + { + RETVALUE(RFAILED); + } + + } + else +#endif + { + if(ROK != cellSchd->apisDl->rgSCHDlUeHqEntInit(cell, hqEnt)) + { + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); +} /* rgSCHCmnDlInitHqEnt */ + +/** + * @brief This function computes distribution of refresh period + * + * @details + * + * Function: rgSCHCmnGetRefreshDist + * Purpose: This function computes distribution of refresh period + * This is required to align set of UEs refresh + * around the different consecutive subframe. + * + * Invoked by: rgSCHCmnGetRefreshPerDist + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnGetRefreshDist +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE U8 rgSCHCmnGetRefreshDist(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + U8 refOffst; +#ifdef DEBUGP + Inst inst = cell->instIdx; +#endif + TRC2(rgSCHCmnGetRefreshDist); + + for(refOffst = 0; refOffst < RGSCH_MAX_REFRESH_OFFSET; refOffst++) + { + if(cell->refreshUeCnt[refOffst] < RGSCH_MAX_REFRESH_GRPSZ) + { + cell->refreshUeCnt[refOffst]++; + ue->refreshOffset = refOffst; + /* printf("UE[%d] refresh offset[%d]. Cell refresh ue count[%d].\n", ue->ueId, refOffst, cell->refreshUeCnt[refOffst]); */ + RETVALUE(refOffst); + } + } + + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Allocation of refresh distribution failed\n")); + /* We should not enter here normally, but incase of failure, allocating from last offset*/ + cell->refreshUeCnt[refOffst-1]++; + ue->refreshOffset = refOffst-1; + + RETVALUE(refOffst-1); +} +/** + * @brief This function computes initial Refresh Wait Period. + * + * @details + * + * Function: rgSCHCmnGetRefreshPer + * Purpose: This function computes initial Refresh Wait Period. + * This is required to align multiple UEs refresh + * around the same time. + * + * Invoked by: rgSCHCmnGetRefreshPer + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 *waitPer + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGetRefreshPer +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 *waitPer +) +#else +PRIVATE Void rgSCHCmnGetRefreshPer(cell, ue, waitPer) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 *waitPer; +#endif +{ + U32 refreshPer; + U32 crntSubFrm; + + TRC2(rgSCHCmnGetRefreshPer); + + refreshPer = RG_SCH_CMN_REFRESH_TIME * RG_SCH_CMN_REFRESH_TIMERES; + crntSubFrm = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.subframe; + /* Fix: syed align multiple UEs to refresh at same time */ + *waitPer = refreshPer - (crntSubFrm % refreshPer); + *waitPer = RGSCH_CEIL(*waitPer, RG_SCH_CMN_REFRESH_TIMERES); + *waitPer = *waitPer + rgSCHCmnGetRefreshDist(cell, ue); + + RETVOID; +} + + +#ifdef LTE_ADV +/** + * @brief UE initialisation for scheduler. + * + * @details + * + * Function : rgSCHCmnRgrSCellUeCfg + * + * This functions intialises UE specific scheduler + * information for SCELL + * 0. Perform basic validations + * 1. Allocate common sched UE cntrl blk + * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks) + * 3. Perform UL cfg + * 4. Perform DLFS cfg + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrSCellUeCfg +( +RgSchCellCb *sCell, +RgSchUeCb *ue, +RgrUeSecCellCfg *sCellInfoCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrSCellUeCfg(sCell, ue, sCellInfoCfg, err) +RgSchCellCb *sCell; +RgSchUeCb *ue; +RgrUeSecCellCfg *sCellInfoCfg; +RgSchErrInfo *err; +#endif +{ + U8 i; + S16 ret; + U8 cnt; + RgSchCmnAllocRecord *allRcd; + RgSchDlRbAlloc *allocInfo; + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell); + RgSchCmnUlUe *ueUl; + RgSchCmnUlUe *ueUlPcell; + RgSchCmnUe *pCellUeSchCmn; + RgSchCmnUe *ueSchCmn; + RgSchCmnDlUe *ueDl; + RgSchCmnDlUe *pCellUeDl; +#ifdef DEBUGP + Inst inst = ue->cell->instIdx; +#endif + U32 idx = (U8)((sCell->cellId - rgSchCb[sCell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); + TRC2(rgSCHCmnRgrSCellUeCfg); + + pCellUeSchCmn = RG_SCH_CMN_GET_UE(ue,ue->cell); + pCellUeDl = &pCellUeSchCmn->dl; + + /* 1. Allocate Common sched control block */ + if((rgSCHUtlAllocSBuf(sCell->instIdx, + (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK)) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Memory allocation FAILED\n")); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ueSchCmn = RG_SCH_CMN_GET_UE(ue,sCell); + + /*2. Perform UEs downlink configuration */ + ueDl = &ueSchCmn->dl; + + /*CA TODO*/ + ueDl->mimoInfo = pCellUeDl->mimoInfo; + + if ((ue->mimoInfo.txMode == RGR_UE_TM_4) || + (ue->mimoInfo.txMode == RGR_UE_TM_6)) + { + RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_NO_PMI); + } + if (ue->mimoInfo.txMode == RGR_UE_TM_3) + { + RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_RI_1); + } + RGSCH_ARRAY_BOUND_CHECK(sCell->instIdx, rgUeCatTbl, pCellUeSchCmn->cmn.ueCat); + ueDl->maxTbBits = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlTbBits; + /*CA dev-Start*/ + U8 ri = 0; + ri = RGSCH_MIN(ri, sCell->numTxAntPorts); + if(((CM_LTE_UE_CAT_6 == pCellUeSchCmn->cmn.ueCat ) + ||(CM_LTE_UE_CAT_7 == pCellUeSchCmn->cmn.ueCat)) + && (4 == ri)) + { + ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[1]; + } + else + { + ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[0]; + } + /*CA dev-End*/ + /* Fix : syed Assign hqEnt to UE only if msg4 is done */ +#ifdef LTE_TDD + ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/ + rgSchTddDlNumHarqProcTbl[sCell->ulDlCfgIdx]); +#else + ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/ + RGSCH_NUM_DL_HQ_PROC); +#endif +#ifdef EMTC_ENABLE + rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, ue->isEmtcUe); +#else + rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, FALSE); +#endif + + /* DL ambr */ + /* ambrCfgd config moved to ueCb.dl, as it's not needed for per cell wise*/ + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, sCell); + allocInfo->rnti = ue->ueId; + + /* Initializing the lastCfi value to current cfi value */ + ueDl->lastCfi = cellSchd->dl.currCfi; + + if ((cellSchd->apisDl->rgSCHRgrSCellDlUeCfg(sCell, ue, err)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Spec Sched DL UE CFG FAILED\n")); + RETVALUE(RFAILED); + } + + /* TODO: enhance for DLFS RB Allocation for SCELLs in future dev */ + + /* DLFS UE Config */ + if (cellSchd->dl.isDlFreqSel) + { + if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeCfg(sCell, ue, sCellInfoCfg, err)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "DLFS UE config FAILED\n")); + RETVALUE(RFAILED); + } + } + + /* TODO: Do UL SCELL CFG during UL CA dev */ + { + ueUl = RG_SCH_CMN_GET_UL_UE(ue, sCell); + + /* TODO_ULCA: SRS for SCELL needs to be handled in the below function call */ + rgSCHCmnUpdUeUlCqiInfo(sCell, ue, ueUl, ueSchCmn, cellSchd, + sCell->isCpUlExtend); + + ret = rgSCHUhmHqEntInit(sCell, ue); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId,"SCELL UHM HARQ Ent Init " + "Failed for CRNTI:%d", ue->ueId); + RETVALUE(RFAILED); + } + + ueUlPcell = RG_SCH_CMN_GET_UL_UE(ue, ue->cell); + /* Initialize uplink HARQ related information for UE */ + ueUl->hqEnt.maxHqRetx = ueUlPcell->hqEnt.maxHqRetx; + cmLListInit(&ueUl->hqEnt.free); + cmLListInit(&ueUl->hqEnt.inUse); + for(i=0; i < ueUl->hqEnt.numHqPrcs; i++) + { + ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt); + ueUl->hqEnt.hqProcCb[i].procId = i; + ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO; + ueUl->hqEnt.hqProcCb[i].alloc = NULLP; +#ifdef LTEMAC_SPS + /* ccpu00139513- Initializing SPS flags*/ + ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE; + ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE; +#endif + cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk); + ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i]; + } + + /* Allocate UL BSR allocation tracking List */ + cmLListInit(&ueUl->ulAllocLst); + + for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++) + { + if((rgSCHUtlAllocSBuf(sCell->instIdx, + (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId,"SCELL Memory allocation FAILED" + "for CRNTI:%d",ue->ueId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + allRcd->allocTime = sCell->crntTime; + cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk); + allRcd->lnk.node = (PTR)allRcd; + } + + /* After initialising UL part, do power related init */ + ret = rgSCHPwrUeSCellCfg(sCell, ue, sCellInfoCfg); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Could not do " + "power config for UE CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Spec Sched UL UE CFG FAILED" + "for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + else +#endif + { + if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,sCell->cellId, "Spec Sched UL UE CFG FAILED" + "for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + + ue->ul.isUlCaEnabled = TRUE; + } + + RETVALUE(ROK); +} /* rgSCHCmnRgrSCellUeCfg */ + + +/** + * @brief UE initialisation for scheduler. + * + * @details + * + * Function : rgSCHCmnRgrSCellUeDel + * + * This functions Delete UE specific scheduler + * information for SCELL + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrSCellUeDel +( +RgSchUeCellInfo *sCellInfo, +RgSchUeCb *ue +) +#else +PUBLIC S16 rgSCHCmnRgrSCellUeDel(sCellInfo, ue) +RgSchUeCellInfo *sCellInfo; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell); + Inst inst = ue->cell->instIdx; + + TRC2(rgSCHCmnRgrSCellUeDel); + + cellSchd->apisDl->rgSCHRgrSCellDlUeDel(sCellInfo, ue); + + /* UL CA */ + rgSCHCmnUlUeDelAllocs(sCellInfo->cell, ue); + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + cellSchd->apisEmtcUl->rgSCHFreeUlUe(sCellInfo->cell, ue); + } + else +#endif + { + cellSchd->apisUl->rgSCHFreeUlUe(sCellInfo->cell, ue); + } + + /* DLFS UE Config */ + if (cellSchd->dl.isDlFreqSel) + { + if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeDel(sCellInfo->cell, ue)) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "DLFS Scell del FAILED\n")); + RETVALUE(RFAILED); + } + } + + rgSCHUtlFreeSBuf(sCellInfo->cell->instIdx, + (Data**)(&(sCellInfo->sch)), (sizeof(RgSchCmnUe))); + + + RETVALUE(ROK); +} /* rgSCHCmnRgrSCellUeDel */ + +#endif + +#ifdef RG_5GTF +/** + * @brief Handles 5gtf configuration for a UE + * + * @details + * + * Function : rgSCHCmn5gtfUeCfg + * + * Processing Steps: + * + * - Return ROK + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeCfg *cfg + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmn5gtfUeCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCfg *cfg +) +#else +PUBLIC S16 rgSCHCmn5gtfUeCfg(cell, ue, cfg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeCfg *cfg; +#endif +{ + TRC2(rgSCHCmnRgrUeCfg); + + RgSchUeGrp *ue5gtfGrp; + ue->ue5gtfCb.grpId = cfg->ue5gtfCfg.grpId; + ue->ue5gtfCb.BeamId = cfg->ue5gtfCfg.BeamId; + ue->ue5gtfCb.numCC = cfg->ue5gtfCfg.numCC; + ue->ue5gtfCb.mcs = cfg->ue5gtfCfg.mcs; + ue->ue5gtfCb.maxPrb = cfg->ue5gtfCfg.maxPrb; + + ue->ue5gtfCb.cqiRiPer = 100; + /* 5gtf TODO: CQIs to start from (10,0)*/ + ue->ue5gtfCb.nxtCqiRiOccn.sfn = 10; + ue->ue5gtfCb.nxtCqiRiOccn.subframe = 0; + ue->ue5gtfCb.rank = 1; + + printf("\nschd cfg at mac,%u,%u,%u,%u,%u\n",ue->ue5gtfCb.grpId,ue->ue5gtfCb.BeamId,ue->ue5gtfCb.numCC, + ue->ue5gtfCb.mcs,ue->ue5gtfCb.maxPrb); + + ue5gtfGrp = &(cell->cell5gtfCb.ueGrp5gConf[ue->ue5gtfCb.BeamId]); + + /* TODO_5GTF: Currently handling 1 group only. Need to update when multi group + scheduling comes into picture */ + if(ue5gtfGrp->beamBitMask & (1 << ue->ue5gtfCb.BeamId)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "5GTF_ERROR Invalid beam id CRNTI:%d",cfg->crnti); + RETVALUE(RFAILED); + } + ue5gtfGrp->beamBitMask |= (1 << ue->ue5gtfCb.BeamId); + + RETVALUE(ROK); +} +#endif + +/** + * @brief UE initialisation for scheduler. + * + * @details + * + * Function : rgSCHCmnRgrUeCfg + * + * This functions intialises UE specific scheduler + * information + * 0. Perform basic validations + * 1. Allocate common sched UE cntrl blk + * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks) + * 3. Perform UL cfg + * 4. Perform DLFS cfg + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeCfg *ueCfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrUeCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCfg *ueCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrUeCfg(cell, ue, ueCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeCfg *ueCfg; +RgSchErrInfo *err; +#endif +{ + RgSchDlRbAlloc *allocInfo; + S16 ret; + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUe *ueSchCmn; + RgSchCmnUlUe *ueUl; + RgSchCmnDlUe *ueDl; + U8 cnt; + RgSchCmnAllocRecord *allRcd; + U32 waitPer; + U32 idx = (U8)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); + RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); + TRC2(rgSCHCmnRgrUeCfg); + + + /* 1. Allocate Common sched control block */ + if((rgSCHUtlAllocSBuf(cell->instIdx, + (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Memory allocation FAILED for CRNTI:%d",ueCfg->crnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); + ue->dl.ueDlCqiCfg = ueCfg->ueDlCqiCfg; + pCellInfo->acqiCb.aCqiCfg = ueCfg->ueDlCqiCfg.aprdCqiCfg; + if(ueCfg->ueCatEnum > 0 ) + { + /*KWORK_FIX removed NULL chk for ueSchCmn*/ + ueSchCmn->cmn.ueCat = ueCfg->ueCatEnum - 1; + } + else + { + ueSchCmn->cmn.ueCat = 0; /* Assuming enum values correctly set */ + } + cmInitTimers(&ueSchCmn->cmn.tmr, 1); + + /*2. Perform UEs downlink configuration */ + ueDl = &ueSchCmn->dl; + /* RACHO : store the rapId assigned for HandOver UE. + * Append UE to handover list of cmnCell */ + if (ueCfg->dedPreambleId.pres == PRSNT_NODEF) + { + rgSCHCmnDelDedPreamble(cell, ueCfg->dedPreambleId.val); + ueDl->rachInfo.hoRapId = ueCfg->dedPreambleId.val; + cmLListAdd2Tail(&cellSchd->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk); + ueDl->rachInfo.hoLnk.node = (PTR)ue; + } + + rgSCHCmnUpdUeMimoInfo(ueCfg, ueDl, cell, cellSchd); + + if (ueCfg->txMode.pres == TRUE) + { + if ((ueCfg->txMode.txModeEnum == RGR_UE_TM_4) || + (ueCfg->txMode.txModeEnum == RGR_UE_TM_6)) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); + } + if (ueCfg->txMode.txModeEnum == RGR_UE_TM_3) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } + } + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat); + ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits; + /*CA dev-Start*/ + U8 ri = 0; + ri = RGSCH_MIN(ri, cell->numTxAntPorts); + if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat ) + ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat)) + && (4 == ri)) + { + ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1]; + } + else + { + ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0]; + } + /*CA dev-End*/ + /* Fix : syed Assign hqEnt to UE only if msg4 is done */ +#ifdef LTE_TDD + ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ + rgSchTddDlNumHarqProcTbl[cell->ulDlCfgIdx]); +#else + ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ + RGSCH_NUM_DL_HQ_PROC); +#endif +#ifdef EMTC_ENABLE + rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe); +#else + rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE); +#endif + /* if none of the DL and UL AMBR are configured then fail the configuration + */ + if((ueCfg->ueQosCfg.dlAmbr == 0) && (ueCfg->ueQosCfg.ueBr == 0)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"UL Ambr and DL Ambr are" + "configured as 0 for CRNTI:%d",ueCfg->crnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + /* DL ambr */ + ue->dl.ambrCfgd = (ueCfg->ueQosCfg.dlAmbr * RG_SCH_CMN_REFRESH_TIME)/100; + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell); + allocInfo->rnti = ue->ueId; + + /* Initializing the lastCfi value to current cfi value */ + ueDl->lastCfi = cellSchd->dl.currCfi; +#ifdef EMTC_ENABLE + if(cell->emtcEnable && ue->isEmtcUe) + { + if ((cellSchd->apisEmtcDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + + } + else +#endif + { + if ((cellSchd->apisDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + } + + + + /* 3. Initialize ul part */ + ueUl = &ueSchCmn->ul; + + rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, + cell->isCpUlExtend); + + ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \ + RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8); + + ue->ul.cfgdAmbr = (ueCfg->ueQosCfg.ueBr * RG_SCH_CMN_REFRESH_TIME)/100; + ue->ul.effAmbr = ue->ul.cfgdAmbr; + RGSCHCPYTIMEINFO(cell->crntTime, ue->ul.ulTransTime); + + /* Allocate UL BSR allocation tracking List */ + cmLListInit(&ueUl->ulAllocLst); + + for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++) + { + if((rgSCHUtlAllocSBuf(cell->instIdx, + (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED" + "for CRNTI:%d",ueCfg->crnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + allRcd->allocTime = cell->crntTime; + cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk); + allRcd->lnk.node = (PTR)allRcd; + } + /* Allocate common sch cntrl blocks for LCGs */ + for (cnt=0; cntinstIdx, + (Data**)&(ue->ul.lcgArr[cnt].sch), (sizeof(RgSchCmnLcg))); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "SCH struct alloc failed for CRNTI:%d",ueCfg->crnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + } + /* After initialising UL part, do power related init */ + ret = rgSCHPwrUeCfg(cell, ue, ueCfg); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not do " + "power config for UE CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } +#ifdef LTEMAC_SPS + ret = rgSCHCmnSpsUeCfg(cell, ue, ueCfg, err); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not do " + "SPS config for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } +#endif /* LTEMAC_SPS */ + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Spec Sched UL UE CFG FAILED" + "for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + } + else +#endif + { + if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Spec Sched UL UE CFG FAILED" + "for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + } + + /* DLFS UE Config */ + if (cellSchd->dl.isDlFreqSel) + { + if ((cellSchd->apisDlfs->rgSCHDlfsUeCfg(cell, ue, ueCfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "DLFS UE config FAILED" + "for CRNTI:%d",ueCfg->crnti); + RETVALUE(RFAILED); + } + } + + /* Fix: syed align multiple UEs to refresh at same time */ + rgSCHCmnGetRefreshPer(cell, ue, &waitPer); + /* Start UE Qos Refresh Timer */ + rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer); +#ifdef RG_5GTF + rgSCHCmn5gtfUeCfg(cell, ue, ueCfg); +#endif + + RETVALUE(ROK); +} /* rgSCHCmnRgrUeCfg */ + +/** + * @brief UE TX mode reconfiguration handler. + * + * @details + * + * Function : rgSCHCmnDlHdlTxModeRecfg + * + * This functions updates UE specific scheduler + * information upon UE reconfiguration. + * + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeRecfg *ueRecfg + * @return Void + **/ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +U8 numTxPorts +) +#else +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg, numTxPorts) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +U8 numTxPorts; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg +) +#else +PRIVATE Void rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlHdlTxModeRecfg); + + if (ueRecfg->txMode.pres != PRSNT_NODEF) + { + RETVOID; + } + /* ccpu00140894- Starting Timer for TxMode Transition Completion*/ + ue->txModeTransCmplt =FALSE; + rgSCHTmrStartTmr (ue->cell, ue, RG_SCH_TMR_TXMODE_TRNSTN, RG_SCH_TXMODE_TRANS_TIMER); + if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_CMPLT) + { + RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, + RG_SCH_CMN_TD_TXMODE_RECFG); + /* MS_WORKAROUND for ccpu00123186 MIMO Fix Start: need to set FORCE TD bitmap based on TX mode */ + ueDl->mimoInfo.ri = 1; + if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) || + (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6)) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); + } + if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } + /* MIMO Fix End: need to set FORCE TD bitmap based on TX mode */ + RETVOID; + } + if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_START) + { + /* start afresh forceTD masking */ + RG_SCH_CMN_INIT_FORCE_TD(ue, cell, 0); + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_TXMODE_RECFG); + /* Intialize MIMO related parameters of UE */ + +#ifdef TFU_UPGRADE + if(ueRecfg->txMode.pres) + { + if((ueRecfg->txMode.txModeEnum ==RGR_UE_TM_3) || + (ueRecfg->txMode.txModeEnum ==RGR_UE_TM_4)) + { + if(ueRecfg->ueCodeBookRstRecfg.pres) + { + ueDl->mimoInfo.ri = + rgSCHCmnComputeRank(ueRecfg->txMode.txModeEnum, + ueRecfg->ueCodeBookRstRecfg.pmiBitMap, numTxPorts); + } + else + { + ueDl->mimoInfo.ri = 1; + } + } + else + { + ueDl->mimoInfo.ri = 1; + } + } + else + { + ueDl->mimoInfo.ri = 1; + } +#else + ueDl->mimoInfo.ri = 1; +#endif /* TFU_UPGRADE */ + if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) || + (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6)) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); + } + if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3) + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } + RETVOID; + } +} +/*********************************************************** + * + * Func : rgSCHCmnUpdUeMimoInfo + * + * Desc : Updates UL and DL Ue Information + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdUeMimoInfo +( +RgrUeCfg *ueCfg, +RgSchCmnDlUe *ueDl, +RgSchCellCb *cell, +RgSchCmnCell *cellSchd +) +#else +PRIVATE Void rgSCHCmnUpdUeMimoInfo(ueCfg, ueDl, cell, cellSchd) +RgrUeCfg *ueCfg; +RgSchCmnDlUe *ueDl; +RgSchCellCb *cell; +RgSchCmnCell *cellSchd; +#endif +{ + TRC2(rgSCHCmnUpdUeMimoInfo) +#ifdef TFU_UPGRADE + if(ueCfg->txMode.pres) + { + if((ueCfg->txMode.txModeEnum ==RGR_UE_TM_3) || + (ueCfg->txMode.txModeEnum ==RGR_UE_TM_4)) + { + if(ueCfg->ueCodeBookRstCfg.pres) + { + ueDl->mimoInfo.ri = + rgSCHCmnComputeRank(ueCfg->txMode.txModeEnum, + ueCfg->ueCodeBookRstCfg.pmiBitMap, cell->numTxAntPorts); + } + else + { + ueDl->mimoInfo.ri = 1; + } + } + else + { + ueDl->mimoInfo.ri = 1; + } + } + else + { + ueDl->mimoInfo.ri = 1; + } + +#else + ueDl->mimoInfo.ri = 1; +#endif /*TFU_UPGRADE */ + ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi; + ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi; + + RETVOID; +} +/*********************************************************** + * + * Func : rgSCHCmnUpdUeUlCqiInfo + * + * Desc : Updates UL and DL Ue Information + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdUeUlCqiInfo +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchCmnUlUe *ueUl, +RgSchCmnUe *ueSchCmn, +RgSchCmnCell *cellSchd, +Bool isEcp +) +#else +PRIVATE Void rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd, isEcp) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchCmnUlUe *ueUl; +RgSchCmnUe *ueSchCmn; +RgSchCmnCell *cellSchd; +Bool isEcp; +#endif +{ + + TRC2(rgSCHCmnUpdUeUlCqiInfo) + +#ifdef TFU_UPGRADE + if(ue->srsCb.srsCfg.type == RGR_SCH_SRS_SETUP) + { + if(ue->ul.ulTxAntSel.pres) + { + ueUl->crntUlCqi[ue->srsCb.selectedAnt] = cellSchd->ul.dfltUlCqi; + ueUl->validUlCqi = ueUl->crntUlCqi[ue->srsCb.selectedAnt]; + } + else + { + ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi; + ueUl->validUlCqi = ueUl->crntUlCqi[0]; + } + ue->validTxAnt = ue->srsCb.selectedAnt; + } + else + { + ueUl->validUlCqi = cellSchd->ul.dfltUlCqi; + ue->validTxAnt = 0; + } +#ifdef UL_LA + ueUl->ulLaCb.cqiBasediTbs = rgSchCmnUlCqiToTbsTbl[isEcp] + [ueUl->validUlCqi] * 100; + ueUl->ulLaCb.deltaiTbs = 0; +#endif + +#else + ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi; +#endif /*TFU_UPGRADE */ + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat); + if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE) + { + ueUl->maxUlCqi = cellSchd->ul.max16qamCqi; + } + else + { + ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1; + } + + RETVOID; +} +/*********************************************************** + * + * Func : rgSCHCmnUpdUeCatCfg + * + * Desc : Updates UL and DL Ue Information + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdUeCatCfg +( +RgSchUeCb *ue, +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnUpdUeCatCfg(ue, cell) +RgSchUeCb *ue; +RgSchCellCb *cell; +#endif +{ + RgSchDlHqEnt *hqE = NULLP; + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell); + RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnUpdUeCatCfg) + + ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits; + + hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell); + /*CA dev-Start*/ + U8 ri = 0; + ri = RGSCH_MIN(ri, cell->numTxAntPorts); + if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat ) + ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat)) + && (RG_SCH_MAX_TX_LYRS_4 == ri)) + { + ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1]; + } + else + { + ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0]; + } + /*CA dev-End*/ + ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/ + hqE->numHqPrcs); + if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE) + { + ueUl->maxUlCqi = cellSchd->ul.max16qamCqi; + } + else + { + ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1; + } + ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \ + RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8); + RETVOID; +} + +/** + * @brief UE reconfiguration for scheduler. + * + * @details + * + * Function : rgSChCmnRgrUeRecfg + * + * This functions updates UE specific scheduler + * information upon UE reconfiguration. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrUeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrUeRecfg(cell, ue, ueRecfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell); + U32 waitPer; + + TRC2(rgSCHCmnRgrUeRecfg); + /* Basic validations */ + if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) + { +#ifdef TFU_UPGRADE + rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg, cell->numTxAntPorts); +#else + rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg); +#endif /* TFU_UPGRADE */ + } + if(ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG) + { + ue->csgMmbrSta = ueRecfg->csgMmbrSta; + } + /* Changes for UE Category reconfiguration feature */ + if(ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG) + { + rgSCHCmnUpdUeCatCfg(ue, cell); + } + if (ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG) + { + RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue); + pCellInfo->acqiCb.aCqiCfg = ueRecfg->aprdDlCqiRecfg; + } +#ifndef TFU_UPGRADE + if (ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) + { + if ((ueRecfg->prdDlCqiRecfg.pres == TRUE) + && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD10) + && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD20)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Unsupported periodic CQI " + "reporting mode %d for old CRNIT:%d", + (int)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->oldCrnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ue->dl.ueDlCqiCfg.prdCqiCfg = ueRecfg->prdDlCqiRecfg; + } +#endif + + if (ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG) + { + if (rgSCHPwrUeRecfg(cell, ue, ueRecfg) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Power Reconfiguration Failed for OLD CRNTI:%d",ueRecfg->oldCrnti); + RETVALUE(RFAILED); + } + } + + if (ueRecfg->ueRecfgTypes & RGR_UE_QOS_RECFG) + { + /* Uplink Sched related Initialization */ + if ((ueRecfg->ueQosRecfg.dlAmbr == 0) && (ueRecfg->ueQosRecfg.ueBr == 0)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Ul Ambr and DL Ambr " + "configured as 0 for OLD CRNTI:%d",ueRecfg->oldCrnti); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ue->ul.cfgdAmbr = (ueRecfg->ueQosRecfg.ueBr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + /* Downlink Sched related Initialization */ + ue->dl.ambrCfgd = (ueRecfg->ueQosRecfg.dlAmbr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + /* Fix: syed Update the effAmbr and effUeBR fields w.r.t the + * new QOS configuration */ + rgSCHCmnDelUeFrmRefreshQ(cell, ue); + /* Fix: syed align multiple UEs to refresh at same time */ + rgSCHCmnGetRefreshPer(cell, ue, &waitPer); + rgSCHCmnApplyUeRefresh(cell, ue); + rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer); + } +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + if ((cellSchCmn->apisEmtcUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + if ((cellSchCmn->apisEmtcDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + else +#endif + { + if ((cellSchCmn->apisUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + if ((cellSchCmn->apisDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + /* DLFS UE Config */ + if (cellSchCmn->dl.isDlFreqSel) + { + if ((cellSchCmn->apisDlfs->rgSCHDlfsUeRecfg(cell, ue, \ + ueRecfg, err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "DLFS UE re-config FAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + +#ifdef LTEMAC_SPS + /* Invoke re-configuration on SPS module */ + if (rgSCHCmnSpsUeRecfg(cell, ue, ueRecfg, err) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "DL SPS ReCFG FAILED for UE CRNTI:%d", ue->ueId); + RETVALUE(RFAILED); + } +#endif + + RETVALUE(ROK); +} /* rgSCHCmnRgrUeRecfg*/ + +/*********************************************************** + * + * Func : rgSCHCmnUlUeDelAllocs + * + * Desc : Deletion of all UE allocations. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlUeDelAllocs +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnUlUeDelAllocs(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + U8 i; +#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); +#endif + TRC2(rgSCHCmnUlUeDelAllocs); + + for (i = 0; i < ueUl->hqEnt.numHqPrcs; ++i) + { + RgSchUlHqProcCb *proc = rgSCHUhmGetUlHqProc(cell, ue, i); + +#ifdef ERRCLS_KW + /* proc can't be NULL here */ + if (proc) +#endif + { + /* R8 Upgrade */ + proc->ndi = 0; + if (proc->alloc) + { + /* Added Insure Fixes Of reading Dangling memory.NULLed crntAlloc */ +#ifdef LTEMAC_SPS + if(proc->alloc == ulSpsUe->ulSpsSchdInfo.crntAlloc) + { + ulSpsUe->ulSpsSchdInfo.crntAlloc = NULLP; + ulSpsUe->ulSpsSchdInfo.crntAllocSf = NULLP; + } +#endif +#ifdef EMTC_ENABLE + rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx], + proc->alloc,ue->isEmtcUe); +#else + rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx], + proc->alloc); +#endif + /* PHY probably needn't be intimated since + * whatever intimation it needs happens at the last minute + */ + } + /* Fix: syed Adaptive Msg3 Retx crash. Remove the harqProc + * from adaptive retx List. */ + if (proc->reTxLnk.node) + { + { + //TODO_SID: Need to take care + cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); + proc->reTxLnk.node = (PTR)NULLP; + } + } + } + } + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnDelUeFrmRefreshQ + * + * Desc : Adds a UE to refresh queue, so that the UE is + * periodically triggered to refresh it's GBR and + * AMBR values. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDelUeFrmRefreshQ +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnDelUeFrmRefreshQ(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); + CmTmrArg arg; + RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue); + + TRC2(rgSCHCmnDelUeFrmRefreshQ); + +#ifdef RGL_SPECIFIC_CHANGES + if(ue->refreshOffset < RGSCH_MAX_REFRESH_GRPSZ) + { + if(cell->refreshUeCnt[ue->refreshOffset]) + { + cell->refreshUeCnt[ue->refreshOffset]--; + } + } +#endif + + + cmMemset((U8 *)&arg, 0, sizeof(arg)); + arg.tqCp = &sched->tmrTqCp; + arg.tq = sched->tmrTq; + arg.timers = &ueSchd->tmr; + arg.cb = (PTR)ue; + arg.tNum = 0; + arg.max = 1; + arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH; + + cmRmvCbTq(&arg); + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnUeCcchSduDel + * + * Desc : Clear CCCH SDU scheduling context. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUeCcchSduDel +( +RgSchCellCb *cell, +RgSchUeCb *ueCb +) +#else +PRIVATE Void rgSCHCmnUeCcchSduDel(cell, ueCb) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +#endif +{ + RgSchDlHqEnt *hqE = NULLP; + RgSchDlHqProcCb *ccchSduHqP = NULLP; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnUeCcchSduDel); + + hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell); + if (hqE == NULLP) + { + RETVOID; + } + ccchSduHqP = hqE->ccchSduProc; + if(ueCb->ccchSduLnk.node != NULLP) + { + /* Remove the ccchSduProc if it is in the Tx list */ + cmLListDelFrm(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk)); + ueCb->ccchSduLnk.node = NULLP; + } + else if(ccchSduHqP != NULLP) + { + /* Fix for crash due to stale pdcch. Release ccch pdcch*/ + if(ccchSduHqP->pdcch) + { + cmLListDelFrm(&ccchSduHqP->subFrm->pdcchInfo.pdcchs, + &ccchSduHqP->pdcch->lnk); + cmLListAdd2Tail(&cell->pdcchLst, &ccchSduHqP->pdcch->lnk); + ccchSduHqP->pdcch = NULLP; + } + if(ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node != NULLP) + { + /* Remove the ccchSduProc if it is in the retx list */ + cmLListDelFrm(&cellSch->dl.ccchSduRetxLst, + &ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk); + /* ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node = NULLP; */ + rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE); + } + else if ((ccchSduHqP->subFrm != NULLP) && + (ccchSduHqP->hqPSfLnk.node != NULLP)) + { + rgSCHUtlDlHqPTbRmvFrmTx(ccchSduHqP->subFrm, + ccchSduHqP, 0, FALSE); + rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE); + } + } + RETVOID; +} + + + + +/** + * @brief UE deletion for scheduler. + * + * @details + * + * Function : rgSCHCmnUeDel + * + * This functions deletes all scheduler information + * pertaining to an UE. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUeDel +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUeDel(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchDlHqEnt *hqE = NULLP; + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + CmLList *node; + RgSchCmnAllocRecord *allRcd; + U8 cnt; + RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell); + U32 idx = 0; + TRC2(rgSCHCmnUeDel); + + if (RG_SCH_CMN_GET_UE(ue,cell) == NULLP) + { + /* Common scheduler config has not happened yet */ + RETVOID; + } + hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell); + if(hqE) + { + /* UE Free can be triggered before MSG4 done when dlHqE is not updated */ +#ifdef EMTC_ENABLE + if(ue->isEmtcUe) + { + rgSCHEmtcCmnUeCcchSduDel(cell, ue); + } + else +#endif + { + rgSCHCmnUeCcchSduDel(cell, ue); + } + } + rgSCHCmnDelUeFrmRefreshQ(cell, ue); + + rgSCHCmnUlUeDelAllocs(cell, ue); + + rgSCHCmnDelRachInfo(cell, ue); + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + cellSchCmn->apisEmtcUl->rgSCHFreeUlUe(cell, ue); + } + else +#endif + { + cellSchCmn->apisUl->rgSCHFreeUlUe(cell, ue); + } +#ifdef LTE_ADV + if (ue->numSCells) + { + for(idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++) + { + if(ue->cellInfo[idx] != NULLP) + { + rgSCHSCellDelUeSCell(cell,ue,idx); + } + } + + } +#endif +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + cellSchCmn->apisEmtcDl->rgSCHFreeDlUe(cell, ue); + } + else +#endif + { + cellSchCmn->apisDl->rgSCHFreeDlUe(cell, ue); + } + rgSCHPwrUeDel(cell, ue); + +#ifdef LTEMAC_SPS + rgSCHCmnSpsUeDel(cell, ue); +#endif /* LTEMAC_SPS*/ + + /* CA Dev Start*/ + rgSchCmnDlSfHqDel(ue, cell); + /* CA Dev End*/ + /* DLFS UE delete */ + if (cellSchCmn->dl.isDlFreqSel) + { + cellSchCmn->apisDlfs->rgSCHDlfsUeDel(cell, ue); + } + node = ueUl->ulAllocLst.first; + +/* ccpu00117052 - MOD - Passing double pointer in all the places of + rgSCHUtlFreeSBuf function call for proper NULLP assignment*/ + while(node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + node = node->next; + cmLListDelFrm(&ueUl->ulAllocLst, &allRcd->lnk); + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&allRcd), (sizeof(RgSchCmnAllocRecord))); + } + + for(cnt = 0; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) + { + if (ue->ul.lcgArr[cnt].sch != NULLP) + { + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(ue->ul.lcgArr[cnt].sch)), (sizeof(RgSchCmnLcg))); + } + } + + /* Fix : syed Moved hqEnt deinit to rgSCHCmnDlDeInitHqEnt */ + idx = (U8)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId) & (CM_LTE_MAX_CELLS - 1)); + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch))), (sizeof(RgSchCmnUe))); + RETVOID; +} /* rgSCHCmnUeDel */ + + +/** + * @brief This function handles the common code rate configurations + * done as part of RgrCellCfg/RgrCellRecfg. + * + * @details + * + * Function: rgSCHCmnDlCnsdrCmnRt + * Purpose: This function handles the common code rate configurations + * done as part of RgrCellCfg/RgrCellRecfg. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrDlCmnCodeRateCfg *dlCmnCodeRate + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlCnsdrCmnRt +( +RgSchCellCb *cell, +RgrDlCmnCodeRateCfg *dlCmnCodeRate +) +#else +PRIVATE S16 rgSCHCmnDlCnsdrCmnRt(cell, dlCmnCodeRate) +RgSchCellCb *cell; +RgrDlCmnCodeRateCfg *dlCmnCodeRate; +#endif +{ + RgSchCmnCell *cellDl = RG_SCH_CMN_GET_CELL(cell); + U32 bitsPerRb; + U32 bitsPer2Rb; + U32 bitsPer3Rb; + U8 i, rbNum; + U32 pdcchBits; + + TRC2(rgSCHCmnDlCnsdrCmnRt); + + /* code rate is bits per 1024 phy bits, since modl'n scheme is 2. it is + * bits per 1024/2 REs */ + if (dlCmnCodeRate->bcchPchRaCodeRate != 0) + { + bitsPerRb = ((dlCmnCodeRate->bcchPchRaCodeRate * 2) * + cellDl->dl.noResPerRb[3])/1024; + } + else + { + bitsPerRb = ((RG_SCH_CMN_DEF_BCCHPCCH_CODERATE * 2) * + cellDl->dl.noResPerRb[3])/1024; + } + /* Store bitsPerRb in cellDl->dl to use later to determine + * Number of RBs for UEs with SI-RNTI, P-RNTI and RA-RNTI */ + cellDl->dl.bitsPerRb = bitsPerRb; + /* ccpu00115595 end*/ + /* calculate the ITbs for 2 RBs. Initialize ITbs to MAX value */ + i = 0; + rbNum = 2; + bitsPer2Rb = bitsPerRb * rbNum; + while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer2Rb)) + i++; + + (i <= 1)? (cellDl->dl.cmnChITbs.iTbs2Rbs = 0) : + (cellDl->dl.cmnChITbs.iTbs2Rbs = i-1); + + /* calculate the ITbs for 3 RBs. Initialize ITbs to MAX value */ + i = 0; + rbNum = 3; + bitsPer3Rb = bitsPerRb * rbNum; + while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer3Rb)) + i++; + + (i <= 1)? (cellDl->dl.cmnChITbs.iTbs3Rbs = 0) : + (cellDl->dl.cmnChITbs.iTbs3Rbs = i-1); + + + pdcchBits = 1 + /* Flag for format0/format1a differentiation */ + 1 + /* Localized/distributed VRB assignment flag */ + 5 + /* For mcs */ +#ifndef LTE_TDD + 3 + /* Harq process Id */ +#else + 4 + /* Harq process Id */ + 2 + /* UL Index or DAI */ +#endif + 1 + /* New Data Indicator */ + 2 + /* For RV */ + 2 + /* For tpc */ + 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \ + (cell->bwCfg.dlTotalBw + 1))/2); + /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \ + Since VRB is local */ + /* For TDD consider DAI */ + + /* Convert the pdcchBits to actual pdcchBits required for transmission */ + if (dlCmnCodeRate->pdcchCodeRate != 0) + { + pdcchBits = (pdcchBits * 1024)/dlCmnCodeRate->pdcchCodeRate; + if (pdcchBits <= 288) /* 288 : Num of pdcch bits for aggrLvl=4 */ + { + cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4; + } + else /* 576 : Num of pdcch bits for aggrLvl=8 */ + { + cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL8; + } + } + else + { + cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4; + } + if (dlCmnCodeRate->ccchCqi == 0) + { + RETVALUE(RFAILED); + } + else + { + cellDl->dl.ccchCqi = dlCmnCodeRate->ccchCqi; + } + RETVALUE(ROK); +} + +#ifdef LTE_TDD +/** + * @brief This function handles the configuration of cell for the first + * time by the scheduler. + * + * @details + * + * Function: rgSCHCmnDlRgrCellCfg + * Purpose: Configuration received is stored into the data structures + * Also, update the scheduler with the number of frames of + * RACH preamble transmission. + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgrCellCfg* cfg + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlRgrCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cfg, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHCmnDlRgrCellCfg(cell, cfg, err) +RgSchCellCb *cell; +RgrCellCfg *cfg; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSch; + U8 cp; + U8 sfCount; + U8 numPdcchSym; + U8 noSymPerSlot; + U8 maxDlSubfrms = cell->numDlSubfrms; + U8 splSubfrmIdx = cfg->spclSfCfgIdx; + U8 swPtCnt = 0; + Bool isSplfrm; + RgSchTddSubfrmInfo subfrmInfo = rgSchTddMaxUlSubfrmTbl[cell->ulDlCfgIdx]; + S16 ret; + U8 splSfIdx; + U8 antPortIdx; + U8 numCrs; + U8 cfi; + U8 cfiIdx; + RgSchDlSf *sf; + U8 splSfCfi; + U8 mPhich; + + TRC2(rgSCHCmnDlRgrCellCfg); + + + cellSch = RG_SCH_CMN_GET_CELL(cell); + cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->\ + rachCfg.preambleFormat]; + /*[ccpu00138532]-ADD-fill the Msg4 Harq data */ + cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx; + + /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + + 3 TTI (MAX L1+L2 processing delay at the UE) */ + cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) * + rgSchCmnHarqRtt[cell->ulDlCfgIdx] + 3; + cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; + cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; + if (cfg->maxUePerDlSf == 0) + { + cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; + } + if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti) + { + RETVALUE(RFAILED); + } + + + if (cell->bwCfg.dlTotalBw <= 10) + { + cfiIdx = 1; + numPdcchSym = 2; + } + else + { + cfiIdx = 0; + numPdcchSym = 1; + } + /* DwPTS Scheduling Changes Start */ + cellSch->dl.splSfCfg = splSubfrmIdx; + + if (cfg->isCpDlExtend == TRUE) + { + if((0 == splSubfrmIdx) || (4 == splSubfrmIdx) || + (7 == splSubfrmIdx) || (8 == splSubfrmIdx) + ) + { + cell->splSubfrmCfg.isDlDataAllowed = FALSE; + } + else + { + cell->splSubfrmCfg.isDlDataAllowed = TRUE; + } + } + else + { + /* Refer to 36.213 Section 7.1.7 */ + if((0 == splSubfrmIdx) || (5 == splSubfrmIdx)) + { + cell->splSubfrmCfg.isDlDataAllowed = FALSE; + } + else + { + cell->splSubfrmCfg.isDlDataAllowed = TRUE; + } + } + /* DwPTS Scheduling Changes End */ + + splSfCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi); + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi); + + for (sfCount = 0; sfCount < maxDlSubfrms; sfCount++) + { + sf = cell->subFrms[sfCount]; + /* Sfcount matches the first special subframe occurs at Index 0 + * or subsequent special subframes */ + if(subfrmInfo.switchPoints == 1) + { + isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount, + RG_SCH_CMN_10_MS_PRD, &subfrmInfo); + } + else + { + isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount, + RG_SCH_CMN_5_MS_PRD, &subfrmInfo); + } + if(isSplfrm == TRUE) + { + swPtCnt++; + /* DwPTS Scheduling Changes Start */ + if (cell->splSubfrmCfg.isDlDataAllowed == TRUE) + { + sf->sfType = RG_SCH_SPL_SF_DATA; + } + else + { + sf->sfType = RG_SCH_SPL_SF_NO_DATA; + } + /* DwPTS Scheduling Changes End */ + } + else + { + /* DwPTS Scheduling Changes Start */ + if (sf->sfNum != 0) + { + sf->sfType = RG_SCH_DL_SF; + } + else + { + sf->sfType = RG_SCH_DL_SF_0; + } + /* DwPTS Scheduling Changes End */ + } + + /* Calculate the number of CCEs per subframe in the cell */ + mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][sf->sfNum]; + if(cell->dynCfiCb.isDynCfiEnb == TRUE) + { + /* In case if Dynamic CFI feature is enabled, default CFI + * value 1 is used */ + sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][1]; + } + else + { + if (sf->sfType == RG_SCH_SPL_SF_DATA) + { + sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi]; + } + else + { + sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi)]; + } + } + } + + /* Intialize the RACH response scheduling related infromation */ + if(rgSCHCmnDlRachInfoInit(cell) != ROK) + { + RETVALUE(RFAILED); + } + + /* Allocate PRACH preamble list */ + rgSCHCmnDlCreateRachPrmLst(cell); + + /* Initialize PHICH offset information */ + rgSCHCmnDlPhichOffsetInit(cell); + + /* Update the size of HARQ ACK/NACK feedback table */ + /* The array size is increased by 2 to have enough free indices, where other + * indices are busy waiting for HARQ feedback */ + cell->ackNackFdbkArrSize = rgSchTddANFdbkMapTbl[cell->ulDlCfgIdx] + 2; + + /* Initialize expected HARQ ACK/NACK feedback time */ + rgSCHCmnDlANFdbkInit(cell); + + /* Initialize UL association set index */ + if(cell->ulDlCfgIdx != 0) + { + rgSCHCmnDlKdashUlAscInit(cell); + } + + if (cfg->isCpDlExtend == TRUE) + { + cp = RG_SCH_CMN_EXT_CP; + noSymPerSlot = 6; + cell->splSubfrmCfg.dwPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlDwPts; + + if ( cell->splSubfrmCfg.dwPts == 0 ) + { + cell->isDwPtsCnted = FALSE; + } + else + { + cell->isDwPtsCnted = TRUE; + } + + if(cfg->isCpUlExtend == TRUE) + { + cell->splSubfrmCfg.upPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlExtUpPts; + } + else + { + cell->splSubfrmCfg.upPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlNorUpPts; + } + } + else + { + cp = RG_SCH_CMN_NOR_CP; + noSymPerSlot = 7; + cell->splSubfrmCfg.dwPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlDwPts; + cell->isDwPtsCnted = TRUE; + + if(cfg->isCpUlExtend == TRUE) + { + cell->splSubfrmCfg.upPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlExtUpPts; + } + else + { + cell->splSubfrmCfg.upPts = + rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlNorUpPts; + } + } + + /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */ + for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++,cfiIdx++) + { + cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx]; + cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\ + [cell->numTxAntPorts]][cfiIdx]; + cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx]; + cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\ + [cell->numTxAntPorts]][cfiIdx]; + } + + /* Initializing the values of CFI parameters */ + if(cell->dynCfiCb.isDynCfiEnb) + { + /* If DCFI is enabled, current CFI value will start from 1 */ + cellSch->dl.currCfi = cellSch->dl.newCfi = 1; + } + else + { + /* If DCFI is disabled, current CFI value is set as default max allowed CFI value */ + cellSch->dl.currCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi); + cellSch->dl.newCfi = cellSch->dl.currCfi; + } + + /* Include CRS REs while calculating Efficiency + * The number of Resource Elements occupied by CRS depends on Number of + * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0. + * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic + * details of the same. Please note that PDCCH overlap symbols would not + * considered in CRS REs deduction */ + for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++) + { + cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF) + - numPdcchSym) *RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts]; + } + + /* DwPTS Scheduling Changes Start */ + antPortIdx = (cell->numTxAntPorts == 1)? 0: + ((cell->numTxAntPorts == 2)? 1: 2); + + if (cp == RG_SCH_CMN_NOR_CP) + { + splSfIdx = (splSubfrmIdx == 4)? 1: 0; + } + else + { + splSfIdx = (splSubfrmIdx == 3)? 1: 0; + } + + numCrs = rgSchCmnDwptsCrs[splSfIdx][antPortIdx]; + + for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI-1; cfi++) + { + /* If CFI is 2 and Ant Port is 4, don't consider the sym 1 CRS REs */ + if (antPortIdx == 2 && cfi == 2) + { + numCrs -= 4; + } + cellSch->dl.numReDwPts[cfi] = ((cell->splSubfrmCfg.dwPts - cfi)* + RB_SCH_CMN_NUM_SCS_PER_RB) - numCrs; + } + /* DwPTS Scheduling Changes End */ + + if (cfg->maxDlBwPerUe == 0) + { + cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE; + } + else + { + cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe; + } + if (cfg->maxDlRetxBw == 0) + { + cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW; + } + else + { + cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw; + } + /* Fix: MUE_PERTTI_DL*/ + cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; + cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; + if (cfg->maxUePerDlSf == 0) + { + cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; + } + RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl); + /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */ + if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid configuration !: " + "maxCcchPerDlSf %u > maxUePerDlSf %u", + cfg->maxCcchPerDlSf, cfg->maxUePerDlSf ); + + RETVALUE(RFAILED); + } + else if (!cfg->maxCcchPerDlSf) + { + /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application + * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler + * does't consider CCCH allocation in MaxUePerTti cap. Hence more than + * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes + * FLE crash in PHY as PHY has limit of 16 max*/ + cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf; + } + else + { + cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf; + } + if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK) + { + RETVALUE(RFAILED); + } + + /*ccpu00118273 - ADD - start */ + cmLListInit(&cellSch->dl.msg4RetxLst); +#ifdef RGR_V1 + cmLListInit(&cellSch->dl.ccchSduRetxLst); +#endif + +#ifdef RG_PHASE2_SCHED + if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */ + { + cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType]; + } + if (cfg->dlfsCfg.isDlFreqSel) + { + ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel; +#endif + + /* Power related configuration */ + ret = rgSCHPwrCellCfg(cell, cfg); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + + cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset; + cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset; + cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset; + cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset; + cellSch->dl.msg4pAVal = cfg->msg4pAVal; + RETVALUE(ROK); +} +#else /* LTE_TDD */ +/** + * @brief This function handles the configuration of cell for the first + * time by the scheduler. + * + * @details + * + * Function: rgSCHCmnDlRgrCellCfg + * Purpose: Configuration received is stored into the data structures + * Also, update the scheduler with the number of frames of + * RACH preamble transmission. + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgrCellCfg* cfg + * @param[in] RgSchErrInfo* err + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlRgrCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cfg, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHCmnDlRgrCellCfg(cell, cfg, err) +RgSchCellCb *cell; +RgrCellCfg *cfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch; + U8 cp; + U8 numPdcchSym; + U8 noSymPerSlot; + U8 cfi; + U8 cfiIdx; + + TRC2(rgSCHCmnDlRgrCellCfg); + + cellSch = RG_SCH_CMN_GET_CELL(cell); + + /* Initialize the parameters with the ones received in the */ + /* configuration. */ + + /* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA + * sub-frames from preamble format */ + cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->rachCfg.preambleFormat]; + + /*[ccpu00138532]-ADD-fill the Msg4 Harq data */ + cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx; + + /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) + + 3 TTI (MAX L1+L2 processing delay at the UE) */ + cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) * + rgSchCmnHarqRtt[7] + 3; + + if (cell->bwCfg.dlTotalBw <= 10) + { + cfiIdx = 1; + numPdcchSym = 2; + } + else + { + cfiIdx = 0; + numPdcchSym = 1; + } + + if (cell->isCpDlExtend == TRUE) + { + cp = RG_SCH_CMN_EXT_CP; + noSymPerSlot = 6; + } + else + { + cp = RG_SCH_CMN_NOR_CP; + noSymPerSlot = 7; + } + + /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */ + for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, cfiIdx++) + { + cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx]; +#ifdef EMTC_ENABLE + cellSch->dl.emtcCqiToTbsTbl[0][cfi] = rgSchEmtcCmnCqiToTbs[0][cp][cfiIdx]; +#endif + cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\ + [cell->numTxAntPorts]][cfiIdx]; + cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx]; +#ifdef EMTC_ENABLE + cellSch->dl.emtcCqiToTbsTbl[1][cfi] = rgSchEmtcCmnCqiToTbs[1][cp][cfiIdx]; +#endif + cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\ + [cell->numTxAntPorts]][cfiIdx]; + } + + /* Initializing the values of CFI parameters */ + if(cell->dynCfiCb.isDynCfiEnb) + { + /* If DCFI is enabled, current CFI value will start from 1 */ + cellSch->dl.currCfi = cellSch->dl.newCfi = 1; + } + else + { + /* If DCFI is disabled, current CFI value is set as default CFI value */ + cellSch->dl.currCfi = cellSch->cfiCfg.cfi; + cellSch->dl.newCfi = cellSch->dl.currCfi; + } + + /* Include CRS REs while calculating Efficiency + * The number of Resource Elements occupied by CRS depends on Number of + * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0. + * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic + * details of the same. Please note that PDCCH overlap symbols would not + * considered in CRS REs deduction */ + for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++) + { + cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF) + - numPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts]; + } + + if (cfg->maxDlBwPerUe == 0) + { + cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE; + } + else + { + cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe; + } + if (cfg->maxDlRetxBw == 0) + { + cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW; + } + else + { + cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw; + } + + /* Fix: MUE_PERTTI_DL*/ + cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf; + cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti; + if (cfg->maxUePerDlSf == 0) + { + cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF; + } + /* Fix: MUE_PERTTI_DL syed validating Cell Configuration */ + if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "FAILED MaxUePerDlSf(%u) < MaxDlUeNewTxPerTti(%u)", + cellSch->dl.maxUePerDlSf, + cellSch->dl.maxUeNewTxPerTti); + RETVALUE(RFAILED); + } + /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */ + if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid configuration !: " + "maxCcchPerDlSf %u > maxUePerDlSf %u", + cfg->maxCcchPerDlSf, cfg->maxUePerDlSf ); + + RETVALUE(RFAILED); + } + else if (!cfg->maxCcchPerDlSf) + { + /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application + * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler + * does't consider CCCH allocation in MaxUePerTti cap. Hence more than + * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes + * FLE crash in PHY as PHY has limit of 16 max*/ + cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf; + } + else + { + cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf; + } + + + if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK) + { + RETVALUE(RFAILED); + } + cmLListInit(&cellSch->dl.msg4RetxLst); +#ifdef RGR_V1 + cmLListInit(&cellSch->dl.ccchSduRetxLst); +#endif + +#ifdef RG_PHASE2_SCHED + if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */ + { + cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType]; + } + if (cfg->dlfsCfg.isDlFreqSel) + { + ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel; +#endif + + /* Power related configuration */ + ret = rgSCHPwrCellCfg(cell, cfg); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + + cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset; + cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset; + cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset; + cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset; + RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl); + RETVALUE(ROK); +} +#endif /* LTE_TDD */ + +/*********************************************************** + * + * Func : rgSCHCmnUlCalcReqRbCeil + * + * Desc : Calculate RB required to satisfy 'bytes' for + * a given CQI. + * Returns number of RBs such that requirement + * is necessarily satisfied (does a 'ceiling' + * computation). + * + * Ret : Required RBs (U8) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUlCalcReqRbCeil +( +U32 bytes, +U8 cqi, +RgSchCmnUlCell *cellUl +) +#else +PUBLIC U8 rgSCHCmnUlCalcReqRbCeil(bytes, cqi, cellUl) +U32 bytes; +U8 cqi; +RgSchCmnUlCell *cellUl; +#endif +{ + U32 numRe = RGSCH_CEIL((bytes * 8) * 1024, rgSchCmnUlCqiTbl[cqi].eff); + TRC2(rgSCHCmnUlCalcReqRbCeil); + RETVALUE((U8)RGSCH_CEIL(numRe, RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl))); +} + +/*********************************************************** + * + * Func : rgSCHCmnPrecompMsg3Vars + * + * Desc : Precomputes the following for msg3 allocation: + * 1. numSb and Imcs for msg size A + * 2. numSb and Imcs otherwise + * + * Ret : + * + * Notes: The corresponding vars in cellUl struct is filled + * up + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnPrecompMsg3Vars +( +RgSchCmnUlCell *cellUl, +U8 ccchCqi, +U16 msgSzA, +U8 sbSize, +Bool isEcp +) +#else +PRIVATE S16 rgSCHCmnPrecompMsg3Vars(cellUl, ccchCqi, msgSzA, sbSize, isEcp) +RgSchCmnUlCell *cellUl; +U8 ccchCqi; +U16 msgSzA; +U8 sbSize; +Bool isEcp; +#endif +{ + U8 numSb; + U8 ccchTbs; + U8 ccchMcs; + U8 numRb = 0; + U8 iTbs = 0; + U16 msg3GrntSz = 0; + + TRC2(rgSCHCmnPrecompMsg3Vars); + + if (ccchCqi > cellUl->max16qamCqi) + { + ccchCqi = cellUl->max16qamCqi; + } +/* #ifndef RG_SCH_CMN_EXP_CP_SUP For ECP Pick the index 1 */ + /* Fix */ + ccchTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi]; + ccchMcs = rgSCHCmnUlGetIMcsFrmITbs(ccchTbs, CM_LTE_UE_CAT_1); + + /* MCS should fit in 4 bits in RAR */ + if (ccchMcs >= 15) + { + ccchMcs = 15; + } + + /* Limit the ccchMcs to 15 as it + * can be inferred from 36.213, section 6.2 that msg3 imcs + * field is 4 bits. + * Since, UE doesn't exist right now, we use CAT_1 for ue + * category*/ + while((ccchMcs = (rgSCHCmnUlGetIMcsFrmITbs( + rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi],CM_LTE_UE_CAT_1)) + ) > + RG_SCH_CMN_MAX_MSG3_IMCS) + { + ccchCqi--; + } + + iTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ccchCqi]; + + if (msgSzA < RGSCH_MIN_MSG3_GRNT_SZ) + { + RETVALUE(RFAILED); + } + numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(msgSzA, ccchCqi, cellUl), sbSize); + + numRb = numSb * sbSize; + msg3GrntSz = 8 * msgSzA; + + while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz) + { + ++numSb; + numRb = numSb * sbSize; + } + while (rgSchCmnMult235Tbl[numSb].match != numSb) + { + ++numSb; + } + /* Reversed(Corrected) the assignment for preamble-GrpA + * Refer- TG36.321- section- 5.1.2*/ + cellUl->ra.prmblBNumSb = numSb; + cellUl->ra.prmblBIMcs = ccchMcs; + numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(RGSCH_MIN_MSG3_GRNT_SZ, \ + ccchCqi, cellUl), + sbSize); + + numRb = numSb * sbSize; + msg3GrntSz = 8 * RGSCH_MIN_MSG3_GRNT_SZ; + while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz) + { + ++numSb; + numRb = numSb * sbSize; + } + while (rgSchCmnMult235Tbl[numSb].match != numSb) + { + ++numSb; + } + /* Reversed(Corrected) the assignment for preamble-GrpA + * Refer- TG36.321- section- 5.1.2*/ + cellUl->ra.prmblANumSb = numSb; + cellUl->ra.prmblAIMcs = ccchMcs; + RETVALUE(ROK); +} + +PUBLIC U32 gPrntPucchDet=0; + +#ifdef LTE_TDD +/*********************************************************** + * + * Func : rgSCHCmnUlCalcAvailBw + * + * Desc : Calculates bandwidth available for PUSCH scheduling. + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlCalcAvailBw +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +U8 cfi, +U8 *rbStartRef, +U8 *bwAvailRef +) +#else +PRIVATE S16 rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, rbStartRef, bwAvailRef) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +U8 cfi; +U8 *rbStartRef; +U8 *bwAvailRef; +#endif +{ + U8 c = 3; + U8 ulBw = cell->bwCfg.ulTotalBw; + U8 n2Rb = cell->pucchCfg.resourceSize; + U8 pucchDeltaShft = cell->pucchCfg.deltaShift; + U16 n1Pucch = cell->pucchCfg.n1PucchAn; + U8 n1Cs = cell->pucchCfg.cyclicShift; + + U8 n1PerRb; + U8 totalCce; + U16 n1Max; + U8 n1Rb; + U32 mixedRb; + U8 exclRb; /* RBs to exclude */ + U8 n1RbPart; + U8 puschRbStart; + /* To avoid PUCCH and PUSCH collision issue */ + U8 P; + U8 n1PlusOne; + U8 mi; + /* Maximum value of M as per Table 10.1-1 */ + U8 M[RGSCH_MAX_TDD_UL_DL_CFG] = {1, 2, 4, 3, 4, 9, 1}; + + TRC2(rgSCHCmnUlCalcAvailBw); + + if (cell->isCpUlExtend) + { + c = 2; + } + + n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */ + + /* Considering the max no. of CCEs for PUSCH BW calculation + * based on min mi value */ + if (cell->ulDlCfgIdx == 0 || cell->ulDlCfgIdx == 6) + { + mi = 1; + } + else + { + mi = 0; + } + + totalCce = cell->dynCfiCb.cfi2NCceTbl[mi][cfi]; + + P = rgSCHCmnGetPValFrmCCE(cell, totalCce-1); + n1PlusOne = cell->rgSchTddNpValTbl[P + 1]; + n1Max = (M[cell->ulDlCfgIdx] - 1)*n1PlusOne + (totalCce-1) + n1Pucch; + + /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in + * TS 36.211 */ + n1RbPart = (c*n1Cs)/pucchDeltaShft; + n1Rb = (n1Max - n1RbPart)/ n1PerRb; + mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */ + + /* get the total Number of RB's to be excluded for PUSCH */ + /* ccpu00137339 */ + if(n1Pucch < n1RbPart) + { + exclRb = n2Rb; + } + else + { + exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */ + } + puschRbStart = exclRb/2 + 1; + + /* Num of PUCCH RBs = puschRbStart*2 */ + if (puschRbStart * 2 >= ulBw) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"No bw available for PUSCH"); + RETVALUE(RFAILED); + } + + *rbStartRef = puschRbStart; + *bwAvailRef = ulBw - puschRbStart * 2; + + if(cell->pucchCfg.maxPucchRb !=0 && + (puschRbStart * 2 > cell->pucchCfg.maxPucchRb)) + { + cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi); + } + + RETVALUE(ROK); +} +#else + +/*********************************************************** + * + * Func : rgSCHCmnUlCalcAvailBw + * + * Desc : Calculates bandwidth available for PUSCH scheduling. + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlCalcAvailBw +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +U8 cfi, +U8 *rbStartRef, +U8 *bwAvailRef +) +#else +PRIVATE S16 rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, rbStartRef, bwAvailRef) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +U8 cfi; +U8 *rbStartRef; +U8 *bwAvailRef; +#endif +{ + U8 c = 3; + U8 ulBw = cell->bwCfg.ulTotalBw; + U8 n2Rb = cell->pucchCfg.resourceSize; + U8 pucchDeltaShft = cell->pucchCfg.deltaShift; + U16 n1Pucch = cell->pucchCfg.n1PucchAn; + U8 n1Cs = cell->pucchCfg.cyclicShift; + U8 n1PerRb; + U8 totalCce; + U16 n1Max; + U8 n1Rb; + U32 mixedRb; + U8 exclRb; /* RBs to exclude */ + U8 n1RbPart; + U8 puschRbStart; +#ifdef LTE_ADV + U16 numOfN3PucchRb; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); +#endif + + TRC2(rgSCHCmnUlCalcAvailBw); + + if (cell->isCpUlExtend) + { + c = 2; + } + + n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */ + + totalCce = cell->dynCfiCb.cfi2NCceTbl[0][cfi]; + + n1Max = n1Pucch + totalCce-1; + + /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in + * TS 36.211 */ + n1RbPart = (c*n1Cs)/pucchDeltaShft; + n1Rb = (U8)((n1Max - n1RbPart) / n1PerRb); + mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */ + + /* get the total Number of RB's to be excluded for PUSCH */ + /* ccpu00137339 */ + if(n1Pucch < n1RbPart) + { + exclRb = n2Rb; + } + else + { + exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */ + } + /*Support for PUCCH Format 3*/ +#ifdef LTE_ADV + if (cell->isPucchFormat3Sptd) + { + numOfN3PucchRb = RGSCH_CEIL(cellSch->dl.maxUePerDlSf,5); + exclRb = exclRb + numOfN3PucchRb; + } +#endif + puschRbStart = exclRb/2 + 1; + + if(gPrntPucchDet) + { +#ifndef ALIGN_64BIT + printf("CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%ld:%d:%d:%d:%d:%d]\n", + cell->crntTime.sfn, cell->crntTime.subframe, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb); +#else + printf("CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%d:%d:%d:%d:%d:%d]\n", + cell->crntTime.sfn, cell->crntTime.subframe, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb); +#endif + } + + if (puschRbStart*2 >= ulBw) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"No bw available for PUSCH"); + RETVALUE(RFAILED); + } + + *rbStartRef = puschRbStart; + *bwAvailRef = ulBw - puschRbStart * 2; + + if(cell->pucchCfg.maxPucchRb !=0 && + (puschRbStart * 2 > cell->pucchCfg.maxPucchRb)) + { + cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi); + } + + RETVALUE(ROK); +} +#endif + + + +/*********************************************************** + * + * Func : rgSCHCmnUlCellInit + * + * Desc : Uplink scheduler initialisation for cell. + * + * Ret : S16 + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlCellInit +( + RgSchCellCb *cell, + RgrCellCfg *cellCfg + ) +#else +PRIVATE S16 rgSCHCmnUlCellInit(cell, cellCfg) + RgSchCellCb *cell; + RgrCellCfg *cellCfg; +#endif +{ + S16 ret; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + U8 maxUePerUlSf = cellCfg->maxUePerUlSf; +#ifdef RGR_V1 + /* Added configuration for maximum number of MSG3s */ + U8 maxMsg3PerUlSf = cellCfg->maxMsg3PerUlSf; +#endif + U8 maxUlBwPerUe = cellCfg->maxUlBwPerUe; + U8 sbSize = cellCfg->puschSubBand.size; + U8 i; + U8 rbStart; + U8 bwAvail; + U8 cfi; + U8 maxSbPerUe; + U8 numSb; +#ifdef LTE_TDD + U16 ulDlCfgIdx = cell->ulDlCfgIdx; + /* [ccpu00127294]-MOD-Change the max Ul subfrms size in TDD */ + U8 maxSubfrms = 2 * rgSchTddNumUlSf[ulDlCfgIdx]; + U8 ulToDlMap[12] = {0}; /* maximum 6 Subframes in UL * 2 */ + U8 maxUlsubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ + [RGSCH_NUM_SUB_FRAMES-1]; + U16 subfrm; + S8 dlIdx; +#else + U8 maxSubfrms = RG_SCH_CMN_UL_NUM_SF; +#endif +#ifdef LTE_L2_MEAS + U8 idx; +#endif + U8 iTbs; +#if (defined(LTE_L2_MEAS) ) + Inst inst = cell->instIdx; +#endif /* #if (defined(LTE_L2_MEAS) || defined(DEBUGP) */ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + + TRC2(rgSCHCmnUlCellInit); + + cellUl->maxUeNewTxPerTti = cellCfg->maxUlUeNewTxPerTti; + if (maxUePerUlSf == 0) + { + maxUePerUlSf = RG_SCH_CMN_MAX_UE_PER_UL_SF; + } +#ifdef RGR_V1 + if (maxMsg3PerUlSf == 0) + { + maxMsg3PerUlSf = RG_SCH_CMN_MAX_MSG3_PER_UL_SF; + } + /* fixed the problem while sending raRsp + * if maxMsg3PerUlSf is greater than + * RGSCH_MAX_RNTI_PER_RARNTI + * */ + if(maxMsg3PerUlSf > RGSCH_MAX_RNTI_PER_RARNTI) + { + maxMsg3PerUlSf = RGSCH_MAX_RNTI_PER_RARNTI; + } + + if(maxMsg3PerUlSf > maxUePerUlSf) + { + maxMsg3PerUlSf = maxUePerUlSf; + } + + /*cellUl->maxAllocPerUlSf = maxUePerUlSf + maxMsg3PerUlSf;*/ + /*Max MSG3 should be a subset of Max UEs*/ + cellUl->maxAllocPerUlSf = maxUePerUlSf; + cellUl->maxMsg3PerUlSf = maxMsg3PerUlSf; +#else + cellUl->maxAllocPerUlSf = maxUePerUlSf; +#endif + /* Fix: MUE_PERTTI_UL syed validating Cell Configuration */ + if (cellUl->maxAllocPerUlSf < cellUl->maxUeNewTxPerTti) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "FAILED: MaxUePerUlSf(%u) < MaxUlUeNewTxPerTti(%u)", + cellUl->maxAllocPerUlSf, + cellUl->maxUeNewTxPerTti); + RETVALUE(RFAILED); + } + +#ifdef LTE_L2_MEAS +#ifdef LTE_TDD + for(idx = 0; idx < RGSCH_SF_ALLOC_SIZE; idx++) +#else + for(idx = 0; idx < RGSCH_NUM_SUB_FRAMES; idx++) +#endif + { + + ret = rgSCHUtlAllocSBuf(inst, (Data **)&(cell->sfAllocArr[idx]. + ulUeInfo.ulAllocInfo), (cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc))); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation failed "); + RETVALUE(ret); + } + } +#endif + if (maxUlBwPerUe == 0) + { + /* ccpu00139362- Setting to configured UL BW instead of MAX BW(100)*/ + maxUlBwPerUe = cell->bwCfg.ulTotalBw; + } + cellUl->maxUlBwPerUe = maxUlBwPerUe; + + /* FOR RG_SCH_CMN_EXT_CP_SUP */ + if (!cellCfg->isCpUlExtend) + { + cellUl->ulNumRePerRb = 12 * (14 - RGSCH_UL_SYM_DMRS_SRS); + } + else + { + cellUl->ulNumRePerRb = 12 * (12 - RGSCH_UL_SYM_DMRS_SRS); + } + + if (sbSize != rgSchCmnMult235Tbl[sbSize].match) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid subband size %d", sbSize); + RETVALUE(RFAILED); + } + //Setting the subband size to 4 which is size of VRBG in 5GTF +#ifdef RG_5GTF + sbSize = MAX_5GTF_VRBG_SIZE; +#endif + + maxSbPerUe = maxUlBwPerUe / sbSize; + if (maxSbPerUe == 0) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnUlCellInit(): " + "maxUlBwPerUe/sbSize is zero"); + RETVALUE(RFAILED); + } + cellUl->maxSbPerUe = rgSchCmnMult235Tbl[maxSbPerUe].prvMatch; + + /* CQI related updations */ + if ((!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->ulCmnCodeRate.ccchCqi)) + || (!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->trgUlCqi.trgCqi))) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnUlCellInit(): " + "Invalid cqi"); + RETVALUE(RFAILED); + } + cellUl->dfltUlCqi = cellCfg->ulCmnCodeRate.ccchCqi; + + /* Changed the logic to determine maxUlCqi. + * For a 16qam UE, maxUlCqi is the CQI Index at which + * efficiency is as close as possible to RG_SCH_MAX_CODE_RATE_16QAM + * Refer to 36.213-8.6.1 */ + for (i = RG_SCH_CMN_UL_NUM_CQI - 1;i > 0; --i) + { + RLOG_ARG2(L_INFO,DBG_CELLID,cell->cellId, + "CQI %u:iTbs %u", + i, + rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]); +#ifdef MAC_SCH_STATS + /* ccpu00128489 ADD Update mcs in hqFailStats here instead of at CRC + * since CQI to MCS mapping does not change. The only exception is for + * ITBS = 19 where the MCS can be 20 or 21 based on the UE cat. We + * choose 20, instead of 21, ie UE_CAT_3 */ + iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]; + RG_SCH_CMN_UL_TBS_TO_MCS(iTbs, hqFailStats.ulCqiStat[i - 1].mcs); +#endif + } + for (i = RG_SCH_CMN_UL_NUM_CQI - 1; i != 0; --i) + { + /* Fix for ccpu00123912*/ + iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]; + if (iTbs <= RGSCH_UL_16QAM_MAX_ITBS) /* corresponds to 16QAM */ + { + RLOG_ARG1(L_INFO,DBG_CELLID,cell->cellId, + "16 QAM CQI %u", i); + cellUl->max16qamCqi = i; + break; + } + } + +#ifdef EMTC_ENABLE + /* Precompute useful values for RA msg3 */ + ret = rgSCHCmnPrecompEmtcMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi, + cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend); + if (ret != ROK) + { + RETVALUE(ret); + } +#endif + + /* Precompute useful values for RA msg3 */ + ret = rgSCHCmnPrecompMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi, + cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend); + if (ret != ROK) + { + RETVALUE(ret); + } + + cellUl->sbSize = sbSize; + +#ifdef LTE_TDD + cellUl->numUlSubfrms = maxSubfrms; + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->ulSfArr, + cellUl->numUlSubfrms * sizeof(RgSchUlSf)); + + if (ret != ROK) + { + cellUl->numUlSubfrms = 0; + RETVALUE(ret); + } + + /* store the DL subframe corresponding to the PUSCH offset + * in their respective UL subframe */ + for(i=0; i < RGSCH_NUM_SUB_FRAMES; i++) + { + if(rgSchTddPuschTxKTbl[ulDlCfgIdx][i] != 0) + { + subfrm = (i + rgSchTddPuschTxKTbl[ulDlCfgIdx][i]) % \ + RGSCH_NUM_SUB_FRAMES; + subfrm = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subfrm]-1; + dlIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][i]-1; + RGSCH_ARRAY_BOUND_CHECK( cell->instIdx, ulToDlMap, subfrm); + ulToDlMap[subfrm] = dlIdx; + } + } + /* Copy the information in the remaining UL subframes based + * on number of HARQ processes */ + for(i=maxUlsubfrms; i < maxSubfrms; i++) + { + subfrm = i-maxUlsubfrms; + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, i); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, subfrm) + ulToDlMap[i] = ulToDlMap[subfrm]; + } +#endif + + for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++) + { +#ifdef LTE_TDD + ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail); +#else + ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail); +#endif + if (ret != ROK) + { + RETVALUE(ret); + } + + if (cfi == 1) + { + cell->ulAvailBw = bwAvail; + } + + numSb = bwAvail/sbSize; + + cell->dynCfiCb.bwInfo[cfi].startRb = rbStart; + cell->dynCfiCb.bwInfo[cfi].numSb = numSb; + } + + if(0 == cell->dynCfiCb.maxCfi) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, + "Incorrect Default CFI(%u), maxCfi(%u), maxPucchRb(%d)", + cellSch->cfiCfg.cfi, cell->dynCfiCb.maxCfi, + cell->pucchCfg.maxPucchRb); + + RETVALUE(RFAILED); + } + + /* DMRS values */ + cellUl->dmrsArrSize = cell->dynCfiCb.bwInfo[1].numSb; + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->dmrsArr, + cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); + if (ret != ROK) + { + RETVALUE(ret); + } + for (i = 0; i < cellUl->dmrsArrSize; ++i) + { + cellUl->dmrsArr[i] = cellCfg->puschSubBand.dmrs[i]; + } + + /* Init subframes */ + for (i = 0; i < maxSubfrms; ++i) + { + ret = rgSCHUtlUlSfInit(cell, &cellUl->ulSfArr[i], i, + cellUl->maxAllocPerUlSf); + if (ret != ROK) + { + for (; i != 0; --i) + { + rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[i-1]); + } + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(cellUl->dmrsArr)), + cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); +#ifdef LTE_TDD + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf)); +#endif + RETVALUE(ret); + } + } + RG_SCH_RESET_HCSG_UL_PRB_CNTR(cellUl); + RETVALUE(ROK); +} + +/** + * @brief Scheduler processing on cell configuration. + * + * @details + * + * Function : rgSCHCmnRgrCellCfg + * + * This function does requisite initialisation + * and setup for scheduler1 when a cell is + * configured. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellCfg *cellCfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrCellCfg(cell, cellCfg, err) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch; + TRC2(rgSCHCmnRgrCellCfg); + + /* As part of RGR cell configuration, validate the CRGCellCfg + * There is no trigger for crgCellCfg from SC1 */ + /* Removed failure check for Extended CP */ + + if (((ret = rgSCHUtlAllocSBuf(cell->instIdx, + (Data**)&(cell->sc.sch), (sizeof(RgSchCmnCell)))) != ROK)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "Memory allocation FAILED"); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + cellSch = (RgSchCmnCell *)(cell->sc.sch); + cellSch->cfiCfg = cellCfg->cfiCfg; + cellSch->trgUlCqi.trgCqi = cellCfg->trgUlCqi.trgCqi; + /* Initialize the scheduler refresh timer queues */ + cellSch->tmrTqCp.nxtEnt = 0; + cellSch->tmrTqCp.tmrLen = RG_SCH_CMN_NUM_REFRESH_Q; + + /* RACHO Intialize the RACH ded Preamble Information */ + rgSCHCmnCfgRachDedPrm(cell); +#ifdef LTE_TDD + /* Initialize 'Np' value for each 'p' used for + * HARQ ACK/NACK reception */ + rgSCHCmnDlNpValInit(cell); +#endif + + /* Initialize 'Np' value for each 'p' used for + * HARQ ACK/NACK reception */ +#ifdef LTE_TDD + rgSCHCmnDlNpValInit(cell); +#endif + + /* Now perform uplink related initializations */ + ret = rgSCHCmnUlCellInit(cell, cellCfg); + if (ret != ROK) + { + /* There is no downlink deinit to be performed */ + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + ret = rgSCHCmnDlRgrCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + /* DL scheduler has no initializations to make */ + /* As of now DL scheduler always returns ROK */ + + rgSCHCmnGetDciFrmtSizes(cell); + rgSCHCmnGetCqiDciFrmt2AggrLvl(cell); +#ifdef EMTC_ENABLE + rgSCHCmnGetEmtcDciFrmtSizes(cell); + rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl(cell); +#endif /* EMTC_ENABLE */ + +#ifdef EMTC_ENABLE + if(TRUE == cellCfg->emtcEnable) + { + cellSch->apisEmtcUl = &rgSchEmtcUlSchdTbl[0]; + ret = cellSch->apisEmtcUl->rgSCHRgrUlCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + RETVALUE(ret); + } + } +#endif + cellSch->apisUl = &rgSchUlSchdTbl[RG_SCH_CMN_GET_UL_SCHED_TYPE(cell)]; + ret = cellSch->apisUl->rgSCHRgrUlCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + RETVALUE(ret); + } +#ifdef EMTC_ENABLE + if(TRUE == cellCfg->emtcEnable) + { + cellSch->apisEmtcDl = &rgSchEmtcDlSchdTbl[0]; + ret = cellSch->apisEmtcDl->rgSCHRgrDlCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + RETVALUE(ret); + } + } +#endif + cellSch->apisDl = &rgSchDlSchdTbl[RG_SCH_CMN_GET_DL_SCHED_TYPE(cell)]; +#ifdef LTEMAC_SPS + /* Perform SPS specific initialization for the cell */ + ret = rgSCHCmnSpsCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + RETVALUE(ret); + } +#endif + ret = cellSch->apisDl->rgSCHRgrDlCellCfg(cell, cellCfg, err); + if (ret != ROK) + { + RETVALUE(ret); + } + rgSCHCmnInitVars(cell); + + RETVALUE(ROK); +} /* rgSCHCmnRgrCellCfg*/ + + +/** + * @brief This function handles the reconfiguration of cell. + * + * @details + * + * Function: rgSCHCmnRgrCellRecfg + * Purpose: Update the reconfiguration parameters. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrCellRecfg +( +RgSchCellCb *cell, +RgrCellRecfg *recfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrCellRecfg(cell, recfg, err) +RgSchCellCb *cell; +RgrCellRecfg *recfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + + TRC2(rgSCHCmnRgrCellRecfg); + + if (recfg->recfgTypes & RGR_CELL_UL_CMNRATE_RECFG) + { + U8 oldCqi = cellUl->dfltUlCqi; + if (!RG_SCH_CMN_UL_IS_CQI_VALID(recfg->ulCmnCodeRate.ccchCqi)) + { + err->errCause = RGSCHERR_SCH_CFG; + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnRgrCellRecfg(): " + "Invalid cqi"); + RETVALUE(RFAILED); + } + cellUl->dfltUlCqi = recfg->ulCmnCodeRate.ccchCqi; + ret = rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi, + cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend); + if (ret != ROK) + { + cellUl->dfltUlCqi = oldCqi; + rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi, + cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend); + RETVALUE(ret); + } + } + + if (recfg->recfgTypes & RGR_CELL_DL_CMNRATE_RECFG) + { + if (rgSCHCmnDlCnsdrCmnRt(cell, &recfg->dlCmnCodeRate) != ROK) + { + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + } + +#ifdef EMTC_ENABLE + if(TRUE == cell->emtcEnable) + { + /* Invoke UL sched for cell Recfg */ + ret = cellSch->apisEmtcUl->rgSCHRgrUlCellRecfg(cell, recfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + + /* Invoke DL sched for cell Recfg */ + ret = cellSch->apisEmtcDl->rgSCHRgrDlCellRecfg(cell, recfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + /* Invoke UL sched for cell Recfg */ + ret = cellSch->apisUl->rgSCHRgrUlCellRecfg(cell, recfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + + /* Invoke DL sched for cell Recfg */ + ret = cellSch->apisDl->rgSCHRgrDlCellRecfg(cell, recfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + + if (recfg->recfgTypes & RGR_CELL_DLFS_RECFG) + { + ret = cellSch->apisDlfs->rgSCHDlfsCellRecfg(cell, recfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + cellSch->dl.isDlFreqSel = recfg->dlfsRecfg.isDlFreqSel; + } + + if (recfg->recfgTypes & RGR_CELL_PWR_RECFG) + { + ret = rgSCHPwrCellRecfg(cell, recfg); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlCellDeinit + * + * Desc : Uplink scheduler de-initialisation for cell. + * + * Ret : S16 + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlCellDeinit +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnUlCellDeinit(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + U8 ulSfIdx; +#ifdef LTE_TDD + U8 maxSubfrms = cellUl->numUlSubfrms; +#endif +#ifdef LTE_L2_MEAS + CmLList *lnk = NULLP; + RgSchL2MeasCb *measCb; +#endif + TRC2(rgSCHCmnUlCellDeinit); +#ifdef LTE_L2_MEAS +#ifdef LTE_TDD + for(ulSfIdx = 0; ulSfIdx < RGSCH_SF_ALLOC_SIZE; ulSfIdx++) +#else + for(ulSfIdx = 0; ulSfIdx < RGSCH_NUM_SUB_FRAMES; ulSfIdx++) +#endif + { + if(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo != NULLP) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo)), + cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc)); + + /* ccpu00117052 - DEL - removed explicit NULLP assignment + as it is done in above utility function */ + } + } + /* Free the memory allocated to measCb */ + lnk = cell->l2mList.first; + while(lnk != NULLP) + { + measCb = (RgSchL2MeasCb *)lnk->node; + cmLListDelFrm(&cell->l2mList, lnk); + lnk = lnk->next; + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\ + sizeof(RgSchL2MeasCb)); + } +#endif + if (cellUl->dmrsArr != NULLP) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx,(Data **)(&(cellUl->dmrsArr)), + cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr)); + } + /* De-init subframes */ +#ifdef LTE_TDD + for (ulSfIdx = 0; ulSfIdx < maxSubfrms; ++ulSfIdx) +#else + for (ulSfIdx = 0; ulSfIdx < RG_SCH_CMN_UL_NUM_SF; ++ulSfIdx) +#endif + { + rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[ulSfIdx]); + } + +#ifdef LTE_TDD + if (cellUl->ulSfArr != NULLP) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf)); + } +#endif + + RETVOID; +} + +/** + * @brief Scheduler processing for cell delete. + * + * @details + * + * Function : rgSCHCmnCellDel + * + * This functions de-initialises and frees memory + * taken up by scheduler1 for the entire cell. + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnCellDel +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnCellDel(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnCellDel); + +#ifdef LTE_L2_MEAS + glblTtiCnt = 0; +#endif + if (cellSch == NULLP) + { + RETVOID; + } + /* Perform the deinit for the UL scheduler */ + rgSCHCmnUlCellDeinit(cell); +#ifdef EMTC_ENABLE + if(TRUE == cell->emtcEnable) + { + if (cellSch->apisEmtcUl) + { + cellSch->apisEmtcUl->rgSCHFreeUlCell(cell); + } + } +#endif + if (cellSch->apisUl) + { + /* api pointer checks added (here and below in + * this function). pl check. - antriksh */ + cellSch->apisUl->rgSCHFreeUlCell(cell); + } + + /* Perform the deinit for the DL scheduler */ + cmLListInit(&cellSch->dl.taLst); + if (cellSch->apisDl) + { + cellSch->apisDl->rgSCHFreeDlCell(cell); + } +#ifdef EMTC_ENABLE + if (cellSch->apisEmtcDl) + { + rgSCHEmtcInitTaLst(&cellSch->dl); + + cellSch->apisEmtcDl->rgSCHFreeDlCell(cell); + } +#endif + + /* DLFS de-initialization */ + if (cellSch->dl.isDlFreqSel && cellSch->apisDlfs) + { + cellSch->apisDlfs->rgSCHDlfsCellDel(cell); + } + + rgSCHPwrCellDel(cell); +#ifdef LTEMAC_SPS + rgSCHCmnSpsCellDel(cell); +#endif + + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(cell->sc.sch)), (sizeof(RgSchCmnCell))); + RETVOID; +} /* rgSCHCmnCellDel */ + + +/** + * @brief This function validates QOS parameters for DL. + * + * @details + * + * Function: rgSCHCmnValidateDlQos + * Purpose: This function validates QOS parameters for DL. + * + * Invoked by: Scheduler + * + * @param[in] CrgLchQosCfg *dlQos + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnValidateDlQos +( +RgrLchQosCfg *dlQos +) +#else +PRIVATE S16 rgSCHCmnValidateDlQos(dlQos) +RgrLchQosCfg *dlQos; +#endif +{ + U8 qci = dlQos->qci; + + TRC2(rgSCHCmnValidateDlQos); + + if ( qci < RG_SCH_CMN_MIN_QCI || qci > RG_SCH_CMN_MAX_QCI ) + { + RETVALUE(RFAILED); + } + + if ((qci >= RG_SCH_CMN_GBR_QCI_START) && + (qci <= RG_SCH_CMN_GBR_QCI_END)) + { + if ((dlQos->mbr == 0) || (dlQos->mbr < dlQos->gbr)) + { + RETVALUE(RFAILED); + } + } + RETVALUE(ROK); +} + +/** + * @brief Scheduler invocation on logical channel addition. + * + * @details + * + * Function : rgSCHCmnRgrLchCfg + * + * This functions does required processing when a new + * (dedicated) logical channel is added. Assumes lcg + * pointer in ulLc is set. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlLcCb *dlLc + * @param[int] RgrLchCfg *lcCfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrLchCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchCfg *lcCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrLchCfg(cell, ue, dlLc, lcCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchCfg *lcCfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnRgrLchCfg); + + ret = rgSCHUtlAllocSBuf(cell->instIdx, + (Data**)&((dlLc)->sch), (sizeof(RgSchCmnDlSvc))); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnRgrLchCfg(): " + "SCH struct alloc failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + if(lcCfg->lcType != CM_LTE_LCH_DCCH) + { + ret = rgSCHCmnValidateDlQos(&lcCfg->dlInfo.dlQos); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSchCmnCrgLcCfg(): " + "DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + /* Perform DL service activation in the scheduler */ + ((RgSchCmnDlSvc *)(dlLc->sch))->qci = lcCfg->dlInfo.dlQos.qci; + ((RgSchCmnDlSvc *)(dlLc->sch))->prio = rgSchCmnDlQciPrio[lcCfg->dlInfo.dlQos.qci - 1]; + ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcCfg->dlInfo.dlQos.gbr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcCfg->dlInfo.dlQos.mbr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + } + else + { + /*assigning highest priority to DCCH */ + ((RgSchCmnDlSvc *)(dlLc->sch))->prio=RG_SCH_CMN_DCCH_PRIO; + } + dlLc->ue = ue; + dlLc->lcType=lcCfg->lcType; + +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + ret = cellSch->apisEmtcDl->rgSCHRgrDlLcCfg(cell, ue,dlLc ,lcCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + ret = cellSch->apisDl->rgSCHRgrDlLcCfg(cell, ue, dlLc, lcCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + ret = cellSch->apisEmtcUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + ret = cellSch->apisUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + +#ifdef LTE_ADV + if (ue->numSCells) + { + rgSCHSCellDlLcCfg(cell, ue, dlLc); + } +#endif + + +#ifdef LTEMAC_SPS + if(lcCfg->dlInfo.dlSpsCfg.isSpsEnabled) + { + /* Invoke SPS module if SPS is enabled for the service */ + ret = rgSCHCmnSpsDlLcCfg(cell, ue, dlLc, lcCfg, err); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "rgSchCmnRgrLchCfg(): " + "SPS configuration failed for DL LC for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief Scheduler invocation on logical channel addition. + * + * @details + * + * Function : rgSCHCmnRgrLchRecfg + * + * This functions does required processing when an existing + * (dedicated) logical channel is reconfigured. Assumes lcg + * pointer in ulLc is set to the old value. + * Independent of whether new LCG is meant to be configured, + * the new LCG scheduler information is accessed and possibly modified. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlLcCb *dlLc + * @param[int] RgrLchRecfg *lcRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrLchRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchRecfg *lcRecfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrLchRecfg(cell, ue, dlLc, lcRecfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchRecfg *lcRecfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnRgrLchRecfg) + + if(dlLc->lcType != CM_LTE_LCH_DCCH) + { + ret = rgSCHCmnValidateDlQos(&lcRecfg->dlRecfg.dlQos); + + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + if (((RgSchCmnDlSvc *)(dlLc->sch))->qci != lcRecfg->dlRecfg.dlQos.qci) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Qci, hence lc Priority change " + "not supported for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(ret); + } + ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcRecfg->dlRecfg.dlQos.gbr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcRecfg->dlRecfg.dlQos.mbr * \ + RG_SCH_CMN_REFRESH_TIME)/100; + } + else + { + /*assigning highest priority to DCCH */ + ((RgSchCmnDlSvc *)(dlLc->sch))->prio = RG_SCH_CMN_DCCH_PRIO; + } + +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + ret = cellSch->apisEmtcDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + ret = cellSch->apisEmtcUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + ret = cellSch->apisDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + ret = cellSch->apisUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + +#ifdef LTEMAC_SPS + if (lcRecfg->recfgTypes & RGR_DL_LC_SPS_RECFG) + { + /* Invoke SPS module if SPS is enabled for the service */ + if(lcRecfg->dlRecfg.dlSpsRecfg.isSpsEnabled) + { + ret = rgSCHCmnSpsDlLcRecfg(cell, ue, dlLc, lcRecfg, err); + if (ret != ROK) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"SPS re-configuration not " + "supported for dlLC Ignore this CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId); + } + } + RETVALUE(ROK); + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief Scheduler invocation on logical channel addition. + * + * @details + * + * Function : rgSCHCmnRgrLcgCfg + * + * This functions does required processing when a new + * (dedicated) logical channel is added. Assumes lcg + * pointer in ulLc is set. + * + * @param[in] RgSchCellCb *cell, + * @param[in] RgSchUeCb *ue, + * @param[in] RgSchLcgCb *lcg, + * @param[in] RgrLcgCfg *lcgCfg, + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrLcgCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *lcg, +RgrLcgCfg *lcgCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrLcgCfg(cell, ue, lcg, lcgCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchLcgCb *lcg; +RgrLcgCfg *lcgCfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].sch)); + + TRC2(rgSCHCmnRgrLcgCfg); + + ulLcg->cfgdGbr = (lcgCfg->ulInfo.gbr * RG_SCH_CMN_REFRESH_TIME)/100; + ulLcg->effGbr = ulLcg->cfgdGbr; + ulLcg->deltaMbr = ((lcgCfg->ulInfo.mbr - lcgCfg->ulInfo.gbr) * RG_SCH_CMN_REFRESH_TIME)/100; + ulLcg->effDeltaMbr = ulLcg->deltaMbr; + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + ret = cellSch->apisUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr)) + { + /* Indicate MAC that this LCG is GBR LCG */ + rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcgCfg->ulInfo.lcgId, TRUE); + } + RETVALUE(ROK); +} + +/** + * @brief Scheduler invocation on logical channel addition. + * + * @details + * + * Function : rgSCHCmnRgrLcgRecfg + * + * This functions does required processing when a new + * (dedicated) logical channel is added. Assumes lcg + * pointer in ulLc is set. + * + * @param[in] RgSchCellCb *cell, + * @param[in] RgSchUeCb *ue, + * @param[in] RgSchLcgCb *lcg, + * @param[in] RgrLcgRecfg *reCfg, + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrLcgRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *lcg, +RgrLcgRecfg *reCfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnRgrLcgRecfg(cell, ue, lcg, reCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchLcgCb *lcg; +RgrLcgRecfg *reCfg; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[reCfg->ulRecfg.lcgId].sch)); + + TRC2(rgSCHCmnRgrLcgRecfg); + + ulLcg->cfgdGbr = (reCfg->ulRecfg.gbr * RG_SCH_CMN_REFRESH_TIME)/100; + ulLcg->effGbr = ulLcg->cfgdGbr; + ulLcg->deltaMbr = ((reCfg->ulRecfg.mbr - reCfg->ulRecfg.gbr) * RG_SCH_CMN_REFRESH_TIME)/100; + ulLcg->effDeltaMbr = ulLcg->deltaMbr; + +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + else +#endif + { + ret = cellSch->apisUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err); + if (ret != ROK) + { + RETVALUE(RFAILED); + } + } + if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr)) + { + /* Indicate MAC that this LCG is GBR LCG */ + rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, TRUE); + } + else + { + /* In case of RAB modification */ + rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, FALSE); + } + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnRgrLchDel + * + * Desc : Scheduler handling for a (dedicated) + * uplink logical channel being deleted. + * + * Ret : + * + * Notes: + * + * File : + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnRgrLchDel +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteLcId lcId, +U8 lcgId +) +#else +PUBLIC S16 rgSCHCmnRgrLchDel(cell, ue, lcId, lcgId) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteLcId lcId; +U8 lcgId; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnRgrLchDel); +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId); + } + else +#endif + { + cellSch->apisUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId); + } + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnLcgDel + * + * Desc : Scheduler handling for a (dedicated) + * uplink logical channel being deleted. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnLcgDel +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *lcg +) +#else +PUBLIC Void rgSCHCmnLcgDel(cell, ue, lcg) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchLcgCb *lcg; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnLcg *lcgCmn = RG_SCH_CMN_GET_UL_LCG(lcg); + TRC2(rgSCHCmnLcgDel); + + if (lcgCmn == NULLP) + { + RETVOID; + } + + if (RGSCH_IS_GBR_BEARER(lcgCmn->cfgdGbr)) + { + /* Indicate MAC that this LCG is GBR LCG */ + rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcg->lcgId, FALSE); + } + +#ifdef LTEMAC_SPS + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlLcgDel(cell, ue, lcg); + } +#endif /* LTEMAC_SPS */ + + lcgCmn->effGbr = 0; + lcgCmn->reportedBs = 0; + lcgCmn->cfgdGbr = 0; + /* set lcg bs to 0. Deletion of control block happens + * at the time of UE deletion. */ + lcgCmn->bs = 0; +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHFreeUlLcg(cell, ue, lcg); + } + else +#endif + { + cellSch->apisUl->rgSCHFreeUlLcg(cell, ue, lcg); + } + RETVOID; +} + + +/** + * @brief This function deletes a service from scheduler. + * + * @details + * + * Function: rgSCHCmnFreeDlLc + * Purpose: This function is made available through a FP for + * making scheduler aware of a service being deleted from UE. + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @param[in] RgSchDlLcCb* svc + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnFreeDlLc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *svc +) +#else +PUBLIC Void rgSCHCmnFreeDlLc(cell, ue, svc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *svc; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnFreeDlLc); + if (svc->sch == NULLP) + { + RETVOID; + } +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + cellSch->apisEmtcDl->rgSCHFreeDlLc(cell, ue, svc); + } + else +#endif + { + cellSch->apisDl->rgSCHFreeDlLc(cell, ue, svc); + } + +#ifdef LTE_ADV + if (ue->numSCells) + { + rgSCHSCellDlLcDel(cell, ue, svc); + } +#endif + +#ifdef LTEMAC_SPS + /* If SPS service, invoke SPS module */ + if (svc->dlLcSpsCfg.isSpsEnabled) + { + rgSCHCmnSpsDlLcDel(cell, ue, svc); + } +#endif + + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data**)(&(svc->sch)), (sizeof(RgSchCmnDlSvc))); + +#ifdef LTE_ADV + rgSCHLaaDeInitDlLchCb(cell, svc); +#endif + + RETVOID; +} + +#ifdef RGR_V1 + +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH SDURetx Allocations. + * + * @details + * + * Function: rgSCHCmnDlCcchSduRetxFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH Retx Allocations. + * Scans through the scheduled list of ccchSdu retrans + * fills the corresponding pdcch, adds the hqProc to + * the corresponding SubFrm and removes the hqP from + * cells retx List. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchSduRetxFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchSduRetxFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchDlRbAlloc *rbAllocInfo; + RgSchDlHqProcCb *hqP; + RgSchUeCb *ue; + TRC2(rgSCHCmnDlCcchSduRetxFnlz); + + /* Traverse through the Scheduled Retx List */ + node = allocInfo->ccchSduAlloc.schdCcchSduRetxLst.first; + while (node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + ue = hqP->hqE->ue; + rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell); + node = node->next; + rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); + + /* Remove the HqP from cell's ccchSduRetxLst */ + cmLListDelFrm(&cmnCellDl->ccchSduRetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; + + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + rgSCHCmnDlUeResetTemp(ue, hqP); + } + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + node = allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst.first; + while(node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + ue = hqP->hqE->ue; + node = node->next; + /* reset the UE allocation Information */ + rgSCHCmnDlUeResetTemp(ue, hqP); + } + RETVOID; +} +#endif +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH Retx Allocations. + * + * @details + * + * Function: rgSCHCmnDlCcchRetxFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH Retx Allocations. + * Scans through the scheduled list of msg4 retrans + * fills the corresponding pdcch, adds the hqProc to + * the corresponding SubFrm and removes the hqP from + * cells retx List. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchRetxFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchRetxFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchDlRbAlloc *rbAllocInfo; + RgSchDlHqProcCb *hqP; + RgSchRaCb *raCb; + TRC2(rgSCHCmnDlCcchRetxFnlz); + + /* Traverse through the Scheduled Retx List */ + node = allocInfo->msg4Alloc.schdMsg4RetxLst.first; + while (node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + raCb = hqP->hqE->raCb; + rbAllocInfo = &raCb->rbAllocInfo; + node = node->next; + rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); + + /* Remove the HqP from cell's msg4RetxLst */ + cmLListDelFrm(&cmnCellDl->msg4RetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + cmMemset((U8 *)rbAllocInfo, (U8)0, sizeof(*rbAllocInfo)); + rgSCHCmnDlHqPResetTemp(hqP); + } + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + node = allocInfo->msg4Alloc.nonSchdMsg4RetxLst.first; + while(node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + raCb = hqP->hqE->raCb; + node = node->next; + cmMemset((U8 *)&raCb->rbAllocInfo, (U8)0, sizeof(raCb->rbAllocInfo)); + rgSCHCmnDlHqPResetTemp(hqP); + } + RETVOID; +} + +#ifdef RGR_V1 +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH SDU tx Allocations. + * + * @details + * + * Function: rgSCHCmnDlCcchSduTxFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH tx Allocations. + * Scans through the scheduled list of CCCH SDU trans + * fills the corresponding pdcch, adds the hqProc to + * the corresponding SubFrm and removes the hqP from + * cells tx List. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchSduTxFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchSduTxFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchUeCb *ueCb; + RgSchDlRbAlloc *rbAllocInfo; + RgSchDlHqProcCb *hqP; + RgSchLchAllocInfo lchSchdData; + TRC2(rgSCHCmnDlCcchSduTxFnlz); + + /* Traverse through the Scheduled Retx List */ + node = allocInfo->ccchSduAlloc.schdCcchSduTxLst.first; + while (node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + ueCb = hqP->hqE->ue; + node = node->next; + rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell); + + /* fill the pdcch and HqProc */ + rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); + + /* Remove the raCb from cell's toBeSchdLst */ + cmLListDelFrm(&cell->ccchSduUeLst, &ueCb->ccchSduLnk); + ueCb->ccchSduLnk.node = (PTR)NULLP; + + /* Fix : Resetting this required to avoid complication + * in reestablishment case */ + ueCb->dlCcchInfo.bo = 0; + + /* Indicate DHM of the CCCH LC scheduling */ + hqP->tbInfo[0].contResCe = NOTPRSNT; + lchSchdData.lcId = 0; + lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes - + (RGSCH_MSG4_HDRSIZE); + rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]); + + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + rgSCHCmnDlUeResetTemp(ueCb, hqP); + } + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + node = allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst.first; + while(node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + ueCb = hqP->hqE->ue; + node = node->next; + /* Release HqProc */ + rgSCHDhmRlsHqpTb(hqP, 0, FALSE); + /*Fix: Removing releasing of TB1 as it will not exist for CCCH SDU and hence caused a crash*/ + /*rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/ + /* reset the UE allocation Information */ + rgSCHCmnDlUeResetTemp(ueCb, hqP); + } + RETVOID; +} + +#endif +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH tx Allocations. + * + * @details + * + * Function: rgSCHCmnDlCcchTxFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested + * CCCH tx Allocations. + * Scans through the scheduled list of msg4 trans + * fills the corresponding pdcch, adds the hqProc to + * the corresponding SubFrm and removes the hqP from + * cells tx List. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCcchTxFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlCcchTxFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + RgSchRaCb *raCb; + RgSchDlRbAlloc *rbAllocInfo; + RgSchDlHqProcCb *hqP; + RgSchLchAllocInfo lchSchdData; + TRC2(rgSCHCmnDlCcchTxFnlz); + + /* Traverse through the Scheduled Retx List */ + node = allocInfo->msg4Alloc.schdMsg4TxLst.first; + while (node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + raCb = hqP->hqE->raCb; + node = node->next; + rbAllocInfo = &raCb->rbAllocInfo; + + /* fill the pdcch and HqProc */ + rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP); + /* MSG4 Fix Start */ + + rgSCHRamRmvFrmRaInfoSchdLst(cell, raCb); + /* MSG4 Fix End */ + + /* Indicate DHM of the CCCH LC scheduling */ + lchSchdData.lcId = 0; + lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes - + (RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE); + /* TRansmitting presence of cont Res CE across MAC-SCH interface to + * identify CCCH SDU transmissions which need to be done + * without the + * contention resolution CE*/ + hqP->tbInfo[0].contResCe = PRSNT_NODEF; + /*Dont add lc if only cont res CE is being transmitted*/ + if(raCb->dlCcchInfo.bo) + { + rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]); + } + else + { + } + /* Fix: syed dlAllocCb reset should be performed. + * zombie info in dlAllocCb leading to crash rbNum wraparound */ + cmMemset((U8 *)&raCb->rbAllocInfo, (U8)0, sizeof(raCb->rbAllocInfo)); + rgSCHCmnDlHqPResetTemp(hqP); + } + node = allocInfo->msg4Alloc.nonSchdMsg4TxLst.first; + while(node) + { + hqP = (RgSchDlHqProcCb *)(node->node); + raCb = hqP->hqE->raCb; + node = node->next; + rbAllocInfo = &raCb->rbAllocInfo; + /* Release HqProc */ + rgSCHDhmRlsHqpTb(hqP, 0, FALSE); + /*Fix: Removing releasing of TB1 as it will not exist for MSG4 and hence caused a crash*/ + /* rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/ + /* reset the UE allocation Information */ + cmMemset((U8 *)rbAllocInfo, (U8)0, sizeof(*rbAllocInfo)); + rgSCHCmnDlHqPResetTemp(hqP); + } + + RETVOID; +} +/* R8 Upgrade */ +/** + * @brief This function calculates the BI Index to be sent in the Bi header + * field. + * + * @details + * Function: rgSCHCmnGetBiIndex + * Purpose: This function Processes utilizes the previous BI time value + * calculated and the difference last BI sent time and current time. To + * calculate the latest BI Index. It also considers the how many UE's + * Unserved in this subframe. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] U32 ueCount + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnGetBiIndex +( +RgSchCellCb *cell, +U32 ueCount +) +#else +PUBLIC U8 rgSCHCmnGetBiIndex(cell, ueCount) +RgSchCellCb *cell; +U32 ueCount; +#endif +{ + S16 prevVal = 0; /* To Store Intermediate Value */ + U16 newBiVal = 0; /* To store Bi Value in millisecond */ + U8 idx = 0; + U16 timeDiff = 0; + + TRC2(rgSCHCmnGetBiIndex) + + if (cell->biInfo.prevBiTime != 0) + { +#ifdef EMTC_ENABLE + if(cell->emtcEnable == TRUE) + { + timeDiff =(RGSCH_CALC_SF_DIFF_EMTC(cell->crntTime, cell->biInfo.biTime)); + } + else +#endif + { + timeDiff =(RGSCH_CALC_SF_DIFF(cell->crntTime, cell->biInfo.biTime)); + } + + prevVal = cell->biInfo.prevBiTime - timeDiff; + } + if (prevVal < 0) + { + prevVal = 0; + } + newBiVal = RG_SCH_CMN_GET_BI_VAL(prevVal,ueCount); + /* To be used next time when BI is calculated */ +#ifdef EMTC_ENABLE + if(cell->emtcEnable == TRUE) + { + RGSCHCPYTIMEINFO_EMTC(cell->crntTime, cell->biInfo.biTime) + } + else +#endif + { + RGSCHCPYTIMEINFO(cell->crntTime, cell->biInfo.biTime) + } + + /* Search the actual BI Index from table Backoff Parameters Value and + * return that Index */ + do + { + if (rgSchCmnBiTbl[idx] > newBiVal) + { + break; + } + idx++; + }while(idx < RG_SCH_CMN_NUM_BI_VAL-1); + cell->biInfo.prevBiTime = rgSchCmnBiTbl[idx]; + /* For 16 Entries in Table 7.2.1 36.321.880 - 3 reserved so total 13 Entries */ + RETVALUE(idx); /* Returning reserved value from table UE treats it has 960 ms */ +} /* rgSCHCmnGetBiIndex */ + + +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * RAR allocations. Assumption: The reuqested + * allocations are always satisfied completely. + * Hence no roll back. + * + * @details + * + * Function: rgSCHCmnDlRaRspFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * Takes care of PDCCH filling. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRaRspFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlRaRspFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + U32 rarCnt = 0; + RgSchDlRbAlloc *raRspAlloc; + RgSchDlSf *subFrm = NULLP; + RgSchRaCb *raCb; + RgSchErrInfo err; + CmLListCp *reqLst; + RgSchRaReqInfo *raReq; + Bool preamGrpA; + RgSchUlAlloc *ulAllocRef=NULLP; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 allocRapidCnt = 0; +#ifdef LTE_TDD + U32 msg3SchdIdx = 0; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 msg3Subfrm; +#endif + + TRC2(rgSCHCmnDlRaRspFnlz); + + for (rarCnt=0; rarCntraRspAlloc[rarCnt]; + /* Having likely condition first for optimization */ + if (!raRspAlloc->pdcch) + { + continue; + } + else + { + subFrm = raRspAlloc->dlSf; + reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex]; + /* Corrected RACH handling for multiple RAPIDs per RARNTI */ + allocRapidCnt = raRspAlloc->numRapids; + while (allocRapidCnt) + { + raReq = (RgSchRaReqInfo *)(reqLst->first->node); + /* RACHO: If dedicated preamble, then allocate UL Grant + * (consequence of handover/pdcchOrder) and continue */ + if (RGSCH_IS_DEDPRM(cell, raReq->raReq.rapId)) + { + rgSCHCmnHdlHoPo(cell, &subFrm->raRsp[rarCnt].contFreeUeLst, + raReq); + cmLListDelFrm(reqLst, reqLst->first); + allocRapidCnt--; + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, + sizeof(RgSchRaReqInfo)); + continue; + } + /* ccpu00139815 */ + if(cell->overLoadBackOffEnab) + {/* rach Overlaod conrol is triggerd, Skipping this rach */ + cmLListDelFrm(reqLst, reqLst->first); + allocRapidCnt--; + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, + sizeof(RgSchRaReqInfo)); + continue; + } + /* Attempt to include each RA request into the RSP */ + /* Any failure in the procedure is considered to */ + /* affect futher allocations in the same TTI. When */ + /* a failure happens, we break out and complete */ + /* the processing for random access */ + if (rgSCHRamCreateRaCb(cell, &raCb, &err) != ROK) + { + break; + } + /* Msg3 allocation request to USM */ + if (raReq->raReq.rapId < cell->rachCfg.sizeRaPreambleGrpA) + preamGrpA = TRUE; + else + preamGrpA = FALSE; + /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/ + rgSCHCmnMsg3GrntReq(cell, raCb->tmpCrnti, preamGrpA, \ + &(raCb->msg3HqProc), &ulAllocRef, &raCb->msg3HqProcId); + if (ulAllocRef == NULLP) + { + rgSCHRamDelRaCb(cell, raCb, TRUE); + break; + } + if (raReq->raReq.cqiPres) + { + raCb->ccchCqi = raReq->raReq.cqiIdx; + } + else + { + raCb->ccchCqi = cellDl->ccchCqi; + } + raCb->rapId = raReq->raReq.rapId; + raCb->ta.pres = TRUE; + raCb->ta.val = raReq->raReq.ta; + raCb->msg3Grnt = ulAllocRef->grnt; + /* Populating the tpc value received */ + raCb->msg3Grnt.tpc = raReq->raReq.tpc; + /* PHR handling for MSG3 */ + ulAllocRef->raCb = raCb; +#ifndef LTE_TDD + /* To the crntTime, add the MIN time at which UE will + * actually send MSG3 i.e DL_DELTA+6 */ + raCb->msg3AllocTime = cell->crntTime; + RGSCH_INCR_SUB_FRAME(raCb->msg3AllocTime, RG_SCH_CMN_MIN_MSG3_RECP_INTRVL); +#else + msg3SchdIdx = (cell->crntTime.subframe+RG_SCH_CMN_DL_DELTA) % + RGSCH_NUM_SUB_FRAMES; + /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in + special subframe */ + if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][msg3SchdIdx] != + RG_SCH_TDD_UL_SUBFRAME) + { + RGSCHCMNADDTOCRNTTIME(cell->crntTime,raCb->msg3AllocTime, + RG_SCH_CMN_DL_DELTA) + msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][ + raCb->msg3AllocTime.subframe]; + RGSCHCMNADDTOCRNTTIME(raCb->msg3AllocTime, raCb->msg3AllocTime, + msg3Subfrm); + } +#endif + cmLListAdd2Tail(&subFrm->raRsp[rarCnt].raRspLst, &raCb->rspLnk); + raCb->rspLnk.node = (PTR)raCb; + cmLListDelFrm(reqLst, reqLst->first); + allocRapidCnt--; + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq, + sizeof(RgSchRaReqInfo)); + + /* SR_RACH_STATS : RAR scheduled */ + rgNumRarSched++; + + } + /* R8 Upgrade */ + /* Fill subframe data members */ + subFrm->raRsp[rarCnt].raRnti = raRspAlloc->rnti; + subFrm->raRsp[rarCnt].pdcch = raRspAlloc->pdcch; + subFrm->raRsp[rarCnt].tbSz = raRspAlloc->tbInfo[0].bytesAlloc; + /* Fill PDCCH data members */ + rgSCHCmnFillPdcch(cell, subFrm->raRsp[rarCnt].pdcch, raRspAlloc); + + /* ccpu00139815 */ + if(cell->overLoadBackOffEnab) + {/* rach Overlaod conrol is triggerd, Skipping this rach */ + subFrm->raRsp[rarCnt].backOffInd.pres = PRSNT_NODEF; + subFrm->raRsp[rarCnt].backOffInd.val = cell->overLoadBackOffval; + continue; + } + else + { + subFrm->raRsp[rarCnt].backOffInd.pres = NOTPRSNT; + } + + /*[ccpu00125212] Avoiding sending of empty RAR in case of RAR window + is short and UE is sending unauthorised preamble.*/ + reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex]; + if ((raRspAlloc->biEstmt) && (reqLst->count)) + { + subFrm->raRsp[0].backOffInd.pres = PRSNT_NODEF; + /* Added as part of Upgrade */ + subFrm->raRsp[0].backOffInd.val = + rgSCHCmnGetBiIndex(cell, reqLst->count); + + /* SR_RACH_STATS : Back Off Inds */ + rgNumBI++; + + } + else if ((subFrm->raRsp[rarCnt].raRspLst.first == NULLP) && + (subFrm->raRsp[rarCnt].contFreeUeLst.first == NULLP)) + { + /* Return the grabbed PDCCH */ + rgSCHUtlPdcchPut(cell, &subFrm->pdcchInfo, raRspAlloc->pdcch); + subFrm->raRsp[rarCnt].pdcch = NULLP; + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnRaRspAlloc(): " + "Not even one RaReq."); + RETVOID; + } + } + RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId, + "RNTI:%d Scheduled RAR @ (%u,%u) ", + raRspAlloc->rnti, + cell->crntTime.sfn, + cell->crntTime.subframe); + } + RETVOID; +} + +/** + * @brief This function computes rv. + * + * @details + * + * Function: rgSCHCmnDlCalcRvForBcch + * Purpose: This function computes rv. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] Bool si + * @param[in] U16 i + * @return U8 + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnDlCalcRvForBcch +( +RgSchCellCb *cell, +Bool si, +U16 i +) +#else +PRIVATE U8 rgSCHCmnDlCalcRvForBcch(cell, si, i) +RgSchCellCb *cell; +Bool si; +U16 i; +#endif +{ + U8 k, rv; + CmLteTimingInfo frm; + TRC2(rgSCHCmnDlCalcRvForBcch); + + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + + if(si) + { + k = i % 4; + } + else + { + k = (frm.sfn/2) % 4; + } + rv = RGSCH_CEIL(3*k, 2) % 4; + RETVALUE(rv); +} + +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested + * BCCH/PCCH allocations. Assumption: The reuqested + * allocations are always satisfied completely. + * Hence no roll back. + * + * @details + * + * Function: rgSCHCmnDlBcchPcchFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * Takes care of PDCCH filling. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlBcchPcchFnlz +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlBcchPcchFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchDlRbAlloc *rbAllocInfo; + RgSchDlSf *subFrm; + +#ifdef LTE_TDD + U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE; +#else +#ifdef LTEMAC_HDFDD + U8 nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; +#else + U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; +#endif +#endif + + /* Moving variables to available scope for optimization */ + RgSchClcDlLcCb *pcch; + RgSchClcBoRpt *bo; +#ifndef RGR_SI_SCH + RgSchClcDlLcCb *bcch; + Bool sendInd=TRUE; +#endif + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + + TRC2(rgSCHCmnDlBcchPcchFnlz); + + /* handle PCCH */ + rbAllocInfo = &allocInfo->pcchAlloc; + if (rbAllocInfo->pdcch) + { + RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]); + + /* Added sfIdx calculation for TDD as well */ +#ifndef LTE_TDD +#ifdef LTEMAC_HDFDD + nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; +#else + nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; +#endif +#endif + subFrm = rbAllocInfo->dlSf; + pcch = rgSCHDbmGetPcch(cell); + if(pcch == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnDlBcchPcchFnlz( ): " + "No Pcch Present"); + RETVOID; + } + + /* Added Dl TB count for paging message transmission*/ +#ifdef LTE_L2_MEAS + cell->dlUlTbCnt.tbTransDlTotalCnt++; +#endif + bo = (RgSchClcBoRpt *)pcch->boLst.first->node; + cmLListDelFrm(&pcch->boLst, &bo->boLstEnt); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); + /* Fill subframe data members */ + subFrm->pcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc; + subFrm->pcch.pdcch = rbAllocInfo->pdcch; + /* Fill PDCCH data members */ + rgSCHCmnFillPdcch(cell, subFrm->pcch.pdcch, rbAllocInfo); + rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, pcch->lcId, TRUE); + /* ccpu00132314-ADD-Update the tx power allocation info + TODO-Need to add a check for max tx power per symbol */ + subfrmAlloc->cmnLcInfo.pcchInfo.txPwrOffset = cellDl->pcchTxPwrOffset; + } + + /* handle BCCH */ + rbAllocInfo = &allocInfo->bcchAlloc; + if (rbAllocInfo->pdcch) + { + RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]); +#ifndef LTE_TDD +#ifdef LTEMAC_HDFDD + nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; +#else + nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; +#endif +#endif + subFrm = rbAllocInfo->dlSf; + + /* Fill subframe data members */ + subFrm->bcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc; + subFrm->bcch.pdcch = rbAllocInfo->pdcch; + /* Fill PDCCH data members */ + rgSCHCmnFillPdcch(cell, subFrm->bcch.pdcch, rbAllocInfo); + + if(rbAllocInfo->schdFirst) + { +#ifndef RGR_SI_SCH + bcch = rgSCHDbmGetFirstBcchOnDlsch(cell); + bo = (RgSchClcBoRpt *)bcch->boLst.first->node; +#else + /*Copy the SIB1 msg buff into interface buffer */ + SCpyMsgMsg(cell->siCb.crntSiInfo.sib1Info.sib1, + rgSchCb[cell->instIdx].rgSchInit.region, + rgSchCb[cell->instIdx].rgSchInit.pool, + &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); +#endif/*RGR_SI_SCH*/ + subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = + rgSCHCmnDlCalcRvForBcch(cell, FALSE, 0); + } + else + { + U16 i; +#ifdef RGR_SI_SCH + Buffer *pdu; + + i = cell->siCb.siCtx.i; + /*Decrement the retransmission count */ + cell->siCb.siCtx.retxCntRem--; + + /*Copy the SI msg buff into interface buffer */ + if(cell->siCb.siCtx.warningSiFlag == FALSE) + { + SCpyMsgMsg(cell->siCb.siArray[cell->siCb.siCtx.siId-1].si, + rgSchCb[cell->instIdx].rgSchInit.region, + rgSchCb[cell->instIdx].rgSchInit.pool, + &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); + } + else + { + pdu = rgSCHUtlGetWarningSiPdu(cell); + RGSCH_NULL_CHECK(cell->instIdx, pdu); + SCpyMsgMsg(pdu, + rgSchCb[cell->instIdx].rgSchInit.region, + rgSchCb[cell->instIdx].rgSchInit.pool, + &subfrmAlloc->cmnLcInfo.bcchInfo.pdu); + if(cell->siCb.siCtx.retxCntRem == 0) + { + rgSCHUtlFreeWarningSiPdu(cell); + cell->siCb.siCtx.warningSiFlag = FALSE; + + } + } +#else + bcch = rgSCHDbmGetSecondBcchOnDlsch(cell); + bo = (RgSchClcBoRpt *)bcch->boLst.first->node; + bo->retxCnt--; + if(bo->retxCnt != cell->siCfg.retxCnt-1) + { + sendInd=FALSE; + } + i = bo->i; +#endif/*RGR_SI_SCH*/ + subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = + rgSCHCmnDlCalcRvForBcch(cell, TRUE, i); + } + + /* Added Dl TB count for SIB1 and SI messages transmission. + * This counter will be incremented only for the first transmission + * (with RV 0) of these messages*/ +#ifdef LTE_L2_MEAS + if(subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv == 0) + { + cell->dlUlTbCnt.tbTransDlTotalCnt++; + } +#endif +#ifndef RGR_SI_SCH + if(bo->retxCnt == 0) + { + cmLListDelFrm(&bcch->boLst, &bo->boLstEnt); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); + } + rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, bcch->lcId, sendInd); +#else + /*Fill the interface info */ + rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, NULLD, NULLD); + + /* ccpu00132314-ADD-Update the tx power allocation info + TODO-Need to add a check for max tx power per symbol */ + subfrmAlloc->cmnLcInfo.bcchInfo.txPwrOffset = cellDl->bcchTxPwrOffset; + + /*mBuf has been already copied above */ +#endif/*RGR_SI_SCH*/ + } + + RETVOID; +} + + +#if RG_UNUSED +/** + * @brief + * + * @details + * + * Function: rgSCHCmnUlSetAllUnSched + * Purpose: + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnUlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlSetAllUnSched +( +RgSchCmnUlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnUlSetAllUnSched(allocInfo) +RgSchCmnUlRbAllocInfo *allocInfo; +#endif +{ + CmLList *node; + + TRC2(rgSCHCmnUlSetAllUnSched); + + node = allocInfo->contResLst.first; + while (node) + { + rgSCHCmnUlMov2NonSchdCntResLst(allocInfo, (RgSchUeCb *)node->node); + node = allocInfo->contResLst.first; + } + + node = allocInfo->retxUeLst.first; + while (node) + { + rgSCHCmnUlMov2NonSchdRetxUeLst(allocInfo, (RgSchUeCb *)node->node); + node = allocInfo->retxUeLst.first; + } + + node = allocInfo->ueLst.first; + while (node) + { + rgSCHCmnUlMov2NonSchdUeLst(allocInfo, (RgSchUeCb *)node->node); + node = allocInfo->ueLst.first; + } + + RETVOID; +} +#endif + +/** + * @brief + * + * @details + * + * Function: rgSCHCmnUlAdd2CntResLst + * Purpose: + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnUlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAdd2CntResLst +( +RgSchCmnUlRbAllocInfo *allocInfo, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlAdd2CntResLst(allocInfo, ue) +RgSchCmnUlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,ue->cell))->alloc); + TRC2(rgSCHCmnUlAdd2CntResLst); + cmLListAdd2Tail(&allocInfo->contResLst, &ulAllocInfo->reqLnk); + ulAllocInfo->reqLnk.node = (PTR)ue; + RETVOID; +} + +/** + * @brief + * + * @details + * + * Function: rgSCHCmnUlAdd2UeLst + * Purpose: + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnUlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlAdd2UeLst +( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlAdd2UeLst(cell, allocInfo, ue) +RgSchCellCb *cell; +RgSchCmnUlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,cell))->alloc); + TRC2(rgSCHCmnUlAdd2UeLst); + if (ulAllocInfo->reqLnk.node == NULLP) + { + cmLListAdd2Tail(&allocInfo->ueLst, &ulAllocInfo->reqLnk); + ulAllocInfo->reqLnk.node = (PTR)ue; + } + RETVOID; +} + +/** + * @brief + * + * @details + * + * Function: rgSCHCmnAllocUlRb + * Purpose: To do RB allocations for uplink + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnUlRbAllocInfo *allocInfo + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnAllocUlRb +( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo +) +#else +PUBLIC Void rgSCHCmnAllocUlRb(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnUlRbAllocInfo *allocInfo; +#endif +{ + RgSchUlSf *sf = allocInfo->sf; + TRC2(rgSCHCmnAllocUlRb); + + /* Schedule for new transmissions */ + rgSCHCmnUlRbAllocForLst(cell, sf, allocInfo->ueLst.count, + &allocInfo->ueLst, &allocInfo->schdUeLst, + &allocInfo->nonSchdUeLst, (Bool)TRUE); + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnUlRbAllocForLst + * + * Desc : Allocate for a list in cmn rb alloc information passed + * in a subframe. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlRbAllocForLst +( +RgSchCellCb *cell, +RgSchUlSf *sf, +U32 count, +CmLListCp *reqLst, +CmLListCp *schdLst, +CmLListCp *nonSchdLst, +Bool isNewTx +) +#else +PRIVATE Void rgSCHCmnUlRbAllocForLst(cell, sf, count, reqLst, schdLst, + nonSchdLst, isNewTx) +RgSchCellCb *cell; +RgSchUlSf *sf; +U32 count; +CmLListCp *reqLst; +CmLListCp *schdLst; +CmLListCp *nonSchdLst; +Bool isNewTx; +#endif +{ + CmLList *lnk; + RgSchUlHole *hole; +#ifdef LTE_L2_MEAS +#ifdef LTE_TDD + U8 k; + CmLteTimingInfo timeInfo; +#endif +#endif + TRC2(rgSCHCmnUlRbAllocForLst); + + if(schdLst->count == 0) + { + cmLListInit(schdLst); + } + + cmLListInit(nonSchdLst); +#ifdef LTE_L2_MEAS + if(isNewTx == TRUE) + { + cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.numUes = (U8) count; +#ifdef LTE_TDD + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timeInfo, TFU_ULCNTRL_DLDELTA); + k = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][timeInfo.subframe]; + RG_SCH_ADD_TO_CRNT_TIME(timeInfo, + cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo, k); +#else + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime,cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo, + (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); +#endif + } +#endif + + for (lnk = reqLst->first; count; lnk = lnk->next, --count) + { + RgSchUeCb *ue = (RgSchUeCb *)lnk->node; + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + S16 ret; + U8 maxRb; + + + if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) + { + break; + } + + ueUl->subbandShare = ueUl->subbandRequired; + if(isNewTx == TRUE) + { + maxRb = RGSCH_MIN((ueUl->subbandRequired * MAX_5GTF_VRBG_SIZE), ue->ue5gtfCb.maxPrb); + } + ret = rgSCHCmnUlRbAllocForUe(cell, sf, ue, maxRb, hole); + if (ret == ROK) + { + rgSCHCmnUlRbAllocAddUeToLst(cell, ue, schdLst); + rgSCHCmnUlUeFillAllocInfo(cell, ue); + } + else + { + gUl5gtfRbAllocFail++; +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.ul5gtfRbAllocFail++; +#endif + rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst); + ue->isMsg4PdcchWithCrnti = FALSE; + ue->isSrGrant = FALSE; + } +#ifdef LTE_L2_MEAS + if(isNewTx == TRUE) + { + cell->sfAllocArr[cell->crntSfIdx].ulUeInfo. + ulAllocInfo[count - 1].rnti = ue->ueId; + cell->sfAllocArr[cell->crntSfIdx].ulUeInfo. + ulAllocInfo[count - 1].numPrb = ue->ul.nPrb; + } +#endif + ueUl->subbandShare = 0; /* This reset will take care of + * all scheduler types */ + } + for (; count; lnk = lnk->next, --count) + { + RgSchUeCb *ue = (RgSchUeCb *)lnk->node; + rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst); + ue->isMsg4PdcchWithCrnti = FALSE; + } + RETVOID; +} + +#ifdef TFU_UPGRADE +/*********************************************************** + * + * Func : rgSCHCmnUlMdfyGrntForCqi + * + * Desc : Modify UL Grant to consider presence of + * CQI along with PUSCH Data. + * + * Ret : + * + * Notes: + * - Scale down iTbs based on betaOffset and + * size of Acqi Size. + * - Optionally attempt to increase numSb by 1 + * if input payload size does not fit in due + * to reduced tbSz as a result of iTbsNew. + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 maxRb, +U32 *numSb, +U8 *iTbs, +U32 hqSz, +U32 stepDownItbs, +U32 effTgt +) +#else +PRIVATE S16 rgSCHCmnUlMdfyGrntForCqi(cell, ue, maxRb, numSb, iTbs, hqSz, stepDownItbs, effTgt) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 maxRb; +U32 *numSb; +U8 *iTbs; +U32 hqSz; +U32 stepDownItbs; +U32 effTgt; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(ue->cell); + U32 nPrb; + U32 totREs; + U32 cqiRiREs; + U32 hqREs; + U32 remREsForPusch; + U32 bitsPerRe; + U32 tbSz; + U32 betaOffVal = ue->ul.betaOffstVal; + U32 cqiRiRptSz = ue->ul.cqiRiSz; + U32 betaOffHqVal = rgSchCmnBetaHqOffstTbl[ue->ul.betaHqOffst]; + U32 resNumSb = *numSb; + U32 puschEff = 1000; + U8 modOdr; + U8 iMcs; + Bool mdfyiTbsFlg = FALSE; + U8 resiTbs = *iTbs; + + TRC2(rgSCHCmnUlMdfyGrntForCqi) + + + do + { + iMcs = rgSCHCmnUlGetIMcsFrmITbs(resiTbs, RG_SCH_CMN_GET_UE_CTGY(ue)); + RG_SCH_UL_MCS_TO_MODODR(iMcs, modOdr); + if (RG_SCH_CMN_GET_UE_CTGY(ue) != CM_LTE_UE_CAT_5) + { + modOdr = RGSCH_MIN(RGSCH_QM_QPSK, modOdr); + } + else + { + modOdr = RGSCH_MIN(RGSCH_QM_64QAM, modOdr); + } + nPrb = resNumSb * cellUl->sbSize; + /* Restricting the minumum iTbs requried to modify to 10 */ + if ((nPrb >= maxRb) && (resiTbs <= 10)) + { + /* Could not accomodate ACQI */ + RETVALUE(RFAILED); + } + totREs = nPrb * RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl); + tbSz = rgTbSzTbl[0][resiTbs][nPrb-1]; + /* totalREs/tbSz = num of bits perRE. */ + cqiRiREs = (totREs * betaOffVal * cqiRiRptSz)/(1000 * tbSz); /* betaOffVal is represented + as parts per 1000 */ + hqREs = (totREs * betaOffHqVal * hqSz)/(1000 * tbSz); + if ((cqiRiREs + hqREs) < totREs) + { + remREsForPusch = totREs - cqiRiREs - hqREs; + bitsPerRe = (tbSz * 1000)/remREsForPusch; /* Multiplying by 1000 for Interger Oper */ + puschEff = bitsPerRe/modOdr; + } + if (puschEff < effTgt) + { + /* ensure resultant efficiency for PUSCH Data is within 0.93*/ + break; + } + else + { + /* Alternate between increasing SB or decreasing iTbs until eff is met */ + if (mdfyiTbsFlg == FALSE) + { + if (nPrb < maxRb) + { + resNumSb = resNumSb + 1; + } + mdfyiTbsFlg = TRUE; + } + else + { + if (resiTbs > 10) + { + resiTbs-= stepDownItbs; + } + mdfyiTbsFlg = FALSE; + } + } + }while (1); /* Loop breaks if efficency is met + or returns RFAILED if not able to meet the efficiency */ + + *numSb = resNumSb; + *iTbs = resiTbs; + + RETVALUE(ROK); +} +#endif +/*********************************************************** + * + * Func : rgSCHCmnUlRbAllocForUe + * + * Desc : Do uplink RB allocation for an UE. + * + * Ret : + * + * Notes: Note that as of now, for retx, maxRb + * is not considered. Alternatives, such + * as dropping retx if it crosses maxRb + * could be considered. + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlRbAllocForUe +( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUeCb *ue, +U8 maxRb, +RgSchUlHole *hole +) +#else +PRIVATE S16 rgSCHCmnUlRbAllocForUe(cell, sf, ue, maxRb, hole) +RgSchCellCb *cell; +RgSchUlSf *sf; +RgSchUeCb *ue; +U8 maxRb; +RgSchUlHole *hole; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + RgSchUlAlloc *alloc = NULLP; + U32 nPrb = 0; + U8 numVrbg; + U8 iMcs; + U8 iMcsCrnt; +#ifndef RG_5GTF + RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->schdHqProcIdx]; +#else + RgSchUlHqProcCb *proc = NULLP; +#endif + RgSchPdcch *pdcch; + U32 reqVrbg; + U8 numVrbgTemp; +#ifdef RG_5GTF + TfuDciFormat dciFrmt; + U8 numLyr; +#endif + + TRC2(rgSCHCmnUlRbAllocForUe); +#ifdef RG_5GTF + rgSCHUhmGetAvlHqProc(cell, ue, &proc); + if (proc == NULLP) + { + //printf("UE [%d] HQ Proc unavailable\n", ue->ueId); + RETVALUE(RFAILED); + } +#endif + + if (ue->ue5gtfCb.rank == 2) + { + dciFrmt = TFU_DCI_FORMAT_A2; + numLyr = 2; + } + else + { + dciFrmt = TFU_DCI_FORMAT_A1; + numLyr = 1; + } + /* 5gtf TODO : To pass dci frmt to this function */ + pdcch = rgSCHCmnPdcchAllocCrntSf(cell, ue); + if(pdcch == NULLP) + { + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "rgSCHCmnUlRbAllocForUe(): Could not get PDCCH for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + gUl5gtfPdcchSchd++; +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.ul5gtfPdcchSchd++; +#endif + + //TODO_SID using configured prb as of now + nPrb = ue->ue5gtfCb.maxPrb; + reqVrbg = nPrb/MAX_5GTF_VRBG_SIZE; + iMcs = ue->ue5gtfCb.mcs; //gSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg); + iMcsCrnt = iMcs; + numVrbg = reqVrbg; + + if((sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart > MAX_5GTF_VRBG) + || (sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated > MAX_5GTF_VRBG)) + { + printf("5GTF_ERROR vrbg > 25 valstart = %d valalloc %d\n", sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart + , sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated); + int *p=NULLP; + *p = 10; + } + + /*TODO_SID: Workaround for alloc. Currently alloc is ulsf based. To handle multiple beams, we need a different + design. Now alloc are formed based on MAX_5GTF_UE_SCH macro. */ + numVrbgTemp = MAX_5GTF_VRBG/MAX_5GTF_UE_SCH; + if(numVrbg) + { + alloc = rgSCHCmnUlSbAlloc(sf, numVrbgTemp,\ + hole); + } + if (alloc == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnUlRbAllocForUe(): Could not get UlAlloc %d CRNTI:%d",numVrbg,ue->ueId); + rgSCHCmnPdcchRlsCrntSf(cell, pdcch); + RETVALUE(RFAILED); + } + gUl5gtfAllocAllocated++; +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.ul5gtfAllocAllocated++; +#endif + alloc->grnt.vrbgStart = sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart; + alloc->grnt.numVrbg = numVrbg; + alloc->grnt.numLyr = numLyr; + alloc->grnt.dciFrmt = dciFrmt; + + sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart += numVrbg; + sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated += numVrbg; + + //rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); +#ifdef LTE_L2_MEAS + sf->totPrb += alloc->grnt.numRb; + ue->ul.nPrb = alloc->grnt.numRb; +#endif + if (ue->csgMmbrSta != TRUE) + { + cellUl->ncsgPrbCnt += alloc->grnt.numRb; + } + cellUl->totPrbCnt += (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); + alloc->pdcch = pdcch; + alloc->grnt.iMcs = iMcs; + alloc->grnt.iMcsCrnt = iMcsCrnt; + alloc->grnt.hop = 0; + /* Initial Num RBs support for UCI on PUSCH */ +#ifdef TFU_UPGRADE + ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); +#endif + alloc->forMsg3 = FALSE; + //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTb5gtfSzTbl[0], (iTbs)); + + //ueUl->alloc.allocdBytes = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; + /* TODO_SID Allocating based on configured MCS as of now. + Currently for format A2. When doing multi grp per tti, need to update this. */ + ueUl->alloc.allocdBytes = (rgSch5gtfTbSzTbl[iMcs]/8) * ue->ue5gtfCb.rank; + + alloc->grnt.datSz = ueUl->alloc.allocdBytes; + //TODO_SID Need to check mod order. + RG_SCH_CMN_TBS_TO_MODODR(iMcs, alloc->grnt.modOdr); + //alloc->grnt.modOdr = 6; + alloc->grnt.isRtx = FALSE; + + alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg); + alloc->grnt.SCID = 0; + alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE; + alloc->grnt.PMI = 0; + alloc->grnt.uciOnxPUSCH = 0; + alloc->grnt.hqProcId = proc->procId; + + alloc->hqProc = proc; + alloc->hqProc->ulSfIdx = cellUl->schdIdx; + alloc->ue = ue; + /*commenting to retain the rnti used for transmission SPS/c-rnti */ + alloc->rnti = ue->ueId; + ueUl->alloc.alloc = alloc; + /*rntiwari-Adding the debug for generating the graph.*/ + /* No grant attr recorded now */ + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlRbAllocAddUeToLst + * + * Desc : Add UE to list (scheduled/non-scheduled list) + * for UL RB allocation information. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlRbAllocAddUeToLst +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLListCp *lst +) +#else +PUBLIC Void rgSCHCmnUlRbAllocAddUeToLst(cell, ue, lst) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLListCp *lst; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + TRC2(rgSCHCmnUlRbAllocAddUeToLst); + UNUSED(cell); + + gUl5gtfUeRbAllocDone++; +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.ul5gtfUeRbAllocDone++; +#endif + cmLListAdd2Tail(lst, &ueUl->alloc.schdLstLnk); + ueUl->alloc.schdLstLnk.node = (PTR)ue; +} + + +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * + * @details + * + * Function: rgSCHCmnUlAllocFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnUlRbAllocInfo *allocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlAllocFnlz +( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnUlAllocFnlz(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnUlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnUlAllocFnlz); + + /* call scheduler specific Finalization */ + cellSch->apisUl->rgSCHUlAllocFnlz(cell, allocInfo); + + RETVOID; +} + +/** + * @brief This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * + * @details + * + * Function: rgSCHCmnDlAllocFnlz + * Purpose: This function Processes the Final Allocations + * made by the RB Allocator against the requested. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlAllocFnlz +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnDlAllocFnlz(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo; + + TRC2(rgSCHCmnDlAllocFnlz); + + rgSCHCmnDlCcchRetxFnlz(cell, allocInfo); + rgSCHCmnDlCcchTxFnlz(cell, allocInfo); +#ifdef RGR_V1 + /* Added below functions for handling CCCH SDU transmission received + * after + * * guard timer expiry*/ + rgSCHCmnDlCcchSduRetxFnlz(cell, allocInfo); + rgSCHCmnDlCcchSduTxFnlz(cell, allocInfo); +#endif + rgSCHCmnDlRaRspFnlz(cell, allocInfo); + /* call scheduler specific Finalization */ + cellSch->apisDl->rgSCHDlAllocFnlz(cell, allocInfo); + + /* Stack Crash problem for TRACE5 Changes. Added the return below */ + RETVOID; + +} + +#ifdef RG_UNUSED +/** + * @brief Update an uplink subframe. + * + * @details + * + * Function : rgSCHCmnUlUpdSf + * + * For each allocation + * - if no more tx needed + * - Release allocation + * - else + * - Perform retransmission + * + * @param[in] RgSchUlSf *sf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlUpdSf +( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo, +RgSchUlSf *sf +) +#else +PRIVATE Void rgSCHCmnUlUpdSf(cell, allocInfo, sf) +RgSchCellCb *cell; +RgSchCmnUlRbAllocInfo *allocInfo; +RgSchUlSf *sf; +#endif +{ + CmLList *lnk; + TRC2(rgSCHCmnUlUpdSf); + + while ((lnk = sf->allocs.first)) + { + RgSchUlAlloc *alloc = (RgSchUlAlloc *)lnk->node; + lnk = lnk->next; + + if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0)) + { + } + else + { + /* If need to handle all retx together, run another loop separately */ + rgSCHCmnUlHndlAllocRetx(cell, allocInfo, sf, alloc); + } + rgSCHCmnUlRlsUlAlloc(cell, sf, alloc); + } + + /* By this time, all allocs would have been cleared and + * SF is reset to be made ready for new allocations. */ + rgSCHCmnUlSfReset(cell, sf); + /* In case there are timing problems due to msg3 + * allocations being done in advance, (which will + * probably happen with the current FDD code that + * handles 8 subframes) one solution + * could be to hold the (recent) msg3 allocs in a separate + * list, and then possibly add that to the actual + * list later. So at this time while allocations are + * traversed, the recent msg3 ones are not seen. Anytime after + * this (a good time is when the usual allocations + * are made), msg3 allocations could be transferred to the + * normal list. Not doing this now as it is assumed + * that incorporation of TDD shall take care of this. + */ + + + RETVOID; +} + +/** + * @brief Handle uplink allocation for retransmission. + * + * @details + * + * Function : rgSCHCmnUlHndlAllocRetx + * + * Processing Steps: + * - Add to queue for retx. + * - Do not release here, release happends as part + * of the loop that calls this function. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnUlRbAllocInfo *allocInfo + * @param[in] RgSchUlSf *sf + * @param[in] RgSchUlAlloc *alloc + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlHndlAllocRetx +( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo, +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PRIVATE Void rgSCHCmnUlHndlAllocRetx(cell, allocInfo, sf, alloc) +RgSchCellCb *cell; +RgSchCmnUlRbAllocInfo *allocInfo; +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + U32 bytes; + RgSchCmnUlUe *ueUl; + TRC2(rgSCHCmnUlHndlAllocRetx); + bytes = \ + rgTbSzTbl[0][rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs)]\ + [alloc->grnt.numRb-1]/8; + if (!alloc->forMsg3) + { + ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue); + ueUl->alloc.reqBytes = bytes; + rgSCHUhmRetx(alloc->hqProc); + rgSCHCmnUlAdd2RetxUeLst(allocInfo, alloc->ue); + } + else + { + /* RACHO msg3 retx handling. Part of RACH procedure changes. */ + retxAlloc = rgSCHCmnUlGetUlAlloc(cell, sf, alloc->numSb); + if (retxAlloc == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnUlRbAllocForUe():Could not get UlAlloc for msg3Retx RNTI:%d", + alloc->rnti); + RETVOID; + } + retxAlloc->grnt.iMcs = alloc->grnt.iMcs; + retxAlloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl\ + [alloc->hqProc->rvIdx]; + retxAlloc->grnt.nDmrs = 0; + retxAlloc->grnt.hop = 0; + retxAlloc->grnt.delayBit = 0; + retxAlloc->rnti = alloc->rnti; + retxAlloc->ue = NULLP; + retxAlloc->pdcch = FALSE; + retxAlloc->forMsg3 = TRUE; + retxAlloc->raCb = alloc->raCb; + retxAlloc->hqProc = alloc->hqProc; + rgSCHUhmRetx(retxAlloc->hqProc); + } + RETVOID; +} +#endif + +/** + * @brief Uplink Scheduling Handler. + * + * @details + * + * Function: rgSCHCmnUlAlloc + * Purpose: This function Handles Uplink Scheduling. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +/* ccpu00132653- The definition of this function made common for TDD and FDD*/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlAlloc +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnUlAlloc(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnUlRbAllocInfo allocInfo; + RgSchCmnUlRbAllocInfo *allocInfoRef = &allocInfo; +#ifdef RG_5GTF + U8 idx; + +#endif + + TRC2(rgSCHCmnUlAlloc); + + /* Initializing RgSchCmnUlRbAllocInfo structure */ + rgSCHCmnInitUlRbAllocInfo(allocInfoRef); + + /* Get Uplink Subframe */ + allocInfoRef->sf = &cellUl->ulSfArr[cellUl->schdIdx]; +#ifdef LTE_L2_MEAS + /* initializing the UL PRB count */ + allocInfoRef->sf->totPrb = 0; +#endif + +#ifdef LTEMAC_SPS + rgSCHCmnSpsUlTti(cell, allocInfoRef); +#endif + + if(*allocInfoRef->sf->allocCountRef == 0) + { + RgSchUlHole *hole; + + if ((hole = rgSCHUtlUlHoleFirst(allocInfoRef->sf)) != NULLP) + { + /* Sanity check of holeDb */ + if (allocInfoRef->sf->holeDb->count == 1 && hole->start == 0) + { + hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb; + /* Re-Initialize available subbands because of CFI change*/ + allocInfoRef->sf->availSubbands = cell->dynCfiCb.\ + bwInfo[cellDl->currCfi].numSb; + /*Currently initializing 5gtf ulsf specific initialization here. + need to do at proper place */ +#ifdef RG_5GTF + allocInfoRef->sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; + allocInfoRef->sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; + for(idx = 0; idx < MAX_5GTF_BEAMS; idx++) + { + allocInfoRef->sf->sfBeamInfo[idx].totVrbgAllocated = 0; + allocInfoRef->sf->sfBeamInfo[idx].totVrbgRequired = 0; + allocInfoRef->sf->sfBeamInfo[idx].vrbgStart = 0; + } +#endif + } + else + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "Error! holeDb sanity check failed"); + } + } + } + + /* Fix: Adaptive re-transmissions prioritised over other transmissions */ + /* perform adaptive retransmissions */ + rgSCHCmnUlSfReTxAllocs(cell, allocInfoRef->sf); + + g5gtfTtiCnt++; + + /* Fix: syed Adaptive Msg3 Retx crash. Release all + Harq processes for which adap Retx failed, to avoid + blocking. This step should be done before New TX + scheduling to make hqProc available. Right now we + dont check if proc is in adap Retx list for considering + it to be available. But now with this release that + functionality would be correct. */ +#ifndef RG_5GTF + rgSCHCmnUlSfRlsRetxProcs(cell, allocInfoRef->sf); +#endif + + /* Specific UL scheduler to perform UE scheduling */ + cellSch->apisUl->rgSCHUlSched(cell, allocInfoRef); + + /* Call UL RB allocator module */ + rgSCHCmnAllocUlRb(cell, allocInfoRef); + + /* Do group power control for PUSCH */ + rgSCHCmnGrpPwrCntrlPusch(cell, allocInfoRef->sf); + + cell->sc.apis->rgSCHDrxStrtInActvTmrInUl(cell); + + rgSCHCmnUlAllocFnlz(cell, allocInfoRef); + if(5000 == g5gtfTtiCnt) + { + ul5gtfsidDlAlreadyMarkUl = 0; + ul5gtfsidDlSchdPass = 0; + ul5gtfsidUlMarkUl = 0; + ul5gtfTotSchdCnt = 0; + g5gtfTtiCnt = 0; + } + + RETVOID; +} + +/** + * @brief send Subframe Allocations. + * + * @details + * + * Function: rgSCHCmnSndCnsldtInfo + * Purpose: Send the scheduled + * allocations to MAC for StaInd generation to Higher layers and + * for MUXing. PST's RgInfSfAlloc to MAC instance. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnSndCnsldtInfo +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnSndCnsldtInfo(cell) +RgSchCellCb *cell; +#endif +{ + RgInfSfAlloc *subfrmAlloc; + Pst pst; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnSndCnsldtInfo); + + subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); + + /* Send the allocations to MAC for MUXing */ + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); + subfrmAlloc->cellId = cell->cellId; + /* Populate the List of UEs needing PDB-based Flow control */ + cellSch->apisDl->rgSCHDlFillFlwCtrlInfo(cell, subfrmAlloc); +#ifdef LTE_L2_MEAS + if((subfrmAlloc->rarInfo.numRaRntis) || +#ifdef EMTC_ENABLE + (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) || + (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) || + (subfrmAlloc->emtcInfo.ueInfo.numUes) || +#endif + (subfrmAlloc->ueInfo.numUes) || + (subfrmAlloc->cmnLcInfo.bitMask) || + (subfrmAlloc->ulUeInfo.numUes) || + (subfrmAlloc->flowCntrlInfo.numUes)) +#else + if((subfrmAlloc->rarInfo.numRaRntis) || +#ifdef EMTC_ENABLE + (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) || + (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) || + (subfrmAlloc->emtcInfo.ueInfo.numUes) || +#endif + (subfrmAlloc->ueInfo.numUes) || + (subfrmAlloc->cmnLcInfo.bitMask) || + (subfrmAlloc->flowCntrlInfo.numUes)) +#endif + { + RgSchMacSfAlloc(&pst, subfrmAlloc); + } +#ifndef LTE_TDD + cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_NUM_SUB_FRAMES; +#else + cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_SF_ALLOC_SIZE; +#endif + + RETVOID; +} +/** + * @brief Consolidate Subframe Allocations. + * + * @details + * + * Function: rgSCHCmnCnsldtSfAlloc + * Purpose: Consolidate Subframe Allocations. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnCnsldtSfAlloc +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnCnsldtSfAlloc(cell) +RgSchCellCb *cell; +#endif +{ + RgInfSfAlloc *subfrmAlloc; + CmLteTimingInfo frm; + RgSchDlSf *dlSf; + CmLListCp dlDrxInactvTmrLst; + CmLListCp dlInActvLst; + CmLListCp ulInActvLst; + RgSchCmnCell *cellSch = NULLP; + + TRC2(rgSCHCmnCnsldtSfAlloc); + + cmLListInit(&dlDrxInactvTmrLst); + cmLListInit(&dlInActvLst); + cmLListInit(&ulInActvLst); + + subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); + + /* Get Downlink Subframe */ + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + dlSf = rgSCHUtlSubFrmGet(cell, frm); + + /* Fill the allocation Info */ + rgSCHUtlFillRgInfRarInfo(dlSf, subfrmAlloc, cell); + + /* CA dev Start */ + rgSCHUtlFillRgInfUeInfo(dlSf, cell, &dlDrxInactvTmrLst, + &dlInActvLst, &ulInActvLst); +#ifdef RG_PFS_STATS + cell->totalPrb += dlSf->bwAssigned; +#endif + /* Mark the following Ues inactive for UL*/ + cellSch = RG_SCH_CMN_GET_CELL(cell); + + /* Calling Scheduler specific function with DRX inactive UE list*/ + cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInActvLst); + cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInActvLst); + + /* CA dev End */ + /*re/start DRX inactivity timer for the UEs*/ + (Void)rgSCHDrxStrtInActvTmr(cell,&dlDrxInactvTmrLst,RG_SCH_DRX_DL); + + RETVOID; +} + +/** + * @brief Initialize the DL Allocation Information Structure. + * + * @details + * + * Function: rgSCHCmnInitDlRbAllocInfo + * Purpose: Initialize the DL Allocation Information Structure. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnInitDlRbAllocInfo +( +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnInitDlRbAllocInfo(allocInfo) +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + TRC2(rgSCHCmnInitDlRbAllocInfo); + cmMemset((U8 *)&allocInfo->pcchAlloc, (U8)0, sizeof(RgSchDlRbAlloc)); + cmMemset((U8 *)&allocInfo->bcchAlloc, (U8)0, sizeof(RgSchDlRbAlloc)); + cmMemset((U8 *)allocInfo->raRspAlloc, (U8)0, + RG_SCH_CMN_MAX_CMN_PDCCH*sizeof(RgSchDlRbAlloc)); + + allocInfo->msg4Alloc.msg4DlSf = NULLP; + cmLListInit(&allocInfo->msg4Alloc.msg4TxLst); + cmLListInit(&allocInfo->msg4Alloc.msg4RetxLst); + cmLListInit(&allocInfo->msg4Alloc.schdMsg4TxLst); + cmLListInit(&allocInfo->msg4Alloc.schdMsg4RetxLst); + cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4TxLst); + cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4RetxLst); +#ifdef RGR_V1 + allocInfo->ccchSduAlloc.ccchSduDlSf = NULLP; + cmLListInit(&allocInfo->ccchSduAlloc.ccchSduTxLst); + cmLListInit(&allocInfo->ccchSduAlloc.ccchSduRetxLst); + cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduTxLst); + cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduRetxLst); + cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst); + cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst); +#endif + + allocInfo->dedAlloc.dedDlSf = NULLP; + cmLListInit(&allocInfo->dedAlloc.txHqPLst); + cmLListInit(&allocInfo->dedAlloc.retxHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdTxHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdRetxHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdTxHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdRetxHqPLst); + + cmLListInit(&allocInfo->dedAlloc.txRetxHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdTxRetxHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdTxRetxHqPLst); +#ifdef LTEMAC_SPS + cmLListInit(&allocInfo->dedAlloc.txSpsHqPLst); + cmLListInit(&allocInfo->dedAlloc.retxSpsHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdTxSpsHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdRetxSpsHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdTxSpsHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdRetxSpsHqPLst); +#endif + +#ifdef LTE_ADV + rgSCHLaaCmnInitDlRbAllocInfo (allocInfo); +#endif + + cmLListInit(&allocInfo->dedAlloc.errIndTxHqPLst); + cmLListInit(&allocInfo->dedAlloc.schdErrIndTxHqPLst); + cmLListInit(&allocInfo->dedAlloc.nonSchdErrIndTxHqPLst); + RETVOID; +} + +/** + * @brief Initialize the UL Allocation Information Structure. + * + * @details + * + * Function: rgSCHCmnInitUlRbAllocInfo + * Purpose: Initialize the UL Allocation Information Structure. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnUlRbAllocInfo *allocInfo + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnInitUlRbAllocInfo +( +RgSchCmnUlRbAllocInfo *allocInfo +) +#else +PUBLIC Void rgSCHCmnInitUlRbAllocInfo(allocInfo) +RgSchCmnUlRbAllocInfo *allocInfo; +#endif +{ + TRC2(rgSCHCmnInitUlRbAllocInfo); + allocInfo->sf = NULLP; + cmLListInit(&allocInfo->contResLst); + cmLListInit(&allocInfo->schdContResLst); + cmLListInit(&allocInfo->nonSchdContResLst); + cmLListInit(&allocInfo->ueLst); + cmLListInit(&allocInfo->schdUeLst); + cmLListInit(&allocInfo->nonSchdUeLst); + + RETVOID; +} + +/** + * @brief Scheduling for PUCCH group power control. + * + * @details + * + * Function: rgSCHCmnGrpPwrCntrlPucch + * Purpose: This function does group power control for PUCCH + * corresponding to the subframe for which DL UE allocations + * have happended. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGrpPwrCntrlPucch +( +RgSchCellCb *cell, +RgSchDlSf *dlSf +) +#else +PRIVATE Void rgSCHCmnGrpPwrCntrlPucch(cell, dlSf) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +#endif +{ + TRC2(rgSCHCmnGrpPwrCntrlPucch); + + rgSCHPwrGrpCntrlPucch(cell, dlSf); + + RETVOID; +} + +/** + * @brief Scheduling for PUSCH group power control. + * + * @details + * + * Function: rgSCHCmnGrpPwrCntrlPusch + * Purpose: This function does group power control, for + * the subframe for which UL allocation has (just) happened. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *ulSf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGrpPwrCntrlPusch +( +RgSchCellCb *cell, +RgSchUlSf *ulSf +) +#else +PRIVATE Void rgSCHCmnGrpPwrCntrlPusch(cell, ulSf) +RgSchCellCb *cell; +RgSchUlSf *ulSf; +#endif +{ + /*removed unused variable *cellSch*/ + CmLteTimingInfo frm; + RgSchDlSf *dlSf; + + TRC2(rgSCHCmnGrpPwrCntrlPusch); + + /* Got to pass DL SF corresponding to UL SF, so get that first. + * There is no easy way of getting dlSf by having the RgSchUlSf*, + * so use the UL delta from current time to get the DL SF. */ + frm = cell->crntTime; + +#ifdef EMTC_ENABLE + if(cell->emtcEnable == TRUE) + { + RGSCH_INCR_SUB_FRAME_EMTC(frm, TFU_DLCNTRL_DLDELTA); + } + else +#endif + { + RGSCH_INCR_SUB_FRAME(frm, TFU_DLCNTRL_DLDELTA); + } + /* Del filling of dl.time */ + dlSf = rgSCHUtlSubFrmGet(cell, frm); + + rgSCHPwrGrpCntrlPusch(cell, dlSf, ulSf); + + RETVOID; +} + +/* Fix: syed align multiple UEs to refresh at same time */ +/*********************************************************** + * + * Func : rgSCHCmnApplyUeRefresh + * + * Desc : Apply UE refresh in CMN and Specific + * schedulers. Data rates and corresponding + * scratchpad variables are updated. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnApplyUeRefresh +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE S16 rgSCHCmnApplyUeRefresh(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U32 effGbrBsr = 0; + U32 effNonGbrBsr = 0; + U32 lcgId; + + TRC2(rgSCHCmnApplyUeRefresh); + + /* Reset the refresh cycle variableCAP */ + ue->ul.effAmbr = ue->ul.cfgdAmbr; + + for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) + { + if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) + { + RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); + + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + cmnLcg->effGbr = cmnLcg->cfgdGbr; + cmnLcg->effDeltaMbr = cmnLcg->deltaMbr; + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); + /* Considering GBR LCG will be prioritised by UE */ + effGbrBsr += cmnLcg->bs; + }/* Else no remaing BS so nonLcg0 will be updated when BSR will be received */ + else + { + effNonGbrBsr += cmnLcg->reportedBs; + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); + } + } + } + effNonGbrBsr = RGSCH_MIN(effNonGbrBsr,ue->ul.effAmbr); + ue->ul.nonGbrLcgBs = effNonGbrBsr; + + ue->ul.nonLcg0Bs = effGbrBsr + effNonGbrBsr; + ue->ul.effBsr = ue->ul.nonLcg0Bs +\ + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; + + + /* call scheduler specific event handlers + * for refresh timer expiry */ + cellSch->apisUl->rgSCHUlUeRefresh(cell, ue); + cellSch->apisDl->rgSCHDlUeRefresh(cell, ue); + + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnTmrExpiry + * + * Desc : Adds an UE to refresh queue, so that the UE is + * periodically triggered to refresh it's GBR and + * AMBR values. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnTmrExpiry +( +PTR cb, /* Pointer to timer control block */ +S16 tmrEvnt /* Timer Event */ +) +#else +PRIVATE S16 rgSCHCmnTmrExpiry(cb, tmrEvnt) +PTR cb; /* Pointer to timer control block */ +S16 tmrEvnt; /* Timer Event */ +#endif +{ + RgSchUeCb *ue = (RgSchUeCb *)cb; + RgSchCellCb *cell = ue->cell; +#if (ERRCLASS & ERRCLS_DEBUG) +#endif + + TRC2(rgSCHCmnTmrExpiry); + +#if (ERRCLASS & ERRCLS_DEBUG) + if (tmrEvnt != RG_SCH_CMN_EVNT_UE_REFRESH) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnTmrExpiry(): Invalid " + "timer event CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } +#else + UNUSED(tmrEvnt); +#endif + + rgSCHCmnApplyUeRefresh(cell, ue); + + rgSCHCmnAddUeToRefreshQ(cell, ue, RG_SCH_CMN_REFRESH_TIME); + + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHCmnTmrProc + * + * Desc : Timer entry point per cell. Timer + * processing is triggered at every frame boundary + * (every 10 ms). + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnTmrProc +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnTmrProc(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); + /* Moving the assignment of scheduler pointer + to available scope for optimization */ + TRC2(rgSCHCmnTmrProc); + + if ((cell->crntTime.subframe % RGSCH_NUM_SUB_FRAMES_5G) == 0) + { + /* Reset the counters periodically */ + if ((cell->crntTime.sfn % RG_SCH_CMN_CSG_REFRESH_TIME) == 0) + { + RG_SCH_RESET_HCSG_DL_PRB_CNTR(cmnDlCell); + RG_SCH_RESET_HCSG_UL_PRB_CNTR(cmnUlCell); + } + if ((cell->crntTime.sfn % RG_SCH_CMN_OVRLDCTRL_REFRESH_TIME) == 0) + { + + cell->measurements.ulTpt = ((cell->measurements.ulTpt * 95) + ( cell->measurements.ulBytesCnt * 5))/100; + cell->measurements.dlTpt = ((cell->measurements.dlTpt * 95) + ( cell->measurements.dlBytesCnt * 5))/100; + + rgSCHUtlCpuOvrLdAdjItbsCap(cell); + /* reset cell level tpt measurements for next cycle */ + cell->measurements.ulBytesCnt = 0; + cell->measurements.dlBytesCnt = 0; + } + /* Comparing with Zero instead of % is being done for efficiency. + * If Timer resolution changes then accordingly update the + * macro RG_SCH_CMN_REFRESH_TIMERES */ + RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell); + cmPrcTmr(&sched->tmrTqCp, sched->tmrTq, (PFV)rgSCHCmnTmrExpiry); + } + + RETVALUE(ROK); +} + + +/*********************************************************** + * + * Func : rgSchCmnUpdCfiVal + * + * Desc : Update the CFI value if CFI switch was done + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSchCmnUpdCfiVal +( +RgSchCellCb *cell, +U8 delta +) +#else +PRIVATE Void rgSchCmnUpdCfiVal(cell, delta) +RgSchCellCb *cell; +U8 delta; +#endif +{ + RgSchDlSf *dlSf; + CmLteTimingInfo pdsch; + RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 dlIdx; +#ifdef LTE_TDD + U8 mPhich; + RgSchDlSf *tddSf; + U8 idx; + U8 splSfCfi = 0; +#endif + + TRC2(rgSchCmnUpdCfiVal); + + pdsch = cell->crntTime; + RGSCH_INCR_SUB_FRAME(pdsch, delta); + dlSf = rgSCHUtlSubFrmGet(cell, pdsch); + /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI + *change happens in that SF then UL PDCCH allocation happens with old CFI + *but CFI in control Req goes updated one since it was stored in the CELL + */ + dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi; + if(cell->dynCfiCb.pdcchSfIdx != 0xFF) + { +#ifdef LTE_TDD + dlIdx = rgSCHUtlGetDlSfIdx(cell, &pdsch); +#else + dlIdx = (((pdsch.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (pdsch.subframe % RGSCH_NUM_SUB_FRAMES)); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); +#endif + /* If current downlink subframe index is same as pdcch SF index, + * perform the switching of CFI in this subframe */ + if(cell->dynCfiCb.pdcchSfIdx == dlIdx) + { + cellCmnDl->currCfi = cellCmnDl->newCfi; + cell->dynCfiCb.pdcchSfIdx = 0xFF; + + /* Updating the nCce value based on the new CFI */ +#ifdef LTE_TDD + splSfCfi = cellCmnDl->newCfi; + for(idx = 0; idx < cell->numDlSubfrms; idx++) + { + tddSf = cell->subFrms[idx]; + + mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][tddSf->sfNum]; + + if(tddSf->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi); + + tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi]; + } + else + { + tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][cellCmnDl->currCfi]; + } + } + /* Setting the switch over window length based on config index. + * During switch over period all the UL trnsmissions are Acked + * to UEs */ + cell->dynCfiCb.switchOvrWinLen = + rgSchCfiSwitchOvrWinLen[cell->ulDlCfgIdx]; +#else + cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCmnDl->currCfi]; + /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI + *change happens in that SF then UL PDCCH allocation happens with old CFI + *but CFI in control Req goes updated one since it was stored in the CELL + */ + dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi; + cell->dynCfiCb.switchOvrWinLen = rgSchCfiSwitchOvrWinLen[7]; +#endif + } + } + + RETVOID; +} + +/*********************************************************** + * + * Func : rgSchCmnUpdtPdcchSfIdx + * + * Desc : Update the switch over window length + * + * Ret : void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef LTE_TDD +#ifdef ANSI +PRIVATE Void rgSchCmnUpdtPdcchSfIdx +( +RgSchCellCb *cell, +U8 dlIdx, +U8 sfNum +) +#else +PRIVATE Void rgSchCmnUpdtPdcchSfIdx(cell, dlIdx, sfNum) +RgSchCellCb *cell; +U8 dlIdx; +U8 sfNum; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSchCmnUpdtPdcchSfIdx +( +RgSchCellCb *cell, +U8 dlIdx +) +#else +PRIVATE Void rgSchCmnUpdtPdcchSfIdx(cell, dlIdx) +RgSchCellCb *cell; +U8 dlIdx; +#endif +#endif +{ + U8 idx; + + TRC2(rgSchCmnUpdtPdcchSfIdx); + + /* Resetting the parameters on CFI switching */ + cell->dynCfiCb.cceUsed = 0; + cell->dynCfiCb.lowCceCnt = 0; + + cell->dynCfiCb.cceFailSum = 0; + cell->dynCfiCb.cceFailCnt = 0; + cell->dynCfiCb.prevCceFailIdx = 0; + + cell->dynCfiCb.switchOvrInProgress = TRUE; + + for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++) + { + cell->dynCfiCb.cceFailSamples[idx] = 0; + } + + cell->dynCfiCb.ttiCnt = 0; + + cell->dynCfiCb.cfiSwitches++; + cfiSwitchCnt = cell->dynCfiCb.cfiSwitches; + +#ifdef LTE_TDD + cell->dynCfiCb.pdcchSfIdx = (dlIdx + + rgSchTddPdcchSfIncTbl[cell->ulDlCfgIdx][sfNum]) % cell->numDlSubfrms; +#else + cell->dynCfiCb.pdcchSfIdx = (dlIdx + RG_SCH_CFI_APPLY_DELTA) % \ + RGSCH_NUM_DL_SUBFRAMES; +#endif +} + +/*********************************************************** + * + * Func : rgSchCmnUpdCfiDb + * + * Desc : Update the counters related to dynamic + * CFI feature in cellCb. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSchCmnUpdCfiDb +( +RgSchCellCb *cell, +U8 delta +) +#else +PUBLIC Void rgSchCmnUpdCfiDb(cell, delta) +RgSchCellCb *cell; +U8 delta; +#endif +{ + CmLteTimingInfo frm; + RgSchDlSf *dlSf; +#ifdef LTE_TDD + U8 mPhich; + Bool isHiDci0; +#endif + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 nCceLowerCfi = 0; + U8 currCfi; + U8 cceFailIdx; + U32 totalCce; + U8 dlIdx; + U16 ttiMod; + + TRC2(rgSchCmnUpdCfiDb); + + /* Get Downlink Subframe */ + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, delta); + +#ifdef LTE_TDD + dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm); + dlSf = cell->subFrms[dlIdx]; + isHiDci0 = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][dlSf->sfNum]; +#else + /* Changing the idexing + so that proper subframe is selected */ + dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.subframe % RGSCH_NUM_SUB_FRAMES)); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); + dlSf = cell->subFrms[dlIdx]; +#endif + + currCfi = cellSch->dl.currCfi; + + if(!cell->dynCfiCb.switchOvrInProgress) + { + do{ + if(!cell->dynCfiCb.isDynCfiEnb) + { + if(currCfi != cellSch->cfiCfg.cfi) + { + if(currCfi < cellSch->cfiCfg.cfi) + { + RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi) + cfiIncr = cell->dynCfiCb.cfiIncr; + } + else + { + RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi) + cfiDecr = cell->dynCfiCb.cfiDecr; + } + } + break; + } + +#ifdef LTE_TDD + /* Setting ttiMod to 0 for ttiCnt > 1000 in case if this + * function was not called in UL subframe*/ + if(cell->dynCfiCb.ttiCnt > RGSCH_CFI_TTI_MON_INTRVL) + { + ttiMod = 0; + } + else +#endif + { + ttiMod = cell->dynCfiCb.ttiCnt % RGSCH_CFI_TTI_MON_INTRVL; + } + + dlSf->dlUlBothCmplt++; +#ifdef LTE_TDD + if((dlSf->dlUlBothCmplt == 2) || (!isHiDci0)) +#else + if(dlSf->dlUlBothCmplt == 2) +#endif + { + /********************STEP UP CRITERIA********************/ + /* Updating the CCE failure count parameter */ + cell->dynCfiCb.cceFailCnt += dlSf->isCceFailure; + cell->dynCfiCb.cceFailSum += dlSf->isCceFailure; + + /* Check if cfi step up can be performed */ + if(currCfi < cell->dynCfiCb.maxCfi) + { + if(cell->dynCfiCb.cceFailSum >= cell->dynCfiCb.cfiStepUpTtiCnt) + { + RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi) + cfiIncr = cell->dynCfiCb.cfiIncr; + break; + } + } + + /********************STEP DOWN CRITERIA********************/ + + /* Updating the no. of CCE used in this dl subframe */ + cell->dynCfiCb.cceUsed += dlSf->cceCnt; + + if(currCfi > RGSCH_MIN_CFI_VAL) + { + /* calculating the number of CCE for next lower CFI */ +#ifdef LTE_TDD + mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][dlSf->sfNum]; + nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[mPhich][currCfi-1]; +#else + nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[0][currCfi-1]; +#endif + if(dlSf->cceCnt < nCceLowerCfi) + { + /* Updating the count of TTIs in which no. of CCEs + * used were less than the CCEs of next lower CFI */ + cell->dynCfiCb.lowCceCnt++; + } + + if(ttiMod == 0) + { + totalCce = (nCceLowerCfi * cell->dynCfiCb.cfiStepDownTtiCnt * + RGSCH_CFI_CCE_PERCNTG)/100; + + if((!cell->dynCfiCb.cceFailSum) && + (cell->dynCfiCb.lowCceCnt >= + cell->dynCfiCb.cfiStepDownTtiCnt) && + (cell->dynCfiCb.cceUsed < totalCce)) + { + RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi) + cfiDecr = cell->dynCfiCb.cfiDecr; + break; + } + } + } + + cceFailIdx = ttiMod/cell->dynCfiCb.failSamplePrd; + + if(cceFailIdx != cell->dynCfiCb.prevCceFailIdx) + { + /* New sample period has started. Subtract the old count + * from the new sample period */ + cell->dynCfiCb.cceFailSum -= cell->dynCfiCb.cceFailSamples[cceFailIdx]; + + /* Store the previous sample period data */ + cell->dynCfiCb.cceFailSamples[cell->dynCfiCb.prevCceFailIdx] + = cell->dynCfiCb.cceFailCnt; + + cell->dynCfiCb.prevCceFailIdx = cceFailIdx; + + /* Resetting the CCE failure count as zero for next sample period */ + cell->dynCfiCb.cceFailCnt = 0; + } + + if(ttiMod == 0) + { + /* Restting the parametrs after Monitoring Interval expired */ + cell->dynCfiCb.cceUsed = 0; + cell->dynCfiCb.lowCceCnt = 0; + cell->dynCfiCb.ttiCnt = 0; + } + + cell->dynCfiCb.ttiCnt++; + } + }while(0); + + if(cellSch->dl.newCfi != cellSch->dl.currCfi) + { +#ifdef LTE_TDD + rgSchCmnUpdtPdcchSfIdx(cell, dlIdx, dlSf->sfNum); +#else + rgSchCmnUpdtPdcchSfIdx(cell, dlIdx); +#endif + } + } +} + +/** + * @brief Dl Scheduler for Broadcast and Common channel scheduling. + * + * @details + * + * Function: rgSCHCmnDlCommonChSch + * Purpose: This function schedules DL Common channels for LTE. + * Invoked by TTI processing in TOM. Scheduling is done for + * BCCH, PCCH, Msg4, CCCH SDU, RAR in that order + * + * Invoked by: TOM (TTI processing) + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlCommonChSch +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnDlCommonChSch(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnDlCommonChSch); + + cellSch->apisDl->rgSCHDlTickForPdbTrkng(cell); + rgSchCmnUpdCfiVal(cell, RG_SCH_CMN_DL_DELTA); + + /* handle Inactive UEs for DL */ + rgSCHCmnHdlDlInactUes(cell); + + /* Send a Tick to Refresh Timer */ + rgSCHCmnTmrProc(cell); + + if (cell->isDlDataAllwd && (cell->stopSiSch == FALSE)) + { + rgSCHCmnInitRbAlloc(cell); + /* Perform DL scheduling of BCCH, PCCH */ + rgSCHCmnDlBcchPcchAlloc(cell); + } + else + { + if(cell->siCb.inWindow != 0) + { + cell->siCb.inWindow--; + } + } + if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE)) + { + rgSCHCmnDlCcchRarAlloc(cell); + } + RETVOID; +} + +/** + * @brief Scheduler invocation per TTI. + * + * @details + * + * Function: rgSCHCmnUlSch + * Purpose: This function implements UL scheduler alone. This is to + * be able to perform scheduling with more flexibility. + * + * Invoked by: TOM (TTI processing) + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlSch +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnUlSch(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnUlSch); + +#ifdef LTE_ADV + /* LAA_SCELL: */ + if(TRUE == rgSCHLaaSCellEnabled(cell)) + { + RETVOID; + } +#endif + + if(cellSch->ul.schdIdx != RGSCH_INVALID_INFO) + { + rgSchCmnUpdCfiVal(cell, TFU_ULCNTRL_DLDELTA); + + /* Handle Inactive UEs for UL */ + rgSCHCmnHdlUlInactUes(cell); + /* Perform UL Scheduling EVERY TTI */ + rgSCHCmnUlAlloc(cell); + + /* Calling function to update CFI parameters*/ + rgSchCmnUpdCfiDb(cell, TFU_ULCNTRL_DLDELTA); + + if(cell->dynCfiCb.switchOvrWinLen > 0) + { + /* Decrementing the switchover window length */ + cell->dynCfiCb.switchOvrWinLen--; + + if(!cell->dynCfiCb.switchOvrWinLen) + { + if(cell->dynCfiCb.dynCfiRecfgPend) + { + /* Toggling the Dynamic CFI enabling */ + cell->dynCfiCb.isDynCfiEnb ^= 1; + rgSCHDynCfiReCfg(cell, cell->dynCfiCb.isDynCfiEnb); + cell->dynCfiCb.dynCfiRecfgPend = FALSE; + } + cell->dynCfiCb.switchOvrInProgress = FALSE; + } + } + } +#ifdef LTE_TDD +#ifdef LTEMAC_SPS + else + { + rgSCHCmnSpsUlTti(cell, NULLP); + } +#endif +#endif + + RETVOID; +} + + +/** + * @brief This function updates the scheduler with service for an UE. + * + * @details + * + * Function: rgSCHCmnDlDedBoUpd + * Purpose: This function should be called whenever there is a + * change BO for a service. + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @param[in] RgSchDlLcCb* svc + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlDedBoUpd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *svc +) +#else +PUBLIC Void rgSCHCmnDlDedBoUpd(cell, ue, svc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *svc; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnDlDedBoUpd); + + /* RACHO : if UEs idle time exceeded and a BO update + * is received, then add UE to the pdcch Order Q */ + if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) + { + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue, cell); + /* If PDCCH order is already triggered and we are waiting for + * RACH from UE then do not add to PdcchOdrQ. */ + if (ueDl->rachInfo.rapIdLnk.node == NULLP) + { + rgSCHCmnDlAdd2PdcchOdrQ(cell, ue); + } + } + +#ifdef LTEMAC_SPS + + /* If SPS service, invoke SPS module */ + if (svc->dlLcSpsCfg.isSpsEnabled) + { + rgSCHCmnSpsDlDedBoUpd(cell, ue, svc); + /* Note: Retrun from here, no update needed in other schedulers */ + RETVOID; + } +#endif +#ifdef EMTC_ENABLE + if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe)) + { + cellSch->apisEmtcDl->rgSCHDlDedBoUpd(cell, ue, svc); + //printf("rgSCHEMTCDlDedBoUpd\n"); + } + else +#endif + { + cellSch->apisDl->rgSCHDlDedBoUpd(cell, ue, svc); + } +#ifdef LTE_ADV + if (ue->numSCells) + { + rgSCHSCellDlDedBoUpd(cell, ue, svc); + } +#endif + RETVOID; +} + + +/** + * @brief Removes an UE from Cell's TA List. + * + * @details + * + * Function: rgSCHCmnRmvFrmTaLst + * Purpose: Removes an UE from Cell's TA List. + * + * Invoked by: Specific Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnRmvFrmTaLst +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnRmvFrmTaLst(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell); + TRC2(rgSCHCmnRmvFrmTaLst); + +#ifdef EMTC_ENABLE + if(cell->emtcEnable && ue->isEmtcUe) + { + rgSCHEmtcRmvFrmTaLst(cellCmnDl,ue); + } + else +#endif + { + cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk); + ue->dlTaLnk.node = (PTR)NULLP; + } + RETVOID; +} + +/* Fix: syed Remove the msg4Proc from cell + * msg4Retx Queue. I have used CMN scheduler function + * directly. Please define a new API and call this + * function through that. */ + +/** + * @brief This function removes MSG4 HARQ process from cell RETX Queues. + * + * @details + * + * Function: rgSCHCmnDlMsg4ProcRmvFrmRetx + * Purpose: This function removes MSG4 HARQ process from cell RETX Queues. + * + * Invoked by: UE/RACB deletion. + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlHqProc* hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlMsg4ProcRmvFrmRetx +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnDlMsg4ProcRmvFrmRetx(cell, hqP) +RgSchCellCb *cell; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnDlMsg4ProcRmvFrmRetx); + + if (hqP->tbInfo[0].ccchSchdInfo.retxLnk.node) + { + if (hqP->hqE->msg4Proc == hqP) + { + cmLListDelFrm(&cellSch->dl.msg4RetxLst, \ + &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; + } +#ifdef RGR_V1 + else if(hqP->hqE->ccchSduProc == hqP) + { + cmLListDelFrm(&cellSch->dl.ccchSduRetxLst, + &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP; + } +#endif + } + RETVOID; +} + + +/** + * @brief This function adds a HARQ process for retx. + * + * @details + * + * Function: rgSCHCmnDlProcAddToRetx + * Purpose: This function adds a HARQ process to retransmission + * queue. This may be performed when a HARQ ack is + * unsuccessful. + * + * Invoked by: HARQ feedback processing + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlHqProc* hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlProcAddToRetx +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnDlProcAddToRetx(cell, hqP) +RgSchCellCb *cell; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnDlProcAddToRetx); + + if (hqP->hqE->msg4Proc == hqP) /* indicating msg4 transmission */ + { + cmLListAdd2Tail(&cellSch->dl.msg4RetxLst, \ + &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP; + } +#ifdef RGR_V1 + else if(hqP->hqE->ccchSduProc == hqP) + { + /*If CCCH SDU being transmitted without cont res CE*/ + cmLListAdd2Tail(&cellSch->dl.ccchSduRetxLst, + &hqP->tbInfo[0].ccchSchdInfo.retxLnk); + hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP; + } +#endif + else + { +#ifdef LTEMAC_SPS + if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) + { + /* Invoke SPS module for SPS HARQ proc re-transmission handling */ + rgSCHCmnSpsDlProcAddToRetx(cell, hqP); + RETVOID; + } +#endif /* LTEMAC_SPS */ +#ifdef EMTC_ENABLE + if((TRUE == cell->emtcEnable) + && (TRUE == hqP->hqE->ue->isEmtcUe)) + { + cellSch->apisEmtcDl->rgSCHDlProcAddToRetx(cell, hqP); + } + else +#endif + { + cellSch->apisDl->rgSCHDlProcAddToRetx(cell, hqP); + } + } + RETVOID; +} + + +/** + * @brief This function performs RI validation and + * updates it to the ueCb. + * + * @details + * + * Function: rgSCHCmnDlSetUeRi + * Purpose: This function performs RI validation and + * updates it to the ueCb. + * + * Invoked by: rgSCHCmnDlCqiInd + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 ri + * @param[in] Bool isPeriodic + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlSetUeRi +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 ri, +Bool isPer +) +#else +PRIVATE Void rgSCHCmnDlSetUeRi(cell, ue, ri, isPer) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 ri; +Bool isPer; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgSchCmnUeInfo *ueSchCmn = RG_SCH_CMN_GET_CMN_UE(ue); + TRC2(rgSCHCmnDlSetUeRi); + +#ifdef TFU_UPGRADE + RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell); + UNUSED(isPer); +#endif + + + /* FIX for RRC Reconfiguration issue */ + /* ccpu00140894- During Tx Mode transition RI report will not entertained for + * specific during which SCH expecting UE can complete TX mode transition*/ + if (ue->txModeTransCmplt == FALSE) + { + RETVOID; + } + + /* Restrict the Number of TX layers to cell->numTxAntPorts. + * Protection from invalid RI values. */ + ri = RGSCH_MIN(ri, cell->numTxAntPorts); + + /* Special case of converting PMI to sane value when + * there is a switch in RI from 1 to 2 and PMI reported + * for RI=1 is invalid for RI=2 */ + if ((cell->numTxAntPorts == 2) && (ue->mimoInfo.txMode == RGR_UE_TM_4)) + { + if ((ri == 2) && ( ueDl->mimoInfo.ri == 1)) + { + ueDl->mimoInfo.pmi = (ueDl->mimoInfo.pmi < 2)? 1:2; + } + } + + /* Restrict the Number of TX layers according to the UE Category */ + ueDl->mimoInfo.ri = RGSCH_MIN(ri, rgUeCatTbl[ueSchCmn->ueCat].maxTxLyrs); +#ifdef TENB_STATS + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].riCnt[ueDl->mimoInfo.ri-1]++; + cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++; +#endif + +#ifdef TENB_STATS + ue->tenbStats->stats.nonPersistent.sch[0].riCnt[ueDl->mimoInfo.ri-1]++; + cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++; +#endif + +#ifdef TFU_UPGRADE + if (isPer) + { + /* If RI is from Periodic CQI report */ + cqiCb->perRiVal = ueDl->mimoInfo.ri; + /* Reset at every Periodic RI Reception */ + cqiCb->invalidateCqi = FALSE; + } + else + { + /* If RI is from Aperiodic CQI report */ + if (cqiCb->perRiVal != ueDl->mimoInfo.ri) + { + /* if this aperRI is different from last reported + * perRI then invalidate all CQI reports till next + * perRI */ + cqiCb->invalidateCqi = TRUE; + } + else + { + cqiCb->invalidateCqi = FALSE; + } + } +#endif + + if (ueDl->mimoInfo.ri > 1) + { + RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } + else if (ue->mimoInfo.txMode == RGR_UE_TM_3) /* ri == 1 */ + { + RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1); + } + + RETVOID; +} + + +/** + * @brief This function performs PMI validation and + * updates it to the ueCb. + * + * @details + * + * Function: rgSCHCmnDlSetUePmi + * Purpose: This function performs PMI validation and + * updates it to the ueCb. + * + * Invoked by: rgSCHCmnDlCqiInd + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 pmi + * @return Void + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlSetUePmi +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 pmi +) +#else +PRIVATE S16 rgSCHCmnDlSetUePmi(cell, ue, pmi) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 pmi; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlSetUePmi); + + if (ue->txModeTransCmplt == FALSE) + { + RETVALUE(RFAILED); + } + + if (cell->numTxAntPorts == 2) + { + if (pmi > 3) + { + RETVALUE(RFAILED); + } + if (ueDl->mimoInfo.ri == 2) + { + /*ccpu00118150 - MOD - changed pmi value validation from 0 to 2*/ + /* PMI 2 and 3 are invalid incase of 2 TxAnt and 2 Layered SM */ + if (pmi == 2 || pmi == 3) + { + RETVALUE(RFAILED); + } + ueDl->mimoInfo.pmi = pmi+1; + } + else + { + ueDl->mimoInfo.pmi = pmi; + } + } + else if (cell->numTxAntPorts == 4) + { + if (pmi > 15) + { + RETVALUE(RFAILED); + } + ueDl->mimoInfo.pmi = pmi; + } + /* Reset the No PMI Flag in forceTD */ + RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI); + RETVALUE(ROK); +} + +/** + * @brief This function Updates the DL CQI on PUCCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlProcCqiMode10 + * + * This function updates the DL CQI on PUCCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiOnPucchInd + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + Bool *isCqiAvail + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi, isCqiAvail) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; + Bool *isCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlProcCqiMode10); + + if (pucchCqi->u.mode10Info.type == TFU_RPT_CQI) + { + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + /* Checking whether the decoded CQI is a value between 1 and 15*/ + if((pucchCqi->u.mode10Info.u.cqi) && (pucchCqi->u.mode10Info.u.cqi + < RG_SCH_CMN_MAX_CQI)) + { + ueDl->cqiFlag = TRUE; + ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode10Info.u.cqi; + ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + } + else if (pucchCqi->u.mode10Info.type == TFU_RPT_RI) + { + if ( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode10Info.u.ri) ) + { + rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode10Info.u.ri, + TRUE); + } + else + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", + pucchCqi->u.mode10Info.u.ri,ue->ueId); + RETVOID; + } + } +} + +/** + * @brief This function Updates the DL CQI on PUCCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlProcCqiMode11 + * + * This function updates the DL CQI on PUCCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiOnPucchInd + * + * Processing Steps: + * Process CQI MODE 11 + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi, isCqiAvail, is2ndCwCqiAvail) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; + Bool *isCqiAvail; + Bool *is2ndCwCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlProcCqiMode11); + + if (pucchCqi->u.mode11Info.type == TFU_RPT_CQI) + { + ue->mimoInfo.puschFdbkVld = FALSE; + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((pucchCqi->u.mode11Info.u.cqi.cqi) && + (pucchCqi->u.mode11Info.u.cqi.cqi < RG_SCH_CMN_MAX_CQI)) + { + ueDl->cqiFlag = TRUE; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode11Info.u.cqi.cqi; + if (pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.pres) + { + RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \ + ueDl->mimoInfo.cwInfo[1].cqi, \ + pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.val); +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = TRUE; +#endif + } + } + else + { + RETVOID; + } + rgSCHCmnDlSetUePmi(cell, ue, \ + pucchCqi->u.mode11Info.u.cqi.pmi); + } + else if (pucchCqi->u.mode11Info.type == TFU_RPT_RI) + { + if( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode11Info.u.ri)) + { + rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode11Info.u.ri, + TRUE); + } + else + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Invalid RI value(%x) CRNTI:%d", + pucchCqi->u.mode11Info.u.ri,ue->ueId); + RETVOID; + } + } +} + +/** + * @brief This function Updates the DL CQI on PUCCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlProcCqiMode20 + * + * This function updates the DL CQI on PUCCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiOnPucchInd + * + * Processing Steps: + * Process CQI MODE 20 + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + Bool *isCqiAvail + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi, isCqiAvail ) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; + Bool *isCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlProcCqiMode20); + + if (pucchCqi->u.mode20Info.type == TFU_RPT_CQI) + { + if (pucchCqi->u.mode20Info.u.cqi.isWideband) + { + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((pucchCqi->u.mode20Info.u.cqi.u.wideCqi) && + (pucchCqi->u.mode20Info.u.cqi.u.wideCqi < RG_SCH_CMN_MAX_CQI)) + { + ueDl->cqiFlag = TRUE; + ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode20Info.u.cqi.\ + u.wideCqi; + ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + } + } + else if (pucchCqi->u.mode20Info.type == TFU_RPT_RI) + { + if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode20Info.u.ri)) + { + rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode20Info.u.ri, + TRUE); + } + else + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", + pucchCqi->u.mode20Info.u.ri,ue->ueId); + RETVOID; + } + } +} + + +/** + * @brief This function Updates the DL CQI on PUCCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlProcCqiMode21 + * + * This function updates the DL CQI on PUCCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiOnPucchInd + * + * Processing Steps: + * Process CQI MODE 21 + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi, isCqiAvail, is2ndCwCqiAvail) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; + TfuDlCqiRpt *dlCqiRpt; + Bool *isCqiAvail; + Bool *is2ndCwCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21 +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + ) +#else +PRIVATE INLINE Void rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlProcCqiMode21); + + if (pucchCqi->u.mode21Info.type == TFU_RPT_CQI) + { + ue->mimoInfo.puschFdbkVld = FALSE; + if (pucchCqi->u.mode21Info.u.cqi.isWideband) + { + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi) && + (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi < RG_SCH_CMN_MAX_CQI)) + { + ueDl->cqiFlag = TRUE; + ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode21Info.u.cqi.\ + u.wideCqi.cqi; + if (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.pres) + { + RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \ + ueDl->mimoInfo.cwInfo[1].cqi, \ + pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.val); +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = TRUE; +#endif + } + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + rgSCHCmnDlSetUePmi(cell, ue, \ + pucchCqi->u.mode21Info.u.cqi.u.wideCqi.pmi); + } + } + else if (pucchCqi->u.mode21Info.type == TFU_RPT_RI) + { + if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode21Info.u.ri)) + { + rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode21Info.u.ri, + TRUE); + } + else + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Invalid RI value(%x) CRNTI:%d", + pucchCqi->u.mode21Info.u.ri,ue->ueId); + RETVOID; + } + } +} + + +/** + * @brief This function Updates the DL CQI on PUCCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlCqiOnPucchInd + * + * This function updates the DL CQI on PUCCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiInd + * + * Processing Steps: + * - Depending on the reporting mode of the PUCCH, the CQI/PMI/RI values + * are updated and stored for each UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCqiOnPucchInd +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi, + RgrUeCqiRept *ueCqiRept, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + ) +#else +PRIVATE Void rgSCHCmnDlCqiOnPucchInd(cell, ue, pucchCqi, ueCqiRept, isCqiAvail, is2ndCwCqiAvail) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; + RgrUeCqiRept *ueCqiRept; + Bool *isCqiAvail; + Bool *is2ndCwCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCqiOnPucchInd +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPucch *pucchCqi + ) +#else +PRIVATE Void rgSCHCmnDlCqiOnPucchInd(cell, ue, pucchCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPucch *pucchCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + TRC2(rgSCHCmnDlCqiOnPucchInd); + + /* ccpu00117452 - MOD - Changed + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* Save CQI mode information in the report */ + ueCqiRept->cqiMode = pucchCqi->mode; +#endif + + switch(pucchCqi->mode) + { + case TFU_PUCCH_CQI_MODE10: +#ifdef RGR_CQI_REPT + rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi, isCqiAvail); +#else + rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi); +#endif + ueDl->cqiFlag = TRUE; + break; + case TFU_PUCCH_CQI_MODE11: +#ifdef RGR_CQI_REPT + rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi, isCqiAvail, + is2ndCwCqiAvail); +#else + rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi); +#endif + ueDl->cqiFlag = TRUE; + break; + case TFU_PUCCH_CQI_MODE20: +#ifdef RGR_CQI_REPT + rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi, isCqiAvail); +#else + rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi); +#endif + ueDl->cqiFlag = TRUE; + break; + case TFU_PUCCH_CQI_MODE21: +#ifdef RGR_CQI_REPT + rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi, isCqiAvail, + is2ndCwCqiAvail); +#else + rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi); +#endif + ueDl->cqiFlag = TRUE; + break; + default: + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Unknown CQI Mode %d", + pucchCqi->mode,ue->ueId); + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = FALSE; +#endif + } + break; + } + + RETVOID; +} /* rgSCHCmnDlCqiOnPucchInd */ + + +/** + * @brief This function Updates the DL CQI on PUSCH for the UE. + * + * @details + * + * Function: rgSCHCmnDlCqiOnPuschInd + * + * This function updates the DL CQI on PUSCH for the UE. + * + * Invoked by: rgSCHCmnDlCqiInd + * + * Processing Steps: + * - Depending on the reporting mode of the PUSCH, the CQI/PMI/RI values + * are updated and stored for each UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef RGR_CQI_REPT +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCqiOnPuschInd +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPusch *puschCqi, + RgrUeCqiRept *ueCqiRept, + Bool *isCqiAvail, + Bool *is2ndCwCqiAvail + ) +#else +PRIVATE Void rgSCHCmnDlCqiOnPuschInd(cell, ue, puschCqi, ueCqiRept, isCqiAvail, is2ndCwCqiAvail) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPusch *puschCqi; + RgrUeCqiRept *ueCqiRept; + Bool *isCqiAvail; + Bool *is2ndCwCqiAvail; +#endif +#else +#ifdef ANSI +PRIVATE Void rgSCHCmnDlCqiOnPuschInd +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuDlCqiPusch *puschCqi + ) +#else +PRIVATE Void rgSCHCmnDlCqiOnPuschInd(cell, ue, puschCqi) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuDlCqiPusch *puschCqi; +#endif +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U32 prevRiVal = 0; + TRC2(rgSCHCmnDlCqiOnPuschInd); + if (puschCqi->ri.pres == PRSNT_NODEF) + { + if (RG_SCH_CMN_IS_RI_VALID(puschCqi->ri.val)) + { + /* Saving the previous ri value to revert back + in case PMI update failed */ + if (RGR_UE_TM_4 == ue->mimoInfo.txMode ) /* Cheking for TM4. TM8 check later */ + { + prevRiVal = ueDl->mimoInfo.ri; + } + rgSCHCmnDlSetUeRi(cell, ue, puschCqi->ri.val, FALSE); + } + else + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RI value(%x) CRNTI:%d", + puschCqi->ri.val,ue->ueId); + RETVOID; + } + } + ue->mimoInfo.puschFdbkVld = FALSE; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* Save CQI mode information in the report */ + ueCqiRept->cqiMode = puschCqi->mode; + /* ccpu00117259 - DEL - removed default setting of isCqiAvail to TRUE */ +#endif + + switch(puschCqi->mode) + { + case TFU_PUSCH_CQI_MODE_20: + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + /* Checking whether the decoded CQI is a value between 1 and 15*/ + if((puschCqi->u.mode20Info.wideBandCqi) && + (puschCqi->u.mode20Info.wideBandCqi < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode20Info.wideBandCqi; + ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + break; + case TFU_PUSCH_CQI_MODE_30: + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((puschCqi->u.mode30Info.wideBandCqi) && + (puschCqi->u.mode30Info.wideBandCqi < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode30Info.wideBandCqi; + ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif +#ifdef CA_DBG + { + extern U32 gACqiRcvdCount; + gACqiRcvdCount++; + + } +#endif + } + else + { + RETVOID; + } + break; + case TFU_PUSCH_CQI_MODE_12: + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((puschCqi->u.mode12Info.cqiIdx[0]) && + (puschCqi->u.mode12Info.cqiIdx[0] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode12Info.cqiIdx[0]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + if((puschCqi->u.mode12Info.cqiIdx[1]) && + (puschCqi->u.mode12Info.cqiIdx[1] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode12Info.cqiIdx[1]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + ue->mimoInfo.puschFdbkVld = TRUE; + ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_12; + ue->mimoInfo.puschPmiInfo.u.mode12Info = puschCqi->u.mode12Info; + /* : resetting this is time based. Make use of CQI reporting + * periodicity, DELTA's in determining the exact time at which this + * need to be reset. */ + break; + case TFU_PUSCH_CQI_MODE_22: + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((puschCqi->u.mode22Info.wideBandCqi[0]) && + (puschCqi->u.mode22Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode22Info.wideBandCqi[0]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + if((puschCqi->u.mode22Info.wideBandCqi[1]) && + (puschCqi->u.mode22Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode22Info.wideBandCqi[1]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = TRUE; +#endif + } + else + { + RETVOID; + } + rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode22Info.wideBandPmi); + ue->mimoInfo.puschFdbkVld = TRUE; + ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_22; + ue->mimoInfo.puschPmiInfo.u.mode22Info = puschCqi->u.mode22Info; + break; + case TFU_PUSCH_CQI_MODE_31: + /*ccpu00109787 - ADD - Check for non-zero CQI*/ + if((puschCqi->u.mode31Info.wideBandCqi[0]) && + (puschCqi->u.mode31Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode31Info.wideBandCqi[0]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = TRUE; +#endif + } + if (ueDl->mimoInfo.ri > 1) + { + if((puschCqi->u.mode31Info.wideBandCqi[1]) && + (puschCqi->u.mode31Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI)) + { + ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode31Info.wideBandCqi[1]; + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = TRUE; +#endif + } + } + if (rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode31Info.pmi) != ROK) + { + /* To avoid Rank and PMI inconsistency */ + if ((puschCqi->ri.pres == PRSNT_NODEF) && + (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */ + { + ueDl->mimoInfo.ri = prevRiVal; + } + } + ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_31; + ue->mimoInfo.puschPmiInfo.u.mode31Info = puschCqi->u.mode31Info; + break; + default: + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "Unknown CQI Mode %d CRNTI:%d", + puschCqi->mode,ue->ueId); + /* CQI decoding failed revert the RI to previous value */ + if ((puschCqi->ri.pres == PRSNT_NODEF) && + (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */ + { + ueDl->mimoInfo.ri = prevRiVal; + } + /* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + *isCqiAvail = FALSE; + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + *is2ndCwCqiAvail = FALSE; +#endif + } + break; + } + + RETVOID; +} /* rgSCHCmnDlCqiOnPuschInd */ + + +/** + * @brief This function Updates the DL CQI for the UE. + * + * @details + * + * Function: rgSCHCmnDlCqiInd + * Purpose: Updates the DL CQI for the UE + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqi + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlCqiInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isPucchInfo, +Void *dlCqi, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHCmnDlCqiInd(cell, ue, isPucchInfo, dlCqi, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +Bool isPucchInfo; +Void *dlCqi; +CmLteTimingInfo timingInfo; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgrUeCqiRept ueCqiRept = {{0}}; + Bool isCqiAvail = FALSE; + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting */ + Bool is2ndCwCqiAvail = FALSE; +#endif + + TRC2(rgSCHCmnDlCqiInd); + +#ifdef RGR_CQI_REPT + if (isPucchInfo) + { + rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail); + } + else + { + rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail); + } +#else + if (isPucchInfo) + { + rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi); + } + else + { + rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi); + } +#endif + +#ifdef CQI_CONFBITMASK_DROP + if(!ue->cqiConfBitMask) + { + if (ueDl->mimoInfo.cwInfo[0].cqi >15) + { + ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi; + ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi; + } + else if ( ueDl->mimoInfo.cwInfo[0].cqi >= ue->prevCqi) + { + ue->prevCqi = ueDl->mimoInfo.cwInfo[0].cqi; + } + else + { + U8 dlCqiDeltaPrev = 0; + dlCqiDeltaPrev = ue->prevCqi - ueDl->mimoInfo.cwInfo[0].cqi; + if (dlCqiDeltaPrev > 3) + dlCqiDeltaPrev = 3; + if ((ue->prevCqi - dlCqiDeltaPrev) < 6) + { + ue->prevCqi = 6; + } + else + { + ue->prevCqi = ue->prevCqi - dlCqiDeltaPrev; + } + ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi; + ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi; + + } + } +#endif + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting - added is2ndCwCqiAvail\ + in 'if' condition*/ + if (RG_SCH_CQIR_IS_PUSHNCQI_ENBLE(ue) && (isCqiAvail || is2ndCwCqiAvail)) + { + ueCqiRept.cqi[0] = ueDl->mimoInfo.cwInfo[0].cqi; + + /* ccpu00117259 - ADD - Considering second codeword CQI info + incase of MIMO for CQI Reporting - added is2ndCwCqiAvail + in 'if' condition*/ + ueCqiRept.cqi[1] = 0; + if(is2ndCwCqiAvail) + { + ueCqiRept.cqi[1] = ueDl->mimoInfo.cwInfo[1].cqi; + } + rgSCHCmnUeDlPwrCtColltCqiRept(cell, ue, &ueCqiRept); + + } +#endif +#ifdef DL_LA + rgSCHCmnDlSetUeAllocLmtLa(cell, ue); + rgSCHCheckAndSetTxScheme(cell, ue); +#else +#ifdef EMTC_ENABLE + rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), ue->isEmtcUe); +#else + rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), FALSE); +#endif +#endif + + if (cellSch->dl.isDlFreqSel) + { + cellSch->apisDlfs->rgSCHDlfsDlCqiInd(cell, ue, isPucchInfo, dlCqi, timingInfo); + } +#ifdef LTEMAC_SPS + /* Call SPS module to update CQI indication */ + rgSCHCmnSpsDlCqiIndHndlr(cell, ue, timingInfo); +#endif + /* Call Specific scheduler to process on dlCqiInd */ +#ifdef EMTC_ENABLE + if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe)) + { + cellSch->apisEmtcDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi); + } + else +#endif + { + cellSch->apisDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi); + } + +#ifdef RG_PFS_STATS + ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].avgCqi += + ueDl->mimoInfo.cwInfo[0].cqi; + ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].totalCqiOcc++; +#endif + +#ifdef SCH_STATS + ueDl->avgCqi += ueDl->mimoInfo.cwInfo[0].cqi; + ueDl->numCqiOccns++; + if (ueDl->mimoInfo.ri == 1) + { + ueDl->numRi1++; + } + else + { + ueDl->numRi2++; + } +#endif + +#ifdef TENB_STATS + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw0Cqi ++; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw1Cqi ++; + cell->tenbStats->sch.dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi; + cell->tenbStats->sch.dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi; + cell->tenbStats->sch.dlNumCw0Cqi ++; + cell->tenbStats->sch.dlNumCw1Cqi ++; +#endif + RETVOID; +} + +#ifdef TFU_UPGRADE +/** + * @brief This function calculates the wideband CQI from SNR + * reported for each RB. + * + * @details + * + * Function: rgSCHCmnCalcWcqiFrmSnr + * Purpose: Wideband CQI calculation from SNR + * + * Invoked by: RG SCH + * + * @param[in] RgSchCellCb *cell + * @param[in] TfuSrsRpt *srsRpt, + * @return Wideband CQI + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr +( + RgSchCellCb *cell, + TfuSrsRpt *srsRpt + ) +#else +PRIVATE U8 rgSCHCmnCalcWcqiFrmSnr(cell,srsRpt) + RgSchCellCb *cell; + TfuSrsRpt *srsRpt; +#endif +{ + U8 wideCqi=1; /*Calculated value from SNR*/ + TRC2(rgSCHCmnCalcWcqiFrmSnr); + /*Need to map a certain SNR with a WideCQI value. + * The CQI calculation is still primitive. Further, need to + * use a improvized method for calculating WideCQI from SNR*/ + if (srsRpt->snr[0] <=50) + { + wideCqi=3; + } + else if (srsRpt->snr[0]>=51 && srsRpt->snr[0] <=100) + { + wideCqi=6; + } + else if (srsRpt->snr[0]>=101 && srsRpt->snr[0] <=150) + { + wideCqi=9; + } + else if (srsRpt->snr[0]>=151 && srsRpt->snr[0] <=200) + { + wideCqi=12; + } + else if (srsRpt->snr[0]>=201 && srsRpt->snr[0] <=250) + { + wideCqi=14; + } + else + { + wideCqi=15; + } + RETVALUE(wideCqi); +}/*rgSCHCmnCalcWcqiFrmSnr*/ + + +/** + * @brief This function Updates the SRS for the UE. + * + * @details + * + * Function: rgSCHCmnSrsInd + * Purpose: Updates the UL SRS for the UE + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuSrsRpt *srsRpt, + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnSrsInd +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuSrsRpt *srsRpt, + CmLteTimingInfo timingInfo + ) +#else +PUBLIC Void rgSCHCmnSrsInd(cell, ue, srsRpt, timingInfo) + RgSchCellCb *cell; + RgSchUeCb *ue; + TfuSrsRpt *srsRpt; + CmLteTimingInfo timingInfo; +#endif +{ + U8 wideCqi; /*Calculated value from SNR*/ + U32 recReqTime; /*Received Time in TTI*/ + TRC2(rgSCHCmnSrsInd); + + recReqTime = (timingInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) + timingInfo.subframe; + ue->srsCb.selectedAnt = (recReqTime/ue->srsCb.peri)%2; + if(srsRpt->wideCqiPres) + { + wideCqi = srsRpt->wideCqi; + } + else + { + wideCqi = rgSCHCmnCalcWcqiFrmSnr(cell, srsRpt); + } + rgSCHCmnFindUlCqiUlTxAnt(cell, ue, wideCqi); + RETVOID; +}/*rgSCHCmnSrsInd*/ +#endif + + +/** + * @brief This function is a handler for TA report for an UE. + * + * @details + * + * Function: rgSCHCmnDlTARpt + * Purpose: Determine based on UE_IDLE_TIME threshold, + * whether UE needs to be Linked to the scheduler's TA list OR + * if it needs a PDCCH Order. + * + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlTARpt +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnDlTARpt(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + CmLListCp poInactvLst; + + TRC2(rgSCHCmnDlTARpt); + + /* RACHO: If UE idle time is more than threshold, then + * set its poInactv pdcch order inactivity */ + /* Fix : syed Ignore if TaTmr is not configured */ + if ((ue->dl.taCb.cfgTaTmr) && (rgSCHCmnUeIdleExdThrsld(cell, ue) == ROK)) + { + U32 prevDlMsk = ue->dl.dlInactvMask; + U32 prevUlMsk = ue->ul.ulInactvMask; + ue->dl.dlInactvMask |= RG_PDCCHODR_INACTIVE; + ue->ul.ulInactvMask |= RG_PDCCHODR_INACTIVE; + /* Indicate Specific scheduler for this UEs inactivity */ + cmLListInit(&poInactvLst); + cmLListAdd2Tail(&poInactvLst, &ueDl->rachInfo.inActUeLnk); + ueDl->rachInfo.inActUeLnk.node = (PTR)ue; + /* Send inactivate ind only if not already sent */ + if (prevDlMsk == 0) + { + cellSch->apisDl->rgSCHDlInactvtUes(cell, &poInactvLst); + } + if (prevUlMsk == 0) + { + cellSch->apisUl->rgSCHUlInactvtUes(cell, &poInactvLst); + } + } + else + { + /* Fix: ccpu00124009 Fix for loop in the linked list "cellDl->taLst" */ + if (!ue->dlTaLnk.node) + { +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + rgSCHEmtcAddToTaLst(cellDl,ue); + } + } + else +#endif + { + + cmLListAdd2Tail(&cellDl->taLst, &ue->dlTaLnk); + ue->dlTaLnk.node = (PTR)ue; + } + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "TA duplicate entry attempt failed: UEID:%u", + ue->ueId); + } + } + RETVOID; +} + +#ifdef TFU_UPGRADE +/** + * @brief Indication of UL CQI. + * + * @details + * + * Function : rgSCHCmnFindUlCqiUlTxAnt + * + * - Finds the Best Tx Antenna amongst the CQIs received + * from Two Tx Antennas. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 wideCqi + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 wideCqi +) +#else +PRIVATE Void rgSCHCmnFindUlCqiUlTxAnt(cell, ue, wideCqi) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 wideCqi; +#endif +{ + ue->validTxAnt = 1; + RETVOID; +} /* rgSCHCmnFindUlCqiUlTxAnt */ +#endif + +/** + * @brief Indication of UL CQI. + * + * @details + * + * Function : rgSCHCmnUlCqiInd + * + * - Updates uplink CQI information for the UE. Computes and + * stores the lowest CQI of CQIs reported in all subbands. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuUlCqiRpt *ulCqiInfo + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlCqiInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuUlCqiRpt *ulCqiInfo +) +#else +PUBLIC Void rgSCHCmnUlCqiInd(cell, ue, ulCqiInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuUlCqiRpt *ulCqiInfo; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); +#ifdef UL_LA + U8 iTbsNew; + S32 previTbs; +#endif +#if (defined(SCH_STATS) || defined(TENB_STATS)) + CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); +#endif + + TRC2(rgSCHCmnUlCqiInd); + /* consider inputs from SRS handlers about SRS occassions + * in determining the UL TX Antenna selection */ + ueUl->crntUlCqi[0] = ulCqiInfo->wideCqi; +#ifdef TFU_UPGRADE + ueUl->validUlCqi = ueUl->crntUlCqi[0]; + ue->validTxAnt = 0; +#ifdef UL_LA + iTbsNew = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][ueUl->validUlCqi]; + previTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; + + if (RG_ITBS_DIFF(iTbsNew, previTbs) > 5) + { + /* Ignore this iTBS report and mark that last iTBS report was */ + /* ignored so that subsequently we reset the LA algorithm */ + ueUl->ulLaCb.lastiTbsIgnored = TRUE; + } + else + { + if (ueUl->ulLaCb.lastiTbsIgnored != TRUE) + { + ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) + + (80 * ueUl->ulLaCb.cqiBasediTbs))/100; + } + else + { + /* Reset the LA as iTbs in use caught up with the value */ + /* reported by UE. */ + ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) + + (80 * previTbs * 100))/100; + ueUl->ulLaCb.deltaiTbs = 0; + ueUl->ulLaCb.lastiTbsIgnored = FALSE; + } + } +#endif +#endif + rgSCHPwrUlCqiInd(cell, ue); +#ifdef LTEMAC_SPS + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlCqiInd(cell, ue); + } +#endif + /* Applicable to only some schedulers */ +#ifdef EMTC_ENABLE + if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe)) + { + cellSch->apisEmtcUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo); + } + else +#endif + { + cellSch->apisUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo); + } + +#ifdef SCH_STATS + ueUl->numCqiOccns++; + ueUl->avgCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); +#endif + +#ifdef TENB_STATS + { + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNumCqi ++; + cell->tenbStats->sch.ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg); + cell->tenbStats->sch.ulNumCqi ++; + } +#endif + + RETVOID; +} /* rgSCHCmnUlCqiInd */ + +/** + * @brief Returns HARQ proc for which data expected now. + * + * @details + * + * Function: rgSCHCmnUlHqProcForUe + * Purpose: This function returns the harq process for + * which data is expected in the current subframe. + * It does not validate that the HARQ process + * has an allocation. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteTimingInfo frm + * @param[in] RgSchUeCb *ue + * @param[out] RgSchUlHqProcCb **procRef + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlHqProcForUe +( +RgSchCellCb *cell, +CmLteTimingInfo frm, +RgSchUeCb *ue, +RgSchUlHqProcCb **procRef +) +#else +PUBLIC Void rgSCHCmnUlHqProcForUe(cell, frm, ue, procRef) +RgSchCellCb *cell; +CmLteTimingInfo frm; +RgSchUeCb *ue; +RgSchUlHqProcCb **procRef; +#endif +{ +#ifndef RG_5GTF + U8 procId = rgSCHCmnGetUlHqProcIdx(&frm, cell); +#endif + TRC2(rgSCHCmnUlHqProcForUe); +#ifndef RG_5GTF + *procRef = rgSCHUhmGetUlHqProc(cell, ue, procId); +#else + *procRef = rgSCHUhmGetUlProcByTime(cell, ue, frm); +#endif + RETVOID; +} + +#ifdef RG_UNUSED +/** + * @brief Update harq process for allocation. + * + * @details + * + * Function : rgSCHCmnUpdUlHqProc + * + * This function is invoked when harq process + * control block is now in a new memory location + * thus requiring a pointer/reference update. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlHqProcCb *curProc + * @param[in] RgSchUlHqProcCb *oldProc + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdUlHqProc +( +RgSchCellCb *cell, +RgSchUlHqProcCb *curProc, +RgSchUlHqProcCb *oldProc +) +#else +PUBLIC S16 rgSCHCmnUpdUlHqProc(cell, curProc, oldProc) +RgSchCellCb *cell; +RgSchUlHqProcCb *curProc; +RgSchUlHqProcCb *oldProc; +#endif +{ + TRC2(rgSCHCmnUpdUlHqProc); + + UNUSED(cell); + UNUSED(oldProc); +#if (ERRCLASS & ERRCLS_DEBUG) + if (curProc->alloc == NULLP) + { + RETVALUE(RFAILED); + } +#endif + curProc->alloc->hqProc = curProc; + RETVALUE(ROK); +} /* rgSCHCmnUpdUlHqProc */ +#endif + +/*MS_WORKAROUND for CR FIXME */ +/** + * @brief Hsndles BSR timer expiry + * + * @details + * + * Function : rgSCHCmnBsrTmrExpry + * + * This function is invoked when periodic BSR timer expires for a UE. + * + * @param[in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnBsrTmrExpry +( +RgSchUeCb *ueCb +) +#else +PUBLIC S16 rgSCHCmnBsrTmrExpry(ueCb) +RgSchUeCb *ueCb; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ueCb->cell); + + TRC2(rgSCHCmnBsrTmrExpry) + + ueCb->isSrGrant = TRUE; + +#ifdef EMTC_ENABLE + emtcStatsUlBsrTmrTxp++; +#endif + +#ifdef EMTC_ENABLE + if(ueCb->cell->emtcEnable) + { + if(ueCb->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHSrRcvd(ueCb->cell, ueCb); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHSrRcvd(ueCb->cell, ueCb); + } + + RETVALUE (ROK); +} + +/** + * @brief Short BSR update. + * + * @details + * + * Function : rgSCHCmnUpdBsrShort + * + * This functions does requisite updates to handle short BSR reporting. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchLcgCb *ulLcg + * @param[in] U8 bsr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdBsrShort +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *ulLcg, +U8 bsr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnUpdBsrShort(cell, ue, ulLcg, bsr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchLcgCb *ulLcg; +U8 bsr; +RgSchErrInfo *err; +#endif +{ + U8 lcgCnt; +#ifdef LTE_L2_MEAS + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); +#endif + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnLcg *cmnLcg = NULLP; + +#ifdef LTE_L2_MEAS + U8 idx; +#endif + TRC2(rgSCHCmnUpdBsrShort); + + if (!RGSCH_LCG_ISCFGD(ulLcg)) + { + err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD; + RETVALUE(RFAILED); + } + for (lcgCnt=0; lcgCnt<4; lcgCnt++) + { +#ifdef LTE_L2_MEAS + /* Set BS of all other LCGs to Zero. + If Zero BSR is reported in Short BSR include this LCG too */ + if ((lcgCnt != ulLcg->lcgId) || + (!bsr && !ueUl->hqEnt.numBusyHqProcs)) + { + /* If old BO is zero do nothing */ + if(((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs != 0) + { + for(idx = 0; idx < ue->ul.lcgArr[lcgCnt].numLch; idx++) + { + if((ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount) && + (ue->ulActiveLCs & (1 << + (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1)))) + { + /* L2_COUNTER */ + ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount--; + ue->ulActiveLCs &= ~(1 << + (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1)); + } + } + } + } +#endif + if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgCnt])) + { + ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs = 0; + ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->reportedBs = 0; + } + } + +#ifdef LTE_L2_MEAS + if(ulLcg->lcgId && bsr && (((RgSchCmnLcg *)(ulLcg->sch))->bs == 0)) + { + for(idx = 0; idx < ulLcg->numLch; idx++) + { + /* L2_COUNTER */ + if (!(ue->ulActiveLCs & (1 << (ulLcg->lcArray[idx]->qciCb->qci -1)))) + { + ulLcg->lcArray[idx]->qciCb->ulUeCount++; + ue->ulActiveLCs |= (1 << (ulLcg->lcArray[idx]->qciCb->qci -1)); + } + } + } +#endif + /* Resetting the nonGbrLcgBs info here */ + ue->ul.nonGbrLcgBs = 0; + ue->ul.nonLcg0Bs = 0; + + cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch)); + + if (TRUE == ue->ul.useExtBSRSizes) + { + cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr]; + } + else + { + cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr]; + } + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + /* TBD check for effGbr != 0 */ + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); + } + else if (0 == ulLcg->lcgId) + { + /* This is added for handling LCG0 */ + cmnLcg->bs = cmnLcg->reportedBs; + } + else + { + /* Update non GBR LCG's BS*/ + ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr); + cmnLcg->bs = ue->ul.nonGbrLcgBs; + } + ue->ul.totalBsr = cmnLcg->bs; + +#ifdef RGR_V1 + if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (bsr == 0)) + { + rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); + } +#endif +#ifdef LTEMAC_SPS + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsBsrRpt(cell, ue, ulLcg); + } +#endif + rgSCHCmnUpdUlCompEffBsr(ue); + +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr); + } + +#ifdef LTE_ADV + if (ue->ul.isUlCaEnabled && ue->numSCells) + { + for(U8 sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++) + { +#ifndef PAL_ENABLE_UL_CA + if((ue->cellInfo[sCellIdx] != NULLP) && + (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)) +#else + if(ue->cellInfo[sCellIdx] != NULLP) +#endif + { + cellSch->apisUl->rgSCHUpdBsrShort(ue->cellInfo[sCellIdx]->cell, + ue, ulLcg, bsr); + } + } + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief Truncated BSR update. + * + * @details + * + * Function : rgSCHCmnUpdBsrTrunc + * + * This functions does required updates to handle truncated BSR report. + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchLcgCb *ulLcg + * @param[in] U8 bsr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdBsrTrunc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *ulLcg, +U8 bsr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnUpdBsrTrunc(cell, ue, ulLcg, bsr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchLcgCb *ulLcg; +U8 bsr; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnLcg *cmnLcg = NULLP; + S32 cnt; +#ifdef LTE_L2_MEAS + U8 idx; +#endif + + TRC2(rgSCHCmnUpdBsrTrunc); + + if (!RGSCH_LCG_ISCFGD(ulLcg)) + { + err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD; + RETVALUE(RFAILED); + } + /* set all higher prio lcgs bs to 0 and update this lcgs bs and + total bsr= sumofall lcgs bs */ + if (ulLcg->lcgId) + { + for (cnt = ulLcg->lcgId-1; cnt >= 0; cnt--) + { +#ifdef LTE_L2_MEAS + /* If Existing BO is zero the don't do anything */ + if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs != 0) + { + for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++) + { + /* L2_COUNTERS */ + if((ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount) && + (ue->ulActiveLCs & (1 << + (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)))) + { + ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount--; + ue->ulActiveLCs &= ~(1 << + (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)); + } + } + } +#endif + ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs = 0; + ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->reportedBs = 0; + } + } + +#ifdef LTE_L2_MEAS + for (cnt = ulLcg->lcgId; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) + { + if (ulLcg->lcgId == 0) + { + continue; + } + /* If Existing BO is zero the don't do anything */ + if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs == 0) + { + for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++) + { + /* L2_COUNTERS */ + if (!(ue->ulActiveLCs & (1 << + (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)))) + { + ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount++; + ue->ulActiveLCs |= (1 << + (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1)); + } + } + } + } +#endif + ue->ul.nonGbrLcgBs = 0; + ue->ul.nonLcg0Bs = 0; + cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch)); + if (TRUE == ue->ul.useExtBSRSizes) + { + cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr]; + } + else + { + cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr]; + } + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); + } + else if(ulLcg->lcgId == 0) + { + /* This is for handeling LCG0 */ + cmnLcg->bs = cmnLcg->reportedBs; + } + else + { + ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); + cmnLcg->bs = ue->ul.nonGbrLcgBs; + } + ue->ul.totalBsr = cmnLcg->bs; + + for (cnt = ulLcg->lcgId+1; cnt < RGSCH_MAX_LCG_PER_UE; cnt++) + { + /* TODO: The bs for the other LCGs may be stale because some or all of + * the part of bs may have been already scheduled/data received. Please + * consider this when truncated BSR is tested/implemented */ + ue->ul.totalBsr += ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs; + } + + rgSCHCmnUpdUlCompEffBsr(ue); + +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr); + } + +#ifdef LTE_ADV + if (ue->ul.isUlCaEnabled && ue->numSCells) + { + for(U8 sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++) + { +#ifndef PAL_ENABLE_UL_CA + if((ue->cellInfo[sCellIdx] != NULLP) && + (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)) +#else + if(ue->cellInfo[sCellIdx] != NULLP) +#endif + { + cellSch->apisUl->rgSCHUpdBsrTrunc(ue->cellInfo[sCellIdx]->cell, ue, ulLcg, bsr); + } + } + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief Long BSR update. + * + * @details + * + * Function : rgSCHCmnUpdBsrLong + * + * - Update BSRs for all configured LCGs. + * - Update priority of LCGs if needed. + * - Update UE's position within/across uplink scheduling queues. + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 bsArr[] + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdBsrLong +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 *bsArr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnUpdBsrLong(cell, ue, bsArr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 *bsArr; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U32 tmpBsArr[4] = {0, 0, 0, 0}; + U32 nonGbrBs = 0; +#ifdef LTE_L2_MEAS + U8 idx1; + U8 idx2; +#endif + U32 lcgId; + + TRC2(rgSCHCmnUpdBsrLong); + +#ifdef LTE_L2_MEAS + for(idx1 = 1; idx1 < RGSCH_MAX_LCG_PER_UE; idx1++) + { + /* If Old BO is non zero then do nothing */ + if ((((RgSchCmnLcg *)(ue->ul.lcgArr[idx1].sch))->bs == 0) + && bsArr[idx1] ) + { + for(idx2 = 0; idx2 < ue->ul.lcgArr[idx1].numLch; idx2++) + { + /* L2_COUNTERS */ + if (!(ue->ulActiveLCs & (1 << + (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1)))) + { + ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->ulUeCount++; + ue->ulActiveLCs |= (1 << + (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1)); + } + } + } + } +#endif + ue->ul.nonGbrLcgBs = 0; + ue->ul.nonLcg0Bs = 0; + + if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[0])) + { + if (TRUE == ue->ul.useExtBSRSizes) + { + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnExtBsrTbl[bsArr[0]]; + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnExtBsrTbl[bsArr[0]]; + tmpBsArr[0] = rgSchCmnExtBsrTbl[bsArr[0]]; + } + else + { + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnBsrTbl[bsArr[0]]; + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnBsrTbl[bsArr[0]]; + tmpBsArr[0] = rgSchCmnBsrTbl[bsArr[0]]; + } + } + for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) + { + if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) + { + RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); + + if (TRUE == ue->ul.useExtBSRSizes) + { + cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsArr[lcgId]]; + } + else + { + cmnLcg->reportedBs = rgSchCmnBsrTbl[bsArr[lcgId]]; + } + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr); + tmpBsArr[lcgId] = cmnLcg->bs; + } + else + { + nonGbrBs += cmnLcg->reportedBs; + tmpBsArr[lcgId] = cmnLcg->reportedBs; + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr); + } + } + } + ue->ul.nonGbrLcgBs = RGSCH_MIN(nonGbrBs,ue->ul.effAmbr); + + ue->ul.totalBsr = tmpBsArr[0] + tmpBsArr[1] + tmpBsArr[2] + tmpBsArr[3]; +#ifdef RGR_V1 + if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (ue->ul.totalBsr == 0)) + { + rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); + } +#endif + +#ifdef LTEMAC_SPS + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) /* SPS_FIX */ + { + if(ue->ul.totalBsr - tmpBsArr[1] == 0) + {/* Updaing the BSR to SPS only if LCG1 BS is present in sps active state */ + rgSCHCmnSpsBsrRpt(cell, ue, &ue->ul.lcgArr[1]); + } + } +#endif + rgSCHCmnUpdUlCompEffBsr(ue); + +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHUpdBsrLong(cell, ue, bsArr); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHUpdBsrLong(cell, ue, bsArr); + } + +#ifdef LTE_ADV + if (ue->ul.isUlCaEnabled && ue->numSCells) + { + for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++) + { +#ifndef PAL_ENABLE_UL_CA + if((ue->cellInfo[idx] != NULLP) && + (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE)) +#else + if(ue->cellInfo[idx] != NULLP) +#endif + { + cellSch->apisUl->rgSCHUpdBsrLong(ue->cellInfo[idx]->cell, ue, bsArr); + } + } + } +#endif + + RETVALUE(ROK); +} + +/** + * @brief PHR update. + * + * @details + * + * Function : rgSCHCmnUpdExtPhr + * + * Updates extended power headroom information for an UE. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 phr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdExtPhr +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgInfExtPhrCEInfo *extPhr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnUpdExtPhr(cell, ue, extPhr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgInfExtPhrCEInfo *extPhr; +RgSchErrInfo *err; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + RgSchCmnAllocRecord *allRcd; + CmLList *node = ueUl->ulAllocLst.last; + +#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); +#endif + TRC2(rgSCHCmnUpdExtPhr); + + UNUSED(err); + + while (node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + node = node->prev; + if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) + { + rgSCHPwrUpdExtPhr(cell, ue, extPhr, allRcd); + break; + } + } +#ifdef LTEMAC_SPS + if(ulSpsUe->isUlSpsActv) + { + rgSCHCmnSpsPhrInd(cell,ue); + } +#endif + + RETVALUE(ROK); +} /* rgSCHCmnUpdExtPhr */ + + + + +/** + * @brief PHR update. + * + * @details + * + * Function : rgSCHCmnUpdPhr + * + * Updates power headroom information for an UE. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 phr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnUpdPhr +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 phr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnUpdPhr(cell, ue, phr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 phr; +RgSchErrInfo *err; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + RgSchCmnAllocRecord *allRcd; + CmLList *node = ueUl->ulAllocLst.last; + +#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell); +#endif + TRC2(rgSCHCmnUpdPhr); + + UNUSED(err); + + while (node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + node = node->prev; + if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) + { + rgSCHPwrUpdPhr(cell, ue, phr, allRcd, RG_SCH_CMN_PWR_USE_CFG_MAX_PWR); + break; + } + } +#ifdef LTEMAC_SPS + if(ulSpsUe->isUlSpsActv) + { + rgSCHCmnSpsPhrInd(cell,ue); + } +#endif + + RETVALUE(ROK); +} /* rgSCHCmnUpdPhr */ + +/** + * @brief UL grant for contention resolution. + * + * @details + * + * Function : rgSCHCmnContResUlGrant + * + * Add UE to another queue specifically for CRNTI based contention + * resolution. + * + * + * @param[in] RgSchUeCb *ue + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnContResUlGrant +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnContResUlGrant(cell, ue, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnContResUlGrant); + + #ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHContResUlGrant(cell, ue); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHContResUlGrant(cell, ue); + } + RETVALUE(ROK); +} + +/** + * @brief SR reception handling. + * + * @details + * + * Function : rgSCHCmnSrRcvd + * + * - Update UE's position within/across uplink scheduling queues + * - Update priority of LCGs if needed. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo frm + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnSrRcvd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHCmnSrRcvd(cell, ue, frm, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +RgSchErrInfo *err; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + CmLList *node = ueUl->ulAllocLst.last; + + TRC2(rgSCHCmnSrRcvd); + +#ifdef EMTC_ENABLE + emtcStatsUlTomSrInd++; +#endif + + RGSCH_INCR_SUB_FRAME(frm, 1); /* 1 TTI after the time SR was sent */ + while (node) + { + RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)node->node; + if (RGSCH_TIMEINFO_SAME(frm, allRcd->allocTime)) + { + break; + } + node = node->prev; + } + //TODO_SID Need to check when it is getting triggered + ue->isSrGrant = TRUE; +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + if(ue->isEmtcUe) + { + cellSch->apisEmtcUl->rgSCHSrRcvd(cell, ue); + RETVALUE(ROK); + } + } + else +#endif + { + cellSch->apisUl->rgSCHSrRcvd(cell, ue); + } + RETVALUE(ROK); +} + +/** + * @brief Returns first uplink allocation to send reception + * request to PHY. + * + * @details + * + * Function: rgSCHCmnFirstRcptnReq(cell) + * Purpose: This function returns the first uplink allocation + * (or NULLP if there is none) in the subframe + * in which is expected to prepare and send reception + * request to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHCmnFirstRcptnReq +( +RgSchCellCb *cell +) +#else +PUBLIC RgSchUlAlloc *rgSCHCmnFirstRcptnReq(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); +/* ACC_TDD */ + RgSchUlAlloc* alloc = NULLP; + + TRC2(rgSCHCmnFirstRcptnReq); + + if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO) + { + RgSchUlSf* sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; + alloc = rgSCHUtlUlAllocFirst(sf); + + if (alloc && alloc->hqProc == NULLP) + { + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + } + } + + RETVALUE(alloc); +} + +/** + * @brief Returns first uplink allocation to send reception + * request to PHY. + * + * @details + * + * Function: rgSCHCmnNextRcptnReq(cell) + * Purpose: This function returns the next uplink allocation + * (or NULLP if there is none) in the subframe + * in which is expected to prepare and send reception + * request to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHCmnNextRcptnReq +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc +) +#else +PUBLIC RgSchUlAlloc *rgSCHCmnNextRcptnReq(cell, alloc) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); +/* ACC-TDD */ + //RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; + + TRC2(rgSCHCmnNextRcptnReq); +/* ACC-TDD */ + if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO) + { + RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx]; + + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + if (alloc && alloc->hqProc == NULLP) + { + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + } + } + else + { + alloc = NULLP; + } + + RETVALUE(alloc); +} +/** + * @brief Collates DRX enabled UE's scheduled in this SF + * + * @details + * + * Function: rgSCHCmnDrxStrtInActvTmrInUl(cell) + * Purpose: This function collates the link + * of UE's scheduled in this SF who + * have drx enabled. It then calls + * DRX specific function to start/restart + * inactivity timer in Ul + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDrxStrtInActvTmrInUl +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnDrxStrtInActvTmrInUl(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchUlSf *sf = &(cellUl->ulSfArr[cellUl->schdIdx]); + RgSchUlAlloc *alloc = rgSCHUtlUlAllocFirst(sf); + CmLListCp ulUeLst; + RgSchUeCb *ueCb; + + + TRC2(rgSCHCmnDrxStrtInActvTmrInUl); + + cmLListInit(&ulUeLst); + + while(alloc) + { + ueCb = alloc->ue; + + if (ueCb) + { + if (!(alloc->grnt.isRtx) && ueCb->isDrxEnabled && !(ueCb->isSrGrant) +#ifdef LTEMAC_SPS + /* ccpu00139513- DRX inactivity timer should not be started for + * UL SPS occasions */ + && (alloc->hqProc->isSpsOccnHqP == FALSE) +#endif + ) + { + cmLListAdd2Tail(&ulUeLst,&(ueCb->ulDrxInactvTmrLnk)); + ueCb->ulDrxInactvTmrLnk.node = (PTR)ueCb; + } + } + + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + }/*while(alloc)*/ + + (Void)rgSCHDrxStrtInActvTmr(cell,&ulUeLst,RG_SCH_DRX_UL); + + RETVOID; +} + + +/** + * @brief Returns first uplink allocation to send HARQ feedback + * request to PHY. + * + * @details + * + * Function: rgSCHCmnFirstHqFdbkAlloc + * Purpose: This function returns the first uplink allocation + * (or NULLP if there is none) in the subframe + * for which it is expected to prepare and send HARQ + * feedback to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] U8 idx + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc +( +RgSchCellCb *cell, +U8 idx +) +#else +PUBLIC RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc(cell, idx) +RgSchCellCb *cell; +U8 idx; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); +/* ACC-TDD */ + RgSchUlAlloc *alloc = NULLP; + + TRC2(rgSCHCmnFirstHqFdbkAlloc); + + if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) + { + RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; + alloc = rgSCHUtlUlAllocFirst(sf); + + while (alloc && (alloc->hqProc == NULLP)) + { + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + } + } + + RETVALUE(alloc); +} + +/** + * @brief Returns next allocation to send HARQ feedback for. + * + * @details + * + * Function: rgSCHCmnNextHqFdbkAlloc(cell) + * Purpose: This function returns the next uplink allocation + * (or NULLP if there is none) in the subframe + * for which HARQ feedback needs to be sent. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc, +U8 idx +) +#else +PUBLIC RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc(cell, alloc, idx) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +U8 idx; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + TRC2(rgSCHCmnNextHqFdbkAlloc); + + if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) + { + RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; + + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + while (alloc && (alloc->hqProc == NULLP)) + { + alloc = rgSCHUtlUlAllocNxt(sf, alloc); + } + } + else + { + alloc = NULLP; + } + RETVALUE(alloc); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlGetITbsFrmIMcs + * + * Desc : Returns the Itbs that is mapped to an Imcs + * for the case of uplink. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUlGetITbsFrmIMcs +( +U8 iMcs +) +#else +PUBLIC U8 rgSCHCmnUlGetITbsFrmIMcs(iMcs) +U8 iMcs; +#endif +{ + TRC2(rgSCHCmnUlGetITbsFrmIMcs); + + RETVALUE(rgUlIMcsTbl[iMcs].iTbs); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlGetIMcsFrmITbs + * + * Desc : Returns the Imcs that is mapped to an Itbs + * for the case of uplink. + * + * Ret : + * + * Notes: For iTbs 19, iMcs is dependant on modulation order. + * Refer to 36.213, Table 8.6.1-1 and 36.306 Table 4.1-2 + * for UE capability information + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUlGetIMcsFrmITbs +( +U8 iTbs, +CmLteUeCategory ueCtg +) +#else +PUBLIC U8 rgSCHCmnUlGetIMcsFrmITbs(iTbs, ueCtg) +U8 iTbs; +CmLteUeCategory ueCtg; +#endif +{ + U8 iMcs; + TRC2(rgSCHCmnUlGetIMcsFrmITbs); + + if (iTbs <= 10) + { + iMcs = iTbs; + } + /*a higher layer can force a 64QAM UE to transmit at 16QAM. + * We currently do not support this. Once the support for such + * is added, ueCtg should be replaced by current transmit + * modulation configuration.Refer to 36.213 -8.6.1 + */ + else if ( iTbs < 19 ) + { + iMcs = iTbs + 1; + } + else if ((iTbs == 19) && (ueCtg != CM_LTE_UE_CAT_5)) + { + iMcs = iTbs + 1; + } + else + { + iMcs = iTbs + 2; + } + +#ifdef LTE_TDD + /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption + was seen when IMCS exceeds 20 on T2k TDD*/ + if (iMcs > 20) + { + iMcs = 20; + } +#endif + + RETVALUE(iMcs); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlMinTbBitsForITbs + * + * Desc : Returns the minimum number of bits that can + * be given as grant for a specific CQI. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC U32 rgSCHCmnUlMinTbBitsForITbs +( +RgSchCmnUlCell *cellUl, +U8 iTbs +) +#else +PUBLIC U32 rgSCHCmnUlMinTbBitsForITbs(cellUl, iTbs) +RgSchCmnUlCell *cellUl; +U8 iTbs; +#endif +{ + TRC2(rgSCHCmnUlMinTbBitsForITbs); + + RGSCH_ARRAY_BOUND_CHECK(0, rgTbSzTbl[0], iTbs); + + RETVALUE(rgTbSzTbl[0][iTbs][cellUl->sbSize-1]); +} + +/*********************************************************** + * + * Func : rgSCHCmnUlSbAlloc + * + * Desc : Given a required 'number of subbands' and a hole, + * returns a suitable alloc such that the subband + * allocation size is valid + * + * Ret : + * + * Notes: Does not assume either passed numSb or hole size + * to be valid for allocation, and hence arrives at + * an acceptable value. + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHCmnUlSbAlloc +( +RgSchUlSf *sf, +U8 numSb, +RgSchUlHole *hole +) +#else +PUBLIC RgSchUlAlloc *rgSCHCmnUlSbAlloc(sf, numSb, hole) +RgSchUlSf *sf; +U8 numSb; +RgSchUlHole *hole; +#endif +{ + U8 holeSz; /* valid hole size */ + RgSchUlAlloc *alloc; + TRC2(rgSCHCmnUlSbAlloc); + + if ((holeSz = rgSchCmnMult235Tbl[hole->num].prvMatch) == hole->num) + { + numSb = rgSchCmnMult235Tbl[numSb].match; + if (numSb >= holeSz) + { + alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); + } + else + { + alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); + } + } + else + { + if (numSb < holeSz) + { + numSb = rgSchCmnMult235Tbl[numSb].match; + } + else + { + numSb = rgSchCmnMult235Tbl[numSb].prvMatch; + } + + if ( numSb >= holeSz ) + { + numSb = holeSz; + } + alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); + } + RETVALUE(alloc); +} + +/** + * @brief To fill the RgSchCmnUeUlAlloc structure of UeCb. + * + * @details + * + * Function: rgSCHCmnUlUeFillAllocInfo + * Purpose: Specific scheduler to call this API to fill the alloc + * information. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlUeFillAllocInfo +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlUeFillAllocInfo(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUeUlAlloc *ulAllocInfo; + RgSchCmnUlUe *ueUl; + + TRC2(rgSCHCmnUlUeFillAllocInfo); + + ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + ulAllocInfo = &ueUl->alloc; + + /* Fill alloc structure */ + rgSCHCmnUlAllocFillTpc(cell, ue, ulAllocInfo->alloc); + rgSCHCmnUlAllocFillNdmrs(cellUl, ulAllocInfo->alloc); + rgSCHCmnUlAllocLnkHqProc(ue, ulAllocInfo->alloc, ulAllocInfo->alloc->hqProc, + ulAllocInfo->alloc->hqProc->isRetx); + /* Fill PDCCH */ + rgSCHCmnUlFillPdcchWithAlloc(ulAllocInfo->alloc->pdcch, + ulAllocInfo->alloc, ue); + /* Recording information about this allocation */ + rgSCHCmnUlRecordUeAlloc(cell, ue); + + /* Update the UE's outstanding allocation */ + if (!ulAllocInfo->alloc->hqProc->isRetx) + { + rgSCHCmnUlUpdOutStndAlloc(cell, ue, ulAllocInfo->allocdBytes); + } + + RETVOID; +} + +/** + * @brief Update the UEs outstanding alloc based on the BSR report's timing. + * + * + * @details + * + * Function: rgSCHCmnUpdUlCompEffBsr + * Purpose: Clear off all the allocations from outstanding allocation that + * are later than or equal to BSR timing information (stored in UEs datIndTime). + * + * Invoked by: Scheduler + * + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdUlCompEffBsr +( +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnUpdUlCompEffBsr(ue) +RgSchUeCb *ue; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,ue->cell); + CmLList *node = ueUl->ulAllocLst.last; + RgSchCmnAllocRecord *allRcd; + U32 outStndAlloc=0; + U32 nonLcg0OutStndAllocBs=0; + U32 nonLcg0Bsr=0; + U8 lcgId; + RgSchCmnLcg *cmnLcg = NULLP; + TRC2(rgSCHCmnUpdUlCompEffBsr); + + while (node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime)) + { + node = node->next; + break; + } + node = node->prev; + } + while (node) + { + allRcd = (RgSchCmnAllocRecord *)node->node; + node = node->next; + outStndAlloc += allRcd->alloc; + } + + cmnLcg = (RgSchCmnLcg *)(ue->ul.lcgArr[0].sch); + /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/ + if (cmnLcg->bs > outStndAlloc) + { + cmnLcg->bs -= outStndAlloc; + ue->ul.minReqBytes = cmnLcg->bs; + outStndAlloc = 0; + } + else + { + nonLcg0OutStndAllocBs = outStndAlloc - cmnLcg->bs; + cmnLcg->bs = 0; + } + + for(lcgId = 1;lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++) + { + if(RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) + { + cmnLcg = ((RgSchCmnLcg *) (ue->ul.lcgArr[lcgId].sch)); + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + nonLcg0Bsr += cmnLcg->bs; + } + } + } + nonLcg0Bsr += ue->ul.nonGbrLcgBs; + if (nonLcg0OutStndAllocBs > nonLcg0Bsr) + { + nonLcg0Bsr = 0; + } + else + { + nonLcg0Bsr -= nonLcg0OutStndAllocBs; + } + ue->ul.nonLcg0Bs = nonLcg0Bsr; + /* Cap effBsr with nonLcg0Bsr and append lcg0 bs. + * nonLcg0Bsr limit applies only to lcg1,2,3 */ + /* better be handled in individual scheduler */ + ue->ul.effBsr = nonLcg0Bsr +\ + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; + RETVOID; +} + +/** + * @brief Records information about the current allocation. + * + * @details + * + * Function: rgSCHCmnUlRecordUeAlloc + * Purpose: Records information about the curent allocation. + * This includes the allocated bytes, as well + * as some power information. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlRecordUeAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnUlRecordUeAlloc(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ +#ifdef LTE_TDD + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); +#endif + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + CmLListCp *lst = &ueUl->ulAllocLst; + CmLList *node = ueUl->ulAllocLst.first; + RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node); + RgSchCmnUeUlAlloc *ulAllocInfo = &ueUl->alloc; + CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); + TRC2(rgSCHCmnUlRecordUeAlloc); + + cmLListDelFrm(lst, &allRcd->lnk); +#ifndef LTE_TDD + /* To the crntTime, add the MIN time at which UE will + * actually send the BSR i.e DELTA+4 */ + allRcd->allocTime = cell->crntTime; + /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ +#ifdef EMTC_ENABLE + if(ue->isEmtcUe == TRUE) + { + RGSCH_INCR_SUB_FRAME_EMTC(allRcd->allocTime, + (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); + } + else +#endif + { + RGSCH_INCR_SUB_FRAME(allRcd->allocTime, + (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)); + } +#else + allRcd->allocTime = cellUl->schdTime; +#endif + cmLListAdd2Tail(lst, &allRcd->lnk); + + /* Filling in the parameters to be recorded */ + allRcd->alloc = ulAllocInfo->allocdBytes; + //allRcd->numRb = ulAllocInfo->alloc->grnt.numRb; + allRcd->numRb = (ulAllocInfo->alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); + /*Recording the UL CQI derived from the maxUlCqi */ + allRcd->cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg); + allRcd->tpc = ulAllocInfo->alloc->grnt.tpc; + + rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb); + + cell->measurements.ulBytesCnt += ulAllocInfo->allocdBytes; + + RETVOID; +} + +/** PHR handling for MSG3 + * @brief Records allocation information of msg3 in the the UE. + * + * @details + * + * Function: rgSCHCmnUlRecMsg3Alloc + * Purpose: Records information about msg3 allocation. + * This includes the allocated bytes, as well + * as some power information. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchRaCb *raCb + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlRecMsg3Alloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchRaCb *raCb +) +#else +PUBLIC Void rgSCHCmnUlRecMsg3Alloc(cell, ue, raCb) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchRaCb *raCb; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + CmLListCp *lst = &ueUl->ulAllocLst; + CmLList *node = ueUl->ulAllocLst.first; + RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node); + + /* Stack Crash problem for TRACE5 changes */ + TRC2(rgSCHCmnUlRecMsg3Alloc); + + cmLListDelFrm(lst, node); + allRcd->allocTime = raCb->msg3AllocTime; + cmLListAdd2Tail(lst, node); + + /* Filling in the parameters to be recorded */ + allRcd->alloc = raCb->msg3Grnt.datSz; + allRcd->numRb = raCb->msg3Grnt.numRb; + allRcd->cqi = raCb->ccchCqi; + allRcd->tpc = raCb->msg3Grnt.tpc; + + rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb); + + RETVOID; +} +/** + * @brief Keeps track of the most recent RG_SCH_CMN_MAX_ALLOC_TRACK + * allocations to track. Adds this allocation to the ueUl's ulAllocLst. + * + * + * @details + * + * Function: rgSCHCmnUlUpdOutStndAlloc + * Purpose: Recent Allocation shall be at First Pos'n. + * Remove the last node, update the fields + * with the new allocation and add at front. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 alloc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlUpdOutStndAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 alloc +) +#else +PUBLIC Void rgSCHCmnUlUpdOutStndAlloc(cell, ue, alloc) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 alloc; +#endif +{ + U32 nonLcg0Alloc=0; + TRC2(rgSCHCmnUlUpdOutStndAlloc); + + /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/ + if (((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs > alloc) + { + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs -= alloc; + } + else + { + nonLcg0Alloc = alloc - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = 0; + } + + if (nonLcg0Alloc >= ue->ul.nonLcg0Bs) + { + ue->ul.nonLcg0Bs = 0; + } + else + { + ue->ul.nonLcg0Bs -= nonLcg0Alloc; + } + /* Cap effBsr with effAmbr and append lcg0 bs. + * effAmbr limit applies only to lcg1,2,3 non GBR LCG's*/ + /* better be handled in individual scheduler */ + ue->ul.effBsr = ue->ul.nonLcg0Bs +\ + ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs; +#ifdef RGR_V1 + if (ue->ul.effBsr == 0) + { + if (ue->bsrTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); + } + /* ccpu00133008 */ + if (FALSE == ue->isSrGrant) + { + if (ue->ul.bsrTmrCfg.isPrdBsrTmrPres) + { + /* + rgSCHTmrStartTmr(cell, ue, RG_SCH_TMR_BSR, + ue->ul.bsrTmrCfg.prdBsrTmr); + */ + } + } + } +#endif + /* Resetting UEs lower Cap */ + ue->ul.minReqBytes = 0; + + RETVOID; +} + + +/** + * @brief Returns the "Itbs" for a given UE. + * + * @details + * + * Function: rgSCHCmnUlGetITbs + * Purpose: This function returns the "Itbs" for a given UE. + * + * Invoked by: Scheduler + * + * @param[in] RgSchUeCb *ue + * @return U8 + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUlGetITbs +( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isEcp +) +#else +PUBLIC U8 rgSCHCmnUlGetITbs(cell, ue, isEcp) +RgSchCellCb *cell; +RgSchUeCb *ue; +Bool isEcp; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + /* CQI will be capped to maxUlCqi for 16qam UEs */ + CmLteUeCategory ueCtgy = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); + U8 cqi; +#ifdef UL_LA + S32 iTbs; + U8 maxiTbs = rgSchCmnUlCqiToTbsTbl[(U8)isEcp][ueUl->maxUlCqi]; +#endif + + TRC2(rgSCHCmnUlGetITbs); + + /* #ifdef RG_SCH_CMN_EXT_CP_SUP For ECP pick index 1 */ +#ifdef TFU_UPGRADE + if ( (ueCtgy != CM_LTE_UE_CAT_5) && + (ueUl->validUlCqi > ueUl->maxUlCqi) + ) + { + cqi = ueUl->maxUlCqi; + } + else + { + cqi = ueUl->validUlCqi; + } + +#ifdef UL_LA + iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; + + RG_SCH_CHK_ITBS_RANGE(iTbs, maxiTbs); + + iTbs = RGSCH_MIN(iTbs, ue->cell->thresholds.maxUlItbs); + +#ifdef LTE_TDD + /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption + was seen when IMCS exceeds 20 on T2k TDD */ + if (iTbs > 19) + { + iTbs = 19; + } +#endif + RETVALUE(iTbs); +#endif +#else + if ( (ueCtgy != CM_LTE_UE_CAT_5) && (ueUl->crntUlCqi[0] > ueUl->maxUlCqi )) + { + cqi = ueUl->maxUlCqi; + } + else + { + cqi = ueUl->crntUlCqi[0]; + } +#endif + RETVALUE(rgSchCmnUlCqiToTbsTbl[(U8)isEcp][cqi]); +} + +/** + * @brief This function adds the UE to DLRbAllocInfo TX lst. + * + * @details + * + * Function: rgSCHCmnDlRbInfoAddUeTx + * Purpose: This function adds the UE to DLRbAllocInfo TX lst. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRbInfoAddUeTx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +) +#else +PRIVATE Void rgSCHCmnDlRbInfoAddUeTx(cell, allocInfo, ue, hqP) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnDlRbInfoAddUeTx); + + if (hqP->reqLnk.node == NULLP) + { + if (cellSch->dl.isDlFreqSel) + { + cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, + &allocInfo->dedAlloc.txHqPLst, hqP); + } + else + { + { + cmLListAdd2Tail(&allocInfo->dedAlloc.txHqPLst, &hqP->reqLnk); + } + hqP->reqLnk.node = (PTR)hqP; + } + } + RETVOID; +} + +/** + * @brief This function adds the UE to DLRbAllocInfo RETX lst. + * + * @details + * + * Function: rgSCHCmnDlRbInfoAddUeRetx + * Purpose: This function adds the UE to DLRbAllocInfo RETX lst. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +) +#else +PRIVATE Void rgSCHCmnDlRbInfoAddUeRetx(cell, allocInfo, ue, hqP) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell); + + TRC2(rgSCHCmnDlRbInfoAddUeRetx); + + if (cellSch->dl.isDlFreqSel) + { + cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, + &allocInfo->dedAlloc.retxHqPLst, hqP); + } + else + { + /* checking UE's presence in this lst is unnecessary */ + cmLListAdd2Tail(&allocInfo->dedAlloc.retxHqPLst, &hqP->reqLnk); + hqP->reqLnk.node = (PTR)hqP; + } + RETVOID; +} + +/** + * @brief This function adds the UE to DLRbAllocInfo TX-RETX lst. + * + * @details + * + * Function: rgSCHCmnDlRbInfoAddUeRetxTx + * Purpose: This adds the UE to DLRbAllocInfo TX-RETX lst. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRbInfoAddUeRetxTx +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +) +#else +PRIVATE Void rgSCHCmnDlRbInfoAddUeRetxTx(allocInfo, ue, hqP) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +RgSchDlHqProcCb *hqP; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell); + + TRC2(rgSCHCmnDlRbInfoAddUeRetxTx); + + if (cellSch->dl.isDlFreqSel) + { + cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell, + &allocInfo->dedAlloc.txRetxHqPLst, hqP); + } + else + { + cmLListAdd2Tail(&allocInfo->dedAlloc.txRetxHqPLst, &hqP->reqLnk); + hqP->reqLnk.node = (PTR)hqP; + } + RETVOID; +} + +/** + * @brief This function adds the UE to DLRbAllocInfo NonSchdRetxLst. + * + * @details + * + * Function: rgSCHCmnDlAdd2NonSchdRetxLst + * Purpose: During RB estimation for RETX, if allocation fails + * then appending it to NonSchdRetxLst, the further + * action is taken as part of Finalization in + * respective schedulers. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst +( +RgSchCmnDlRbAllocInfo *allocInfo, +RgSchUeCb *ue, +RgSchDlHqProcCb *hqP +) +#else +PRIVATE Void rgSCHCmnDlAdd2NonSchdRetxLst(allocInfo, ue, hqP) +RgSchCmnDlRbAllocInfo *allocInfo; +RgSchUeCb *ue; +RgSchDlHqProcCb *hqP; +#endif +{ + CmLList *schdLnkNode; + + TRC2(rgSCHCmnDlAdd2NonSchdRetxLst); + +#ifdef LTEMAC_SPS + if ( (hqP->sch != (RgSchCmnDlHqProc *)NULLP) && + (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP))) + { + RETVOID; + } +#endif + + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + cmLListAdd2Tail(&allocInfo->dedAlloc.nonSchdRetxHqPLst, schdLnkNode); + + RETVOID; +} + + + +/** + * @brief This function adds the UE to DLRbAllocInfo NonSchdTxRetxLst. + * + * @details + * + * Function: rgSCHCmnDlAdd2NonSchdTxRetxLst + * Purpose: During RB estimation for TXRETX, if allocation fails + * then appending it to NonSchdTxRetxLst, the further + * action is taken as part of Finalization in + * respective schedulers. + * + * Invoked by: Common Scheduler + * + * @param[out] RgSchCmnDlRbAllocInfo *allocInfo + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef LTE_TDD +/** + * @brief This function handles the initialisation of DL HARQ/ACK feedback + * timing information for eaach DL subframe. + * + * @details + * + * Function: rgSCHCmnDlANFdbkInit + * Purpose: Each DL subframe stores the sfn and subframe + * information of UL subframe in which it expects + * HARQ ACK/NACK feedback for this subframe.It + * generates the information based on Downlink + * Association Set Index table. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlANFdbkInit +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlANFdbkInit(cell) +RgSchCellCb *cell; +#endif +{ + U8 sfCount; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 maxDlSubfrms = cell->numDlSubfrms; + U8 sfNum; + U8 idx; + U8 dlIdx; + U8 calcSfnOffset; + S8 calcSfNum; + U8 ulSfCnt =0; + RgSchTddSubfrmInfo ulSubfrmInfo; + U8 maxUlSubfrms; + + TRC2(rgSCHCmnDlANFdbkInit); + + ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; + maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + + /* Generate HARQ ACK/NACK feedback information for each DL sf in a radio frame + * Calculate this information based on DL Association set Index table */ + for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) + { + while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != + RG_SCH_TDD_UL_SUBFRAME) + { + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + ulSfCnt++; + + for(idx=0; idx < rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\ + numFdbkSubfrms; idx++) + { + calcSfNum = sfNum - rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\ + subfrmNum[idx]; + if(calcSfNum < 0) + { + calcSfnOffset = RGSCH_CEIL(-calcSfNum, RGSCH_NUM_SUB_FRAMES); + } + else + { + calcSfnOffset = 0; + } + + calcSfNum = ((RGSCH_NUM_SUB_FRAMES * calcSfnOffset) + calcSfNum)\ + % RGSCH_NUM_SUB_FRAMES; + + if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) + { + dlIdx = calcSfNum; + } + else if((ulSubfrmInfo.switchPoints == 2) && (calcSfNum <= \ + RG_SCH_CMN_SPL_SUBFRM_6)) + { + dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; + } + else + { + dlIdx = calcSfNum - maxUlSubfrms; + } + + cell->subFrms[dlIdx]->dlFdbkInfo.subframe = sfNum; + cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = calcSfnOffset; + cell->subFrms[dlIdx]->dlFdbkInfo.m = idx; + } + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + + /* DL subframes in the subsequent radio frames are initialized + * with the previous radio frames */ + for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms;\ + dlIdx++) + { + sfNum = dlIdx - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx]\ + [RGSCH_NUM_SUB_FRAMES-1]; + cell->subFrms[dlIdx]->dlFdbkInfo.subframe = \ + cell->subFrms[sfNum]->dlFdbkInfo.subframe; + cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = \ + cell->subFrms[sfNum]->dlFdbkInfo.sfnOffset; + cell->subFrms[dlIdx]->dlFdbkInfo.m = cell->subFrms[sfNum]->dlFdbkInfo.m; + } + RETVALUE(ROK); +} + +/** + * @brief This function handles the initialization of uplink association + * set information for each DL subframe. + * + * + * @details + * + * Function: rgSCHCmnDlKdashUlAscInit + * Purpose: Each DL sf stores the sfn and sf information of UL sf + * in which it expects HQ ACK/NACK trans. It generates the information + * based on k` in UL association set index table. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlKdashUlAscInit +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlKdashUlAscInit(cell) +RgSchCellCb *cell; +#endif +{ + U8 sfCount; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 maxDlSubfrms = cell->numDlSubfrms; + U8 sfNum; + U8 dlIdx; + S8 calcSfnOffset; + S8 calcSfNum; + U8 ulSfCnt =0; + RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; + U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ + [RGSCH_NUM_SUB_FRAMES-1]; + U8 dlPres = 0; + + TRC2(rgSCHCmnDlKdashUlAscInit); + + /* Generate ACK/NACK offset information for each DL subframe in a radio frame + * Calculate this information based on K` in UL Association Set table */ + for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) + { + while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != + RG_SCH_TDD_UL_SUBFRAME) + { + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + ulSfCnt++; + + calcSfNum = (sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum] + \ + RGSCH_NUM_SUB_FRAMES) % RGSCH_NUM_SUB_FRAMES; + calcSfnOffset = sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum]; + if(calcSfnOffset < 0) + { + calcSfnOffset = RGSCH_CEIL(-calcSfnOffset, RGSCH_NUM_SUB_FRAMES); + } + else + { + calcSfnOffset = 0; + } + + if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) + { + dlIdx = calcSfNum; + } + else if((ulSubfrmInfo.switchPoints == 2) && + (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6)) + { + dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; + } + else + { + dlIdx = calcSfNum - maxUlSubfrms; + } + + cell->subFrms[dlIdx]->ulAscInfo.subframe = sfNum; + cell->subFrms[dlIdx]->ulAscInfo.sfnOffset = calcSfnOffset; + + /* set dlIdx for which ulAscInfo is updated */ + dlPres = dlPres | (1 << dlIdx); + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + + /* Set Invalid information for which ulAscInfo is not present */ + for (sfCount = 0; + sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + sfCount++) + { + /* If dlPres is 0, ulAscInfo is not present in that DL index */ + if(! ((dlPres >> sfCount)&0x01)) + { + cell->subFrms[sfCount]->ulAscInfo.sfnOffset = + RGSCH_INVALID_INFO; + cell->subFrms[sfCount]->ulAscInfo.subframe = + RGSCH_INVALID_INFO; + } + } + + /* DL subframes in the subsequent radio frames are initialized + * with the previous radio frames */ + for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms; + dlIdx++) + { + sfNum = dlIdx - \ + rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + cell->subFrms[dlIdx]->ulAscInfo.subframe = + cell->subFrms[sfNum]->ulAscInfo.subframe; + cell->subFrms[dlIdx]->ulAscInfo.sfnOffset = + cell->subFrms[sfNum]->ulAscInfo.sfnOffset; + } + RETVALUE(ROK); +} + + +/** + * @brief This function initialises the 'Np' value for 'p' + * + * @details + * + * Function: rgSCHCmnDlNpValInit + * Purpose: To initialise the 'Np' value for each 'p'. It is used + * to find the mapping between nCCE and 'p' and used in + * HARQ ACK/NACK reception. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlNpValInit +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlNpValInit(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx; + U16 np; + TRC2(rgSCHCmnDlNpValInit); + + /* Always Np is 0 for p=0 */ + cell->rgSchTddNpValTbl[0] = 0; + + for(idx=1; idx < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; idx++) + { + np = cell->bwCfg.dlTotalBw * (idx * RG_SCH_CMN_NUM_SUBCAR - 4); + cell->rgSchTddNpValTbl[idx] = (U8) (np/36); + } + + RETVALUE(ROK); +} + +/** + * @brief This function handles the creation of RACH preamble + * list to queue the preambles and process at the scheduled + * time. + * + * @details + * + * Function: rgSCHCmnDlCreateRachPrmLst + * Purpose: To create RACH preamble list based on RA window size. + * It is used to queue the preambles and process it at the + * scheduled time. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlCreateRachPrmLst +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlCreateRachPrmLst(cell) +RgSchCellCb *cell; +#endif +{ + U8 raArrSz; + S16 ret; + U8 lstSize; + + TRC2(rgSCHCmnDlCreateRachPrmLst); + + RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz); + + lstSize = raArrSz * RGSCH_MAX_RA_RNTI_PER_SUBFRM * RGSCH_NUM_SUB_FRAMES; + + cell->raInfo.maxRaSize = raArrSz; + ret = rgSCHUtlAllocSBuf(cell->instIdx, + (Data **)(&cell->raInfo.raReqLst), (Size)(lstSize * sizeof(CmLListCp))); + if (ret != ROK) + { + RETVALUE(ret); + } + + cell->raInfo.lstSize = lstSize; + + RETVALUE(ROK); +} + + +/** + * @brief This function handles the initialization of RACH Response + * information at each DL subframe. + * + * @details + * + * Function: rgSCHCmnDlRachInfoInit + * Purpose: Each DL subframe stores the sfn and subframe information of + * possible RACH response allowed for UL subframes. It generates + * the information based on PRACH configuration. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlRachInfoInit +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlRachInfoInit(cell) +RgSchCellCb *cell; +#endif +{ + U8 sfCount; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 sfNum; + U8 ulSfCnt =0; + U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ + [RGSCH_NUM_SUB_FRAMES-1]; + U8 raArrSz; + RgSchTddRachRspLst rachRspLst[3][RGSCH_NUM_SUB_FRAMES]; + U8 startWin; + U8 endWin; + U8 sfnIdx; + U8 subfrmIdx; + U8 endSubfrmIdx; + U8 startSubfrmIdx; + S16 ret; + RgSchTddRachDelInfo *delInfo; + S8 sfnOffset; + U8 numSubfrms; + + TRC2(rgSCHCmnDlRachInfoInit); + + cmMemset((U8 *)rachRspLst, 0, sizeof(rachRspLst)); + + RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz); + + /* Include Special subframes */ + maxUlSubfrms = maxUlSubfrms + \ + rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx].switchPoints; + for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) + { + while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] == + RG_SCH_TDD_DL_SUBFRAME) + { + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + ulSfCnt++; + + startWin = (sfNum + RG_SCH_CMN_RARSP_WAIT_PRD + \ + ((RgSchCmnCell *)cell->sc.sch)->dl.numRaSubFrms); + endWin = (startWin + cell->rachCfg.raWinSize - 1); + startSubfrmIdx = + rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][startWin%RGSCH_NUM_SUB_FRAMES]; + /* Find the next DL subframe starting from Subframe 0 */ + if((startSubfrmIdx % RGSCH_NUM_SUB_FRAMES) == 0) + { + startWin = RGSCH_CEIL(startWin, RGSCH_NUM_SUB_FRAMES); + startWin = startWin * RGSCH_NUM_SUB_FRAMES; + } + + endSubfrmIdx = + rgSchTddLowDlSubfrmIdxTbl[ulDlCfgIdx][endWin%RGSCH_NUM_SUB_FRAMES]; + endWin = (endWin/RGSCH_NUM_SUB_FRAMES) * RGSCH_NUM_SUB_FRAMES \ + + endSubfrmIdx; + if(startWin > endWin) + { + continue; + } + /* Find all the possible RACH Response transmission + * time within the RA window size */ + startSubfrmIdx = startWin%RGSCH_NUM_SUB_FRAMES; + for(sfnIdx = startWin/RGSCH_NUM_SUB_FRAMES; + sfnIdx <= endWin/RGSCH_NUM_SUB_FRAMES; sfnIdx++) + { + if(sfnIdx == endWin/RGSCH_NUM_SUB_FRAMES) + { + endSubfrmIdx = endWin%RGSCH_NUM_SUB_FRAMES; + } + else + { + endSubfrmIdx = RGSCH_NUM_SUB_FRAMES-1; + } + + /* Find all the possible RACH Response transmission + * time within radio frame */ + for(subfrmIdx = startSubfrmIdx; + subfrmIdx <= endSubfrmIdx; subfrmIdx++) + { + if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][subfrmIdx] == + RG_SCH_TDD_UL_SUBFRAME) + { + continue; + } + subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx]; + /* Find the next DL subframe starting from Subframe 0 */ + if(subfrmIdx == RGSCH_NUM_SUB_FRAMES) + { + break; + } + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx], subfrmIdx); + numSubfrms = + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset = sfnIdx; + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].subframe[numSubfrms] + = sfNum; + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms++; + } + startSubfrmIdx = RG_SCH_CMN_SUBFRM_0; + } + /* Update the subframes to be deleted at this subframe */ + /* Get the subframe after the end of RA window size */ + endWin++; + endSubfrmIdx++; + sfnOffset = endWin/RGSCH_NUM_SUB_FRAMES; + if(sfnOffset < 0) + { + sfnOffset += raArrSz; + } + sfnIdx = (endWin/RGSCH_NUM_SUB_FRAMES) % raArrSz; + + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx],endSubfrmIdx-1); + if((endSubfrmIdx == RGSCH_NUM_SUB_FRAMES) || + (rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx] == + RGSCH_NUM_SUB_FRAMES)) + { + subfrmIdx = + rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][RG_SCH_CMN_SUBFRM_0]; + } + else + { + subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx]; + } + + delInfo = &rachRspLst[sfnIdx][subfrmIdx].delInfo; + delInfo->sfnOffset = sfnOffset; + delInfo->subframe[delInfo->numSubfrms] = sfNum; + delInfo->numSubfrms++; + + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + + ret = rgSCHCmnDlCpyRachInfo(cell, rachRspLst, raArrSz); + if (ret != ROK) + { + RETVALUE(ret); + } + + RETVALUE(ROK); +} + +/** + * @brief This function handles the initialization of PHICH information + * for each DL subframe based on PHICH table. + * + * @details + * + * Function: rgSCHCmnDlPhichOffsetInit + * Purpose: Each DL subf stores the sfn and subf information of UL subframe + * for which it trnsmts PHICH in this subframe. It generates the information + * based on PHICH table. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlPhichOffsetInit +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHCmnDlPhichOffsetInit(cell) +RgSchCellCb *cell; +#endif +{ + U8 sfCount; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 maxDlSubfrms = cell->numDlSubfrms; + U8 sfNum; + U8 dlIdx; + U8 dlPres = 0; + U8 calcSfnOffset; + U8 calcSfNum; + U8 ulSfCnt =0; + RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx]; + U8 maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\ + [RGSCH_NUM_SUB_FRAMES-1]; + + TRC2(rgSCHCmnDlPhichOffsetInit); + + /* Generate PHICH offset information for each DL subframe in a radio frame + * Calculate this information based on K in PHICH table */ + for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++) + { + while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] != + RG_SCH_TDD_UL_SUBFRAME) + { + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + ulSfCnt++; + + calcSfNum = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) % \ + RGSCH_NUM_SUB_FRAMES; + calcSfnOffset = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) / \ + RGSCH_NUM_SUB_FRAMES; + + if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1) + { + dlIdx = calcSfNum; + } + else if((ulSubfrmInfo.switchPoints == 2) && + (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6)) + { + dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1; + } + else + { + dlIdx = calcSfNum - maxUlSubfrms; + } + + cell->subFrms[dlIdx]->phichOffInfo.subframe = sfNum; + cell->subFrms[dlIdx]->phichOffInfo.numSubfrms = 1; + + cell->subFrms[dlIdx]->phichOffInfo.sfnOffset = calcSfnOffset; + + /* set dlIdx for which phich offset is updated */ + dlPres = dlPres | (1 << dlIdx); + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + + /* Set Invalid information for which phich offset is not present */ + for (sfCount = 0; + sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + sfCount++) + { + /* If dlPres is 0, phich offset is not present in that DL index */ + if(! ((dlPres >> sfCount)&0x01)) + { + cell->subFrms[sfCount]->phichOffInfo.sfnOffset = + RGSCH_INVALID_INFO; + cell->subFrms[sfCount]->phichOffInfo.subframe = + RGSCH_INVALID_INFO; + cell->subFrms[sfCount]->phichOffInfo.numSubfrms = 0; + } + } + + /* DL subframes in the subsequent radio frames are + * initialized with the previous radio frames */ + for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; + dlIdx < maxDlSubfrms; dlIdx++) + { + sfNum = dlIdx - \ + rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + + cell->subFrms[dlIdx]->phichOffInfo.subframe = + cell->subFrms[sfNum]->phichOffInfo.subframe; + + cell->subFrms[dlIdx]->phichOffInfo.sfnOffset = + cell->subFrms[sfNum]->phichOffInfo.sfnOffset; + } + RETVALUE(ROK); +} + + +/** + * @brief Updation of Sch vars per TTI. + * + * @details + * + * Function: rgSCHCmnUpdVars + * Purpose: Updation of Sch vars per TTI. + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUpdVars +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHCmnUpdVars(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + CmLteTimingInfo timeInfo; + U8 idx; + U8 ulSubframe; + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 msg3Subfrm; + U8 Mval; + TRC2(rgSCHCmnUpdVars); + + /* ccpu00132654-ADD- Initializing all the indices in every subframe*/ + rgSCHCmnInitVars(cell); + + idx = (cell->crntTime.subframe + TFU_ULCNTRL_DLDELTA) % RGSCH_NUM_SUB_FRAMES; + /* Calculate the UL scheduling subframe idx based on the + Pusch k table */ + if(rgSchTddPuschTxKTbl[ulDlCfgIdx][idx] != 0) + { + /* PUSCH transmission is based on offset from DL + * PDCCH scheduling */ + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA); + ulSubframe = rgSchTddPuschTxKTbl[ulDlCfgIdx][timeInfo.subframe]; + /* Add the DCI-0 to PUSCH time to get the time of UL subframe */ + RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, ulSubframe); +#ifdef LTEMAC_SPS + cellUl->schdTti = timeInfo.sfn * 10 + timeInfo.subframe; +#endif + /* Fetch the corresponding UL subframe Idx in UL sf array */ + cellUl->schdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); + /* Fetch the corresponding UL Harq Proc ID */ + cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); + cellUl->schdTime = timeInfo; + } + Mval = rgSchTddPhichMValTbl[ulDlCfgIdx][idx]; + if(Mval) + { + /* Fetch the tx time for DL HIDCI-0 */ + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA); + /* Fetch the corresponding n-k tx time of PUSCH */ + cellUl->hqFdbkIdx[0] = rgSCHCmnGetPhichUlSfIdx(&timeInfo, cell); + /* Retx will happen according to the Pusch k table */ + cellUl->reTxIdx[0] = cellUl->schdIdx; + + if(ulDlCfgIdx == 0) + { + /* Calculate the ReTxIdx corresponding to hqFdbkIdx[0] */ + cellUl->reTxIdx[0] = rgSchUtlCfg0ReTxIdx(cell,timeInfo, + cellUl->hqFdbkIdx[0]); + if(Mval == 2) + { + /* At Idx 1 store the UL SF adjacent(left) to the UL SF + given at idx 0 */ + cellUl->hqFdbkIdx[1] = (cellUl->hqFdbkIdx[0]-1 + + cellUl->numUlSubfrms) % cellUl->numUlSubfrms; + /* Calculate the ReTxIdx corresponding to hqFdbkIdx[1] */ + cellUl->reTxIdx[1] = rgSchUtlCfg0ReTxIdx(cell,timeInfo, + cellUl->hqFdbkIdx[1]); + } + } + } + + idx = (cell->crntTime.subframe + TFU_RECPREQ_DLDELTA) % RGSCH_NUM_SUB_FRAMES; + if (rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] == RG_SCH_TDD_UL_SUBFRAME) + { + RGSCHCMNADDTOCRNTTIME(cell->crntTime, timeInfo, TFU_RECPREQ_DLDELTA) + cellUl->rcpReqIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); + } + idx = (cell->crntTime.subframe+RG_SCH_CMN_DL_DELTA) % RGSCH_NUM_SUB_FRAMES; + + /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in + special subframe */ + if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] != RG_SCH_TDD_UL_SUBFRAME) + { + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA) + msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe]; + RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, msg3Subfrm); + cellUl->msg3SchdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); + cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell); + } +#ifdef LTEMAC_SPS + if(!rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][idx]) + { + cellUl->spsUlRsrvIdx = RGSCH_INVALID_INFO; + } + else + { + /* introduce some reuse with above code? */ + U8 offst; + RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA) + //offst = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe]; + offst = rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][timeInfo.subframe]; + RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, offst); + cellUl->spsUlRsrvIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell); + /* The harq proc continues to be accessed and used the same delta before + * actual data occurance, and hence use the same idx */ + cellUl->spsUlRsrvHqProcIdx = cellUl->schdHqProcIdx; + } +#endif + + /* RACHO: update cmn sched specific RACH variables, + * mainly the prachMaskIndex */ + rgSCHCmnUpdRachParam(cell); + + RETVOID; +} + +/** + * @brief To get 'p' value from nCCE. + * + * @details + * + * Function: rgSCHCmnGetPValFrmCCE + * Purpose: Gets 'p' value for HARQ ACK/NACK reception from CCE. + * + * @param[in] RgSchCellCb *cell + * @param[in] U8 cce + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnGetPValFrmCCE +( +RgSchCellCb *cell, +U8 cce +) +#else +PUBLIC U8 rgSCHCmnGetPValFrmCCE(cell, cce) +RgSchCellCb *cell; +U8 cce; +#endif +{ + U8 i; + TRC2(rgSCHCmnGetPValFrmCCE); + + for(i=1; i < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; i++) + { + if(cce < cell->rgSchTddNpValTbl[i]) + { + RETVALUE(i-1); + } + } + RETVALUE(0); +} +#endif + +/*********************************************************** + * + * Func : rgSCHCmnUlAdapRetx + * + * Desc : Adaptive retransmission for an allocation. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlAdapRetx +( +RgSchUlAlloc *alloc, +RgSchUlHqProcCb *proc +) +#else +PRIVATE Void rgSCHCmnUlAdapRetx(alloc, proc) +RgSchUlAlloc *alloc; +RgSchUlHqProcCb *proc; +#endif +{ + TRC2(rgSCHCmnUlAdapRetx); + + rgSCHUhmRetx(proc, alloc); +#ifndef RG_5GTF + if (proc->rvIdx != 0) + { + alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[proc->rvIdx]; + } + else +#endif + { + alloc->grnt.iMcsCrnt = alloc->grnt.iMcs; + } + RETVOID; +} + +/** + * @brief Scheduler invocation per TTI. + * + * @details + * + * Function: rgSCHCmnHdlUlInactUes + * Purpose: + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnHdlUlInactUes +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnHdlUlInactUes(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + CmLListCp ulInactvLst; + TRC2(rgSCHCmnHdlUlInactUes); + /* Get a List of Inactv UEs for UL*/ + cmLListInit(&ulInactvLst); + + /* Trigger Spfc Schedulers with Inactive UEs */ + rgSCHMeasGapANRepGetUlInactvUe (cell, &ulInactvLst); + /* take care of this in UL retransmission */ + cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst); + + RETVOID; +} + +/** + * @brief Scheduler invocation per TTI. + * + * @details + * + * Function: rgSCHCmnHdlDlInactUes + * Purpose: + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnHdlDlInactUes +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnHdlDlInactUes(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + CmLListCp dlInactvLst; + TRC2(rgSCHCmnHdlDlInactUes); + /* Get a List of Inactv UEs for DL */ + cmLListInit(&dlInactvLst); + + /* Trigger Spfc Schedulers with Inactive UEs */ + rgSCHMeasGapANRepGetDlInactvUe (cell, &dlInactvLst); + + cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst); + RETVOID; +} + +/* RACHO: Rach handover functions start here */ +/*********************************************************** + * + * Func : rgSCHCmnUeIdleExdThrsld + * + * Desc : RETURN ROK if UE has been idle more + * than threshold. + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUeIdleExdThrsld +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE S16 rgSCHCmnUeIdleExdThrsld(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + /* Time difference in subframes */ + U32 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, ue->ul.ulTransTime); + + TRC2(rgSCHCmnUeIdleExdThrsld); + + if (sfDiff > (U32)RG_SCH_CMN_UE_IDLE_THRSLD(ue)) + { + RETVALUE(ROK); + } + else + { + RETVALUE(RFAILED); + } +} + + +/** + * @brief Scheduler processing for Ded Preambles on cell configuration. + * + * @details + * + * Function : rgSCHCmnCfgRachDedPrm + * + * This function does requisite initialisation + * for RACH Ded Preambles. + * + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnCfgRachDedPrm +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnCfgRachDedPrm(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + U32 gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP; + U32 sfDiff; + U8 cnt; + TRC2(rgSCHCmnCfgRachDedPrm); + + if (cell->macPreambleSet.pres == NOTPRSNT) + { + RETVOID; + } + cellSch->rachCfg.numDedPrm = cell->macPreambleSet.size; + cellSch->rachCfg.dedPrmStart = cell->macPreambleSet.start; + /* Initialize handover List */ + cmLListInit(&cellSch->rachCfg.hoUeLst); + /* Initialize pdcch Order List */ + cmLListInit(&cellSch->rachCfg.pdcchOdrLst); + + /* Intialize the rapId to UE mapping structure */ + for (cnt = 0; cntrachCfg.numDedPrm; cnt++) + { + cellSch->rachCfg.rapIdMap[cnt].rapId = cellSch->rachCfg.dedPrmStart + \ + cnt; + cmLListInit(&cellSch->rachCfg.rapIdMap[cnt].assgndUes); + } + /* Perform Prach Mask Idx, remDedPrm, applFrm initializations */ + /* Set remDedPrm as numDedPrm */ + cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm; + /* Initialize applFrm */ + cellSch->rachCfg.prachMskIndx = 0; + if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_EVEN) + { + cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + \ + (cell->crntTime.sfn % 2)) % RGSCH_MAX_SFN; + } +#ifdef LTE_TDD + else if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ODD) + { + if((cell->crntTime.sfn%2) == 0) + { + cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + 1)\ + % RGSCH_MAX_SFN; + } + } +#endif + else /* ANY sfn */ + { + cellSch->rachCfg.applFrm.sfn = cell->crntTime.sfn; + } + /* Initialize cellSch->rachCfg.applFrm as >= crntTime. + * This is because of RGSCH_CALC_SF_DIFF logic */ + if (cellSch->rachCfg.applFrm.sfn == cell->crntTime.sfn) + { + while (cellSch->rachCfg.prachMskIndx < cell->rachCfg.raOccasion.size) + { + if (cell->crntTime.subframe <\ + cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]) + { + break; + } + cellSch->rachCfg.prachMskIndx++; + } + if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size) + { + if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY) + { + cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) %\ + RGSCH_MAX_SFN; + } + else + { + cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) %\ + RGSCH_MAX_SFN; + } + cellSch->rachCfg.prachMskIndx = 0; + } + cellSch->rachCfg.applFrm.subframe = \ + cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; + } + else + { + cellSch->rachCfg.applFrm.subframe = \ + cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; + } + + /* Note first param to this macro should always be the latest in time */ + sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime); + while (sfDiff <= gap) + { + rgSCHCmnUpdNxtPrchMskIdx(cell); + sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime); + } + + RETVOID; +} + +/** + * @brief Updates the PRACH MASK INDEX. + * + * @details + * + * Function: rgSCHCmnUpdNxtPrchMskIdx + * Purpose: Ensures the "applFrm" field of Cmn Sched RACH + * CFG is always >= "n"+"DELTA", where "n" is the crntTime + * of the cell. If not, applFrm is updated to the next avl + * PRACH oppurtunity as per the PRACH Cfg Index configuration. + * + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnUpdNxtPrchMskIdx(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + TRC2(rgSCHCmnUpdNxtPrchMskIdx); + + /* Determine the next prach mask Index */ + if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size - 1) + { + /* PRACH within applFrm.sfn are done, go to next AVL sfn */ + cellSch->rachCfg.prachMskIndx = 0; + if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY) + { + cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) % \ + RGSCH_MAX_SFN; + } + else/* RGR_SFN_EVEN or RGR_SFN_ODD */ + { + cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) % \ + RGSCH_MAX_SFN; + } + cellSch->rachCfg.applFrm.subframe = cell->rachCfg.raOccasion.\ + subFrameNum[0]; + } + else /* applFrm.sfn is still valid */ + { + cellSch->rachCfg.prachMskIndx += 1; + if ( cellSch->rachCfg.prachMskIndx < RGR_MAX_SUBFRAME_NUM ) + { + cellSch->rachCfg.applFrm.subframe = \ + cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx]; + } + } + RETVOID; +} + +/** + * @brief Updates the Ded preamble RACH parameters + * every TTI. + * + * @details + * + * Function: rgSCHCmnUpdRachParam + * Purpose: Ensures the "applFrm" field of Cmn Sched RACH + * CFG is always >= "n"+"6"+"DELTA", where "n" is the crntTime + * of the cell. If not, applFrm is updated to the next avl + * PRACH oppurtunity as per the PRACH Cfg Index configuration, + * accordingly the "remDedPrm" is reset to "numDedPrm" and + * "prachMskIdx" field is updated as per "applFrm". + * + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUpdRachParam +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnUpdRachParam(cell) +RgSchCellCb *cell; +#endif +{ + + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + U32 gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP; + U32 sfDiff; + TRC2(rgSCHCmnUpdRachParam); + + if (cell->macPreambleSet.pres == NOTPRSNT) + { + RETVOID; + } + sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, \ + cell->crntTime); + if (sfDiff > gap) + { + /* applFrm is still a valid next Prach Oppurtunity */ + RETVOID; + } + rgSCHCmnUpdNxtPrchMskIdx(cell); + /* Reset remDedPrm as numDedPrm */ + cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm; + + RETVOID; +} + +/** + * @brief Dedicated Preamble allocation function. + * + * @details + * + * Function: rgSCHCmnAllocPOParam + * Purpose: Allocate pdcch, rapId and PrachMskIdx. + * Set mapping of UE with the allocated rapId. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchUeCb *ue + * @param[out] RgSchPdcch **pdcch + * @param[out] U8 *rapId + * @param[out] U8 *prachMskIdx + * @return Void + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnAllocPOParam +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchUeCb *ue, +RgSchPdcch **pdcch, +U8 *rapId, +U8 *prachMskIdx +) +#else +PRIVATE S16 rgSCHCmnAllocPOParam(cell, dlSf, ue, pdcch, rapId, prachMskIdx) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchUeCb *ue; +RgSchPdcch **pdcch; +U8 *rapId; +U8 *prachMskIdx; +#endif +{ + + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnAllocPOParam); + + if (cell->macPreambleSet.pres == PRSNT_NODEF) + { + if (cellSch->rachCfg.remDedPrm == 0) + { + RETVALUE(RFAILED); + } + /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ + if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP) + { + RETVALUE(RFAILED); + } + /* The stored prachMskIdx is the index of PRACH Oppurtunities in + * raOccasions.subframes[]. + * Converting the same to the actual PRACHMskIdx to be transmitted. */ + *prachMskIdx = cellSch->rachCfg.prachMskIndx + 1; + /* Distribution starts from dedPrmStart till dedPrmStart + numDedPrm */ + *rapId = cellSch->rachCfg.dedPrmStart + + cellSch->rachCfg.numDedPrm - cellSch->rachCfg.remDedPrm; + cellSch->rachCfg.remDedPrm--; + /* Map UE with the allocated RapId */ + ueDl->rachInfo.asgnOppr = cellSch->rachCfg.applFrm; + RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, cellSch->rachCfg.rapIdMap, (*rapId - cellSch->rachCfg.dedPrmStart)); + cmLListAdd2Tail(&cellSch->rachCfg.rapIdMap[*rapId - cellSch->rachCfg.dedPrmStart].assgndUes, + &ueDl->rachInfo.rapIdLnk); + ueDl->rachInfo.rapIdLnk.node = (PTR)ue; + ueDl->rachInfo.poRapId = *rapId; + } + else /* if dedicated preambles not configured */ + { + /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ + if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP) + { + RETVALUE(RFAILED); + } + *prachMskIdx = 0; + *rapId = 0; + } + + RETVALUE(ROK); +} + +/** + * @brief Dowlink Scheduling Handler. + * + * @details + * + * Function: rgSCHCmnGenPdcchOrder + * Purpose: For each UE in PO Q, grab a PDCCH, + * get an available ded RapId and fill PDCCH + * with PO information. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnGenPdcchOrder +( +RgSchCellCb *cell, +RgSchDlSf *dlSf +) +#else +PRIVATE Void rgSCHCmnGenPdcchOrder(cell, dlSf) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + CmLList *node = cellSch->rachCfg.pdcchOdrLst.first; + RgSchUeCb *ue; + U8 rapId; + U8 prachMskIdx; + RgSchPdcch *pdcch = NULLP; + + TRC2(rgSCHCmnGenPdcchOrder); + + while (node) + { + ue = (RgSchUeCb *)node->node; + node = node->next; + /* Skip sending for this subframe is Measuring or inActive in UL due + * to MeasGap or inactie due to DRX + */ + if ((ue->measGapCb.isMeasuring == TRUE) || + (ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE) || + (ue->isDrxEnabled && + ue->dl.dlInactvMask & RG_DRX_INACTIVE) + ) + { + continue; + } + if (rgSCHCmnAllocPOParam(cell, dlSf, ue, &pdcch, &rapId,\ + &prachMskIdx) != ROK) + { + /* No More rapIds left for the valid next avl Oppurtunity. + * Unsatisfied UEs here would be given a chance, when the + * prach Mask Index changes as per rachUpd every TTI */ + + /* PDDCH can also be ordered with rapId=0, prachMskIdx=0 + * so that UE triggers a RACH procedure with non-dedicated preamble. + * But the implementation here does not do this. Instead, the "break" + * here implies, that PDCCH Odr always given with valid rapId!=0, + * prachMskIdx!=0 if dedicated preambles are configured. + * If not configured, then trigger a PO with rapId=0,prchMskIdx=0*/ + break; + } + /* Fill pdcch with pdcch odr information */ + rgSCHCmnFillPdcchOdr2Sf(cell, ue, pdcch, rapId, prachMskIdx); + /* Remove this UE from the PDCCH ORDER QUEUE */ + rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); + /* Reset UE's power state */ + rgSCHPwrUeReset(cell, ue); + } + RETVOID; +} + + +/** + * @brief This function add UE to PdcchOdr Q if not already present. + * + * @details + * + * Function: rgSCHCmnDlAdd2PdcchOdrQ + * Purpose: + * + * Invoked by: CMN Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnDlAdd2PdcchOdrQ(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnDlAdd2PdcchOdrQ); + + if (ueDl->rachInfo.poLnk.node == NULLP) + { + cmLListAdd2Tail(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk); + ueDl->rachInfo.poLnk.node = (PTR)ue; + } + RETVOID; +} + + +/** + * @brief This function rmvs UE to PdcchOdr Q if not already present. + * + * @details + * + * Function: rgSCHCmnDlRmvFrmPdcchOdrQ + * Purpose: + * + * Invoked by: CMN Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnDlRmvFrmPdcchOdrQ); + + cmLListDelFrm(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk); + ueDl->rachInfo.poLnk.node = NULLP; + RETVOID; +} + +/** + * @brief Fill pdcch with PDCCH order information. + * + * @details + * + * Function: rgSCHCmnFillPdcchOdr2Sf + * Purpose: Fill PDCCH with PDCCH order information, + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchUeCb *ue + * @param[in] RgSchPdcch *pdcch + * @param[in] U8 rapId + * @param[in] U8 prachMskIdx + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFillPdcchOdr2Sf +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchPdcch *pdcch, +U8 rapId, +U8 prachMskIdx +) +#else +PRIVATE Void rgSCHCmnFillPdcchOdr2Sf(ue, pdcch, rapId, prachMskIdx) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchPdcch *pdcch; +U8 rapId; +U8 prachMskIdx; +#endif +{ + RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell); + + TRC2(rgSCHCmnFillPdcchOdr2Sf); + + pdcch->rnti = ue->ueId; + pdcch->dci.dciFormat = TFU_DCI_FORMAT_1A; + pdcch->dci.u.format1aInfo.isPdcchOrder = TRUE; + pdcch->dci.u.format1aInfo.t.pdcchOrder.preambleIdx = rapId; + pdcch->dci.u.format1aInfo.t.pdcchOrder.prachMaskIdx = prachMskIdx; + + /* Request for APer CQI immediately after PDCCH Order */ + /* CR ccpu00144525 */ +#ifdef TFU_UPGRADE + if(ue->dl.ueDlCqiCfg.aprdCqiCfg.pres) + { + ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC; + acqiCb->aCqiTrigWt = 0; + } +#endif + + RETVOID; +} + + +/** + * @brief UE deletion for scheduler. + * + * @details + * + * Function : rgSCHCmnDelRachInfo + * + * This functions deletes all scheduler information + * pertaining to an UE. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDelRachInfo +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnDelRachInfo(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 rapIdIdx; + + TRC2(rgSCHCmnDelRachInfo); + + if (ueDl->rachInfo.poLnk.node) + { + rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue); + } + if (ueDl->rachInfo.hoLnk.node) + { + cmLListDelFrm(&cellSch->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk); + ueDl->rachInfo.hoLnk.node = NULLP; + } + if (ueDl->rachInfo.rapIdLnk.node) + { + rapIdIdx = ueDl->rachInfo.poRapId - cellSch->rachCfg.dedPrmStart; + cmLListDelFrm(&cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes, + &ueDl->rachInfo.rapIdLnk); + ueDl->rachInfo.rapIdLnk.node = NULLP; + } + RETVOID; +} + +/** + * @brief This function retrieves the ue which has sent this raReq + * and it allocates grant for UEs undergoing (for which RAR + * is being generated) HandOver/PdcchOrder. + * + * + * @details + * + * Function: rgSCHCmnHdlHoPo + * Purpose: This function retrieves the ue which has sent this raReq + * and it allocates grant for UEs undergoing (for which RAR + * is being generated) HandOver/PdcchOrder. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] CmLListCp *raRspLst + * @param[in] RgSchRaReqInfo *raReq + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnHdlHoPo +( +RgSchCellCb *cell, +CmLListCp *raRspLst, +RgSchRaReqInfo *raReq +) +#else +PRIVATE Void rgSCHCmnHdlHoPo(cell, raRspLst, raReq) +RgSchCellCb *cell; +CmLListCp *raRspLst; +RgSchRaReqInfo *raReq; +#endif +{ + RgSchUeCb *ue = raReq->ue; + TRC2(rgSCHCmnHdlHoPo); + + if ( ue->isDrxEnabled ) + { + rgSCHDrxDedRa(cell,ue); + } + rgSCHCmnAllocPoHoGrnt(cell, raRspLst, ue, raReq); + RETVOID; +} + +/** + * @brief This function retrieves the UE which has sent this raReq + * for handover case. + * + * + * @details + * + * Function: rgSCHCmnGetHoUe + * Purpose: This function retrieves the UE which has sent this raReq + * for handover case. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchRaReqInfo *raReq + * @return RgSchUeCb* + * + **/ +#ifdef ANSI +PUBLIC RgSchUeCb* rgSCHCmnGetHoUe +( +RgSchCellCb *cell, +U16 rapId +) +#else +PUBLIC RgSchUeCb* rgSCHCmnGetHoUe(cell, rapId) +RgSchCellCb *cell; +U16 rapId +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + CmLList *node; + CmLListCp *ueLst; + RgSchUeCb *ue; + RgSchCmnDlUe *ueDl; + TRC2(rgSCHCmnGetHoUe); + + ueLst = &cellSch->rachCfg.hoUeLst; + node = ueLst->first; + while (node) + { + ue = (RgSchUeCb *)node->node; + node = node->next; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + if (ueDl->rachInfo.hoRapId == rapId) + { + RETVALUE(ue); + } + } + RETVALUE(NULLP); +} + +#ifdef ANSI +PRIVATE Void rgSCHCmnDelDedPreamble +( +RgSchCellCb *cell, +U8 preambleId +) +#else +PRIVATE rgSCHCmnDelDedPreamble(cell, preambleId) +RgSchCellCb *cell; +U8 preambleId; +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + CmLList *node; + CmLListCp *ueLst; + RgSchUeCb *ue; + RgSchCmnDlUe *ueDl; + TRC2(rgSCHCmnDelDedPreamble); + + ueLst = &cellSch->rachCfg.hoUeLst; + node = ueLst->first; + while (node) + { + ue = (RgSchUeCb *)node->node; + node = node->next; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + if (ueDl->rachInfo.hoRapId == preambleId) + { + cmLListDelFrm(ueLst, &ueDl->rachInfo.hoLnk); + ueDl->rachInfo.hoLnk.node = (PTR)NULLP; + } + } +} + +/** + * @brief This function retrieves the UE which has sent this raReq + * for PDCCh Order case. + * + * + * @details + * + * Function: rgSCHCmnGetPoUe + * Purpose: This function retrieves the UE which has sent this raReq + * for PDCCH Order case. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchRaReqInfo *raReq + * @return RgSchUeCb* + * + **/ +#ifdef ANSI +PUBLIC RgSchUeCb* rgSCHCmnGetPoUe +( +RgSchCellCb *cell, +U16 rapId, +CmLteTimingInfo timingInfo +) +#else +PUBLIC RgSchUeCb* rgSCHCmnGetPoUe(cell, rapId, timingInfo) +RgSchCellCb *cell; +U16 rapId; +CmLteTimingInfo timingInfo; +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + CmLList *node; + CmLListCp *ueLst; + RgSchUeCb *ue; + RgSchCmnDlUe *ueDl; + U8 rapIdIdx; + TRC2(rgSCHCmnGetPoUe); + + rapIdIdx = rapId -cellSch->rachCfg.dedPrmStart; + ueLst = &cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes; + node = ueLst->first; + while (node) + { + ue = (RgSchUeCb *)node->node; + node = node->next; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + /* Remove UEs irrespective. + * Old UE associations are removed.*/ + cmLListDelFrm(ueLst, &ueDl->rachInfo.rapIdLnk); + ueDl->rachInfo.rapIdLnk.node = (PTR)NULLP; + if (RGSCH_TIMEINFO_SAME(ueDl->rachInfo.asgnOppr, timingInfo)) + { + RETVALUE(ue); + } + } + + RETVALUE(NULLP); +} + + +/** + * @brief This function returns the valid UL cqi for a given UE. + * + * @details + * + * Function: rgSCHCmnUlGetCqi + * Purpose: This function returns the "valid UL cqi" for a given UE + * based on UE category + * + * Invoked by: Scheduler + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 ueCtgy + * @return U8 + **/ +#ifdef ANSI +PUBLIC U8 rgSCHCmnUlGetCqi +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteUeCategory ueCtgy +) +#else +PUBLIC U8 rgSCHCmnUlGetCqi(cell, ue, ueCtgy) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteUeCategory ueCtgy; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + U8 cqi; + + TRC2(rgSCHCmnUlGetCqi); + + cqi = ueUl->maxUlCqi; +#ifdef TFU_UPGRADE + if (!((ueCtgy != CM_LTE_UE_CAT_5) && + (ueUl->validUlCqi > ueUl->maxUlCqi))) + { + cqi = ueUl->validUlCqi; + } +#else + if (!((ueCtgy != CM_LTE_UE_CAT_5) && + (ueUl->crntUlCqi[0] > ueUl->maxUlCqi ))) + { + cqi = ueUl->crntUlCqi[0]; + } +#endif + RETVALUE(cqi); +}/* End of rgSCHCmnUlGetCqi */ + +/*********************************************************** + * + * Func : rgSCHCmnUlRbAllocForPoHoUe + * + * Desc : Do uplink RB allocation for a HO/PO UE. + * + * Ret : + * + * Notes: Note that as of now, for retx, maxRb + * is not considered. Alternatives, such + * as dropping retx if it crosses maxRb + * could be considered. + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe +( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUeCb *ue, +U8 maxRb +) +#else +PRIVATE S16 rgSCHCmnUlRbAllocForPoHoUe(cell, sf, ue, maxRb) +RgSchCellCb *cell; +RgSchUlSf *sf; +RgSchUeCb *ue; +U8 maxRb; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + U8 sbSize = cellUl->sbSize; + U32 maxBits = ue->ul.maxBytesPerUePerTti*8; + U32 bits; + RgSchUlAlloc *alloc; + U32 nPrb; + U8 iTbs; + U32 eff; + U32 numSb; + U8 iMcs; + U8 iMcsCrnt; + U8 cqi; + U8 modOdr; + RgSchUlHole *hole; + RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->msg3SchdHqProcIdx]; + CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue)); + + TRC2(rgSCHCmnUlRbAllocForPoHoUe); + if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) + { + RETVALUE(RFAILED); + } + /*MS_WORKAROUND for HO ccpu00121116*/ + cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend], cqi); + iTbs = rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend][cqi]; + iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg); + while(iMcs > RG_SCH_CMN_MAX_MSG3_IMCS) + { + cqi--; + iTbs = rgSchCmnUlCqiToTbsTbl[(U8)cell->isCpUlExtend][cqi]; + iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs, ueCtg); + } + /* Filling the modorder in the grant structure*/ + RG_SCH_UL_MCS_TO_MODODR(iMcs,modOdr); + if (!cell->isCpUlExtend) + { + eff = rgSchCmnNorUlEff[0][iTbs]; + } + else + { + eff = rgSchCmnExtUlEff[0][iTbs]; + } + + bits = ueUl->alloc.reqBytes * 8; + +#if (ERRCLASS & ERRCLS_DEBUG) + if (!bits) + { + RETVALUE(RFAILED); + } +#endif + + if (bits < rgSCHCmnUlMinTbBitsForITbs(cellUl, iTbs)) + { + numSb = 1; + nPrb = numSb * sbSize; + } + else + { + if (bits > maxBits) + { + bits = maxBits; + nPrb = bits * 1024 / eff / RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl); + if (nPrb > maxRb) + { + nPrb = maxRb; + } + numSb = nPrb / sbSize; + } + else + { + /*ccpu00128775:MOD-Change to get upper threshold nPrb*/ + nPrb = RGSCH_CEIL((RGSCH_CEIL(bits * 1024, eff)), + RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl)); + if (nPrb > maxRb) + { + nPrb = maxRb; + } + numSb = RGSCH_DIV_ROUND(nPrb, sbSize); + } + } + iMcsCrnt = iMcs; + + alloc = rgSCHCmnUlSbAlloc(sf, (U8)RGSCH_MIN(numSb, cellUl->maxSbPerUe),\ + hole); + if (alloc == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnUlRbAllocForPoHoUe(): Could not get UlAlloc"); + RETVALUE(RFAILED); + } + rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); + + /* Filling the modorder in the grant structure start*/ + alloc->grnt.modOdr = (TfuModScheme) modOdr; + alloc->grnt.iMcs = iMcs; + alloc->grnt.iMcsCrnt = iMcsCrnt; + alloc->grnt.hop = 0; + /* Fix for ccpu00123915*/ + alloc->forMsg3 = TRUE; + alloc->hqProc = proc; + alloc->hqProc->ulSfIdx = cellUl->msg3SchdIdx; + alloc->ue = ue; + alloc->rnti = ue->ueId; + /* updating initNumRbs in case of HO */ +#ifdef TFU_UPGRADE + ue->initNumRbs = alloc->grnt.numRb; +#endif + ueUl->alloc.alloc = alloc; + iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs); + alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8; + /* MS_WORKAROUND for HO ccpu00121124*/ + /*[Adi temp change] Need to fil modOdr */ + RG_SCH_UL_MCS_TO_MODODR(alloc->grnt.iMcsCrnt,alloc->grnt.modOdr); + rgSCHUhmNewTx(proc, ueUl->hqEnt.maxHqRetx, alloc); + /* No grant attr recorded now */ + RETVALUE(ROK); +} + +/** + * @brief This function allocates grant for UEs undergoing (for which RAR + * is being generated) HandOver/PdcchOrder. + * + * + * @details + * + * Function: rgSCHCmnAllocPoHoGrnt + * Purpose: This function allocates grant for UEs undergoing (for which RAR + * is being generated) HandOver/PdcchOrder. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[out] CmLListCp *raRspLst, + * @param[in] RgSchUeCb *ue + * @param[in] RgSchRaReqInfo *raReq + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnAllocPoHoGrnt +( +RgSchCellCb *cell, +CmLListCp *raRspLst, +RgSchUeCb *ue, +RgSchRaReqInfo *raReq +) +#else +PRIVATE Void rgSCHCmnAllocPoHoGrnt(cell, raRspLst, ue, raReq) +RgSchCellCb *cell; +CmLListCp *raRspLst; +RgSchUeCb *ue; +RgSchRaReqInfo *raReq; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + RgSchUlGrnt *grnt; + RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx]; + + TRC2(rgSCHCmnAllocPoHoGrnt); + + /* Clearing previous allocs if any*/ + rgSCHCmnUlUeDelAllocs(cell, ue); + /* Fix : syed allocs are limited */ + if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf) + { + RETVOID; + } + ueUl->alloc.reqBytes = RG_SCH_MIN_GRNT_HOPO; + if (rgSCHCmnUlRbAllocForPoHoUe(cell, sf, ue, RGSCH_MAX_UL_RB) != ROK) + { + RETVOID; + } + + /* Fill grant information */ + grnt = &ueUl->alloc.alloc->grnt; + + /* KWork fix */ + if (grnt == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_INSTID,cell->instIdx, "Failed to get" + "the grant for HO/PDCCH Order. CRNTI:%d",ue->ueId); + RETVOID; + } + ue->ul.rarGrnt.rapId = raReq->raReq.rapId; + ue->ul.rarGrnt.hop = grnt->hop; + ue->ul.rarGrnt.rbStart = grnt->rbStart; + ue->ul.rarGrnt.numRb = grnt->numRb; + ue->ul.rarGrnt.tpc = grnt->tpc; + ue->ul.rarGrnt.iMcsCrnt = grnt->iMcsCrnt; + ue->ul.rarGrnt.ta.pres = TRUE; + ue->ul.rarGrnt.ta.val = raReq->raReq.ta; + ue->ul.rarGrnt.datSz = grnt->datSz; + if((sf->numACqiCount < RG_SCH_MAX_ACQI_PER_ULSF) && (RG_SCH_APCQI_NO != ue->dl.reqForCqi)) + { +#ifdef LTE_ADV + U8 idx = 0; + /* Send two bits cqireq field if more than one cells are configured else one*/ + for (idx = 1;idx < CM_LTE_MAX_CELLS;idx++) + { + if (ue->cellInfo[idx] != NULLP) + { + ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi; + break; + } + } + if (idx == CM_LTE_MAX_CELLS) +#endif + { + ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi; + } + ue->dl.reqForCqi = RG_SCH_APCQI_NO; + sf->numACqiCount++; + } + else + { + ue->ul.rarGrnt.cqiReqBit = 0; + } + /* Attach Ho/Po allocation to RAR Rsp cont free Lst */ + cmLListAdd2Tail(raRspLst, &ue->ul.rarGrnt.raRspLnk); + ue->ul.rarGrnt.raRspLnk.node = (PTR)ue; + + RETVOID; +} + +/** + * @brief This is a utility function to set the fields in + * an UL harq proc which is identified for non-adaptive retx + * + * @details + * + * Function: rgSCHCmnUlNonadapRetx + * Purpose: Sets the fields in UL Harq proc for non-adaptive retx + * + * @param[in] RgSchCmnUlCell *cellUl + * @param[out] RgSchUlAlloc *alloc + * @param[in] U8 idx + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlNonadapRetx +( +RgSchCmnUlCell *cellUl, +RgSchUlAlloc *alloc, +U8 idx +) +#else +PRIVATE Void rgSCHCmnUlNonadapRetx(cellUl, alloc, idx) +RgSchCmnUlCell *cellUl; +RgSchUlAlloc *alloc; +U8 idx; +#endif +{ + TRC2(rgSCHCmnUlNonadapRetx); + rgSCHUhmRetx(alloc->hqProc, alloc); + + /* Update alloc to retx */ + alloc->hqProc->isRetx = TRUE; + alloc->hqProc->ulSfIdx = cellUl->reTxIdx[idx]; + + if (alloc->hqProc->rvIdx != 0) + { + alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[alloc->hqProc->rvIdx]; + } + else + { + alloc->grnt.iMcsCrnt = alloc->grnt.iMcs; + } + alloc->grnt.isRtx = TRUE; + alloc->pdcch = NULLP; + RETVOID; +} + +/** + * @brief Check if 2 allocs overlap + * + * @details + * + * Function : rgSCHCmnUlAllocsOvrLap + * + * - Return TRUE if alloc1 and alloc2 overlap. + * + * @param[in] RgSchUlAlloc *alloc1 + * @param[in] RgSchUlAlloc *alloc2 + * @return Bool + **/ +#ifdef ANSI +PRIVATE Bool rgSCHCmnUlAllocsOvrLap +( +RgSchUlAlloc *alloc1, +RgSchUlAlloc *alloc2 +) +#else +PRIVATE Bool rgSCHCmnUlAllocsOvrLap(alloc1, alloc2) +RgSchUlAlloc *alloc1; +RgSchUlAlloc *alloc2; +#endif +{ + + TRC2(rgSCHCmnUlAllocsOvrLap); + + if (((alloc1->sbStart >= alloc2->sbStart) && + (alloc1->sbStart <= alloc2->sbStart + alloc2->numSb-1)) || + ((alloc2->sbStart >= alloc1->sbStart) && + (alloc2->sbStart <= alloc1->sbStart + alloc1->numSb-1))) + { + RETVALUE(TRUE); + } + RETVALUE(FALSE); +} + +/** + * @brief Copy allocation Info from src to dst. + * + * @details + * + * Function : rgSCHCmnUlCpyAllocInfo + * + * - Copy allocation Info from src to dst. + * + * @param[in] RgSchUlAlloc *srcAlloc + * @param[in] RgSchUlAlloc *dstAlloc + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlCpyAllocInfo +( +RgSchCellCb *cell, +RgSchUlAlloc *srcAlloc, +RgSchUlAlloc *dstAlloc +) +#else +PRIVATE Void rgSCHCmnUlCpyAllocInfo(cell, srcAlloc, dstAlloc) +RgSchCellCb *cell; +RgSchUlAlloc *srcAlloc; +RgSchUlAlloc *dstAlloc; +#endif +{ + RgSchCmnUlUe *ueUl; + TRC2(rgSCHCmnUlCpyAllocInfo); + + dstAlloc->grnt = srcAlloc->grnt; + dstAlloc->hqProc = srcAlloc->hqProc; + /* Fix : syed During UE context release, hqProc->alloc + * was pointing to srcAlloc instead of dstAlloc and + * freeing from incorrect sf->allocDb was + * corrupting the list. */ + /* In case of SPS Occasion Allocation is done in advance and + at a later time Hq Proc is linked. Hence HqProc + pointer in alloc shall be NULL */ +#ifdef LTEMAC_SPS + if (dstAlloc->hqProc) +#endif + { + dstAlloc->hqProc->alloc = dstAlloc; + } + dstAlloc->ue = srcAlloc->ue; + dstAlloc->rnti = srcAlloc->rnti; + dstAlloc->forMsg3 = srcAlloc->forMsg3; + dstAlloc->raCb = srcAlloc->raCb; + dstAlloc->pdcch = srcAlloc->pdcch; + /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ + if (dstAlloc->ue) + { + ueUl = RG_SCH_CMN_GET_UL_UE(dstAlloc->ue,cell); + ueUl->alloc.alloc = dstAlloc; +#ifdef LTEMAC_SPS + if (dstAlloc->ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + if((dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc != NULLP) + && (dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc == srcAlloc)) + { + dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc = dstAlloc; + } + } +#endif + } + + RETVOID; +} + + +/** + * @brief Update TX and RETX subframe's allocation + * markings. + * + * @details + * + * Function : rgSCHCmnUlInsAllocFrmNewSf2OldSf + * + * - Release all preassigned allocations of newSf and merge + * them to oldSf. + * - If alloc of newSf collide with one or more allocs of oldSf + * - mark all such allocs of oldSf for Adaptive Retx. + * - Swap the alloc and hole DB references of oldSf and newSf. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *newSf + * @param[in] RgSchUlSf *oldSf + * @param[in] RgSchUlAlloc *srcAlloc + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlInsAllocFrmNewSf2OldSf +( +RgSchCellCb *cell, +RgSchUlSf *newSf, +RgSchUlSf *oldSf, +RgSchUlAlloc *srcAlloc +) +#else +PRIVATE Void rgSCHCmnUlInsAllocFrmNewSf2OldSf(cell, newSf, oldSf, srcAlloc) +RgSchCellCb *cell; +RgSchUlSf *newSf; +RgSchUlSf *oldSf; +RgSchUlAlloc *srcAlloc; +#endif +{ + RgSchUlAlloc *alloc, *dstAlloc, *nxtAlloc; + + /* MS_WORKAROUND ccpu00120827 */ + RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); + U8 remAllocs; + TRC2(rgSCHCmnUlInsAllocFrmNewSf2OldSf); + + if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP) + { + do + { + nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc); + /* If there is an overlap between alloc and srcAlloc + * then alloc is marked for Adaptive retx and it is released + * from txSf */ + if (rgSCHCmnUlAllocsOvrLap(alloc, srcAlloc) == TRUE) + { + rgSCHCmnUlUpdAllocRetx(cell, alloc); + rgSCHUtlUlAllocRls(oldSf, alloc); + } + /* No further allocs spanning the srcAlloc subbands */ + if (srcAlloc->sbStart + srcAlloc->numSb - 1 <= alloc->sbStart) + { + break; + } + } while ((alloc = nxtAlloc) != NULLP); + } + + /* After freeing all the colliding allocs, request for an allocation + * specifying the start and numSb with in txSf. This function should + * always return positively with a nonNULL dstAlloc */ + /* MS_WORKAROUND ccpu00120827 */ + remAllocs = schCmnCell->ul.maxAllocPerUlSf - *oldSf->allocCountRef; + if (!remAllocs) + { + /* Fix : If oldSf already has max Allocs then release the + * old RETX alloc to make space for new alloc of newSf. + * newSf allocs(i.e new Msg3s) are given higher priority + * over retx allocs. */ + if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP) + { + do + { + nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc); + if (!alloc->mrgdNewTxAlloc) + { + /* If alloc is for RETX */ + /* TODO: Incase of this ad also in case of choosing + * and alloc for ADAP RETX, we need to send ACK for + * the corresponding alloc in PHICH */ +#ifndef EMTC_ENABLE + rgSCHCmnUlFreeAllocation(cell, oldSf, alloc); +#else + rgSCHCmnUlFreeAllocation(cell, oldSf, alloc,FALSE); +#endif + break; + } + }while((alloc = nxtAlloc) != NULLP); + } + } + dstAlloc = rgSCHUtlUlGetSpfcAlloc(oldSf, srcAlloc->sbStart, srcAlloc->numSb); +#ifdef ERRCLS_KW + /* This should never happen */ + if (dstAlloc == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d " + "rgSCHUtlUlGetSpfcAlloc failed in rgSCHCmnUlInsAllocFrmNewSf2OldSf", + srcAlloc->rnti); + RETVOID; + } +#endif + /* Copy the srcAlloc's state information in to dstAlloc */ + rgSCHCmnUlCpyAllocInfo(cell, srcAlloc, dstAlloc); + /* Set new Tx merged Alloc Flag to TRUE, indicating that this + * alloc shall not be processed for non-adaptive retransmission */ + dstAlloc->mrgdNewTxAlloc = TRUE; + RETVOID; +} + +/** + * @brief Merge all allocations of newSf to oldSf. + * + * @details + * + * Function : rgSCHCmnUlMergeSfAllocs + * + * - Merge all allocations of newSf to oldSf. + * - If newSf's alloc collides with oldSf's alloc + * then oldSf's alloc is marked for adaptive Retx + * and is released from oldSf to create space for + * newSf's alloc. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *oldSf + * @param[in] RgSchUlSf *newSf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlMergeSfAllocs +( +RgSchCellCb *cell, +RgSchUlSf *oldSf, +RgSchUlSf *newSf +) +#else +PRIVATE Void rgSCHCmnUlMergeSfAllocs(cell, oldSf, newSf) +RgSchCellCb *cell; +RgSchUlSf *oldSf; +RgSchUlSf *newSf; +#endif +{ + RgSchUlAlloc *alloc, *nxtAlloc; + TRC2(rgSCHCmnUlMergeSfAllocs); + UNUSED(cell); + + /* Merge each alloc of newSf in to oldSf + * and release it from newSf */ + if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP) + { + do + { + nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc); + rgSCHCmnUlInsAllocFrmNewSf2OldSf(cell, newSf, oldSf, alloc); + rgSCHUtlUlAllocRls(newSf, alloc); + } while((alloc = nxtAlloc) != NULLP); + } + RETVOID; +} + +/** + * @brief Swap Hole/Alloc DB context of newSf and oldSf. + * + * @details + * + * Function : rgSCHCmnUlSwapSfAllocs + * + * - Swap Hole/Alloc DB context of newSf and oldSf. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *oldSf + * @param[in] RgSchUlSf *newSf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlSwapSfAllocs +( +RgSchCellCb *cell, +RgSchUlSf *oldSf, +RgSchUlSf *newSf +) +#else +PRIVATE Void rgSCHCmnUlSwapSfAllocs(cell, oldSf, newSf) +RgSchCellCb *cell; +RgSchUlSf *oldSf; +RgSchUlSf *newSf; +#endif +{ + RgSchUlAllocDb *tempAllocDb = newSf->allocDb; + RgSchUlHoleDb *tempHoleDb = newSf->holeDb; + U8 tempAvailSbs = newSf->availSubbands; + + TRC2(rgSCHCmnUlSwapSfAllocs); + UNUSED(cell); + + newSf->allocDb = oldSf->allocDb; + newSf->holeDb = oldSf->holeDb; + newSf->availSubbands = oldSf->availSubbands; + + oldSf->allocDb = tempAllocDb; + oldSf->holeDb = tempHoleDb; + oldSf->availSubbands = tempAvailSbs; + + /* Fix ccpu00120610*/ + newSf->allocCountRef = &newSf->allocDb->count; + oldSf->allocCountRef = &oldSf->allocDb->count; + RETVOID; +} + +/** + * @brief Perform non-adaptive RETX for non-colliding allocs. + * + * @details + * + * Function : rgSCHCmnUlPrcNonAdptRetx + * + * - Perform non-adaptive RETX for non-colliding allocs. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *newSf + * @param[in] U8 idx + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlPrcNonAdptRetx +( +RgSchCellCb *cell, +RgSchUlSf *newSf, +U8 idx +) +#else +PRIVATE Void rgSCHCmnUlPrcNonAdptRetx(cell, newSf, idx) +RgSchCellCb *cell; +RgSchUlSf *newSf; +U8 idx; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchUlAlloc *alloc, *nxtAlloc; + TRC2(rgSCHCmnUlPrcNonAdptRetx); + + /* perform non-adaptive retx allocation(adjustment) */ + if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP) + { + do + { + nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc); + /* A merged new TX alloc, reset the state and skip */ + if (alloc->mrgdNewTxAlloc) + { + alloc->mrgdNewTxAlloc = FALSE; + continue; + } + + + rgSCHCmnUlNonadapRetx(cellUl, alloc, idx); + + } while((alloc = nxtAlloc) != NULLP); + } + RETVOID; +} + +/** + * @brief Update TX and RETX subframe's allocation + * markings. + * + * @details + * + * Function : rgSCHCmnUlPrfmSfMerge + * + * - Release all preassigned allocations of newSf and merge + * them to oldSf. + * - If alloc of newSf collide with one or more allocs of oldSf + * - mark all such allocs of oldSf for Adaptive Retx. + * - Swap the alloc and hole DB references of oldSf and newSf. + * - The allocs which did not collide with pre-assigned msg3 + * allocs are marked for non-adaptive RETX. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *oldSf + * @param[in] RgSchUlSf *newSf + * @param[in] U8 idx + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlPrfmSfMerge +( +RgSchCellCb *cell, +RgSchUlSf *oldSf, +RgSchUlSf *newSf, +U8 idx +) +#else +PRIVATE Void rgSCHCmnUlPrfmSfMerge(cell, oldSf, newSf, idx) +RgSchCellCb *cell; +RgSchUlSf *oldSf; +RgSchUlSf *newSf; +U8 idx; +#endif +{ + TRC2(rgSCHCmnUlPrfmSfMerge); + /* Preassigned resources for msg3 in newSf. + * Hence do adaptive retx for all NACKED TXs */ + rgSCHCmnUlMergeSfAllocs(cell, oldSf, newSf); + /* swap alloc and hole DBs of oldSf and newSf. */ + rgSCHCmnUlSwapSfAllocs(cell, oldSf, newSf); + /* Here newSf has the resultant merged allocs context */ + /* Perform non-adaptive RETX for non-colliding allocs */ + rgSCHCmnUlPrcNonAdptRetx(cell, newSf, idx); + + RETVOID; +} + +/** + * @brief Update TX and RETX subframe's allocation + * markings. + * + * @details + * + * Function : rgSCHCmnUlRmvCmpltdAllocs + * + * - Free all Transmission which are ACKED + * OR for which MAX retransmission have + * occurred. + * + * + * @param[in] RgSchCellCb *cell, + * @param[in] RgSchUlSf *sf + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlRmvCmpltdAllocs +( +RgSchCellCb *cell, +RgSchUlSf *sf +) +#else +PRIVATE Void rgSCHCmnUlRmvCmpltdAllocs(cell, sf) +RgSchCellCb *cell; +RgSchUlSf *sf; +#endif +{ + RgSchUlAlloc *alloc, *nxtAlloc; + TRC2(rgSCHCmnUlRmvCmpltdAllocs); + + if ((alloc = rgSCHUtlUlAllocFirst(sf)) == NULLP) + { + RETVOID; + } + do + { + nxtAlloc = rgSCHUtlUlAllocNxt(sf, alloc); +#ifdef UL_ADPT_DBG + printf("rgSCHCmnUlRmvCmpltdAllocs:time(%d %d) alloc->hqProc->remTx %d hqProcId(%d) \n",cell->crntTime.sfn,cell->crntTime.subframe,alloc->hqProc->remTx, alloc->grnt.hqProcId); +#endif + alloc->hqProc->rcvdCrcInd = TRUE; + if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0)) + { + + /* SR_RACH_STATS : MSG 3 MAX RETX FAIL*/ + if ((alloc->forMsg3 == TRUE) && (alloc->hqProc->remTx == 0)) + { + rgNumMsg3FailMaxRetx++; +#ifdef TENB_STATS + cell->tenbStats->sch.msg3Fail++; +#endif + } + +#ifdef MAC_SCH_STATS + if(alloc->ue != NULLP) + { + /* access from ulHarqProc*/ + RgSchUeCb *ueCb = alloc->ue; + RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch; + RgSchCmnUlUe *ulUe = &(cmnUe->ul); + U8 cqi = ulUe->crntUlCqi[0]; + U16 numUlRetx = ueCb->ul.hqEnt.maxHqRetx - alloc->hqProc->remTx; + + hqRetxStats.ulCqiStat[(cqi - 1)].mcs = alloc->grnt.iMcs; + + switch (numUlRetx) + { + case 1: + hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1++; + break; + case 2: + hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2++; + break; + case 3: + hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3++; + break; + case 4: + hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4++; + break; + } + hqRetxStats.ulCqiStat[(cqi - 1)].totalTx = \ + hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1 + \ + (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2 * 2) + \ + (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3 * 3) + \ + (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4 * 4); + } + +#endif /*MAC_SCH_STATS*/ + rgSCHCmnUlFreeAllocation(cell, sf, alloc); + } + /*ccpu00106104 MOD added check for AckNackRep */ + /*added check for acknack so that adaptive retx considers ue + inactivity due to ack nack repetition*/ + else if((alloc->ue != NULLP) && (TRUE != alloc->forMsg3)) + { + rgSCHCmnUlUpdAllocRetx(cell, alloc); + rgSCHUtlUlAllocRls(sf, alloc); + } + } while ((alloc = nxtAlloc) != NULLP); + + RETVOID; +} + +/** + * @brief Update an uplink subframe. + * + * @details + * + * Function : rgSCHCmnRlsUlSf + * + * For each allocation + * - if no more tx needed + * - Release allocation + * - else + * - Perform retransmission + * + * @param[in] RgSchUlSf *sf + * @param[in] U8 idx + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnRlsUlSf +( +RgSchCellCb *cell, +U8 idx +) +#else +PUBLIC Void rgSCHCmnRlsUlSf(cell, idx) +RgSchCellCb *cell; +U8 idx; +#endif +{ + TRC2(rgSCHCmnRlsUlSf); + + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + + if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) + { + RgSchUlSf *oldSf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]]; + + /* Initialize the reTxLst of UL HqProcs for RETX subframe */ + if (rgSCHUtlUlAllocFirst(oldSf) == NULLP) + { + RETVOID; + } + /* Release all completed TX allocs from sf */ + rgSCHCmnUlRmvCmpltdAllocs(cell, oldSf); + + oldSf->numACqiCount = 0; + } + RETVOID; +} + +/** + * @brief Handle uplink allocation for retransmission. + * + * @details + * + * Function : rgSCHCmnUlUpdAllocRetx + * + * - Perform adaptive retransmission + * + * @param[in] RgSchUlSf *sf + * @param[in] RgSchUlAlloc *alloc + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlUpdAllocRetx +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc +) +#else +PRIVATE Void rgSCHCmnUlUpdAllocRetx(cell, alloc) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +#endif +{ + RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); + + TRC2(rgSCHCmnUlUpdAllocRetx); + + alloc->hqProc->reTxAlloc.rnti = alloc->rnti; + alloc->hqProc->reTxAlloc.numSb = alloc->numSb; + alloc->hqProc->reTxAlloc.iMcs = alloc->grnt.iMcs; +#ifdef RG_5GTF + alloc->hqProc->reTxAlloc.dciFrmt = alloc->grnt.dciFrmt; + alloc->hqProc->reTxAlloc.numLyr = alloc->grnt.numLyr; + alloc->hqProc->reTxAlloc.vrbgStart = alloc->grnt.vrbgStart; + alloc->hqProc->reTxAlloc.numVrbg = alloc->grnt.numVrbg; + alloc->hqProc->reTxAlloc.modOdr = alloc->grnt.modOdr; +#endif + //iTbs = rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); + //iTbs = alloc->grnt.iMcs; + //RGSCH_ARRAY_BOUND_CHECK( 0, rgTbSzTbl[0], iTbs); + alloc->hqProc->reTxAlloc.tbSz = alloc->grnt.datSz; + //rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1]/8; + alloc->hqProc->reTxAlloc.ue = alloc->ue; + alloc->hqProc->reTxAlloc.forMsg3 = alloc->forMsg3; + alloc->hqProc->reTxAlloc.raCb = alloc->raCb; + + /* Set as retransmission is pending */ + alloc->hqProc->isRetx = TRUE; + alloc->hqProc->alloc = NULLP; + alloc->hqProc->ulSfIdx = RGSCH_INVALID_INFO; +#ifdef UL_ADPT_DBG + printf("Adding Harq Proc Id in the retx list hqProcId %d \n",alloc->grnt.hqProcId); +#endif + cmLListAdd2Tail(&cmnUlCell->reTxLst, &alloc->hqProc->reTxLnk); + alloc->hqProc->reTxLnk.node = (PTR)alloc->hqProc; + RETVOID; +} + +/** + * @brief Attempts allocation for msg3s for which ADAP retransmissions + * are required. + * + * @details + * + * Function : rgSCHCmnUlAdapRetxAlloc + * + * Attempts allocation for msg3s for which ADAP retransmissions + * are required. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *sf + * @param[in] RgSchUlHqProcCb *proc; + * @param[in] RgSchUlHole *hole; + * @return U8 + **/ +#ifdef ANSI +PRIVATE Bool rgSCHCmnUlAdapRetxAlloc +( +RgSchCellCb *cell, +RgSchUlSf *sf, +RgSchUlHqProcCb *proc, +RgSchUlHole *hole +) +#else +PRIVATE Bool rgSCHCmnUlAdapRetxAlloc(cell, sf, proc, hole) +RgSchCellCb *cell; +RgSchUlSf *sf; +RgSchUlHqProcCb *proc; +RgSchUlHole *hole; +#endif +{ + U8 numSb = proc->reTxAlloc.numSb; + U8 iMcs = proc->reTxAlloc.iMcs; + CmLteTimingInfo frm = cell->crntTime; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchDlSf *dlSf; + RgSchPdcch *pdcch; + RgSchUlAlloc *alloc; + TRC2(rgSCHCmnUlAdapRetxAlloc); + + /* Fetch PDCCH for msg3 */ + /* ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ + /* Introduced timing delta for UL control */ + RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA); + dlSf = rgSCHUtlSubFrmGet(cell, frm); + pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); + if (pdcch == NULLP) + { + RETVALUE(FALSE); + } + + /* Fetch UL Alloc for msg3 */ + if (numSb <= hole->num) + { + alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole); + + /* KWork fix */ + if(alloc == NULLP) + { + rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch); + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "UL Alloc fail for msg3 retx for rnti: %d\n", + proc->reTxAlloc.rnti); + RETVALUE(FALSE); + } + + rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc); + alloc->grnt.iMcs = iMcs; + alloc->grnt.datSz = proc->reTxAlloc.tbSz; +#ifdef RG_5GTF +#else + //RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr); +#endif + /* Fill UL Alloc for msg3 */ + /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/ + alloc->grnt.nDmrs = 0; + alloc->grnt.hop = 0; + alloc->grnt.delayBit = 0; + alloc->grnt.isRtx = TRUE; + proc->ulSfIdx = cellUl->schdIdx; +#ifdef RG_5GTF + proc->schdTime = cellUl->schdTime; + alloc->grnt.hqProcId = proc->procId; + alloc->grnt.dciFrmt = proc->reTxAlloc.dciFrmt; + alloc->grnt.numLyr = proc->reTxAlloc.numLyr; + alloc->grnt.vrbgStart = proc->reTxAlloc.vrbgStart; + alloc->grnt.numVrbg = proc->reTxAlloc.numVrbg; + alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg); + alloc->grnt.modOdr = proc->reTxAlloc.modOdr; + + /* TODO : Hardcoding these as of now */ + alloc->grnt.hop = 0; + alloc->grnt.SCID = 0; + alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE; + alloc->grnt.PMI = 0; + alloc->grnt.uciOnxPUSCH = 0; +#endif + alloc->rnti = proc->reTxAlloc.rnti; + /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ + alloc->ue = proc->reTxAlloc.ue; + alloc->pdcch = pdcch; + alloc->forMsg3 = proc->reTxAlloc.forMsg3; + alloc->raCb = proc->reTxAlloc.raCb; + alloc->hqProc = proc; + alloc->isAdaptive = TRUE; +#ifdef LTE_L2_MEAS + sf->totPrb += alloc->grnt.numRb; +#endif + /* FIX : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */ + if (alloc->raCb) + { + alloc->raCb->msg3Grnt= alloc->grnt; +#ifndef LTE_TDD + /* To the crntTime, add the time at which UE will + * actually send MSG3 */ + alloc->raCb->msg3AllocTime = cell->crntTime; + RGSCH_INCR_SUB_FRAME(alloc->raCb->msg3AllocTime, RG_SCH_CMN_MIN_RETXMSG3_RECP_INTRVL); +#else + alloc->raCb->msg3AllocTime = cellUl->schdTime; +#endif + rgSCHCmnUlAdapRetx(alloc, proc); + /* Fill PDCCH with alloc info */ + pdcch->rnti = alloc->rnti; + pdcch->dci.dciFormat = TFU_DCI_FORMAT_0; + pdcch->dci.u.format0Info.hoppingEnbld = alloc->grnt.hop; + pdcch->dci.u.format0Info.rbStart = alloc->grnt.rbStart; + pdcch->dci.u.format0Info.numRb = alloc->grnt.numRb; + pdcch->dci.u.format0Info.mcs = alloc->grnt.iMcsCrnt; + pdcch->dci.u.format0Info.ndi = alloc->hqProc->ndi; + pdcch->dci.u.format0Info.nDmrs = alloc->grnt.nDmrs; + pdcch->dci.u.format0Info.tpcCmd = alloc->grnt.tpc; + +#ifdef LTE_TDD +#ifdef TFU_TDD + /* ulIdx setting for cfg 0 shall be appropriately fixed thru ccpu00109015 */ + pdcch->dci.u.format0Info.ulIdx = RG_SCH_ULIDX_MSB; + pdcch->dci.u.format0Info.dai = RG_SCH_MAX_DAI_IDX; +#endif +#endif + pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_0]; + } + else + { + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue,cell); +#ifdef TFU_UPGRADE + alloc->ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE); +#endif +#ifdef LTE_L2_MEAS + ue->ul.nPrb = alloc->grnt.numRb; +#endif + ueUl->alloc.alloc = alloc; + /* FIx: Removed the call to rgSCHCmnUlAdapRetx */ + rgSCHCmnUlUeFillAllocInfo(cell, alloc->ue); + /* Setting csireq as false for Adaptive Retx*/ + ueUl->alloc.alloc->pdcch->dci.u.format0Info.cqiReq = RG_SCH_APCQI_NO; + pdcch->dciNumOfBits = alloc->ue->dciSize.cmnSize[TFU_DCI_FORMAT_0]; + } + /* Reset as retransmission is done */ + proc->isRetx = FALSE; + } + else /* Intg fix */ + { + rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch); + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId, + "Num SB not suffiecient for adap retx for rnti: %d", + proc->reTxAlloc.rnti); + RETVALUE(FALSE); + } + RETVALUE(TRUE); +} + +/* Fix: syed Adaptive Msg3 Retx crash. */ +/** + * @brief Releases all Adaptive Retx HqProcs which failed for + * allocations in this scheduling occassion. + * + * @details + * + * Function : rgSCHCmnUlSfRlsRetxProcs + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *sf + * @return U8 + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlSfRlsRetxProcs +( +RgSchCellCb *cell, +RgSchUlSf *sf +) +#else +PRIVATE Void rgSCHCmnUlSfRlsRetxProcs(cell, sf) +RgSchCellCb *cell; +RgSchUlSf *sf; +#endif +{ + CmLListCp *cp; + CmLList *node; + RgSchUlHqProcCb *proc; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + + TRC2(rgSCHCmnUlSfRlsRetxProcs); + + cp = &(cellUl->reTxLst); + node = cp->first; + while (node) + { + proc = (RgSchUlHqProcCb *)node->node; + node = node->next; + /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */ + cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); + proc->reTxLnk.node = (PTR)NULLP; + } + RETVOID; +} + + +/** + * @brief Attempts allocation for UEs for which retransmissions + * are required. + * + * @details + * + * Function : rgSCHCmnUlSfReTxAllocs + * + * Attempts allocation for UEs for which retransmissions + * are required. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlSf *sf + * @return U8 + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnUlSfReTxAllocs +( +RgSchCellCb *cell, +RgSchUlSf *sf +) +#else +PRIVATE Void rgSCHCmnUlSfReTxAllocs(cell, sf) +RgSchCellCb *cell; +RgSchUlSf *sf; +#endif +{ + CmLListCp *cp; + CmLList *node; + RgSchUlHqProcCb *proc; + RgSchUlHole *hole; + RgSchUeCb *ue; + RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + TRC2(rgSCHCmnUlSfReTxAllocs); + + cp = &(cellUl->reTxLst); + node = cp->first; + while ((node)) + { + proc = (RgSchUlHqProcCb *)node->node; + ue = proc->reTxAlloc.ue; + node = node->next; + /*ccpu00106104 MOD added check for AckNackRep */ + /*added check for acknack so that adaptive retx considers ue + inactivity due to ack nack repetition*/ + if((ue != NULLP) && + ((ue->measGapCb.isMeasuring == TRUE)|| + (ue->ackNakRepCb.isAckNakRep == TRUE))) + { + continue; + } + /* Fix for ccpu00123917: Check if maximum allocs per UL sf have been exhausted */ + if (((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) + || (sf->allocDb->count == schCmnCell->ul.maxAllocPerUlSf)) + { + /* No more UL BW then return */ + break; + } + /* perform adaptive retx for UE's */ + if (rgSCHCmnUlAdapRetxAlloc(cell, sf, proc, hole) == FALSE) + { + continue; + } + /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */ + cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk); + /* Fix: syed Adaptive Msg3 Retx crash. */ + proc->reTxLnk.node = (PTR)NULLP; + } + RETVOID; +} + +/** + * @brief Handles RB allocation for downlink. + * + * @details + * + * Function : rgSCHCmnDlRbAlloc + * + * Invoking Module Processing: + * - This function is invoked for DL RB allocation + * + * Processing Steps: + * - If cell is frequency selecive, + * - Call rgSCHDlfsAllocRb(). + * - else, + * - Call rgSCHCmnNonDlfsRbAlloc(). + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlRbAllocInfo *allocInfo + * @return Void + **/ + +#ifdef ANSI +PRIVATE Void rgSCHCmnDlRbAlloc +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnDlRbAlloc(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + TRC2(rgSCHCmnDlRbAlloc); + + if (cellSch->dl.isDlFreqSel) + { + printf("5GTF_ERROR DLFS SCH Enabled\n"); + cellSch->apisDlfs->rgSCHDlfsAllocRb(cell, allocInfo); + } + else + { + rgSCHCmnNonDlfsRbAlloc(cell, allocInfo); + } + RETVOID; +} + +#ifdef LTEMAC_SPS + +/** + * @brief Determines number of RBGs and RBG subset sizes for the given DL + * bandwidth and rbgSize + * + * @details + * Function : rgSCHCmnDlGetRbgInfo + * + * + * Processing Steps: + * - Fill-up rbgInfo data structure for given DL bandwidth and rbgSize + * + * @param[in] U8 dlTotalBw + * @param[in] U8 dlSubsetBw + * @param[in] U8 maxRaType1SubsetBw + * @param[in] U8 rbgSize + * @param[out] RgSchBwRbgInfo *rbgInfo + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlGetRbgInfo +( +U8 dlTotalBw, +U8 dlSubsetBw, +U8 maxRaType1SubsetBw, +U8 rbgSize, +RgSchBwRbgInfo *rbgInfo +) +#else +PUBLIC Void rgSCHCmnDlGetRbgInfo(dlTotalBw, dlSubsetBw, maxRaType1SubsetBw, + rbgSize, rbgInfo) +U8 dlTotalBw; +U8 dlSubsetBw; +U8 maxRaType1SubsetBw; +U8 rbgSize; +RgSchBwRbgInfo *rbgInfo; +#endif +{ +#ifdef RGSCH_SPS_UNUSED + U8 idx = 0; + U8 lastRbgIdx = ((dlTotalBw + rbgSize - 1)/rbgSize) - 1; + U8 currRbgSize = rbgSize; + U8 subsetSizeIdx = 0; + U8 subsetSize[RG_SCH_NUM_RATYPE1_SUBSETS] = {0}; + U8 lastRbgSize = rbgSize - (dlTotalBw - ((dlTotalBw/rbgSize) * rbgSize)); + U8 numRaType1Rbgs = (maxRaType1SubsetBw + rbgSize - 1)/rbgSize; +#endif + + /* Compute maximum number of SPS RBGs for the cell */ + rbgInfo->numRbgs = ((dlSubsetBw + rbgSize - 1)/rbgSize); + +#ifdef RGSCH_SPS_UNUSED + /* Distribute RBGs across subsets except last RBG */ + for (;idx < numRaType1Rbgs - 1; ++idx) + { + subsetSize[subsetSizeIdx] += currRbgSize; + subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize; + } + + /* Computation for last RBG */ + if (idx == lastRbgIdx) + { + currRbgSize = lastRbgSize; + } + subsetSize[subsetSizeIdx] += currRbgSize; + subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize; +#endif + + /* Update the computed sizes */ +#ifdef RGSCH_SPS_UNUSED + rbgInfo->lastRbgSize = currRbgSize; +#endif + rbgInfo->lastRbgSize = rbgSize - + (dlSubsetBw - ((dlSubsetBw/rbgSize) * rbgSize)); +#ifdef RGSCH_SPS_UNUSED + cmMemcpy((U8 *)rbgInfo->rbgSubsetSize, (U8 *) subsetSize, 4 * sizeof(U8)); +#endif + rbgInfo->numRbs = (rbgInfo->numRbgs * rbgSize > dlTotalBw) ? + dlTotalBw:(rbgInfo->numRbgs * rbgSize); + rbgInfo->rbgSize = rbgSize; +} + +/** + * @brief Handles RB allocation for Resource allocation type 0 + * + * @details + * + * Function : rgSCHCmnDlRaType0Alloc + * + * Invoking Module Processing: + * - This function is invoked for DL RB allocation for resource allocation + * type 0 + * + * Processing Steps: + * - Determine the available positions in the rbgMask. + * - Allocate RBGs in the available positions. + * - Update RA Type 0, RA Type 1 and RA type 2 masks. + * + * @param[in] RgSchDlSfAllocInfo *allocedInfo + * @param[in] U8 rbsReq + * @param[in] RgSchBwRbgInfo *rbgInfo + * @param[out] U8 *numAllocRbs + * @param[out] RgSchDlSfAllocInfo *resAllocInfo + * @param[in] Bool isPartialAlloc + * + * @return Void + **/ + +#ifdef ANSI +PUBLIC U8 rgSCHCmnDlRaType0Alloc +( +RgSchDlSfAllocInfo *allocedInfo, +U8 rbsReq, +RgSchBwRbgInfo *rbgInfo, +U8 *numAllocRbs, +RgSchDlSfAllocInfo *resAllocInfo, +Bool isPartialAlloc +) +#else +PUBLIC U8 rgSCHCmnDlRaType0Alloc(allocedInfo, rbsReq, rbgInfo, + numAllocRbs, resAllocInfo, isPartialAlloc) +RgSchDlSfAllocInfo *allocedInfo; +U8 rbsReq; +RgSchBwRbgInfo *rbgInfo; +U8 *numAllocRbs; +RgSchDlSfAllocInfo *resAllocInfo; +Bool isPartialAlloc; +#endif +{ + /* Note: This function atttempts allocation only full allocation */ + U32 remNumRbs, rbgPosInRbgMask, ueRaType2Mask; + U8 type2MaskIdx, cnt, rbIdx; + U8 maskSize, rbg; + U8 bestNumAvailRbs = 0; + U8 usedRbs = 0; + U8 numAllocRbgs = 0; + U8 rbgSize = rbgInfo->rbgSize; + U32 *rbgMask = &(resAllocInfo->raType0Mask); +#ifdef RGSCH_SPS_UNUSED + U8 rbgSubset; + U32 ueRaType1Mask; + U32 *raType1Mask = resAllocInfo->raType1Mask; + U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; +#endif + U32 *raType2Mask = resAllocInfo->raType2Mask; + + U32 allocedMask = allocedInfo->raType0Mask; + + maskSize = rbgInfo->numRbgs; + + *numAllocRbs = 0; + RG_SCH_CMN_DL_COUNT_ONES(allocedMask, maskSize, &usedRbs); + if (maskSize == usedRbs) + { + /* All RBGs are allocated, including the last one */ + remNumRbs = 0; + } + else + { + remNumRbs = (maskSize - usedRbs - 1) * rbgSize; /* vamsee: removed minus 1 */ + + /* If last RBG is available, add last RBG size */ + if (!(allocedMask & (1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(maskSize - 1)))) + { + remNumRbs += rbgInfo->lastRbgSize; + } + } + + /* If complete allocation is needed, check if total requested RBs are available else + * check the best available RBs */ + if (!isPartialAlloc) + { + if (remNumRbs >= rbsReq) + { + bestNumAvailRbs = rbsReq; + } + } + else + { + bestNumAvailRbs = remNumRbs > rbsReq ? rbsReq : remNumRbs; + } + + /* Allocate for bestNumAvailRbs */ + if (bestNumAvailRbs) + { + for (rbg = 0; rbg < maskSize - 1; ++rbg) + { + rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); + if (!(allocedMask & rbgPosInRbgMask)) + { + /* Update RBG mask */ + *rbgMask |= rbgPosInRbgMask; + + /* Compute RB index of the first RB of the RBG allocated */ + rbIdx = rbg * rbgSize; + + for (cnt = 0; cnt < rbgSize; ++cnt) + { +#ifdef RGSCH_SPS_UNUSED + ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); +#endif + ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); +#ifdef RGSCH_SPS_UNUSED + /* Update RBG mask for RA type 1 */ + raType1Mask[rbgSubset] |= ueRaType1Mask; + raType1UsedRbs[rbgSubset]++; +#endif + /* Update RA type 2 mask */ + raType2Mask[type2MaskIdx] |= ueRaType2Mask; + rbIdx++; + } + *numAllocRbs += rbgSize; + remNumRbs -= rbgSize; + ++numAllocRbgs; + if (*numAllocRbs >= bestNumAvailRbs) + { + break; + } + } + } + /* If last RBG available and allocation is not completed, allocate + * last RBG */ + if (*numAllocRbs < bestNumAvailRbs) + { + rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); + *rbgMask |= rbgPosInRbgMask; + *numAllocRbs += rbgInfo->lastRbgSize; + + /* Compute RB index of the first RB of the last RBG */ + rbIdx = ((rbgInfo->numRbgs - 1 ) * rbgSize ); /* removed minus 1 vamsee */ + + for (cnt = 0; cnt < rbgInfo->lastRbgSize; ++cnt) + { +#ifdef RGSCH_SPS_UNUSED + ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); +#endif + ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); +#ifdef RGSCH_SPS_UNUSED + /* Update RBG mask for RA type 1 */ + raType1Mask[rbgSubset] |= ueRaType1Mask; + raType1UsedRbs[rbgSubset]++; +#endif + /* Update RA type 2 mask */ + raType2Mask[type2MaskIdx] |= ueRaType2Mask; + rbIdx++; + } + remNumRbs -= rbgInfo->lastRbgSize; + ++numAllocRbgs; + } + /* Note: this should complete allocation, not checking for the + * same */ + } + + RETVALUE(numAllocRbgs); +} + +#ifdef RGSCH_SPS_UNUSED +/** + * @brief Handles RB allocation for Resource allocation type 1 + * + * @details + * + * Function : rgSCHCmnDlRaType1Alloc + * + * Invoking Module Processing: + * - This function is invoked for DL RB allocation for resource allocation + * type 1 + * + * Processing Steps: + * - Determine the available positions in the subsets. + * - Allocate RB in the available subset. + * - Update RA Type1, RA type 0 and RA type 2 masks. + * + * @param[in] RgSchDlSfAllocInfo *allocedInfo + * @param[in] U8 rbsReq + * @param[in] RgSchBwRbgInfo *rbgInfo + * @param[in] U8 startRbgSubset + * @param[in] U8 *allocRbgSubset + * @param[out] rgSchDlSfAllocInfo *resAllocInfo + * @param[in] Bool isPartialAlloc + * + * @return U8 + * Number of allocated RBs + **/ + +#ifdef ANSI +PUBLIC U8 rgSCHCmnDlRaType1Alloc +( +RgSchDlSfAllocInfo *allocedInfo, +U8 rbsReq, +RgSchBwRbgInfo *rbgInfo, +U8 startRbgSubset, +U8 *allocRbgSubset, +RgSchDlSfAllocInfo *resAllocInfo, +Bool isPartialAlloc +) +#else +PUBLIC U8 rgSCHCmnDlRaType1Alloc(allocedInfo, rbsReq,rbgInfo,startRbgSubset, + allocRbgSubset, resAllocInfo, isPartialAlloc) +RgSchDlSfAllocInfo *allocedInfo; +U8 rbsReq; +RgSchBwRbgInfo *rbgInfo; +U8 startRbgSubset; +U8 *allocRbgSubset; +RgSchDlSfAllocInfo *resAllocInfo; +Bool isPartialAlloc; +#endif +{ + /* Note: This function atttempts only full allocation */ + U8 *rbgSubsetSzArr; + U8 type2MaskIdx, subsetIdx, rbIdx, rbInSubset, rbgInSubset; + U8 offset, rbg, maskSize, bestSubsetIdx; + U8 startPos = 0; + U8 bestNumAvailRbs = 0; + U8 numAllocRbs = 0; + U32 ueRaType2Mask, ueRaType0Mask, rbPosInSubset; + U32 remNumRbs, allocedMask; + U8 usedRbs = 0; + U8 rbgSize = rbgInfo->rbgSize; + U8 rbgSubset = startRbgSubset; + U32 *rbgMask = &resAllocInfo->raType0Mask; + U32 *raType1Mask = resAllocInfo->raType1Mask; + U32 *raType2Mask = resAllocInfo->raType2Mask; + U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; + U32 *allocMask = allocedInfo->raType1Mask; + + /* Initialize the subset size Array */ + rbgSubsetSzArr = rbgInfo->rbgSubsetSize; + + /* Perform allocation for RA type 1 */ + for (subsetIdx = 0;subsetIdx < rbgSize; ++subsetIdx) + { + allocedMask = allocMask[rbgSubset]; + maskSize = rbgSubsetSzArr[rbgSubset]; + + /* Determine number of available RBs in the subset */ + usedRbs = allocedInfo->raType1UsedRbs[subsetIdx]; + remNumRbs = maskSize - usedRbs; + + if (remNumRbs >= rbsReq) + { + bestNumAvailRbs = rbsReq; + bestSubsetIdx = rbgSubset; + break; + } + else if (isPartialAlloc && (remNumRbs > bestNumAvailRbs)) + { + bestNumAvailRbs = remNumRbs; + bestSubsetIdx = rbgSubset; + } + + rbgSubset = (rbgSubset + 1) % rbgSize; + } /* End of for (each rbgsubset) */ + + if (bestNumAvailRbs) + { + /* Initialize alloced mask and subsetSize depending on the RBG + * subset of allocation */ + U8 startIdx = 0; + maskSize = rbgSubsetSzArr[bestSubsetIdx]; + allocedMask = allocMask[bestSubsetIdx]; + RG_SCH_CMN_DL_GET_START_POS(allocedMask, maskSize, + &startPos); + for (; startIdx < rbgSize; ++startIdx, ++startPos) + { + for (rbInSubset = startPos; rbInSubset < maskSize; + rbInSubset = rbInSubset + rbgSize) + { + rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset); + if (!(allocedMask & rbPosInSubset)) + { + raType1Mask[bestSubsetIdx] |= rbPosInSubset; + raType1UsedRbs[bestSubsetIdx]++; + + /* Compute RB index value for the RB being allocated */ + rbgInSubset = rbInSubset /rbgSize; + offset = rbInSubset % rbgSize; + rbg = (rbgInSubset * rbgSize) + bestSubsetIdx; + rbIdx = (rbg * rbgSize) + offset; + + /* Update RBG mask for RA type 0 allocation */ + ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize); + *rbgMask |= ueRaType0Mask; + + /* Update RA type 2 mask */ + ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx); + raType2Mask[type2MaskIdx] |= ueRaType2Mask; + + /* Update the counters */ + numAllocRbs++; + remNumRbs--; + if (numAllocRbs == bestNumAvailRbs) + { + break; + } + } + } /* End of for (each position in the subset mask) */ + if (numAllocRbs == bestNumAvailRbs) + { + break; + } + } /* End of for startIdx = 0 to rbgSize */ + + *allocRbgSubset = bestSubsetIdx; + } /* End of if (bestNumAvailRbs) */ + + RETVALUE(numAllocRbs); +} +#endif +/** + * @brief Handles RB allocation for Resource allocation type 2 + * + * @details + * + * Function : rgSCHCmnDlRaType2Alloc + * + * Invoking Module Processing: + * - This function is invoked for DL RB allocation for resource allocation + * type 2 + * + * Processing Steps: + * - Determine the available positions in the mask + * - Allocate best fit cosecutive RBs. + * - Update RA Type2, RA type 1 and RA type 0 masks. + * + * @param[in] RgSchDlSfAllocInfo *allocedInfo + * @param[in] U8 rbsReq + * @param[in] RgSchBwRbgInfo *rbgInfo + * @param[out] U8 *rbStart + * @param[out] rgSchDlSfAllocInfo *resAllocInfo + * @param[in] Bool isPartialAlloc + * + * @return U8 + * Number of allocated RBs + **/ + +#ifdef ANSI +PUBLIC U8 rgSCHCmnDlRaType2Alloc +( +RgSchDlSfAllocInfo *allocedInfo, +U8 rbsReq, +RgSchBwRbgInfo *rbgInfo, +U8 *rbStart, +RgSchDlSfAllocInfo *resAllocInfo, +Bool isPartialAlloc +) +#else +PUBLIC U8 rgSCHCmnDlRaType2Alloc(allocedInfo, rbsReq, rbgInfo, rbStart, + resAllocInfo, isPartialAlloc) +RgSchDlSfAllocInfo *allocedInfo; +U8 rbsReq; +RgSchBwRbgInfo *rbgInfo; +U8 *rbStart; +RgSchDlSfAllocInfo *resAllocInfo; +Bool isPartialAlloc; +#endif +{ + U8 numAllocRbs = 0; + U8 rbIdx; + U8 rbgSize = rbgInfo->rbgSize; + U32 *rbgMask = &resAllocInfo->raType0Mask; +#ifdef RGSCH_SPS_UNUSED + U32 *raType1Mask = resAllocInfo->raType1Mask; +#endif + U32 *raType2Mask = resAllocInfo->raType2Mask; +#ifdef RGSCH_SPS_UNUSED + U32 *raType1UsedRbs = resAllocInfo->raType1UsedRbs; +#endif + U32 *allocedMask = allocedInfo->raType2Mask; + + /* Note: This function atttempts only full allocation */ + rgSCHCmnDlGetBestFitHole(allocedMask, rbgInfo->numRbs, + raType2Mask, rbsReq, rbStart, &numAllocRbs, isPartialAlloc); + if (numAllocRbs) + { + /* Update the allocation in RA type 0 and RA type 1 masks */ + U8 rbCnt = numAllocRbs; +#ifdef RGSCH_SPS_UNUSED + U8 rbgSubset; + U32 ueRaType1Mask; +#endif + U32 ueRaType0Mask; + rbIdx = *rbStart; + + while(rbCnt) + { + /* Update RBG mask for RA type 0 allocation */ + ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize); + *rbgMask |= ueRaType0Mask; + +#ifdef RGSCH_SPS_UNUSED + /* Update RBG mask for RA type 1 */ + ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset); + raType1Mask[rbgSubset] |= ueRaType1Mask; + raType1UsedRbs[rbgSubset]++; +#endif + /* Update the counters */ + --rbCnt; + rbIdx++; + } + } + + RETVALUE(numAllocRbs); +} + +/** + * @brief Determines RA type 0 mask from given RB index. + * + * @details + * + * Function : rgSCHCmnGetRaType0Mask + * + * + * Processing Steps: + * - Determine RA Type 0 mask for given rbIdex and rbg size. + * + * @param[in] U8 rbIdx + * @param[in] U8 rbgSize + * @return U32 RA type 0 mask + **/ +#ifdef ANSI +PRIVATE U32 rgSCHCmnGetRaType0Mask +( +U8 rbIdx, +U8 rbgSize +) +#else +PRIVATE U32 rgSCHCmnGetRaType0Mask(rbIdx, rbgSize) +U8 rbIdx; +U8 rbgSize; +#endif +{ + U8 rbg; + U32 rbgPosInRbgMask = 0; + + rbg = rbIdx/rbgSize; + rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg); + + RETVALUE(rbgPosInRbgMask); +} + +#ifdef RGSCH_SPS_UNUSED +/** + * @brief Determines RA type 1 mask from given RB index. + * + * @details + * + * Function : rgSCHCmnGetRaType1Mask + * + * + * Processing Steps: + * - Determine RA Type 1 mask for given rbIdex and rbg size. + * + * @param[in] U8 rbIdx + * @param[in] U8 rbgSize + * @param[out] U8 *type1Subset + * @return U32 RA type 1 mask + **/ +#ifdef ANSI +PRIVATE U32 rgSCHCmnGetRaType1Mask +( +U8 rbIdx, +U8 rbgSize, +U8 *type1Subset +) +#else +PRIVATE U32 rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, type1Subset) +U8 rbIdx; +U8 rbgSize; +U8 *type1Subset; +#endif +{ + U8 rbg, rbgSubset, rbgInSubset, offset, rbInSubset; + U32 rbPosInSubset; + + rbg = rbIdx/rbgSize; + rbgSubset = rbg % rbgSize; + rbgInSubset = rbg/rbgSize; + offset = rbIdx % rbgSize; + rbInSubset = rbgInSubset * rbgSize + offset; + rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset); + + *type1Subset = rbgSubset; + RETVALUE(rbPosInSubset); +} +#endif /* RGSCH_SPS_UNUSED */ +/** + * @brief Determines RA type 2 mask from given RB index. + * + * @details + * + * Function : rgSCHCmnGetRaType2Mask + * + * + * Processing Steps: + * - Determine RA Type 2 mask for given rbIdx and rbg size. + * + * @param[in] U8 rbIdx + * @param[out] U8 *maskIdx + * @return U32 RA type 2 mask + **/ +#ifdef ANSI +PRIVATE U32 rgSCHCmnGetRaType2Mask +( +U8 rbIdx, +U8 *maskIdx +) +#else +PRIVATE U32 rgSCHCmnGetRaType2Mask(rbIdx, maskIdx) +U8 rbIdx; +U8 *maskIdx; +#endif +{ + U32 rbPosInType2; + + *maskIdx = rbIdx / 32; + rbPosInType2 = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbIdx % 32); + + RETVALUE(rbPosInType2); +} + +/** + * @brief Performs resource allocation for a non-SPS UE in SPS bandwidth + * + * @details + * + * Function : rgSCHCmnAllocUeInSpsBw + * + * + * Processing Steps: + * - Determine allocation for the UE. + * - Use resource allocation type 0, 1 and 2 for allocation + * within maximum SPS bandwidth. + * + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlRbAlloc *rbAllocInfo + * @param[in] Bool isPartialAlloc + * @return Bool + * ROK success + * RFAILED failed + **/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnAllocUeInSpsBw +( +RgSchDlSf *dlSf, +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlRbAlloc *rbAllocInfo, +Bool isPartialAlloc +) +#else +PUBLIC Bool rgSCHCmnAllocUeInSpsBw(dlSf, cell, ue, rbAllocInfo, isPartialAlloc) +RgSchDlSf *dlSf; +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlRbAlloc *rbAllocInfo; +Bool isPartialAlloc; +#endif +{ + U8 rbgSize = cell->rbgSize; + U8 numAllocRbs = 0; + U8 numAllocRbgs = 0; + U8 rbStart = 0; + U8 idx, noLyr, iTbs; + RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); + RgSchDlSfAllocInfo *dlSfAlloc = &rbAllocInfo->dlSf->dlSfAllocInfo; + RgSchBwRbgInfo *spsRbgInfo = &cell->spsBwRbgInfo; + + /* SPS_FIX : Check if this Hq proc is scheduled */ + if ((0 == rbAllocInfo->tbInfo[0].schdlngForTb) && + (0 == rbAllocInfo->tbInfo[1].schdlngForTb)) + { + RETVALUE(TRUE); + } + + /* Check if the requirement can be accomodated in SPS BW */ + if (dlSf->spsAllocdBw == spsRbgInfo->numRbs) + { + /* SPS Bandwidth has been exhausted: no further allocations possible */ + RETVALUE(FALSE); + } + if (!isPartialAlloc) + { + if((dlSf->spsAllocdBw + rbAllocInfo->rbsReq) > spsRbgInfo->numRbs) + { + RETVALUE(TRUE); + } + } + + /* Perform allocation for RA type 0 if rbsReq is multiple of RBG size (also + * if RBG size = 1) */ + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + rbAllocInfo->rbsReq += (rbgSize - rbAllocInfo->rbsReq % rbgSize); + numAllocRbgs = rgSCHCmnDlRaType0Alloc(dlSfAlloc, + rbAllocInfo->rbsReq, spsRbgInfo, &numAllocRbs, + &rbAllocInfo->resAllocInfo, isPartialAlloc); + } +#ifdef RGSCH_SPS_UNUSED + else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1) + { + /* If no RBS could be allocated, attempt RA TYPE 1 */ + + numAllocRbs = rgSCHCmnDlRaType1Alloc(dlSfAlloc, + rbAllocInfo->rbsReq, spsRbgInfo, (U8)dlSfAlloc->nxtRbgSubset, + &rbAllocInfo->allocInfo.raType1.rbgSubset, + &rbAllocInfo->resAllocInfo, isPartialAlloc); + + if(numAllocRbs) + { + dlSfAlloc->nxtRbgSubset = + (rbAllocInfo->allocInfo.raType1.rbgSubset + 1 ) % rbgSize; + } + } +#endif + else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + numAllocRbs = rgSCHCmnDlRaType2Alloc(dlSfAlloc, + rbAllocInfo->rbsReq, spsRbgInfo, + &rbStart, &rbAllocInfo->resAllocInfo, isPartialAlloc); + } + if (!numAllocRbs) + { + RETVALUE(TRUE); + } + + if (!(rbAllocInfo->pdcch = + rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi,\ + rbAllocInfo->dciFormat, FALSE))) + { + /* Note: Returning TRUE since PDCCH might be available for another UE */ + RETVALUE(TRUE); + } + + /* Update Tb info for each scheduled TB */ + iTbs = rbAllocInfo->tbInfo[0].iTbs; + noLyr = rbAllocInfo->tbInfo[0].noLyr; + rbAllocInfo->tbInfo[0].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8; + + if (rbAllocInfo->tbInfo[1].schdlngForTb) + { + iTbs = rbAllocInfo->tbInfo[1].iTbs; + noLyr = rbAllocInfo->tbInfo[1].noLyr; + rbAllocInfo->tbInfo[1].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8;; + } + + /* Update rbAllocInfo with the allocation information */ + if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + rbAllocInfo->allocInfo.raType0.dlAllocBitMask = + rbAllocInfo->resAllocInfo.raType0Mask; + rbAllocInfo->allocInfo.raType0.numDlAlloc = numAllocRbgs; + } +#ifdef RGSCH_SPS_UNUSED + else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1) + { + rbAllocInfo->allocInfo.raType1.dlAllocBitMask = + rbAllocInfo->resAllocInfo.raType1Mask[rbAllocInfo->allocInfo.raType1.rbgSubset]; + rbAllocInfo->allocInfo.raType1.numDlAlloc = numAllocRbs; + rbAllocInfo->allocInfo.raType1.shift = 0; + } +#endif + else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + rbAllocInfo->allocInfo.raType2.isLocal = TRUE; + rbAllocInfo->allocInfo.raType2.rbStart = rbStart; + rbAllocInfo->allocInfo.raType2.numRb = numAllocRbs; + } + + rbAllocInfo->rbsAlloc = numAllocRbs; + rbAllocInfo->tbInfo[0].schdlngForTb = TRUE; + + /* Update allocation masks for RA types 0, 1 and 2 in DL SF */ + + /* Update type 0 allocation mask */ + dlSfAlloc->raType0Mask |= rbAllocInfo->resAllocInfo.raType0Mask; +#ifdef RGSCH_SPS_UNUSED + /* Update type 1 allocation masks */ + for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx) + { + dlSfAlloc->raType1Mask[idx] |= rbAllocInfo->resAllocInfo.raType1Mask[idx]; + dlSfAlloc->raType1UsedRbs[idx] += + rbAllocInfo->resAllocInfo.raType1UsedRbs[idx]; + } +#endif + /* Update type 2 allocation masks */ + for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx) + { + dlSfAlloc->raType2Mask[idx] |= rbAllocInfo->resAllocInfo.raType2Mask[idx]; + } + + dlSf->spsAllocdBw += numAllocRbs; + RETVALUE(TRUE); +} + +/*********************************************************** + * + * Func : rgSCHCmnDlGetBestFitHole + * + * + * Desc : Converts the best fit hole into allocation and returns the + * allocation information. + * + * + * Ret : Void + * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlGetBestFitHole +( +U32 *allocMask, +U8 numMaskRbs, +U32 *crntAllocMask, +U8 rbsReq, +U8 *allocStart, +U8 *allocNumRbs, +Bool isPartialAlloc +) +#else +PRIVATE Void rgSCHCmnDlGetBestFitHole (allocMask, numMaskRbs, + crntAllocMask, rbsReq, allocStart, allocNumRbs, isPartialAlloc) +U32 *allocMask; +U8 numMaskRbs; +U32 *crntAllocMask; +U8 rbsReq; +U8 *allocStart; +U8 *allocNumRbs; +Bool isPartialAlloc; +#endif +{ + U8 maskSz = (numMaskRbs + 31)/32; + U8 maxMaskPos = (numMaskRbs % 32); + U8 maskIdx, maskPos; + U8 numAvailRbs = 0; + U8 bestAvailNumRbs = 0; + S8 bestStartPos = -1; + S8 startPos = -1; + U32 tmpMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0}; + U32 bestMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0}; + + *allocNumRbs = numAvailRbs; + *allocStart = 0; + + for (maskIdx = 0; maskIdx < maskSz; ++maskIdx) + { + maxMaskPos = 31; + if (maskIdx == (maskSz - 1)) + { + if (numMaskRbs % 32) + { + maxMaskPos = numMaskRbs % 32; + } + } + for (maskPos = 0; maskPos < maxMaskPos; ++maskPos) + { + if (!(allocMask[maskIdx] & (1 << (31 - maskPos)))) + { + tmpMask[maskIdx] |= (1 << (31 - maskPos)); + if (startPos == -1) + { + startPos = maskIdx * 32 + maskPos; + } + ++numAvailRbs; + if (numAvailRbs == rbsReq) + { + *allocStart = (U8)startPos; + *allocNumRbs = rbsReq; + break; + } + } + else + { + if (numAvailRbs > bestAvailNumRbs) + { + bestAvailNumRbs = numAvailRbs; + bestStartPos = startPos; + cmMemcpy((U8 *)bestMask, (U8 *) tmpMask, 4 * sizeof(U32)); + } + numAvailRbs = 0; + startPos = -1; + cmMemset((U8 *)tmpMask, 0, 4 * sizeof(U32)); + } + } + if (*allocNumRbs == rbsReq) + { + break; + } + } + + if (*allocNumRbs == rbsReq) + { + /* Convert the hole into allocation */ + cmMemcpy((U8 *)crntAllocMask, (U8 *) tmpMask, 4 * sizeof(U32)); + RETVOID; + } + else + { + if (bestAvailNumRbs && isPartialAlloc) + { + /* Partial allocation could have been done */ + *allocStart = (U8)bestStartPos; + *allocNumRbs = bestAvailNumRbs; + /* Convert the hole into allocation */ + cmMemcpy((U8 *)crntAllocMask, (U8 *) bestMask, 4 * sizeof(U32)); + } + } + + RETVOID; +} +#endif /* LTEMAC_SPS */ + +/*************************************************************************** + * + * NON-DLFS Allocation functions + * + * *************************************************************************/ +#ifndef LTE_TDD +#ifdef DEBUGP +/** + * @brief Function to find out code rate + * + * @details + * + * Function : rgSCHCmnFindCodeRate + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @return void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFindCodeRate +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +U8 idx +) +#else +PRIVATE Void rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,idx) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +U8 idx; +#endif +{ + RETVOID; + +} +#endif + +/* Adjust the Imcs and bytes allocated also with respect to the adjusted + RBs - Here we will find out the Imcs by identifying first Highest + number of bits compared to the original bytes allocated. */ +/** + * @brief Adjust IMCS according to tbSize and ITBS + * + * @details + * + * Function : rgSCHCmnNonDlfsPbchTbImcsAdj + * + * Processing Steps: + * - Adjust Imcs according to tbSize and ITBS. + * + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @param[in] U8 *idx + * @return void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsPbchTbImcsAdj +( +RgSchCellCb *cell, +RgSchDlRbAlloc *allocInfo, +U8 idx, +U8 rbsReq +) +#else +PRIVATE Void rgSCHCmnNonDlfsPbchTbImcsAdj(cell,allocInfo, idx, rbsReq) +RgSchCellCb *cell; +RgSchDlRbAlloc *allocInfo; +U8 idx; +U8 rbsReq; +#endif +{ + U8 noLyrs = 0; + U8 tbs = 0; + U32 origBytesReq; + U8 noRbgs = 0; + U8 noRbs = 0; + RgSchDlSf *dlSf = allocInfo->dlSf; + + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs); + noLyrs = allocInfo->tbInfo[idx].noLyr; + + if((allocInfo->raType == RG_SCH_CMN_RA_TYPE0)) + { + noRbgs = RGSCH_CEIL((allocInfo->rbsReq + dlSf->lstRbgDfct), cell->rbgSize); + noRbs = (noRbgs * cell->rbgSize) - dlSf->lstRbgDfct; + } + else + { + noRbs = allocInfo->rbsReq; + } + + /* This line will help in case if tbs is zero and reduction in MCS is not possible */ + if (allocInfo->rbsReq == 0 ) + { + RETVOID; + } + origBytesReq = rgTbSzTbl[noLyrs - 1][tbs][rbsReq - 1]/8; + + /* Find out the ITbs & Imcs by identifying first Highest + number of bits compared to the original bytes allocated.*/ + if(tbs > 0) + { + if(((rgTbSzTbl[noLyrs - 1][0][noRbs - 1])/8) < origBytesReq) + { + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyrs - 1], tbs); + while(((rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1])/8) > origBytesReq) + { + tbs--; + } + } + else + { + tbs = 0; + } + allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1]/8; + allocInfo->tbInfo[idx].iTbs = tbs; + RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs); + } + + RETVOID; +} +/* Added funcion to adjust TBSize*/ +/** + * @brief Function to adjust the tbsize in case of subframe 0 & 5 when + * we were not able to do RB alloc adjustment by adding extra required Rbs + * + * @details + * + * Function : rgSCHCmnNonDlfsPbchTbSizeAdj + * + * Processing Steps: + * + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @param[in] U8 numOvrlapgPbchRb + * @param[in] U8 idx + * @param[in] U8 pbchSsRsSym + * @return void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj +( +RgSchDlRbAlloc *allocInfo, +U8 numOvrlapgPbchRb, +U8 pbchSsRsSym, +U8 idx, +U32 bytesReq +) +#else +PRIVATE Void rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,idx,bytesReq) +RgSchDlRbAlloc *allocInfo; +U8 numOvrlapgPbchRb; +U8 pbchSsRsSym; +U8 idx; +U32 bytesReq; +#endif +{ + U32 reducedTbs = 0; + U8 noLyrs = 0; + U8 tbs = 0; + + noLyrs = allocInfo->tbInfo[idx].noLyr; + + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs); + + reducedTbs = bytesReq - (((U32)numOvrlapgPbchRb * (U32)pbchSsRsSym * 6)/8); + + /* find out the ITbs & Imcs by identifying first Highest + number of bits compared with reduced bits considering the bits that are + reserved for PBCH/PSS/SSS */ + if(((rgTbSzTbl[noLyrs - 1][0][allocInfo->rbsReq - 1])/8) < reducedTbs) + { + while(((rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1])/8) > reducedTbs) + { + tbs--; + } + } + else + { + tbs = 0; + } + allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1]/8; + allocInfo->tbInfo[idx].iTbs = tbs; + RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs); + + RETVOID; +} + +/* Added this function to find num of ovrlapping PBCH rb*/ +/** + * @brief Function to find out how many additional rbs are available + * in the entire bw which can be allocated to a UE + * @details + * + * Function : rgSCHCmnFindNumAddtlRbsAvl + * + * Processing Steps: + * - Calculates number of additinal rbs available + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @param[out] U8 addtlRbsAvl + * @return void + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo +) +#else +PRIVATE U8 rgSCHCmnFindNumAddtlRbsAvl(cell,dlSf,allocInfo) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +#endif +{ + U8 addtlRbsAvl = 0; + + TRC2(rgSCHCmnFindNumAddtlRbsAvl) + + if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + addtlRbsAvl = (((dlSf->type0End - dlSf->type2End + 1)*\ + cell->rbgSize) - dlSf->lstRbgDfct) - allocInfo->rbsReq; + } + else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + addtlRbsAvl = (dlSf->bw - dlSf->bwAlloced) - allocInfo->rbsReq; + } + + RETVALUE(addtlRbsAvl); + +} +/* Added this function to find num of ovrlapping PBCH rb*/ +/** + * @brief Function to find out how many of the requested RBs are + * falling in the center 6 RBs of the downlink bandwidth. + * @details + * + * Function : rgSCHCmnFindNumPbchOvrlapRbs + * + * Processing Steps: + * - Calculates number of overlapping rbs + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @param[out] U8* numOvrlapgPbchRb + * @return void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +U8 *numOvrlapgPbchRb +) +#else +PRIVATE Void rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,numOvrlapgPbchRb) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +U8 *numOvrlapgPbchRb; +#endif +{ + *numOvrlapgPbchRb = 0; + TRC2(rgSCHCmnFindNumPbchOvrlapRbs) + /*Find if we have already crossed the start boundary for PBCH 6 RBs, + * if yes then lets find the number of RBs which are getting overlapped + * with this allocation.*/ + if(dlSf->bwAlloced <= (cell->pbchRbStart)) + { + /*We have not crossed the start boundary of PBCH RBs. Now we need + * to know that if take this allocation then how much PBCH RBs + * are overlapping with this allocation.*/ + /* Find out the overlapping RBs in the centre 6 RBs */ + if((dlSf->bwAlloced + allocInfo->rbsReq) > cell->pbchRbStart) + { + *numOvrlapgPbchRb = (dlSf->bwAlloced + allocInfo->rbsReq) - (cell->pbchRbStart); + if(*numOvrlapgPbchRb > 6) + *numOvrlapgPbchRb = 6; + } + } + else if ((dlSf->bwAlloced > (cell->pbchRbStart)) && + (dlSf->bwAlloced < (cell->pbchRbEnd))) + { + /*We have already crossed the start boundary of PBCH RBs.We need to + * find that if we take this allocation then how much of the RBs for + * this allocation will overlap with PBCH RBs.*/ + /* Find out the overlapping RBs in the centre 6 RBs */ + if(dlSf->bwAlloced + allocInfo->rbsReq < (cell->pbchRbEnd)) + { + /*If we take this allocation then also we are not crossing the + * end boundary of PBCH 6 RBs.*/ + *numOvrlapgPbchRb = allocInfo->rbsReq; + } + else + { + /*If we take this allocation then we are crossing the + * end boundary of PBCH 6 RBs.*/ + *numOvrlapgPbchRb = (cell->pbchRbEnd) - dlSf->bwAlloced; + } + } + RETVOID; + +} +/** + * @brief Performs RB allocation adjustment if the requested RBs are + * falling in the center 6 RBs of the downlink bandwidth. + * @details + * + * Function : rgSCHCmnNonDlfsPbchRbAllocAdj + * + * Processing Steps: + * - Allocate consecutively available RBs. + * + * @param[in] RgSchCellCb *cell + * @param[in,out] RgSchDlRbAlloc *allocInfo + * @param[in] U8 pbchSsRsSym + * @return void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj +( +RgSchCellCb *cell, +RgSchDlRbAlloc *allocInfo, +U8 pbchSsRsSym, +Bool isBcchPcch +) +#else +PRIVATE Void rgSCHCmnNonDlfsPbchRbAllocAdj(cell, allocInfo,pbchSsRsSym) +RgSchCellCb *cell; +RgSchDlRbAlloc *allocInfo; +U8 pbchSsRsSym; +Bool isBcchPcch; +#endif +{ + RgSchDlSf *dlSf = allocInfo->dlSf; + U8 numOvrlapgPbchRb = 0; + U8 numOvrlapgAdtlPbchRb = 0; + U8 totSym; + U8 addtlRbsReq = 0; + U8 moreAddtlRbsReq = 0; + U8 addtlRbsAdd = 0; + U8 moreAddtlRbsAdd = 0; + U8 tbs; + U8 origRbsReq = 0; + U32 bytesReq; + U8 noLyr; + U8 divResult; + + + TRC2(rgSCHCmnNonDlfsPbchRbAllocAdj); + + + origRbsReq = allocInfo->rbsReq; + rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); + + totSym = (cell->isCpDlExtend) ? RGSCH_TOT_NUM_SYM_EXTCP : RGSCH_TOT_NUM_SYM_NORCP; + + /* Additional RBs are allocated by considering the loss due to + the reserved symbols for CFICH, PBCH, PSS, SSS and cell specific RS */ + + divResult = (numOvrlapgPbchRb * pbchSsRsSym)/totSym; + if((numOvrlapgPbchRb * pbchSsRsSym) % totSym) + { + divResult++; + } + addtlRbsReq = divResult; + + RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, addtlRbsReq, addtlRbsAdd) + + /*Now RBs requires is original requested RBs + these additional RBs to make + * up for PSS/SSS/BCCH.*/ + allocInfo->rbsReq = allocInfo->rbsReq + addtlRbsAdd; + + /*Check if with these additional RBs we have taken up, these are also falling + * under PBCH RBs range, if yes then we would need to account for + * PSS/BSS/BCCH for these additional RBs too.*/ + if(addtlRbsAdd && ((dlSf->bwAlloced + allocInfo->rbsReq - addtlRbsAdd) < (cell->pbchRbEnd))) + { + if((dlSf->bwAlloced + allocInfo->rbsReq) <= (cell->pbchRbEnd)) + { + /*With additional RBs taken into account, we are not crossing the + * PBCH RB end boundary.Thus here we need to account just for + * overlapping PBCH RBs for these additonal RBs.*/ + divResult = (addtlRbsAdd * pbchSsRsSym)/totSym; + if((addtlRbsAdd * pbchSsRsSym) % totSym) + { + divResult++; + } + + moreAddtlRbsReq = divResult; + + RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd) + + allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd; + } + else + { + + /*Here we have crossed the PBCH RB end boundary, thus we need to take + * into account the overlapping RBs for additional RBs which will be + * subset of addtlRbs.*/ + numOvrlapgAdtlPbchRb = (cell->pbchRbEnd) - ((dlSf->bwAlloced + allocInfo->rbsReq) - addtlRbsAdd); + + divResult = (numOvrlapgAdtlPbchRb * pbchSsRsSym)/totSym; + if((numOvrlapgAdtlPbchRb * pbchSsRsSym) % totSym) + { + divResult++; + } + + moreAddtlRbsReq = divResult; + + RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd) + + allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd; + } + } + if (isBcchPcch == TRUE) + { + RETVOID; + } + + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + if(tbs == 6) + { + /* This case might be for Imcs value 6 and NPrb = 1 case - Not + Adjusting either RBs or Imcs or Bytes Allocated */ + allocInfo->rbsReq = allocInfo->rbsReq - addtlRbsAdd - moreAddtlRbsAdd; + } + else if(tbs && ((0 == addtlRbsAdd) && (moreAddtlRbsAdd == 0))) + { + /*In case of a situation where we the entire bandwidth is already occupied + * and we dont have room to add additional Rbs then in order to decrease the + * code rate we reduce the tbsize such that we reduce the present calculated + * tbsize by number of bytes that would be occupied by PBCH/PSS/SSS in overlapping + * rbs and find the nearest tbsize which would be less than this deduced value*/ + + rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); + + noLyr = allocInfo->tbInfo[0].noLyr; + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyr - 1], tbs); + bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8; + + rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,bytesReq); + + if(allocInfo->tbInfo[1].schdlngForTb == TRUE) + { + noLyr = allocInfo->tbInfo[1].noLyr; + bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8; + rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,bytesReq); + } + + } + else if(tbs && ((addtlRbsAdd != addtlRbsReq) || + (addtlRbsAdd && (moreAddtlRbsReq != moreAddtlRbsAdd)))) + { + /*In case of a situation where we were not able to add required number of + * additional RBs then we adjust the Imcs based on original RBs requested. + * Doing this would comensate for the few extra Rbs we have added but inorder + * to comensate for number of RBS we couldnt add we again do the TBSize adjustment*/ + + rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq); + + if(allocInfo->tbInfo[1].schdlngForTb == TRUE) + { + rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq); + } + + rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb); + numOvrlapgPbchRb = numOvrlapgPbchRb - (addtlRbsAdd + moreAddtlRbsAdd); + + rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,allocInfo->tbInfo[0].bytesReq); + + if(allocInfo->tbInfo[1].schdlngForTb == TRUE) + { + rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,allocInfo->tbInfo[1].bytesReq); + } + + } + else + { + /*We hit this code when we were able to add the required additional RBS + * hence we should adjust the IMcs based on orignals RBs requested*/ + + rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq); + + if(allocInfo->tbInfo[1].schdlngForTb == TRUE) + { + rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq); + } + } + + RETVOID; +} /* end of rgSCHCmnNonDlfsPbchRbAllocAdj */ +#endif + +/** + * @brief Performs RB allocation for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsCmnRbAlloc + * + * Processing Steps: + * - Allocate consecutively available RBs for BCCH/PCCH/RAR. + * + * @param[in] RgSchCellCb *cell + * @param[in, out] RgSchDlRbAlloc *allocInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc +( +RgSchCellCb *cell, +RgSchDlRbAlloc *allocInfo +) +#else +PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc(cell, allocInfo) +RgSchCellCb *cell; +RgSchDlRbAlloc *allocInfo; +#endif +{ +#ifndef LTE_TDD +#ifdef LTEMAC_SPS +#endif + U8 pbchSsRsSym = 0; + U8 pbchFrame = 0; + U8 tbs = 0; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); +#endif + RgSchDlSf *dlSf = allocInfo->dlSf; +#ifdef LTEMAC_SPS + U8 rbStart = 0; + U8 spsRbsAlloc = 0; + RgSchDlSfAllocInfo *dlSfAlloc = &allocInfo->dlSf->dlSfAllocInfo; +#endif + TRC2(rgSCHCmnNonDlfsCmnRbAlloc); + + allocInfo->tbInfo[0].noLyr = 1; + +#ifdef LTEMAC_SPS + /* Note: Initialize the masks to 0, this might not be needed since alloInfo + * is initialized to 0 at the beginning of allcoation */ + allocInfo->resAllocInfo.raType0Mask = 0; + cmMemset((U8*)allocInfo->resAllocInfo.raType1Mask, 0, + RG_SCH_NUM_RATYPE1_32BIT_MASK * sizeof (U32)); + cmMemset((U8*)allocInfo->resAllocInfo.raType2Mask, 0, + RG_SCH_NUM_RATYPE2_32BIT_MASK * sizeof (U32)); + + if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && + (dlSf->bwAlloced == dlSf->bw)) +#else + if(dlSf->bwAlloced == dlSf->bw) +#endif + { + RETVALUE(RFAILED); + } +#ifndef LTE_TDD + if (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced)) + { +#ifdef LTEMAC_SPS + if ((allocInfo->tbInfo[0].imcs < 29) && (dlSf->bwAlloced < dlSf->bw)) +#else + if(allocInfo->tbInfo[0].imcs < 29) +#endif + { + /* set the remaining RBs for the requested UE */ + allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced; + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[0][tbs][allocInfo->rbsReq - 1]/8; + } + else + { +#ifdef LTEMAC_SPS + /* Attempt RA Type 2 allocation in SPS Bandwidth */ + if (dlSf->spsAllocdBw < cell->spsBwRbgInfo.numRbs) + { + spsRbsAlloc = + rgSCHCmnDlRaType2Alloc(dlSfAlloc, + allocInfo->rbsReq, &cell->spsBwRbgInfo, &rbStart, + &allocInfo->resAllocInfo, FALSE); + /* rbsAlloc assignment moved from line 16671 to here to avoid + * compilation error. Recheck */ + dlSf->spsAllocdBw += spsRbsAlloc; + } + if (!spsRbsAlloc) +#endif /* LTEMAC_SPS */ + { + RETVALUE(RFAILED); + } + } + } +#endif + + /* Update allocation information */ + allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); + if (allocInfo->pdcch == NULLP) + { + RETVALUE(RFAILED); + } + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A]; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + allocInfo->allocInfo.raType2.isLocal = TRUE; +#ifdef LTEMAC_SPS + if (spsRbsAlloc) + { + allocInfo->allocInfo.raType2.rbStart = rbStart; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + allocInfo->rbsAlloc = allocInfo->rbsReq; + } +#endif + +#ifdef LTEMAC_SPS + if (!spsRbsAlloc) + { +#endif +#ifndef LTE_TDD + if(dlSf->sfNum) + { + if(!(dlSf->sfNum == 5)) + { + /* case for subframes 1 to 9 except 5 */ +#ifdef LTEMAC_SPS + allocInfo->allocInfo.raType2.rbStart = rbStart; +#else + /*Fix for ccpu00123918*/ + allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; +#endif + } + else + { + pbchFrame = 1; /* case for subframe 5 */ + /* In subframe 5, symbols are reserved for PSS and SSS and CFICH + and Cell Specific Reference Signals */ + pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PSS_SSS_SYM) * + RGSCH_NUM_SC_IN_RB + cell->numCellRSPerSf); + } + } + else + { + pbchFrame = 1; + /* In subframe 0, symbols are reserved for PSS, SSS, PBCH, CFICH and + and Cell Specific Reference signals */ + pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PBCH_SYM + + RGSCH_NUM_PSS_SSS_SYM) * RGSCH_NUM_SC_IN_RB + + cell->numCellRSPerSf); + } /* end of outer else */ + + if((pbchFrame) && + (((dlSf->bwAlloced + allocInfo->rbsReq) - cell->pbchRbStart) > 0)&& + (dlSf->bwAlloced < cell->pbchRbEnd)) + { + if(allocInfo->tbInfo[0].imcs < 29) + { + rgSCHCmnNonDlfsPbchRbAllocAdj(cell, allocInfo, pbchSsRsSym, TRUE); + } + } +#endif +#ifdef LTEMAC_SPS + } +#endif + +#ifdef LTEMAC_SPS + if (!spsRbsAlloc) + { +#endif + /*Fix for ccpu00123918*/ + allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + allocInfo->rbsAlloc = allocInfo->rbsReq; + + /* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD + if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) + { + rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \ + allocInfo->allocInfo.raType2.rbStart, \ + allocInfo->allocInfo.raType2.numRb); + } + else +#endif + { + rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \ + allocInfo->allocInfo.raType2.rbStart, \ + allocInfo->allocInfo.raType2.numRb); + } + +#ifdef LTEMAC_SPS + } +#endif + /* LTE_ADV_FLAG_REMOVED_END */ + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + + +#ifdef LTEMAC_SPS + if (spsRbsAlloc) + { + U8 idx; + /* Update type 0, 1 and 2 masks */ + dlSfAlloc->raType0Mask |= allocInfo->resAllocInfo.raType0Mask; +#ifdef RGSCH_SPS_UNUSED + for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx) + { + dlSfAlloc->raType1Mask[idx] |= + allocInfo->resAllocInfo.raType1Mask[idx]; + dlSfAlloc->raType1UsedRbs[idx] += + allocInfo->resAllocInfo.raType1UsedRbs[idx]; + } +#endif + for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx) + { + dlSfAlloc->raType2Mask[idx] |= + allocInfo->resAllocInfo.raType2Mask[idx]; + } + } +#endif + + RETVALUE(ROK); +} + + +/** + * @brief Performs RB allocation for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsCmnRbAllocRar + * + * Processing Steps: + * - Allocate consecutively available RBs for BCCH/PCCH/RAR. + * + * @param[in] RgSchCellCb *cell + * @param[in, out] RgSchDlRbAlloc *allocInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsCmnRbAllocRar +( + RgSchCellCb *cell, + RgSchDlRbAlloc *allocInfo + ) +#else +PRIVATE S16 rgSCHCmnNonDlfsCmnRbAlloc(cell, allocInfo) + RgSchCellCb *cell; + RgSchDlRbAlloc *allocInfo; +#endif +{ + RgSchDlSf *dlSf = allocInfo->dlSf; + TRC2(rgSCHCmnNonDlfsCmnRbAllocRar); + + + if(dlSf->bwAlloced == dlSf->bw) + { + RETVALUE(RFAILED); + } + + allocInfo->tbInfo[0].noLyr = 1; +#ifndef RG_5GTF + /* Update allocation information */ + allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf); + if (allocInfo->pdcch == NULLP) + { + RETVALUE(RFAILED); + } + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A]; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + allocInfo->allocInfo.raType2.isLocal = TRUE; + + /*Fix for ccpu00123918*/ + allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + allocInfo->rbsAlloc = allocInfo->rbsReq; + + /* LTE_ADV_FLAG_REMOVED_END */ + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + +#else + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, NULLP, dlSf, 13, TFU_DCI_FORMAT_B1, FALSE); + if (allocInfo->pdcch == NULLP) + { + RETVALUE(RFAILED); + } + RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]); + if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) + { + printf("5GTF_ERROR vrbg allocated > 25\n"); + RETVALUE(RFAILED); + } + + allocInfo->tbInfo[0].cmnGrnt.vrbgStart = beamInfo->vrbgStart; + allocInfo->tbInfo[0].cmnGrnt.numVrbg = allocInfo->vrbgReq; + + /* Update allocation information */ + allocInfo->dciFormat = TFU_DCI_FORMAT_B1; + + allocInfo->tbInfo[0].cmnGrnt.xPDSCHRange = 1; + allocInfo->tbInfo[0].cmnGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, + allocInfo->tbInfo[0].cmnGrnt.vrbgStart, allocInfo->tbInfo[0].cmnGrnt.numVrbg); + + allocInfo->tbInfo[0].cmnGrnt.rbStrt = (allocInfo->tbInfo[0].cmnGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); + allocInfo->tbInfo[0].cmnGrnt.numRb = (allocInfo->tbInfo[0].cmnGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); + + beamInfo->vrbgStart += allocInfo->tbInfo[0].cmnGrnt.numVrbg; + beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].cmnGrnt.numVrbg; + allocInfo->tbInfo[0].cmnGrnt.rv = 0; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + +#endif + printf("\n[%s],allocInfo->tbInfo[0].bytesAlloc:%u,vrbgReq:%u\n", + __func__,allocInfo->tbInfo[0].bytesAlloc,allocInfo->vrbgReq); + + RETVALUE(ROK); +} + + +/* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD +/** + * @brief To check if DL BW available for non-DLFS allocation. + * + * @details + * + * Function : rgSCHCmnNonDlfsBwAvlbl + * + * Processing Steps: + * - Determine availability based on RA Type. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchDlRbAlloc *allocInfo + * + * @return Bool + * -# TRUE + * -# FALSE + **/ +#ifdef ANSI +PRIVATE Bool rgSCHCmnNonDlfsSFRBwAvlbl +( +RgSchCellCb *cell, +RgSchSFRPoolInfo **sfrpoolInfo, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +Bool isUeCellEdge +) +#else +PRIVATE Bool rgSCHCmnNonDlfsSFRBwAvlbl(cell, sfrpoolInfo, dlSf, allocInfo, isUeCellEdge) +RgSchCellCb *cell; +RgSchSFRPoolInfo **sfrpoolInfo; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +Bool isUeCellEdge; +#endif +{ + CmLListCp *l; + CmLListCp *l1; + CmLList *n; + CmLList *n1; + RgSchSFRPoolInfo *sfrPool; + RgSchSFRPoolInfo *sfrCEPool; + + U8 tbs; + U8 noLyrs; + RgSchSFRPoolInfo *poolWithMaxAvlblBw = NULLP; + U32 bwAvlbl = 0; + U32 addtnlPRBs = 0; + + if (dlSf->bw <= dlSf->bwAlloced) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "BW is fully allocated for subframe (%d) CRNTI:%d", dlSf->sfNum,allocInfo->rnti); + return FALSE; + } + + if (dlSf->sfrTotalPoolInfo.ccBwFull == TRUE) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "BW is fully allocated for CC Pool CRNTI:%d",allocInfo->rnti); + return FALSE; + } + + if ((dlSf->sfrTotalPoolInfo.ceBwFull == TRUE) && (isUeCellEdge)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "BW is fully allocated for CE Pool CRNTI:%d",allocInfo->rnti); + return FALSE; + } + + /* We first check if the ue scheduled is a cell edge or cell centre and accordingly check the avaialble + memory in their pool. If the cell centre UE doesnt have Bw available in its pool, then it will check + Bw availability in cell edge pool but the other way around is NOT possible. */ + if(isUeCellEdge) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + } + else + { + l = &dlSf->sfrTotalPoolInfo.ccPool; + } + + n = cmLListFirst(l); + + while(n) + { + if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + sfrPool = (RgSchSFRPoolInfo*)(n->node); + + /* MS_FIX for ccpu00123919 : Number of RBs in case of RETX should be same as that of initial transmission. */ + if(allocInfo->tbInfo[0].tbCb->txCntr) + { + /* If RB assignment is being done for RETX. Then if reqRbs are a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is + * not a multiple of rbgSize then check if lsgRbgDfct exists */ + if (allocInfo->rbsReq % cell->rbgSize == 0) + { + if ((sfrPool->type2End == dlSf->type2End) && dlSf->lstRbgDfct) + { + /* In this scenario we are wasting the last RBG for this dlSf */ + sfrPool->type0End--; + sfrPool->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); + + dlSf->lstRbgDfct = 0; + + /*ABHINAV To check if these variables need to be taken care of*/ + dlSf->type0End--; + dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); + } + } + else + { + if (dlSf->lstRbgDfct) + { + /* Check if type0 allocation can cater to this RETX requirement */ + if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct)) + { + RETVALUE(FALSE); + } + else + { + if (sfrPool->type2End != dlSf->type2End) /*Search again for some pool which has the END RBG of the BandWidth*/ + { + continue; + } + } + } + else + { + /* cannot allocate same number of required RBs */ + RETVALUE(FALSE); + } + } + } + + /*rg002.301 ccpu00120391 MOD condition is modified approprialtely to find if rbsReq is less than available RBS*/ + if(allocInfo->rbsReq <= (((sfrPool->type0End - sfrPool->type2End + 1)*\ + cell->rbgSize) - dlSf->lstRbgDfct)) + { + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + else + { + if (sfrPool->bw <= sfrPool->bwAlloced + cell->rbgSize) + { + n = cmLListNext(l); + /* If the ue is cell centre then it will simply check the memory available in next pool. + But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */ + + if((!isUeCellEdge) && (!n->node)) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + n = cmLListFirst(l); + } + + continue; + } + + /* MS_FIX: Number of RBs in case of RETX should be same as that of initial transmission */ + if(allocInfo->tbInfo[0].tbCb->txCntr == 0) + { + /*rg002.301 ccpu00120391 MOD setting the remaining RBs for the requested UE*/ + allocInfo->rbsReq = (((sfrPool->type0End - sfrPool->type2End + 1)*\ + cell->rbgSize) - dlSf->lstRbgDfct); + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + noLyrs = allocInfo->tbInfo[0].noLyr; + allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + else + { + n = cmLListNext(l); + + /* If the ue is cell centre then it will simply check the memory available in next pool. + But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */ + if((!isUeCellEdge) && (!n->node)) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + n = cmLListFirst(l); + } + + continue; + } + + // RETVALUE(FALSE); + } + } + else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + sfrPool = (RgSchSFRPoolInfo*)(n->node); + /* This is a Case where a UE was CC and had more RBs allocated than present in CE pool. + In case this UE whn become CE with retx going on, then BW is not sufficient for Retx */ + if ((isUeCellEdge) && + (allocInfo->tbInfo[0].tbCb->txCntr != 0)) + { + if(allocInfo->rbsReq > (sfrPool->bw - sfrPool->bwAlloced)) + { + /* Adjust CE BW such that Retx alloc is successful */ + /* Check if merging CE with adjacent CC pool will be sufficient to process Retx */ + + /* If no Type 0 allocations are made from this pool */ + if (sfrPool->type0End == (((sfrPool->poolendRB + 1) / cell->rbgSize) - 1)) + { + if (sfrPool->adjCCPool && + (sfrPool->adjCCPool->type2Start == sfrPool->poolendRB + 1) && + (allocInfo->rbsReq <= ((sfrPool->bw - sfrPool->bwAlloced) + + ((sfrPool->adjCCPool->bw - sfrPool->adjCCPool->bwAlloced))))) + { + addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced); + + /* Adjusting CE Pool Info */ + sfrPool->bw += addtnlPRBs; + sfrPool->type0End = ((sfrPool->poolendRB + addtnlPRBs + 1) / + cell->rbgSize) - 1; + + /* Adjusting CC Pool Info */ + sfrPool->adjCCPool->type2Start += addtnlPRBs; + sfrPool->adjCCPool->type2End = RGSCH_CEIL(sfrPool->adjCCPool->type2Start, + cell->rbgSize); + sfrPool->adjCCPool->bw -= addtnlPRBs; + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + } + } + } + + /* Check if CC pool is one of the following: + * 1. |CE| + |CC "CCPool2Exists" = TRUE| + * 2. |CC "CCPool2Exists" = FALSE| + |CE| + |CC "CCPool2Exists" = TRUE| + */ + if(TRUE == sfrPool->CCPool2Exists) + { + l1 = &dlSf->sfrTotalPoolInfo.cePool; + n1 = cmLListFirst(l1); + sfrCEPool = (RgSchSFRPoolInfo*)(n1->node); + if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced)) + { + *sfrpoolInfo = sfrCEPool; + RETVALUE(TRUE); + } + else if(allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced)) + { + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + /* Check if CE and CC boundary has unallocated prbs */ + else if ((sfrPool->poolstartRB == sfrPool->type2Start) && + (sfrCEPool->type0End == ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1)) + { + if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced) + + (sfrPool->bw - sfrPool->bwAlloced)) + { + /* Checking if BW can be allocated partly from CE pool and partly + * from CC pool + */ + addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced); + /* Updating CE and CC type2 parametrs based on the RBs allocated + * from these pools*/ + sfrPool->type2Start -= addtnlPRBs; + sfrPool->type2End = RGSCH_CEIL(sfrPool->type2Start, cell->rbgSize); + sfrPool->bw += addtnlPRBs; + if (addtnlPRBs == (sfrCEPool->bw - sfrCEPool->bwAlloced)) + { + sfrCEPool->bwAlloced = sfrCEPool->bw; + dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; + } + else + { + sfrCEPool->bw -= addtnlPRBs; + sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1 - addtnlPRBs) / cell->rbgSize) - 1; + } + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + else if ( bwAvlbl < + ((sfrCEPool->bw - sfrCEPool->bwAlloced) + + (sfrPool->bw - sfrPool->bwAlloced))) + { + /* All the Prbs from CE BW shall be allocated */ + if(allocInfo->tbInfo[0].tbCb->txCntr == 0) + { + sfrPool->type2Start = sfrCEPool->type2Start; + sfrPool->bw += sfrCEPool->bw - sfrCEPool->bwAlloced; + sfrCEPool->type2Start = sfrCEPool->poolendRB + 1; + sfrCEPool->bwAlloced = sfrCEPool->bw; + dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; + + /* set the remaining RBs for the requested UE */ + allocInfo->rbsReq = (sfrPool->bw - sfrPool->bwAlloced); + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + noLyrs = allocInfo->tbInfo[0].noLyr; + allocInfo->tbInfo[0].bytesReq = + rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + else + { + RETVALUE(FALSE); + } + } + } + } + + /* Checking if no. of RBs required can be allocated from + * SFR pool. + * 1. If available return the SFR pool. + * 2. Else update the RBs required parameter based on the + * BW available in the pool + * 3. Return FALSE if no B/W is available. + */ + if (allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced)) + { + *sfrpoolInfo = sfrPool; + RETVALUE(TRUE); + } + else + { + if(allocInfo->tbInfo[0].tbCb->txCntr == 0) + { + if (bwAvlbl < sfrPool->bw - sfrPool->bwAlloced) + { + if (isUeCellEdge) + { + dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; + } + bwAvlbl = sfrPool->bw - sfrPool->bwAlloced; + poolWithMaxAvlblBw = sfrPool; + } + n = cmLListNext(l); + + if ((isUeCellEdge == FALSE) && (n == NULLP)) + { + if(l != &dlSf->sfrTotalPoolInfo.cePool) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + n = cmLListFirst(l); + } + } + + if (n == NULLP) + { + if (bwAvlbl == 0) + { + if (isUeCellEdge) + { + dlSf->sfrTotalPoolInfo.ceBwFull = TRUE; + } + else + { + dlSf->sfrTotalPoolInfo.ccBwFull = TRUE; + } + RETVALUE(FALSE); + } + else + { + /* set the remaining RBs for the requested UE */ + allocInfo->rbsReq = poolWithMaxAvlblBw->bw - + poolWithMaxAvlblBw->bwAlloced; + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + noLyrs = allocInfo->tbInfo[0].noLyr; + allocInfo->tbInfo[0].bytesReq = + rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; + *sfrpoolInfo = poolWithMaxAvlblBw; + RETVALUE(TRUE); + } + } + } + else + { + n = cmLListNext(l); + + if ((isUeCellEdge == FALSE) && (n == NULLP)) + { + if(l != &dlSf->sfrTotalPoolInfo.cePool) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + n = cmLListFirst(l); + } + } + + if (n == NULLP) + { + RETVALUE(FALSE); + } + } + + } + } + } + RETVALUE(FALSE); +} +#endif /* end of ifndef LTE_TDD*/ +/* LTE_ADV_FLAG_REMOVED_END */ + +/** + * @brief To check if DL BW available for non-DLFS allocation. + * + * @details + * + * Function : rgSCHCmnNonDlfsUeRbAlloc + * + * Processing Steps: + * - Determine availability based on RA Type. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchDlRbAlloc *allocInfo + * + * @return Bool + * -# TRUE + * -# FALSE + **/ +#ifdef ANSI +PRIVATE Bool rgSCHCmnNonDlfsBwAvlbl +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo +) +#else +PRIVATE Bool rgSCHCmnNonDlfsBwAvlbl(cell, dlSf, allocInfo) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +#endif +{ + U8 tbs; + U8 noLyrs; + U8 ignoredDfctRbg = FALSE; + + TRC2(rgSCHCmnNonDlfsBwAvlbl); + if (dlSf->bw <= dlSf->bwAlloced) + { + RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId, "(%d:%d)FAILED CRNTI:%d", + dlSf->bw, dlSf->bwAlloced,allocInfo->rnti); + RETVALUE(FALSE); + } + if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + /* Fix for ccpu00123919 : Number of RBs in case of RETX should be same as + * that of initial transmission. */ + if(allocInfo->tbInfo[0].tbCb->txCntr) + { + /* If RB assignment is being done for RETX. Then if reqRbs are + * a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is + * not a multiple of rbgSize then check if lsgRbgDfct exists */ + if (allocInfo->rbsReq % cell->rbgSize == 0) + { + if (dlSf->lstRbgDfct) + { + /* In this scenario we are wasting the last RBG for this dlSf */ + + dlSf->type0End--; + dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct); + /* Fix: MUE_PERTTI_DL */ + dlSf->lstRbgDfct = 0; + ignoredDfctRbg = TRUE; + + } + } + else + { + if (dlSf->lstRbgDfct) + { + /* Check if type0 allocation can cater to this RETX requirement */ + if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct)) + { + RETVALUE(FALSE); + } + } + else + { + /* cannot allocate same number of required RBs */ + RETVALUE(FALSE); + } + } + } + + /* Condition is modified approprialtely to find + * if rbsReq is less than available RBS*/ + if(allocInfo->rbsReq <= (((dlSf->type0End - dlSf->type2End + 1)*\ + cell->rbgSize) - dlSf->lstRbgDfct)) + { + RETVALUE(TRUE); + } + /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB + * allocation in TDD when requested RBs are more than available RBs*/ + else + { + /* MS_WORKAROUND for ccpu00122022 */ + if (dlSf->bw < dlSf->bwAlloced + cell->rbgSize) + { + /* ccpu00132358- Re-assigning the values which were updated above + * if it is RETX and Last RBG available*/ + if(ignoredDfctRbg == TRUE) + { + dlSf->type0End++; + dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct); + dlSf->lstRbgDfct = 1; + } + + + RETVALUE(FALSE); + } + /* Fix: Number of RBs in case of RETX should be same as + * that of initial transmission. */ + if(allocInfo->tbInfo[0].tbCb->txCntr == 0 +#ifdef LTE_ADV + && (FALSE == rgSCHLaaIsLaaTB(allocInfo)) +#endif + ) + { + /* Setting the remaining RBs for the requested UE*/ + allocInfo->rbsReq = (((dlSf->type0End - dlSf->type2End + 1)*\ + cell->rbgSize) - dlSf->lstRbgDfct); + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + noLyrs = allocInfo->tbInfo[0].noLyr; + allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; + /* DwPts Scheduling Changes Start */ +#if LTE_TDD + if (dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + allocInfo->tbInfo[0].bytesReq = + rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8; + } +#endif + /* DwPts Scheduling Changes End */ + } + else + { + /* ccpu00132358- Re-assigning the values which were updated above + * if it is RETX and Last RBG available*/ + if(ignoredDfctRbg == TRUE) + { + dlSf->type0End++; + dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct); + dlSf->lstRbgDfct = 1; + } + + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "FAILED for CRNTI:%d", + allocInfo->rnti); + printf ("RB Alloc failed for LAA TB type 0\n"); + RETVALUE(FALSE); + } + RETVALUE(TRUE); + } + } + else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + if (allocInfo->rbsReq <= (dlSf->bw - dlSf->bwAlloced)) + { + RETVALUE(TRUE); + } + /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB + * allocation in TDD when requested RBs are more than available RBs*/ + else + { + /* Fix: Number of RBs in case of RETX should be same as + * that of initial transmission. */ + if((allocInfo->tbInfo[0].tbCb->txCntr == 0) +#ifdef LTE_ADV + && (FALSE == rgSCHLaaIsLaaTB(allocInfo)) +#endif + ) + { + /* set the remaining RBs for the requested UE */ + allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced; + RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs); + noLyrs = allocInfo->tbInfo[0].noLyr; + allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8; + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if (dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + allocInfo->tbInfo[0].bytesReq = + rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8; + } +#endif + /* DwPts Scheduling Changes End */ + } + else + { + printf ("RB Alloc failed for LAA TB type 2\n"); + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"FAILED for CRNTI:%d",allocInfo->rnti); + RETVALUE(FALSE); + } + /* Fix: Number of RBs in case of RETX should be same as + * that of initial transmission. */ + RETVALUE(TRUE); + } + } + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"FAILED for CRNTI:%d",allocInfo->rnti); + RETVALUE(FALSE); +} +/* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD +/** + * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. + * + * @details + * + * Function : rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] U8 rbStrt + * @param[in] U8 numRb + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +) +#else +PUBLIC Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, rbStrt, numRb) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +U8 rbStrt; +U8 numRb; +#endif +{ + CmLListCp *l; + CmLList *n; + RgSchSFRPoolInfo *sfrPool; + TRC2(rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc); + + l = &dlSf->sfrTotalPoolInfo.ccPool; + + dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); + dlSf->bwAlloced += numRb; + dlSf->type2Start += numRb; + n = cmLListFirst(l); + + while(n->node) + { + sfrPool = (RgSchSFRPoolInfo*)(n->node); + n = cmLListNext(l); + + /* If the pool contains some RBs allocated in this allocation, e.g: Pool is [30.50]. Pool->type2Start is 40 , dlSf->type2Start is 45. then update the variables in pool */ + if((sfrPool->poolendRB >= dlSf->type2Start) && (sfrPool->type2Start < dlSf->type2Start)) + { + sfrPool->type2End = dlSf->type2End; + sfrPool->bwAlloced = dlSf->type2Start - sfrPool->poolstartRB; + sfrPool->type2Start = dlSf->type2Start; + } + else + { + /* If the pool contains all RBs allocated in this allocation*/ + if(dlSf->type2Start > sfrPool->poolendRB) + { + sfrPool->type2End = sfrPool->type0End + 1; + sfrPool->bwAlloced = sfrPool->bw; + sfrPool->type2Start = sfrPool->poolendRB + 1; + } + } + if (!n) + { + if (l != &dlSf->sfrTotalPoolInfo.cePool) + { + l = &dlSf->sfrTotalPoolInfo.cePool; + n = cmLListFirst(l); + } + else + RETVOID; + } + } + RETVOID; +} + +/** + * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. + * + * @details + * + * Function : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] U8 rbStrt + * @param[in] U8 numRb + * + * @return Void + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +) +#else +PRIVATE S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc(cell, ue, dlSf, rbStrt, numRb) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlSf *dlSf; +U8 rbStrt; +U8 numRb; +#endif +{ + CmLListCp *l; + CmLList *n; + RgSchSFRPoolInfo *sfrCCPool1 = NULL; + RgSchSFRPoolInfo *sfrCCPool2 = NULL; + S16 ret = RFAILED; + + TRC2(rgSCHCmnNonDlfsUpdDSFRTyp2Alloc); + /* Move the type2End pivot forward */ + + + l = &dlSf->sfrTotalPoolInfo.ccPool; + n = cmLListFirst(l); + while(n) + { + sfrCCPool1 = (RgSchSFRPoolInfo*)(n->node); + /* KWork fix */ + if (sfrCCPool1 == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" + "sfrCCPool1 is NULL for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + n = cmLListNext(l); + if(n) + { + sfrCCPool2 = (RgSchSFRPoolInfo*)(n->node); + n = cmLListNext(l); + } + if((sfrCCPool1) && (sfrCCPool2)) + { + /* Based on RNTP info, the CC user is assigned high power per subframe basis */ + if(((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) && + (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb)) || + ((dlSf->type2Start >= sfrCCPool2->pwrHiCCRange.startRb) && + (dlSf->type2Start + numRb < sfrCCPool2->pwrHiCCRange.endRb))) + { + ue->lteAdvUeCb.isCCUePHigh = TRUE; + + /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ + ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" + "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + } + else + { + if((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) && + (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb)) + { + ue->lteAdvUeCb.isCCUePHigh = TRUE; + + /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ + ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():" + "rgSCHCmnBuildRntpInfo() function returned RFAILED CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + } + } + dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); +#ifndef LTEMAC_SPS + dlSf->bwAlloced += numRb; + /*MS_FIX for ccpu00123918*/ + dlSf->type2Start += numRb; +#endif + RETVALUE(ROK); +} +#endif /* end of ifndef LTE_TDD*/ +/* LTE_ADV_FLAG_REMOVED_END */ +/** + * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation. + * + * @details + * + * Function : rgSCHCmnNonDlfsUpdTyp2Alloc + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] U8 rbStrt + * @param[in] U8 numRb + * + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +U8 rbStrt, +U8 numRb +) +#else +PRIVATE Void rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, rbStrt, numRb) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +U8 rbStrt; +U8 numRb; +#endif +{ + TRC2(rgSCHCmnNonDlfsUpdTyp2Alloc); + /* Move the type2End pivot forward */ + dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); +//#ifndef LTEMAC_SPS + dlSf->bwAlloced += numRb; + /*Fix for ccpu00123918*/ + dlSf->type2Start += numRb; +//#endif + RETVOID; +} + +/** + * @brief To do DL allocation using TYPE0 RA. + * + * @details + * + * Function : rgSCHCmnNonDlfsType0Alloc + * + * Processing Steps: + * - Perform TYPE0 allocation using the RBGs between + * type0End and type2End. + * - Build the allocation mask as per RBG positioning. + * - Update the allocation parameters. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchDlRbAlloc *allocInfo + * + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsType0Alloc +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlRbAlloc *allocInfo, +RgSchUeCb *ue +) +#else +PRIVATE Void rgSCHCmnNonDlfsType0Alloc(cell, dlSf, allocInfo, dlUe) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlRbAlloc *allocInfo; +RgSchUeCb *ue; +#endif +{ + U32 dlAllocMsk = 0; + U8 rbgFiller = dlSf->lstRbgDfct; + U8 noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize); + //U8 noRbgs = (allocInfo->rbsReq + rbgFiller)/ cell->rbgSize; + U8 noRbs; + U8 noLyr; + U8 iTbs; + U32 tb1BytesAlloc = 0; + U32 tb2BytesAlloc = 0; + RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnNonDlfsType0Alloc); + //if(noRbgs == 0) noRbgs = 1; /* Not required as ceilling is used above*/ + + /* Fix for ccpu00123919*/ + noRbs = (noRbgs * cell->rbgSize) - rbgFiller; + if (dlSf->bwAlloced + noRbs > dlSf->bw) + { + if (--noRbgs == 0) + { + RETVOID; + } + noRbs = (noRbgs * cell->rbgSize) - rbgFiller; + } + + /* Fix for ccpu00138701: Ceilling is using to derive num of RBGs, Therefore, + * after this operation,checking Max TB size and Max RBs are not crossed + * if it is crossed then decrement num of RBGs. */ + //if((noRbs + rbgFiller) % cell->rbgSize) + if((noRbs > allocInfo->rbsReq) && + (allocInfo->rbsReq + rbgFiller) % cell->rbgSize) + {/* considering ue category limitation + * due to ceiling */ + +#ifdef LTE_ADV + if (rgSCHLaaIsLaaTB(allocInfo)== FALSE) +#endif + { + if ((allocInfo->tbInfo[0].schdlngForTb) && (!allocInfo->tbInfo[0].tbCb->txCntr)) + { + iTbs = allocInfo->tbInfo[0].iTbs; + noLyr = allocInfo->tbInfo[0].noLyr; + tb1BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; + } + + if ((allocInfo->tbInfo[1].schdlngForTb) && (!allocInfo->tbInfo[1].tbCb->txCntr)) + { + iTbs = allocInfo->tbInfo[1].iTbs; + noLyr = allocInfo->tbInfo[1].noLyr; + tb2BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; + } + } + + /* Only Check for New Tx No need for Retx */ + if (tb1BytesAlloc || tb2BytesAlloc) + { + if (( ue->dl.aggTbBits >= dlUe->maxTbBits) || + (tb1BytesAlloc >= dlUe->maxTbSz/8) || + (tb2BytesAlloc >= dlUe->maxTbSz/8) || + (noRbs >= dlUe->maxRb)) + { + if (--noRbgs == 0) + { + RETVOID; + } + noRbs = (noRbgs * cell->rbgSize) - rbgFiller; + } + } + } + /* type0End would have been initially (during subfrm Init) at the bit position + * (cell->noOfRbgs - 1), 0 being the most significant. + * Getting DlAllocMsk for noRbgs and at the appropriate position */ + dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - dlSf->type0End)); + /* Move backwards the type0End pivot */ + dlSf->type0End -= noRbgs; + /*Fix for ccpu00123919*/ + /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/ + /* Update the bwAlloced field accordingly */ +//#ifndef LTEMAC_SPS /* ccpu00129474*/ + dlSf->bwAlloced += noRbs; +//#endif + /* Update Type0 Alloc Info */ + allocInfo->allocInfo.raType0.numDlAlloc = noRbgs; + allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk; + allocInfo->rbsAlloc = noRbs; + + /* Update Tb info for each scheduled TB */ + iTbs = allocInfo->tbInfo[0].iTbs; + noLyr = allocInfo->tbInfo[0].noLyr; + /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant. + * RETX TB Size is same as Init TX TB Size */ + if (allocInfo->tbInfo[0].tbCb->txCntr) + { + allocInfo->tbInfo[0].bytesAlloc = + allocInfo->tbInfo[0].bytesReq; + } + else + { + allocInfo->tbInfo[0].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if (dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + allocInfo->tbInfo[0].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8; + } +#endif + /* DwPts Scheduling Changes End */ + } + + if (allocInfo->tbInfo[1].schdlngForTb) + { + iTbs = allocInfo->tbInfo[1].iTbs; + noLyr = allocInfo->tbInfo[1].noLyr; + /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant + * RETX TB Size is same as Init TX TB Size */ + if (allocInfo->tbInfo[1].tbCb->txCntr) + { + allocInfo->tbInfo[1].bytesAlloc = + allocInfo->tbInfo[1].bytesReq; + } + else + { + allocInfo->tbInfo[1].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;; + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if (dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + allocInfo->tbInfo[1].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8; + } +#endif + /* DwPts Scheduling Changes End */ + } + } + + /* The last RBG which can be smaller than the RBG size is consedered + * only for the first time allocation of TYPE0 UE */ + dlSf->lstRbgDfct = 0; + RETVOID; +} +#ifndef LTE_TDD + +/** + * @brief To prepare RNTP value from the PRB allocation (P-High -> 1 and P-Low -> 0) + * + * @details + * + * Function : rgSCHCmnBuildRntpInfo + * + * Processing Steps: + * + * @param[in] U8 *rntpPtr + * @param[in] U8 startRb + * @param[in] U8 numRb + * + * @return Void + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnBuildRntpInfo +( +RgSchCellCb *cell, +U8 *rntpPtr, +U8 startRb, +U8 nmbRb, +U16 bw +) +#else +PRIVATE S16 rgSCHCmnBuildRntpInfo(cell, rntpPtr, startRb, nmbRb, bw) +RgSchCellCb *cell; +U8 *rntpPtr; +U8 startRb; +U8 nmbRb; +U16 bw; +#endif +{ + U16 rbPtrStartIdx; /* Start Index of Octete Buffer to be filled */ + U16 rbPtrEndIdx; /* End Index of Octete Buffer to be filled */ + U16 rbBitLoc; /* Bit Location to be set as 1 in the current Byte */ + U16 nmbRbPerByte; /* PRB's to be set in the current Byte (in case of multiple Bytes) */ + + TRC2(rgSCHCmnBuildRntpInfo); + + rbPtrStartIdx = (startRb)/8; + rbPtrEndIdx = (startRb + nmbRb)/8; + + if (rntpPtr == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHCmnBuildRntpInfo():" + "rntpPtr can't be NULLP (Memory Allocation Failed)"); + RETVALUE(RFAILED); + } + + while(rbPtrStartIdx <= rbPtrEndIdx) + { + rbBitLoc = (startRb)%8; + + /* case 1: startRb and endRb lies in same Byte */ + if (rbPtrStartIdx == rbPtrEndIdx) + { + rntpPtr[rbPtrStartIdx] = rntpPtr[rbPtrStartIdx] + | (((1<type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); + sfrPool->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize); + +#ifndef LTEMAC_SPS + dlSf->type2Start += numRb; + dlSf->bwAlloced += numRb; + + if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + /* Based on RNTP info, the CC user is assigned high power per subframe basis */ + if(FALSE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge) + { + if((sfrPool->type2Start >= sfrPool->pwrHiCCRange.startRb) && + (sfrPool->type2Start + numRb < sfrPool->pwrHiCCRange.endRb)) + { + ue->lteAdvUeCb.isCCUePHigh = TRUE; + + /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ + ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():" + "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + } + else + { + /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */ + ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():" + "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + } + } + sfrPool->type2Start += numRb; + sfrPool->bwAlloced += numRb; +#endif + + RETVALUE(ROK); +} + +/** + * @brief To do DL allocation using TYPE0 RA. + * + * @details + * + * Function : rgSCHCmnNonDlfsSFRPoolType0Alloc + * + * Processing Steps: + * - Perform TYPE0 allocation using the RBGs between type0End and type2End. + * - Build the allocation mask as per RBG positioning. + * - Update the allocation parameters. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchDlRbAlloc *allocInfo + * + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsSFRPoolType0Alloc +( +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchSFRPoolInfo *poolInfo, +RgSchDlRbAlloc *allocInfo +) +#else +PRIVATE Void rgSCHCmnNonDlfsSFRPoolType0Alloc(cell, dlSf, poolInfo, allocInfo) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchSFRPoolInfo *poolInfo; +RgSchDlRbAlloc *allocInfo; +#endif +{ + U32 dlAllocMsk = 0; + U8 rbgFiller = 0; + U8 noRbgs = 0; + U8 noRbs; + U8 noLyr; + U8 iTbs; + + TRC2(rgSCHCmnNonDlfsSFRPoolType0Alloc); + + if (poolInfo->poolstartRB + poolInfo->bw == dlSf->bw) + { + if (poolInfo->type0End == dlSf->bw/4) + { + rbgFiller = dlSf->lstRbgDfct; + /* The last RBG which can be smaller than the RBG size is consedered + * only for the first time allocation of TYPE0 UE */ + dlSf->lstRbgDfct = 0; + } + } + + noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize); + + /* Abhinav to-do start */ + /* MS_FIX for ccpu00123919*/ + noRbs = (noRbgs * cell->rbgSize) - rbgFiller; + if (dlSf->bwAlloced + noRbs > dlSf->bw) + { + if (--noRbgs == 0) + { + RETVOID; + } + noRbs = (noRbgs * cell->rbgSize) - rbgFiller; + } + /* Abhinav to-do end */ + + + + /* type0End would have been initially (during subfrm Init) at the bit position + * (cell->noOfRbgs - 1), 0 being the most significant. + * Getting DlAllocMsk for noRbgs and at the appropriate position */ + dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - poolInfo->type0End)); + /* Move backwards the type0End pivot */ + poolInfo->type0End -= noRbgs; + /*MS_FIX for ccpu00123919*/ + /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/ + /* Update the bwAlloced field accordingly */ + poolInfo->bwAlloced += noRbs + dlSf->lstRbgDfct; + dlSf->bwAlloced += noRbs + dlSf->lstRbgDfct; + + /* Update Type0 Alloc Info */ + allocInfo->allocInfo.raType0.numDlAlloc = noRbgs; + allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk; + allocInfo->rbsAlloc = noRbs; + + /* Update Tb info for each scheduled TB */ + iTbs = allocInfo->tbInfo[0].iTbs; + noLyr = allocInfo->tbInfo[0].noLyr; + /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant. + * RETX TB Size is same as Init TX TB Size */ + if (allocInfo->tbInfo[0].tbCb->txCntr) + { + allocInfo->tbInfo[0].bytesAlloc = + allocInfo->tbInfo[0].bytesReq; + } + else + { + allocInfo->tbInfo[0].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8; + } + + if (allocInfo->tbInfo[1].schdlngForTb) + { + iTbs = allocInfo->tbInfo[1].iTbs; + noLyr = allocInfo->tbInfo[1].noLyr; + /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant + * RETX TB Size is same as Init TX TB Size */ + if (allocInfo->tbInfo[1].tbCb->txCntr) + { + allocInfo->tbInfo[1].bytesAlloc = + allocInfo->tbInfo[1].bytesReq; + } + else + { + allocInfo->tbInfo[1].bytesAlloc = + rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;; + } + } + + /* The last RBG which can be smaller than the RBG size is consedered + * only for the first time allocation of TYPE0 UE */ + dlSf->lstRbgDfct = 0; + RETVOID; +} + +/** + * @brief Computes RNTP Info for a subframe. + * + * @details + * + * Function : rgSCHCmnNonDlfsDsfrRntpComp + * + * Processing Steps: + * - Computes RNTP info from individual pools. + * + * @param[in] RgSchDlSf *dlSf + * + * @return void + + **/ +#ifdef ANSI +PRIVATE void rgSCHCmnNonDlfsDsfrRntpComp +( +RgSchCellCb *cell, +RgSchDlSf *dlSf +) +#else +PRIVATE void rgSCHCmnNonDlfsDsfrRntpComp(cell, dlSf) +RgSchCellCb *cell; +RgSchDlSf *dlSf; +#endif +{ + PRIVATE U16 samples = 0; + U16 i; + U16 bwBytes = (dlSf->bw-1)/8; + RgrLoadInfIndInfo *rgrLoadInf; + U16 len; + U16 ret = ROK; + + TRC2(rgSCHCmnNonDlfsDsfrRntpComp); + + len = (dlSf->bw % 8 == 0) ? dlSf->bw/8 : dlSf->bw/8 + 1; + + /* RNTP info is ORed every TTI and the sample is stored in cell control block */ + for(i = 0; i <= bwBytes; i++) + { + cell->rntpAggrInfo.val[i] |= dlSf->rntpInfo.val[i]; + } + samples = samples + 1; + /* After every 1000 ms, the RNTP info will be sent to application to be further sent to all neighbouring eNB + informing them about the load indication for cell edge users */ + if(RG_SCH_MAX_RNTP_SAMPLES == samples) + { + /* ccpu00134492 */ + ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf, + sizeof(RgrLoadInfIndInfo)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Could not " + "allocate memory for sending LoadInfo"); + RETVOID; + } + + rgrLoadInf->u.rntpInfo.pres = cell->rntpAggrInfo.pres; + /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ + rgrLoadInf->u.rntpInfo.len = len; + + /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ + rgrLoadInf->u.rntpInfo.val = cell->rntpAggrInfo.val; + rgrLoadInf->cellId = cell->cellId; + + /* dsfr_pal_fixes ** 22-March-2013 ** SKS */ + rgrLoadInf->bw = dlSf->bw; + rgrLoadInf->type = RGR_SFR; + + ret = rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf); + if(ret == RFAILED) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHCmnNonDlfsDsfrRntpComp():" + "rgSCHUtlRgrLoadInfInd() returned RFAILED"); + } + + cmMemset(cell->rntpAggrInfo.val,0,len); + samples = 0; + } + } +/* LTE_ADV_FLAG_REMOVED_END */ + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + * @brief Performs RB allocation per UE from a pool. + * + * @details + * + * Function : rgSCHCmnSFRNonDlfsUeRbAlloc + * + * Processing Steps: + * - Allocate consecutively available RBs. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlSf *dlSf + * @param[out] U8 *isDlBwAvail + * + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnSFRNonDlfsUeRbAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *dlSf, +U8 *isDlBwAvail +) +#else +PRIVATE S16 rgSCHCmnSFRNonDlfsUeRbAlloc(cell, ue, dlSf, isDlBwAvail) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlSf *dlSf; +U8 *isDlBwAvail; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *dlUe; + Bool isUECellEdge; + RgSchSFRPoolInfo *sfrpoolInfo = NULLP; + + TRC2(rgSCHCmnSFRNonDlfsUeRbAlloc); + + isUECellEdge = RG_SCH_CMN_IS_UE_CELL_EDGE(ue); + + dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + *isDlBwAvail = TRUE; + + /*Find which pool is available for this UE*/ + if (rgSCHCmnNonDlfsSFRBwAvlbl(cell, &sfrpoolInfo, dlSf, allocInfo, isUECellEdge) != TRUE) + { + /* SFR_FIX - If this is CE UE there may be BW available in CC Pool + So CC UEs will be scheduled */ + if (isUECellEdge) + { + *isDlBwAvail = TRUE; + } + else + { + *isDlBwAvail = FALSE; + } + RETVALUE(RFAILED); + } + + if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX || dlUe->proc->tbInfo[1].isAckNackDtx) + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE); + } + else + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE); + } + + if (!(allocInfo->pdcch)) + { + /* Returning ROK since PDCCH might be available for another UE and further allocations could be done */ + RETVALUE(RFAILED); + } + +#ifdef LTEMAC_SPS + allocInfo->rnti = ue->ueId; +#endif + + if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2) + { + allocInfo->allocInfo.raType2.isLocal = TRUE; + /* rg004.201 patch - ccpu00109921 fix end */ + /* MS_FIX for ccpu00123918*/ + allocInfo->allocInfo.raType2.rbStart = (U8)sfrpoolInfo->type2Start; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + /* rg007.201 - Changes for MIMO feature addition */ + /* rg008.201 - Removed dependency on MIMO compile-time flag */ + rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc(cell, ue, dlSf, sfrpoolInfo, \ + allocInfo->allocInfo.raType2.rbStart, \ + allocInfo->allocInfo.raType2.numRb); + allocInfo->rbsAlloc = allocInfo->rbsReq; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + } + else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0) + { + rgSCHCmnNonDlfsSFRPoolType0Alloc(cell, dlSf, sfrpoolInfo, allocInfo); + } +#ifndef LTE_TDD +#ifdef DEBUGP + rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,0); + if(allocInfo->tbInfo[1].schdlngForTb == TRUE) + { + rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,1); + } +#endif +#endif + +#if defined(LTEMAC_SPS) + /* Update the sub-frame with new allocation */ + dlSf->bwAlloced += allocInfo->rbsReq; +#endif + + RETVALUE(ROK); +} +/* LTE_ADV_FLAG_REMOVED_END */ +#endif /* LTE_TDD */ + +/** + * @brief Performs RB allocation per UE for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsUeRbAlloc + * + * Processing Steps: + * - Allocate consecutively available RBs. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlSf *dlSf + * @param[out] U8 *isDlBwAvail + * + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlSf *dlSf, +U8 *isDlBwAvail +) +#else +PRIVATE S16 rgSCHCmnNonDlfsUeRbAlloc(cell, ue, dlSf, isDlBwAvail) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlSf *dlSf; +U8 *isDlBwAvail; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *dlUe; +#ifdef LAA_DBG + U32 dbgRbsReq = 0; +#endif + TRC2(rgSCHCmnNonDlfsUeRbAlloc); + +#ifdef RG_5GTF + RgSch5gtfUeCb *ue5gtfCb = &(ue->ue5gtfCb); + RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[ue5gtfCb->BeamId]); +#endif + dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + *isDlBwAvail = TRUE; + + if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) + { + RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, + "5GTF_ERROR : vrbg allocated > 25 :ue (%u)", + ue->ueId); + printf("5GTF_ERROR vrbg allocated > 25\n"); + RETVALUE(RFAILED); + } + + if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX + || dlUe->proc->tbInfo[1].isAckNackDtx) + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE); + } + else + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE); + } + if (!(allocInfo->pdcch)) + { + /* Returning ROK since PDCCH might be available for another UE and + * further allocations could be done */ + RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, + "5GTF_ERROR : PDCCH allocation failed :ue (%u)", + ue->ueId); + printf("5GTF_ERROR PDCCH allocation failed\n"); + RETVALUE(RFAILED); + } +#ifdef RG_5GTF + //maxPrb = RGSCH_MIN((allocInfo->vrbgReq * MAX_5GTF_VRBG_SIZE), ue5gtfCb->maxPrb); + //maxPrb = RGSCH_MIN(maxPrb, + //((beamInfo->totVrbgAvail - beamInfo->vrbgStart)* MAX_5GTF_VRBG_SIZE))); + //TODO_SID Need to check for vrbg available after scheduling for same beam. + allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart; + allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq; + //TODO_SID: Setting for max TP + allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1; + allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, + allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg); + allocInfo->tbInfo[0].tbCb->dlGrnt.SCID = 0; + allocInfo->tbInfo[0].tbCb->dlGrnt.dciFormat = allocInfo->dciFormat; + //Filling temporarily + allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); + allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); + + beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; + beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; +#endif + + RETVALUE(ROK); +} + +#ifdef RGR_V1 +/** + * @brief Performs RB allocation for Msg4 for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsCcchSduAlloc + * + * Processing Steps: + * - For each element in the list, Call rgSCHCmnNonDlfsCcchSduRbAlloc(). + * - If allocation is successful, add the ueCb to scheduled list of CCCH + * SDU. + * - else, add UeCb to non-scheduled list. + * + * @param[in] RgSchCellCb *cell + * @param[in, out] RgSchCmnCcchSduRbAlloc *allocInfo + * @param[in] U8 isRetx + * + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsCcchSduAlloc +( +RgSchCellCb *cell, +RgSchCmnCcchSduRbAlloc *allocInfo, +U8 isRetx +) +#else +PRIVATE Void rgSCHCmnNonDlfsCcchSduAlloc(cell, allocInfo, isRetx) +RgSchCellCb *cell; +RgSchCmnCcchSduRbAlloc *allocInfo; +U8 isRetx; +#endif +{ + S16 ret; + CmLListCp *ccchSduLst = NULLP; + CmLListCp *schdCcchSduLst = NULLP; + CmLListCp *nonSchdCcchSduLst = NULLP; + CmLList *schdLnkNode = NULLP; + CmLList *toBeSchdLnk = NULLP; + RgSchDlSf *dlSf = allocInfo->ccchSduDlSf; + RgSchUeCb *ueCb = NULLP; + RgSchDlHqProcCb *hqP = NULLP; + TRC2(rgSCHCmnNonDlfsCcchSduAlloc); + + if (isRetx) + { + /* Initialize re-transmitting lists */ + ccchSduLst = &(allocInfo->ccchSduRetxLst); + schdCcchSduLst = &(allocInfo->schdCcchSduRetxLst); + nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduRetxLst); + } + else + { + /* Initialize transmitting lists */ + ccchSduLst = &(allocInfo->ccchSduTxLst); + schdCcchSduLst = &(allocInfo->schdCcchSduTxLst); + nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduTxLst); + } + + /* Perform allocaations for the list */ + toBeSchdLnk = cmLListFirst(ccchSduLst); + for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + ueCb = hqP->hqE->ue; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + ret = rgSCHCmnNonDlfsCcchSduRbAlloc(cell, ueCb, dlSf); + if (ret != ROK) + { + /* Allocation failed: Add remaining MSG4 nodes to non-scheduled + * list and return */ + do + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + ueCb = hqP->hqE->ue; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + cmLListAdd2Tail(nonSchdCcchSduLst, schdLnkNode); + toBeSchdLnk = toBeSchdLnk->next; + } while(toBeSchdLnk); + RETVOID; + } + + /* Allocation successful: Add UE to the scheduled list */ + cmLListAdd2Tail(schdCcchSduLst, schdLnkNode); + } + + + RETVOID; +} + +/** + * @brief Performs RB allocation for CcchSdu for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsCcchSduRbAlloc + * + * Processing Steps: + * - Fetch PDCCH + * - Allocate consecutively available RBs + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * @param[in] RgSchDlSf *dlSf + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc +( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgSchDlSf *dlSf +) +#else +PRIVATE S16 rgSCHCmnNonDlfsCcchSduRbAlloc(cell, ueCb, dlSf) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +RgSchDlSf *dlSf; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell); + + TRC2(rgSCHCmnNonDlfsCcchSduRbAlloc); + + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb,cell); + + /* [ccpu00138802]-MOD-If Bw is less than required, return fail + It will be allocated in next TTI */ +#ifdef LTEMAC_SPS + if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && + (dlSf->bwAlloced == dlSf->bw)) +#else + if((dlSf->bwAlloced == dlSf->bw) || + (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced))) +#endif + { + RETVALUE(RFAILED); + } + /* Retrieve PDCCH */ + /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ + if (ueDl->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX) + { + /* allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, dlSf, y, ueDl->cqi, + * TFU_DCI_FORMAT_1A, TRUE);*/ + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, TRUE); + } + else + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE); + } + if (!(allocInfo->pdcch)) + { + /* Returning RFAILED since PDCCH not available for any CCCH allocations */ + RETVALUE(RFAILED); + } + + /* Update allocation information */ + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + allocInfo->allocInfo.raType2.isLocal = TRUE; + + /*Fix for ccpu00123918*/ + /* Push this harq process back to the free queue */ + allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + allocInfo->rbsAlloc = allocInfo->rbsReq; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + /* Update the sub-frame with new allocation */ + /* ccpu00129469 */ + /* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD + if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) + { + rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, + allocInfo->allocInfo.raType2.rbStart, + allocInfo->allocInfo.raType2.numRb); + } + else +#endif /* end of ifndef LTE_TDD*/ + { + rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, + allocInfo->allocInfo.raType2.rbStart, + allocInfo->allocInfo.raType2.numRb); + } + + /* LTE_ADV_FLAG_REMOVED_END */ + /* ccpu00131941 - bwAlloced is updated from SPS bandwidth */ + + + RETVALUE(ROK); +} +#endif + +/** + * @brief Performs RB allocation for Msg4 for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsMsg4RbAlloc + * + * Processing Steps: + * - Fetch PDCCH + * - Allocate consecutively available RBs + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchRaCb *raCb + * @param[in] RgSchDlSf *dlSf + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc +( +RgSchCellCb *cell, +RgSchRaCb *raCb, +RgSchDlSf *dlSf +) +#else +PRIVATE S16 rgSCHCmnNonDlfsMsg4RbAlloc(cell, raCb, dlSf) +RgSchCellCb *cell; +RgSchRaCb *raCb; +RgSchDlSf *dlSf; +#endif +{ + RgSchDlRbAlloc *allocInfo; + TRC2(rgSCHCmnNonDlfsMsg4RbAlloc); + + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_RACB(raCb); + +#ifdef RG_5GTF + RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]); + if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG) + { + RLOG_ARG1(L_ERROR ,DBG_CELLID,cell->cellId, + "5GTF_ERROR : vrbg allocated > 25 :ue (%u)", + raCb->ue->ueId); + printf("5GTF_ERROR vrbg allocated > 25\n"); + RETVALUE(RFAILED); + } +#endif +#ifdef LTEMAC_SPS + if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) && + (dlSf->bwAlloced == dlSf->bw)) +#else + if((dlSf->bwAlloced == dlSf->bw) || + (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced))) +#endif + { + + RETVALUE(RFAILED); + } + + /* DTX Changes: One Variable is passed to check whether it is DTX or Not */ + if (raCb->dlHqE->msg4Proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX) + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, TRUE); + } + else + { + allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, FALSE); + } + if (!(allocInfo->pdcch)) + { + /* Returning RFAILED since PDCCH not available for any CCCH allocations */ + RETVALUE(RFAILED); + } + +#ifndef RG_5GTF + /* SR_RACH_STATS : MSG4 TX Failed */ + allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE; + + /* Update allocation information */ + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + allocInfo->allocInfo.raType2.isLocal = TRUE; + + + /*Fix for ccpu00123918*/ + allocInfo->allocInfo.raType2.rbStart = (U8)dlSf->type2Start; + allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq; + /* LTE_ADV_FLAG_REMOVED_START */ +#ifndef LTE_TDD + if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) + { + rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \ + allocInfo->allocInfo.raType2.rbStart, \ + allocInfo->allocInfo.raType2.numRb); + } + else +#endif /* end of ifndef LTE_TDD */ + { + rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \ + allocInfo->allocInfo.raType2.rbStart, \ + allocInfo->allocInfo.raType2.numRb); + } + /* LTE_ADV_FLAG_REMOVED_END */ + + allocInfo->rbsAlloc = allocInfo->rbsReq; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + +#else + + allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE; + + allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart; + allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq; + + /* Update allocation information */ + allocInfo->dciFormat = TFU_DCI_FORMAT_B1; + + allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1; + allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, + allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg); + + allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE); + allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE); + + + beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; + beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg; + allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq; + +#endif + + RETVALUE(ROK); +} + +/** + * @brief Performs RB allocation for Msg4 lists of frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsMsg4Alloc + * + * Processing Steps: + * - For each element in the list, Call rgSCHCmnNonDlfsMsg4RbAlloc(). + * - If allocation is successful, add the raCb to scheduled list of MSG4. + * - else, add RaCb to non-scheduled list. + * + * @param[in] RgSchCellCb *cell + * @param[in, out] RgSchCmnMsg4RbAlloc *allocInfo + * @param[in] U8 isRetx + * + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc +( +RgSchCellCb *cell, +RgSchCmnMsg4RbAlloc *allocInfo, +U8 isRetx +) +#else +PRIVATE Void rgSCHCmnNonDlfsMsg4Alloc(cell, allocInfo, isRetx) +RgSchCellCb *cell; +RgSchCmnMsg4RbAlloc *allocInfo; +U8 isRetx; +#endif +{ + S16 ret; + CmLListCp *msg4Lst = NULLP; + CmLListCp *schdMsg4Lst = NULLP; + CmLListCp *nonSchdMsg4Lst = NULLP; + CmLList *schdLnkNode = NULLP; + CmLList *toBeSchdLnk = NULLP; + RgSchDlSf *dlSf = allocInfo->msg4DlSf; + RgSchRaCb *raCb = NULLP; + RgSchDlHqProcCb *hqP = NULLP; + TRC2(rgSCHCmnNonDlfsMsg4Alloc); + + if (isRetx) + { + /* Initialize re-transmitting lists */ + msg4Lst = &(allocInfo->msg4RetxLst); + schdMsg4Lst = &(allocInfo->schdMsg4RetxLst); + nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4RetxLst); + } + else + { + /* Initialize transmitting lists */ + msg4Lst = &(allocInfo->msg4TxLst); + schdMsg4Lst = &(allocInfo->schdMsg4TxLst); + nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4TxLst); + } + + /* Perform allocaations for the list */ + toBeSchdLnk = cmLListFirst(msg4Lst); + for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + raCb = hqP->hqE->raCb; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + ret = rgSCHCmnNonDlfsMsg4RbAlloc(cell, raCb, dlSf); + if (ret != ROK) + { + /* Allocation failed: Add remaining MSG4 nodes to non-scheduled + * list and return */ + do + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + raCb = hqP->hqE->raCb; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + cmLListAdd2Tail(nonSchdMsg4Lst, schdLnkNode); + toBeSchdLnk = toBeSchdLnk->next; + } while(toBeSchdLnk); + RETVOID; + } + + /* Allocation successful: Add UE to the scheduled list */ + cmLListAdd2Tail(schdMsg4Lst, schdLnkNode); + if (isRetx) + { + } + } + + + RETVOID; +} + +/** + * @brief Performs RB allocation for the list of UEs of a frequency + * non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsDedRbAlloc + * + * Processing Steps: + * - For each element in the list, Call rgSCHCmnNonDlfsUeRbAlloc(). + * - If allocation is successful, add the ueCb to scheduled list of UEs. + * - else, add ueCb to non-scheduled list of UEs. + * + * @param[in] RgSchCellCb *cell + * @param[in, out] RgSchCmnUeRbAlloc *allocInfo + * @param[in] CmLListCp *ueLst, + * @param[in, out] CmLListCp *schdHqPLst, + * @param[in, out] CmLListCp *nonSchdHqPLst + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnNonDlfsDedRbAlloc +( +RgSchCellCb *cell, +RgSchCmnUeRbAlloc *allocInfo, +CmLListCp *ueLst, +CmLListCp *schdHqPLst, +CmLListCp *nonSchdHqPLst +) +#else +PUBLIC Void rgSCHCmnNonDlfsDedRbAlloc(cell, allocInfo, ueLst, + schdHqPLst, nonSchdHqPLst) +RgSchCellCb *cell; +RgSchCmnUeRbAlloc *allocInfo; +CmLListCp *ueLst; +CmLListCp *schdHqPLst; +CmLListCp *nonSchdHqPLst; +#endif +{ + S16 ret; + CmLList *schdLnkNode = NULLP; + CmLList *toBeSchdLnk = NULLP; + RgSchDlSf *dlSf = allocInfo->dedDlSf; + RgSchUeCb *ue = NULLP; + RgSchDlHqProcCb *hqP = NULLP; + U8 isDlBwAvail; + TRC2(rgSCHCmnNonDlfsDedRbAlloc); + + + /* Perform allocaations for the list */ + toBeSchdLnk = cmLListFirst(ueLst); + for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next) + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + ue = hqP->hqE->ue; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + + ret = rgSCHCmnNonDlfsUeRbAlloc(cell, ue, dlSf, &isDlBwAvail); + if (!isDlBwAvail) + { + /* Allocation failed: Add remaining UEs to non-scheduled + * list and return */ + do + { + hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node); + ue = hqP->hqE->ue; + schdLnkNode = &hqP->schdLstLnk; + RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP); + cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode); + toBeSchdLnk = toBeSchdLnk->next; + } while(toBeSchdLnk); + break; + } + + if (ret == ROK) + { +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.dl5gtfRbAllocPass++; +#endif + /* Allocation successful: Add UE to the scheduled list */ + cmLListAdd2Tail(schdHqPLst, schdLnkNode); + } + else + { +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.dl5gtfRbAllocFail++; +#endif + /* Allocation failed : Add UE to the non-scheduled list */ + printf("5GTF_ERROR Dl rb alloc failed adding nonSchdHqPLst\n"); + cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode); + } + } + + RETVOID; +} + +/** + * @brief Handles RB allocation for frequency non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsRbAlloc + * + * Invoking Module Processing: + * - SCH shall invoke this if downlink frequency selective is disabled for + * the cell for RB allocation. + * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs + * estimate and subframe for each allocation to be made to SCH. + * + * Processing Steps: + * - Allocate sequentially for common channels. + * - For transmitting and re-transmitting UE list. + * - For each UE: + * - Perform wide-band allocations for UE in increasing order of + * frequency. + * - Determine Imcs for the allocation. + * - Determine RA type. + * - Determine DCI format. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + **/ + +#ifdef ANSI +PUBLIC Void rgSCHCmnNonDlfsRbAlloc +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PUBLIC Void rgSCHCmnNonDlfsRbAlloc(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + U8 raRspCnt = 0; + RgSchDlRbAlloc *reqAllocInfo; + TRC2(rgSCHCmnNonDlfsRbAlloc); + + /* Allocate for MSG4 retransmissions */ + if (allocInfo->msg4Alloc.msg4RetxLst.count) + { + printf("5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc RetxLst\n"); + rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), TRUE); + } + + /* Allocate for MSG4 transmissions */ + /* Assuming all the nodes in the list need allocations: rbsReq is valid */ + if (allocInfo->msg4Alloc.msg4TxLst.count) + { + printf("5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc txLst\n"); + rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), FALSE); + } +#ifdef RGR_V1 + /* Allocate for CCCH SDU (received after guard timer expiry) + * retransmissions */ + if (allocInfo->ccchSduAlloc.ccchSduRetxLst.count) + { + printf("5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n"); + rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), TRUE); + } + + /* Allocate for CCCD SDU transmissions */ + /* Allocate for CCCH SDU (received after guard timer expiry) transmissions */ + if (allocInfo->ccchSduAlloc.ccchSduTxLst.count) + { + printf("5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n"); + rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), FALSE); + } +#endif + + /* Allocate for Random access response */ + for (raRspCnt = 0; raRspCnt < RG_SCH_CMN_MAX_CMN_PDCCH; ++raRspCnt) + { + /* Assuming that the requests will be filled in sequentially */ + reqAllocInfo = &(allocInfo->raRspAlloc[raRspCnt]); + if (!reqAllocInfo->rbsReq) + { + break; + } + printf("5GTF_ERROR calling RAR rgSCHCmnNonDlfsCmnRbAlloc\n"); + // if ((rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo)) != ROK) + if ((rgSCHCmnNonDlfsCmnRbAllocRar(cell, reqAllocInfo)) != ROK) + { + break; + } + } + + /* Allocate for RETX+TX UEs */ + if(allocInfo->dedAlloc.txRetxHqPLst.count) + { + printf("5GTF_ERROR TX RETX rgSCHCmnNonDlfsDedRbAlloc\n"); + rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), + &(allocInfo->dedAlloc.txRetxHqPLst), + &(allocInfo->dedAlloc.schdTxRetxHqPLst), + &(allocInfo->dedAlloc.nonSchdTxRetxHqPLst)); + } + + if((allocInfo->dedAlloc.retxHqPLst.count)) + { + rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), + &(allocInfo->dedAlloc.retxHqPLst), + &(allocInfo->dedAlloc.schdRetxHqPLst), + &(allocInfo->dedAlloc.nonSchdRetxHqPLst)); + } + + /* Allocate for transmitting UEs */ + if((allocInfo->dedAlloc.txHqPLst.count)) + { + rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc), + &(allocInfo->dedAlloc.txHqPLst), + &(allocInfo->dedAlloc.schdTxHqPLst), + &(allocInfo->dedAlloc.nonSchdTxHqPLst)); + } + { + RgSchCmnCell *cmnCell = RG_SCH_CMN_GET_CELL(cell); + if ((allocInfo->dedAlloc.txRetxHqPLst.count + + allocInfo->dedAlloc.retxHqPLst.count + + allocInfo->dedAlloc.txHqPLst.count) > + cmnCell->dl.maxUePerDlSf) + { +#ifndef ALIGN_64BIT + RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"UEs selected by" + " scheduler exceed maximumUePerDlSf(%u)tx-retx %ld retx %ld tx %ld\n", + cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count, + allocInfo->dedAlloc.retxHqPLst.count, + allocInfo->dedAlloc.txHqPLst.count)); +#else + RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"UEs selected by" + " scheduler exceed maximumUePerDlSf(%u)tx-retx %d retx %d tx %d\n", + cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count, + allocInfo->dedAlloc.retxHqPLst.count, + allocInfo->dedAlloc.txHqPLst.count)); +#endif + } + } +#ifndef LTE_TDD + /* LTE_ADV_FLAG_REMOVED_START */ + if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + printf("5GTF_ERROR RETX rgSCHCmnNonDlfsDsfrRntpComp\n"); + rgSCHCmnNonDlfsDsfrRntpComp(cell, allocInfo->dedAlloc.dedDlSf); + } + /* LTE_ADV_FLAG_REMOVED_END */ +#endif /* LTE_TDD */ + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHCmnCalcRiv + * + * Desc : This function calculates RIV. + * + * Ret : None. + * + * Notes: None. + * + * File : rg_sch_utl.c + * + **********************************************************/ +#ifdef LTEMAC_SPS +#ifdef ANSI +PUBLIC U32 rgSCHCmnCalcRiv +( +U8 bw, +U8 rbStart, +U8 numRb +) +#else +PUBLIC U32 rgSCHCmnCalcRiv(bw, rbStart, numRb) +U8 bw; +U8 rbStart; +U8 numRb; +#endif +#else +#ifdef ANSI +PUBLIC U32 rgSCHCmnCalcRiv +( +U8 bw, +U8 rbStart, +U8 numRb +) +#else +PUBLIC U32 rgSCHCmnCalcRiv(bw, rbStart, numRb) +U8 bw; +U8 rbStart; +U8 numRb; +#endif +#endif +{ + U8 numRbMinus1 = numRb - 1; + U32 riv; + + TRC2(rgSCHCmnCalcRiv); + + if (numRbMinus1 <= bw/2) + { + riv = bw * numRbMinus1 + rbStart; + } + else + { + riv = bw * (bw - numRbMinus1) + (bw - rbStart - 1); + } + RETVALUE(riv); +} /* rgSCHCmnCalcRiv */ + +#ifdef LTE_TDD +/** + * @brief This function allocates and copies the RACH response scheduling + * related information into cell control block. + * + * @details + * + * Function: rgSCHCmnDlCpyRachInfo + * Purpose: This function allocates and copies the RACH response + * scheduling related information into cell control block + * for each DL subframe. + * + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES] + * @param[in] U8 raArrSz + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlCpyRachInfo +( +RgSchCellCb *cell, +RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES], +U8 raArrSz +) +#else +PRIVATE S16 rgSCHCmnDlCpyRachInfo(cell, rachRspLst, raArrSz) +RgSchCellCb *cell; +RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES]; +U8 raArrSz; +#endif +{ + U8 ulDlCfgIdx = cell->ulDlCfgIdx; + U8 sfNum; + S16 sfnIdx; + U16 subfrmIdx; + U8 numRfs; + U8 numSubfrms; + U8 sfcount; + S16 ret; + + TRC2(rgSCHCmnDlCpyRachInfo); + + /* Allocate RACH response information for each DL + * subframe in a radio frame */ + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cell->rachRspLst, + rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1] * + sizeof(RgSchTddRachRspLst)); + if (ret != ROK) + { + RETVALUE(ret); + } + + for(sfnIdx=raArrSz-1; sfnIdx>=0; sfnIdx--) + { + for(subfrmIdx=0; subfrmIdx < RGSCH_NUM_SUB_FRAMES; subfrmIdx++) + { + subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx]; + if(subfrmIdx == RGSCH_NUM_SUB_FRAMES) + { + break; + } + + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx],subfrmIdx); + numSubfrms = + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; + + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddNumDlSubfrmTbl[ulDlCfgIdx],subfrmIdx); + sfNum = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][subfrmIdx]-1; + numRfs = cell->rachRspLst[sfNum].numRadiofrms; + /* For each DL subframe in which RACH response can + * be sent is updated */ + if(numSubfrms > 0) + { + cell->rachRspLst[sfNum].rachRsp[numRfs].sfnOffset = + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset; + for(sfcount=0; sfcount < numSubfrms; sfcount++) + { + cell->rachRspLst[sfNum].rachRsp[numRfs].\ + subframe[sfcount] = + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].\ + subframe[sfcount]; + } + cell->rachRspLst[sfNum].rachRsp[numRfs].numSubfrms = + rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms; + cell->rachRspLst[sfNum].numRadiofrms++; + } + + /* Copy the subframes to be deleted at ths subframe */ + numSubfrms = + rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms; + if(numSubfrms > 0) + { + cell->rachRspLst[sfNum].delInfo.sfnOffset = + rachRspLst[sfnIdx][subfrmIdx].delInfo.sfnOffset; + for(sfcount=0; sfcount < numSubfrms; sfcount++) + { + cell->rachRspLst[sfNum].delInfo.subframe[sfcount] = + rachRspLst[sfnIdx][subfrmIdx].delInfo.subframe[sfcount]; + } + cell->rachRspLst[sfNum].delInfo.numSubfrms = + rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms; + } + } + } + RETVALUE(ROK); +} +#endif +/** + * @brief This function determines the iTbs based on the new CFI, + * CQI and BLER based delta iTbs + * + * @details + * + * Function: rgSchCmnFetchItbs + * Purpose: Fetch the new iTbs when CFI changes. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlUe *ueDl + * @param[in] U8 cqi + * + * @return S32 iTbs + * + **/ +#ifdef LTE_TDD +#ifdef ANSI +PRIVATE S32 rgSchCmnFetchItbs +( +RgSchCellCb *cell, +RgSchCmnDlUe *ueDl, +RgSchDlSf *subFrm, +U8 cqi, +U8 cfi, +U8 cwIdx, +U8 noLyr +) +#else +PRIVATE S32 rgSchCmnFetchItbs (cell, ueDl, subFrm, cqi, cfi, cwIdx, noLyr) +RgSchCellCb *cell; +RgSchCmnDlUe *ueDl; +RgSchDlSf *subFrm; +U8 cqi; +U8 cfi; +U8 cwIdx; +U8 noLyr; +#endif +#else +#ifdef ANSI +PRIVATE S32 rgSchCmnFetchItbs +( +RgSchCellCb *cell, +RgSchCmnDlUe *ueDl, +U8 cqi, +U8 cfi, +U8 cwIdx, +U8 noLyr +) +#else +PRIVATE S32 rgSchCmnFetchItbs (cell, ueDl, cqi, cfi, cwIdx, noLyr) +RgSchCellCb *cell; +RgSchCmnDlUe *ueDl; +U8 cqi; +U8 cfi; +U8 cwIdx; +U8 noLyr; +#endif +#endif +{ + + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + S32 iTbs = 0; + + TRC2(rgSchCmnFetchItbs); + +#ifdef LTE_TDD + /* Special Handling for Spl Sf when CFI is 3 as + * CFI in Spl Sf will be max 2 */ + if(subFrm->sfType == RG_SCH_SPL_SF_DATA) + { + if((cellDl->currCfi == 3) || + ((cell->bwCfg.dlTotalBw <= 10) && (cellDl->currCfi == 1))) + { + /* Use CFI 2 in this case */ + iTbs = (ueDl->laCb[cwIdx].deltaiTbs + + ((*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][2]))[cqi])* 100)/100; + + RG_SCH_CHK_ITBS_RANGE(iTbs, RGSCH_NUM_ITBS - 1); + } + else + { + iTbs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1]; + } + iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs); + } + else /* CFI Changed. Update with new iTbs Reset the BLER*/ +#endif + { + S32 tmpiTbs = (*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][cfi]))[cqi]; + + iTbs = (ueDl->laCb[cwIdx].deltaiTbs + tmpiTbs*100)/100; + + RG_SCH_CHK_ITBS_RANGE(iTbs, tmpiTbs); + + iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs); + + ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1] = iTbs; + + ueDl->lastCfi = cfi; + ueDl->laCb[cwIdx].deltaiTbs = 0; + } + + RETVALUE(iTbs); +} + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 1/2/6/7. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRb1Tb1Cw + * Purpose: Allocate TB1 on CW1. + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRbTM1/2/6/7 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRb1Tb1Cw +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + S16 ret; + U8 numRb; + TRC2(rgSCHCmnDlAllocTxRb1Tb1Cw); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); +#ifdef RG_5GTF + if (ue->ue5gtfCb.rank == 2) + { + allocInfo->dciFormat = TFU_DCI_FORMAT_B2; + } + else + { + allocInfo->dciFormat = TFU_DCI_FORMAT_B1; + } +#else + allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ + allocInfo->raType); +#endif + ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ + bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + /* Adding UE to RbAllocInfo TX Lst */ + rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); + /* Fill UE alloc Info */ + allocInfo->rbsReq = numRb; + allocInfo->dlSf = subFrm; +#ifdef RG_5GTF + allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE; +#endif + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 1/2/6/7. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRb1Tb1Cw + * Purpose: Allocate TB1 on CW1. + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRbTM1/2/6/7 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRb1Tb1Cw +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + S16 ret; + U8 numRb; + TRC2(rgSCHCmnDlAllocRetxRb1Tb1Cw); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + +#ifndef RG_5GTF + /* 5GTF: RETX DCI format same as TX */ + allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ + &allocInfo->raType); +#endif + + /* Get the Allocation in terms of RBs that are required for + * this retx of TB1 */ + ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0], + 1, &numRb, effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + /* Fix : syed If TxRetx allocation failed then add the UE along with the proc + * to the nonSchdTxRetxUeLst and let spfc scheduler take care of it during + * finalization. */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + /* Fill UE alloc Info */ + allocInfo->rbsReq = numRb; + allocInfo->dlSf = subFrm; +#ifdef RG_5GTF + allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE; +#endif + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 2. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM1 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM1 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM1(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocTxRbTM1); + rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 2. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM1 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM1 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM1(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocRetxRbTM1); + rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 2. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM2 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM2 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM2(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocTxRbTM2); + rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 2. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM2 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM2 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM2(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocRetxRbTM2); + rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 3. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM3 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM3 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM3(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + + TRC2(rgSCHCmnDlAllocTxRbTM3); + + /* Both TBs free for TX allocation */ + rgSCHCmnDlTM3TxTx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 3. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM3 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM3 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM3(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + + TRC2(rgSCHCmnDlAllocRetxRbTM3); + + if ((proc->tbInfo[0].state == HQ_TB_NACKED) && + (proc->tbInfo[1].state == HQ_TB_NACKED)) + { +#ifdef LAA_DBG_LOG + printf ("RETX RB TM3 nack for both hqp %d cell %d \n", proc->procId, proc->hqE->cell->cellId); +#endif + /* Both TBs require RETX allocation */ + rgSCHCmnDlTM3RetxRetx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + } + else + { + /* One of the TBs need RETX allocation. Other TB may/maynot + * be available for new TX allocation. */ + rgSCHCmnDlTM3TxRetx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + } + + RETVOID; +} + + +/** + * @brief This function performs the DCI format selection in case of + * Transmit Diversity scheme where there can be more + * than 1 option for DCI format selection. + * + * @details + * + * Function: rgSCHCmnSlctPdcchFrmt + * Purpose: 1. If DLFS is enabled, then choose TM specific + * DCI format for Transmit diversity. All the + * TM Specific DCI Formats support Type0 and/or + * Type1 resource allocation scheme. DLFS + * supports only Type-0&1 Resource allocation. + * 2. If DLFS is not enabled, select a DCI format + * which is of smaller size. Since Non-DLFS + * scheduler supports all Resource allocation + * schemes, selection is based on efficiency. + * + * Invoked by: DL UE Allocation by Common Scheduler. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[out] U8 *raType + * @return TfuDciFormat + * + **/ +#ifdef ANSI +PUBLIC TfuDciFormat rgSCHCmnSlctPdcchFrmt +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 *raType +) +#else +PUBLIC TfuDciFormat rgSCHCmnSlctPdcchFrmt(cell, ue, raType) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 *raType; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHCmnSlctPdcchFrmt); + + /* ccpu00140894- Selective DCI Format and RA type should be selected only + * after TX Mode transition is completed*/ + if ((cellSch->dl.isDlFreqSel) && (ue->txModeTransCmplt)) + { + *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciRAType; + RETVALUE(rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciFrmt); + } + else + { + *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciRAType; + RETVALUE(rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciFrmt); + } +} + + +/** + * @brief This function handles Retx allocation in case of TM3 UEs + * where both the TBs were NACKED previously. + * + * @details + * + * Function: rgSCHCmnDlTM3RetxRetx + * Purpose: If forceTD flag enabled + * TD for TB1 on CW1. + * Else + * DCI Frmt 2A and RA Type 0 + * RI layered SM of both TBs on 2 CWs + * Add UE to cell Alloc Info. + * Fill UE alloc Info. + * + * + * Successful allocation is indicated by non-zero effBo value. + * + * Invoked by: rgSCHCmnDlAllocRbTM3 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM3RetxRetx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM3RetxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + S16 ret; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + Bool swpFlg; + U8 precInfo; + U8 noTxLyrs; + U8 precInfoAntIdx; + + TRC2(rgSCHCmnDlTM3RetxRetx); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + swpFlg = FALSE; +/* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */ + { + allocInfo->dciFormat = TFU_DCI_FORMAT_2A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE0; + + ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\ + effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + /* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */ + noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs; +#ifdef FOUR_TX_ANTENNA + /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1 should + * have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */ + if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2) + { + swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; + } +#endif + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); + } + +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to allocInfo RETX Lst */ + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + } + /* Fill UE alloc Info scratch pad */ + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ + precInfo, noTxLyrs, subFrm); + + RETVOID; +} + + +/** + * @brief This function handles Retx allocation in case of TM4 UEs + * where both the TBs were NACKED previously. + * + * @details + * + * Function: rgSCHCmnDlTM4RetxRetx + * Purpose: If forceTD flag enabled + * TD for TB1 on CW1. + * Else + * DCI Frmt 2 and RA Type 0 + * If RI == 1 + * 1 layer SM of TB1 on CW1. + * Else + * RI layered SM of both TBs on 2 CWs + * Add UE to cell Alloc Info. + * Fill UE alloc Info. + * + * + * Successful allocation is indicated by non-zero effBo value. + * + * Invoked by: rgSCHCmnDlAllocRbTM4 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM4RetxRetx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM4RetxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + S16 ret; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + Bool swpFlg = FALSE; + U8 precInfo; +#ifdef FOUR_TX_ANTENNA + U8 precInfoAntIdx; +#endif + U8 noTxLyrs; + + TRC2(rgSCHCmnDlTM4RetxRetx); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + /* Irrespective of RI Schedule both CWs */ + allocInfo->dciFormat = TFU_DCI_FORMAT_2; + allocInfo->raType = RG_SCH_CMN_RA_TYPE0; + + ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\ + effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs; + precInfo = 0; +#ifdef FOUR_TX_ANTENNA + /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1 + * should have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */ + if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2) + { + swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; +} +precInfoAntIdx = cell->numTxAntPorts/2 - 1; +precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); +#endif + +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to allocInfo RETX Lst */ + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + } + /* Fill UE alloc Info scratch pad */ + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ + precInfo, noTxLyrs, subFrm); + + RETVOID; +} + + + +/** + * @brief This function determines Transmission attributes + * incase of Spatial multiplexing for TX and RETX TBs. + * + * @details + * + * Function: rgSCHCmnDlSMGetAttrForTxRetx + * Purpose: 1. Reached here for a TM3/4 UE's HqP whose one of the TBs is + * NACKED and the other TB is either NACKED or WAITING. + * 2. Select the NACKED TB for RETX allocation. + * 3. Allocation preference for RETX TB by mapping it to a better + * CW (better in terms of efficiency). + * 4. Determine the state of the other TB. + * Determine if swapFlag were to be set. + * Swap flag would be set if Retx TB is cross + * mapped to a CW. + * 5. If UE has new data available for TX and if the other TB's state + * is ACKED then set furtherScope as TRUE. + * + * Invoked by: rgSCHCmnDlTM3[4]TxRetx + * + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchDlHqTbCb **retxTb + * @param[out] RgSchDlHqTbCb **txTb + * @param[out] Bool *frthrScp + * @param[out] Bool *swpFlg + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlSMGetAttrForTxRetx +( +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +RgSchDlHqTbCb **retxTb, +RgSchDlHqTbCb **txTb, +Bool *frthrScp, +Bool *swpFlg +) +#else +PRIVATE Void rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, frthrScp,\ + swpFlg) +RgSchUeCb *ue; +RgSchDlHqProcCb *proc; +RgSchDlHqTbCb **retxTb; +RgSchDlHqTbCb **txTb; +Bool *frthrScp; +Bool *swpFlg; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,proc->hqE->cell); + RgSchDlRbAlloc *allocInfo; + + TRC2(rgSCHCmnDlSMGetAttrForTxRetx); + + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + *retxTb = &proc->tbInfo[0]; + *txTb = &proc->tbInfo[1]; + /* TENB_BRDCM_TM4- Currently disabling swapflag for TM3/TM4, since + * HqFeedback processing does not consider a swapped hq feedback */ + if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 1)) + { + *swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; + } + if (proc->tbInfo[1].state == HQ_TB_ACKED) + { + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell); + *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData; + } + } + else + { + *retxTb = &proc->tbInfo[1]; + *txTb = &proc->tbInfo[0]; + /* TENB_BRDCM_TM4 - Currently disabling swapflag for TM3/TM4, since + * HqFeedback processing does not consider a swapped hq feedback */ + if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 0)) + { + *swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; + } + if (proc->tbInfo[0].state == HQ_TB_ACKED) + { + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell); + *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData; + } + } + RETVOID; +} + + +/** + * @brief Determine Precoding information for TM3 2 TX Antenna. + * + * @details + * + * Function: rgSCHCmnDlTM3PrecInf2 + * Purpose: + * + * Invoked by: rgSCHCmnDlGetAttrForTM3 + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 numTxLyrs + * @param[in] Bool bothCwEnbld + * @return U8 + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnDlTM3PrecInf2 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +) +#else +PRIVATE U8 rgSCHCmnDlTM3PrecInf2(ue, numTxLyrs, bothCwEnbld) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 numTxLyrs; +Bool bothCwEnbld; +#endif +{ + TRC2(rgSCHCmnDlTM3PrecInf2); + + RETVALUE(0); +} + + +/** + * @brief Determine Precoding information for TM4 2 TX Antenna. + * + * @details + * + * Function: rgSCHCmnDlTM4PrecInf2 + * Purpose: To determine a logic of deriving precoding index + * information from 36.212 table 5.3.3.1.5-4 + * + * Invoked by: rgSCHCmnDlGetAttrForTM4 + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 numTxLyrs + * @param[in] Bool bothCwEnbld + * @return U8 + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnDlTM4PrecInf2 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +) +#else +PRIVATE U8 rgSCHCmnDlTM4PrecInf2(ue, numTxLyrs, bothCwEnbld) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 numTxLyrs; +Bool bothCwEnbld; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 precIdx; + + TRC2(rgSCHCmnDlTM4PrecInf2); + + if (ueDl->mimoInfo.ri == numTxLyrs) + { + if (ueDl->mimoInfo.ri == 2) + { + /* PrecInfo corresponding to 2 CW + Transmission */ + if (ue->mimoInfo.puschFdbkVld) + { + precIdx = 2; + } + else + { + precIdx = ueDl->mimoInfo.pmi - 1; + } + } + else + { + /* PrecInfo corresponding to 1 CW + * Transmission */ + if (ue->mimoInfo.puschFdbkVld) + { + precIdx = 5; + } + else + { + precIdx = ueDl->mimoInfo.pmi + 1; + } + } + } + else if (ueDl->mimoInfo.ri > numTxLyrs) + { + /* In case of choosing among the columns of a + * precoding matrix, choose the column corresponding + * to the MAX-CQI */ + if (ue->mimoInfo.puschFdbkVld) + { + precIdx = 5; + } + else + { + precIdx = (ueDl->mimoInfo.pmi- 1)* 2 + 1; + } + } + else /* if RI < numTxLyrs */ + { + precIdx = (ueDl->mimoInfo.pmi < 2)? 0:1; + } + RETVALUE(precIdx); +} + + +/** + * @brief Determine Precoding information for TM3 4 TX Antenna. + * + * @details + * + * Function: rgSCHCmnDlTM3PrecInf4 + * Purpose: To determine a logic of deriving precoding index + * information from 36.212 table 5.3.3.1.5A-2 + * + * Invoked by: rgSCHCmnDlGetAttrForTM3 + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 numTxLyrs + * @param[in] Bool bothCwEnbld + * @return U8 + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnDlTM3PrecInf4 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +) +#else +PRIVATE U8 rgSCHCmnDlTM3PrecInf4(ue, numTxLyrs, bothCwEnbld) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 numTxLyrs; +Bool bothCwEnbld; +#endif +{ + U8 precIdx; + + TRC2(rgSCHCmnDlTM3PrecInf4); + + if (bothCwEnbld) + { + precIdx = numTxLyrs - 2; + } + else /* one 1 CW transmission */ + { + precIdx = 1; + } + RETVALUE(precIdx); +} + + +/** + * @brief Determine Precoding information for TM4 4 TX Antenna. + * + * @details + * + * Function: rgSCHCmnDlTM4PrecInf4 + * Purpose: To determine a logic of deriving precoding index + * information from 36.212 table 5.3.3.1.5-5 + * + * Invoked by: rgSCHCmnDlGetAttrForTM4 + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 numTxLyrs + * @param[in] Bool bothCwEnbld + * @return U8 + * + **/ +#ifdef ANSI +PRIVATE U8 rgSCHCmnDlTM4PrecInf4 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 numTxLyrs, +Bool bothCwEnbld +) +#else +PRIVATE U8 rgSCHCmnDlTM4PrecInf4(cell, ue, numTxLyrs, bothCwEnbld) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 numTxLyrs; +Bool bothCwEnbld; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 precInfoBaseIdx, precIdx; + + TRC2(rgSCHCmnDlTM4PrecInf4); + + precInfoBaseIdx = (ue->mimoInfo.puschFdbkVld)? (16): + (ueDl->mimoInfo.pmi); + if (bothCwEnbld) + { + precIdx = precInfoBaseIdx + (numTxLyrs-2)*17; + } + else /* one 1 CW transmission */ + { + precInfoBaseIdx += 1; + precIdx = precInfoBaseIdx + (numTxLyrs-1)*17; + } + RETVALUE(precIdx); +} + + +/** + * @brief This function determines Transmission attributes + * incase of TM3 scheduling. + * + * @details + * + * Function: rgSCHCmnDlGetAttrForTM3 + * Purpose: Determine retx TB and tx TB based on TB states. + * If forceTD enabled + * perform only retx TB allocation. + * If retxTB == TB2 then DCI Frmt = 2A, RA Type = 0. + * Else DCI Frmt and RA Type based on cell->isDlfsEnbld + * If RI == 1 + * perform retxTB allocation on CW1. + * Else if RI > 1 + * Determine further Scope and Swap Flag attributes + * assuming a 2 CW transmission of RetxTB and new Tx TB. + * If no further scope for new TX allocation + * Allocate only retx TB using 2 layers if + * this TB was previously transmitted using 2 layers AND + * number of Tx antenna ports == 4. + * otherwise do single layer precoding. + * + * Invoked by: rgSCHCmnDlTM3TxRetx + * + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @param[out] U8 *numTxLyrs + * @param[out] Bool *isTraDiv + * @param[out] U8 *prcdngInf + * @param[out] U8 *raType + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlGetAttrForTM3 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U8 *numTxLyrs, +TfuDciFormat *dciFrmt, +U8 *prcdngInf, +RgSchDlHqTbCb **retxTb, +RgSchDlHqTbCb **txTb, +Bool *frthrScp, +Bool *swpFlg, +U8 *raType +) +#else +PRIVATE Void rgSCHCmnDlGetAttrForTM3(cell, ue, proc, numTxLyrs, dciFrmt,\ + prcdngInf, retxTb, txTb, frthrScp, swpFlg, raType) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlHqProcCb *proc; +U8 *numTxLyrs; +TfuDciFormat *dciFrmt; +U8 *prcdngInf; +RgSchDlHqTbCb **retxTb; +RgSchDlHqTbCb **txTb; +Bool *frthrScp; +Bool *swpFlg; +U8 *raType; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 precInfoAntIdx; + + TRC2(rgSCHCmnDlGetAttrForTM3); + + /* Avoiding Tx-Retx for LAA cell as firstSchedTime is associated with + HQP */ + /* Integration_fix: SPS Proc shall always have only one Cw */ +#ifdef LTEMAC_SPS + if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD)) +#ifdef LTE_ADV + ||(TRUE == rgSCHLaaSCellEnabled(cell)) +#endif + ) +#else + if ((ueDl->mimoInfo.forceTD) +#ifdef LTE_ADV + || (TRUE == rgSCHLaaSCellEnabled(cell)) +#endif + ) +#endif + { + /* Transmit Diversity. Format based on dlfsEnabled + * No further scope */ + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + *retxTb = &proc->tbInfo[0]; + *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); + } + else + { + *retxTb = &proc->tbInfo[1]; + *dciFrmt = TFU_DCI_FORMAT_2A; + *raType = RG_SCH_CMN_RA_TYPE0; + } + *numTxLyrs = 1; + *frthrScp = FALSE; + *prcdngInf = 0; + RETVOID; + } + + /* Determine the 2 TB transmission attributes */ + rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \ + frthrScp, swpFlg); + if (*frthrScp) + { + /* Prefer allocation of RETX TB over 2 layers rather than combining + * it with a new TX. */ + if ((ueDl->mimoInfo.ri == 2) + && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4)) + { + /* Allocate TB on CW1, using 2 Lyrs, + * Format 2, precoding accordingly */ + *numTxLyrs = 2; + *frthrScp = FALSE; + } + else + { + *numTxLyrs= ((*retxTb)->numLyrs + ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)].noLyr); + + if((*retxTb)->tbIdx == 0 && ((*retxTb)->numLyrs == 2 ) && *numTxLyrs ==3) + { + *swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; + } + else if((*retxTb)->tbIdx == 1 && ((*retxTb)->numLyrs == 1) && *numTxLyrs ==3) + { + *swpFlg = TRUE; + proc->cwSwpEnabled = TRUE; + } + } + + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])\ + (cell, ue, ueDl->mimoInfo.ri, *frthrScp); + *dciFrmt = TFU_DCI_FORMAT_2A; + *raType = RG_SCH_CMN_RA_TYPE0; + } + else /* frthrScp == FALSE */ + { + if (cell->numTxAntPorts == 2) + { + /* Transmit Diversity */ + *numTxLyrs = 1; + if ((*retxTb)->tbIdx == 0) + { + *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); + } + else + { + /* If retxTB is TB2 then use format 2A */ + *dciFrmt = TFU_DCI_FORMAT_2A; + *raType = RG_SCH_CMN_RA_TYPE0; + } + *prcdngInf = 0; + RETVOID; + } + else /* NumAntPorts == 4 */ + { + if ((*retxTb)->numLyrs == 2) + { + /* Allocate TB on CW1, using 2 Lyrs, + * Format 2A, precoding accordingly */ + *numTxLyrs = 2; + *dciFrmt = TFU_DCI_FORMAT_2A; + *raType = RG_SCH_CMN_RA_TYPE0; + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, *numTxLyrs, *frthrScp); + RETVOID; + } + else + { + /* Transmit Diversity */ + *numTxLyrs = 1; + if ((*retxTb)->tbIdx == 0) + { + *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); + } + else + { + /* If retxTB is TB2 then use format 2A */ + *dciFrmt = TFU_DCI_FORMAT_2A; + *raType = RG_SCH_CMN_RA_TYPE0; + } + *prcdngInf = 0; + RETVOID; + } + } + } + + RETVOID; +} + + + +/** + * @brief This function determines Transmission attributes + * incase of TM4 scheduling. + * + * @details + * + * Function: rgSCHCmnDlGetAttrForTM4 + * Purpose: Determine retx TB and tx TB based on TB states. + * If forceTD enabled + * perform only retx TB allocation. + * If retxTB == TB2 then DCI Frmt = 2, RA Type = 0. + * Else DCI Frmt and RA Type based on cell->isDlfsEnbld + * If RI == 1 + * perform retxTB allocation on CW1. + * Else if RI > 1 + * Determine further Scope and Swap Flag attributes + * assuming a 2 CW transmission of RetxTB and new Tx TB. + * If no further scope for new TX allocation + * Allocate only retx TB using 2 layers if + * this TB was previously transmitted using 2 layers AND + * number of Tx antenna ports == 4. + * otherwise do single layer precoding. + * + * Invoked by: rgSCHCmnDlTM4TxRetx + * + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @param[out] U8 *numTxLyrs + * @param[out] Bool *isTraDiv + * @param[out] U8 *prcdngInf + * @param[out] U8 *raType + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlGetAttrForTM4 +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U8 *numTxLyrs, +TfuDciFormat *dciFrmt, +U8 *prcdngInf, +RgSchDlHqTbCb **retxTb, +RgSchDlHqTbCb **txTb, +Bool *frthrScp, +Bool *swpFlg, +U8 *raType +) +#else +PRIVATE Void rgSCHCmnDlGetAttrForTM4(cell, ue, proc, numTxLyrs, dciFrmt,\ + prcdngInf, retxTb, txTb, frthrScp, swpFlg, raType) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlHqProcCb *proc; +U8 *numTxLyrs; +TfuDciFormat *dciFrmt; +U8 *prcdngInf; +RgSchDlHqTbCb **retxTb; +RgSchDlHqTbCb **txTb; +Bool *frthrScp; +Bool *swpFlg; +U8 *raType; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + U8 precInfoAntIdx; + + TRC2(rgSCHCmnDlGetAttrForTM4); + + *frthrScp = FALSE; + /* Integration_fix: SPS Proc shall always have only one Cw */ +#ifdef LTEMAC_SPS + if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD)) +#ifdef LTE_ADV + ||(TRUE == rgSCHLaaSCellEnabled(cell)) +#endif + ) +#else + if ((ueDl->mimoInfo.forceTD) +#ifdef LTE_ADV + || (TRUE == rgSCHLaaSCellEnabled(cell)) +#endif + ) +#endif + { + /* Transmit Diversity. Format based on dlfsEnabled + * No further scope */ + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + *retxTb = &proc->tbInfo[0]; + *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType); + } + else + { + *retxTb = &proc->tbInfo[1]; + *dciFrmt = TFU_DCI_FORMAT_2; + *raType = RG_SCH_CMN_RA_TYPE0; + } + *numTxLyrs = 1; + *frthrScp = FALSE; + *prcdngInf = 0; + RETVOID; + } + + if (ueDl->mimoInfo.ri == 1) + { + /* single layer precoding. Format 2. + * No further scope */ + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + *retxTb = &proc->tbInfo[0]; + } + else + { + *retxTb = &proc->tbInfo[1]; + } + *numTxLyrs = 1; + *dciFrmt = TFU_DCI_FORMAT_2; + *raType = RG_SCH_CMN_RA_TYPE0; + *frthrScp = FALSE; + *prcdngInf = 0; /*When RI= 1*/ + RETVOID; + } + + /* Determine the 2 TB transmission attributes */ + rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \ + frthrScp, swpFlg); + *dciFrmt = TFU_DCI_FORMAT_2; + *raType = RG_SCH_CMN_RA_TYPE0; + if (*frthrScp) + { + /* Prefer allocation of RETX TB over 2 layers rather than combining + * it with a new TX. */ + if ((ueDl->mimoInfo.ri == 2) + && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4)) + { + /* Allocate TB on CW1, using 2 Lyrs, + * Format 2, precoding accordingly */ + *numTxLyrs = 2; + *frthrScp = FALSE; + } + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx]) + (cell, ue, ueDl->mimoInfo.ri, *frthrScp); + } + else /* frthrScp == FALSE */ + { + if (cell->numTxAntPorts == 2) + { + /* single layer precoding. Format 2. */ + *numTxLyrs = 1; + *prcdngInf = (getPrecInfoFunc[1][cell->numTxAntPorts/2 - 1])\ + (cell, ue, *numTxLyrs, *frthrScp); + RETVOID; + } + else /* NumAntPorts == 4 */ + { + if ((*retxTb)->numLyrs == 2) + { + /* Allocate TB on CW1, using 2 Lyrs, + * Format 2, precoding accordingly */ + *numTxLyrs = 2; + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\ + (cell, ue, *numTxLyrs, *frthrScp); + RETVOID; + } + else + { + /* Allocate TB with 1 lyr precoding, + * Format 2, precoding info accordingly */ + *numTxLyrs = 1; + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\ + (cell, ue, *numTxLyrs, *frthrScp); + RETVOID; + } + } + } + + RETVOID; +} + + +/** + * @brief This function handles Retx allocation in case of TM3 UEs + * where previously one of the TBs was NACKED and the other + * TB is either ACKED/WAITING. + * + * @details + * + * Function: rgSCHCmnDlTM3TxRetx + * Purpose: Determine the TX attributes for TM3 TxRetx Allocation. + * If futher Scope for New Tx Allocation on other TB + * Perform RETX alloc'n on 1 CW and TX alloc'n on other. + * Add UE to cell wide RetxTx List. + * Else + * Perform only RETX alloc'n on CW1. + * Add UE to cell wide Retx List. + * + * effBo is set to a non-zero value if allocation is + * successful. + * + * Invoked by: rgSCHCmnDlAllocRbTM3 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM3TxRetx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM3TxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + S16 ret; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + RgSchDlHqTbCb *retxTb, *txTb; + Bool frthrScp; + Bool swpFlg; + U8 prcdngInf; + U8 numTxLyrs; + + TRC2(rgSCHCmnDlTM3TxRetx); + frthrScp = FALSE; + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + swpFlg = FALSE; + + /* Determine the transmission attributes */ + rgSCHCmnDlGetAttrForTM3(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\ + &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\ + &allocInfo->raType); + + if (frthrScp) + { +#ifdef LAA_DBG_LOG + printf ("TX RETX called from proc %d cell %d \n",proc->procId, cell->cellId); +#endif + ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\ + &numRb, effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + /* Adding UE to RbAllocInfo RETX-TX Lst */ + rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc); + } + else + { + ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb, + numTxLyrs, &numRb, effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to allocInfo RETX Lst */ + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + } + } + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ + prcdngInf, numTxLyrs, subFrm); + + RETVOID; +} + + +/** + * @brief This function handles Retx allocation in case of TM4 UEs + * where previously one of the TBs was NACKED and the other + * TB is either ACKED/WAITING. + * + * @details + * + * Function: rgSCHCmnDlTM4TxRetx + * Purpose: Determine the TX attributes for TM4 TxRetx Allocation. + * If futher Scope for New Tx Allocation on other TB + * Perform RETX alloc'n on 1 CW and TX alloc'n on other. + * Add UE to cell wide RetxTx List. + * Else + * Perform only RETX alloc'n on CW1. + * Add UE to cell wide Retx List. + * + * effBo is set to a non-zero value if allocation is + * successful. + * + * Invoked by: rgSCHCmnDlAllocRbTM4 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM4TxRetx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM4TxRetx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + S16 ret; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + RgSchDlHqTbCb *retxTb, *txTb; + Bool frthrScp; + Bool swpFlg; + U8 prcdngInf; + U8 numTxLyrs; + + TRC2(rgSCHCmnDlTM4TxRetx); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + swpFlg = FALSE; + + /* Determine the transmission attributes */ + rgSCHCmnDlGetAttrForTM4(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\ + &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\ + &allocInfo->raType); + + if (frthrScp) + { + ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\ + &numRb, effBo); + if (ret == RFAILED) + { + /* Fix : syed If TxRetx allocation failed then add the UE along + * with the proc to the nonSchdTxRetxUeLst and let spfc scheduler + * take care of it during finalization. */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + /* Adding UE to RbAllocInfo RETX-TX Lst */ + rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc); + } + else + { + ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb, + numTxLyrs, &numRb, effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to allocInfo RETX Lst */ + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + } + } + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \ + prcdngInf, numTxLyrs, subFrm) + + RETVOID; +} + + +/** + * @brief This function handles Retx allocation in case of TM4 UEs + * where previously both the TBs were ACKED and ACKED + * respectively. + * + * @details + * + * Function: rgSCHCmnDlTM3TxTx + * Purpose: Reached here for a TM3 UE's HqP's fresh allocation + * where both the TBs are free for TX scheduling. + * If forceTD flag is set + * perform TD on CW1 with TB1. + * precInfo = 0 + * else + * DCI Format = 2A. + * RA Type = Type0. + * RI layered precoding 2 TB on 2 CW. + * Set precoding info. + * Add UE to cellAllocInfo. + * Fill ueAllocInfo. + * + * effBo is set to a non-zero value if allocation is + * successful. + * + * Invoked by: rgSCHCmnDlAllocRbTM3 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM3TxTx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM3TxTx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchCmnDlUe *ueDl; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + U8 noTxLyrs; + U8 precInfo; + S16 ret; + U8 precInfoAntIdx; + + TRC2(rgSCHCmnDlTM3TxTx); + + ret = ROK; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + /* Integration_fix: SPS Proc shall always have only one Cw */ +#ifdef LTEMAC_SPS +#ifdef FOUR_TX_ANTENNA + if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */ +#else + if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD)) +#endif +#else + if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */ +#endif + { + allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ + &allocInfo->raType); + ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ + bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + noTxLyrs = 1; + precInfo = 0; /* TD */ + } + else /* Precoding */ + { + allocInfo->dciFormat = TFU_DCI_FORMAT_2A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE0; + + /* Spatial Multiplexing using 2 CWs */ + ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + noTxLyrs = ueDl->mimoInfo.ri; + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, getPrecInfoFunc[0], precInfoAntIdx); + precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); + } + +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to RbAllocInfo TX Lst */ + rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); + } + /* Fill UE allocInfo scrath pad */ + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \ + precInfo, noTxLyrs, subFrm); + + RETVOID; +} + + +/** + * @brief This function handles Retx allocation in case of TM4 UEs + * where previously both the TBs were ACKED and ACKED + * respectively. + * + * @details + * + * Function: rgSCHCmnDlTM4TxTx + * Purpose: Reached here for a TM4 UE's HqP's fresh allocation + * where both the TBs are free for TX scheduling. + * If forceTD flag is set + * perform TD on CW1 with TB1. + * precInfo = 0 + * else + * DCI Format = 2. + * RA Type = Type0. + * If Rank == 1 + * Single layer precoding of TB1 on CW1. + * Set precoding info. + * else + * RI layered precoding 2 TB on 2 CW. + * Set precoding info. + * Add UE to cellAllocInfo. + * Fill ueAllocInfo. + * + * effBo is set to a non-zero value if allocation is + * successful. + * + * Invoked by: rgSCHCmnDlAllocRbTM4 + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlTM4TxTx +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlTM4TxTx(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchCmnDlUe *ueDl; + RgSchDlRbAlloc *allocInfo; + U8 numRb; + U8 precInfo; + U8 noTxLyrs; + U8 precInfoAntIdx; + S16 ret; + + TRC2(rgSCHCmnDlTM4TxTx); + + ret = ROK; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + /* Integration_fix: SPS Proc shall always have only one Cw */ +#ifdef LTEMAC_SPS +#ifdef FOUR_TX_ANTENNA + if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */ +#else + if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) || + (ueDl->mimoInfo.forceTD)) +#endif +#else + if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */ +#endif + { + allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \ + &allocInfo->raType); + + ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ + bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + noTxLyrs = 1; + precInfo = 0; /* TD */ + } + else /* Precoding */ + { + allocInfo->dciFormat = TFU_DCI_FORMAT_2; + allocInfo->raType = RG_SCH_CMN_RA_TYPE0; + + if (ueDl->mimoInfo.ri == 1) + { + /* Single Layer SM using FORMAT 2 */ + ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ + bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + noTxLyrs = 1; + precInfo = 0; /* PrecInfo as 0 for RI=1*/ + } + else + { + /* Spatial Multiplexing using 2 CWs */ + ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + noTxLyrs = ueDl->mimoInfo.ri; + precInfoAntIdx = cell->numTxAntPorts/2 - 1; + precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE); + } + } + + +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to RbAllocInfo TX Lst */ + rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); + } + + /* Fill UE allocInfo scrath pad */ + RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \ + precInfo, noTxLyrs, subFrm); + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 4. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM4 + * Purpose: Invokes the functionality particular to the + * current state of the TBs of the "proc". + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM4 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM4(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocTxRbTM4); + + /* Both TBs free for TX allocation */ + rgSCHCmnDlTM4TxTx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 4. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM4 + * Purpose: Invokes the functionality particular to the + * current state of the TBs of the "proc". + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM4 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM4(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocRetxRbTM4); + + if ((proc->tbInfo[0].state == HQ_TB_NACKED) && + (proc->tbInfo[1].state == HQ_TB_NACKED)) + { + /* Both TBs require RETX allocation */ + rgSCHCmnDlTM4RetxRetx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + } + else + { + /* One of the TBs need RETX allocation. Other TB may/maynot + * be available for new TX allocation. */ + rgSCHCmnDlTM4TxRetx(cell, subFrm, ue, bo, effBo,\ + proc, cellWdAllocInfo); + } + + RETVOID; +} + +#ifdef RG_UNUSED + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 5. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM5 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM5 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM5(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocTxRbTM5); +#if (ERRCLASS & ERRCLS_DEBUG) + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Invalid TM 5 for CRNTI:%d",ue->ueId); +#endif + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 5. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM5 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM5 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM5(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocRetxRbTM5); +#if (ERRCLASS & ERRCLS_DEBUG) + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Invalid TM 5 for CRNTI:%d",ue->ueId); +#endif + RETVOID; +} +#endif + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 6. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM6 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM6 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM6(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *ueDl; + S16 ret; + U8 numRb; + + TRC2(rgSCHCmnDlAllocTxRbTM6); + + ret = ROK; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + if (ueDl->mimoInfo.forceTD) + { + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + } + else + { + allocInfo->dciFormat = TFU_DCI_FORMAT_1B; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + /* Fill precoding information for FORMAT 1B */ + /* First 4 least significant bits to indicate PMI. + * 4th most significant corresponds to pmi Confirmation. + */ + allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4; + allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi; + } + ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\ + bo, &numRb, effBo); + if (ret == RFAILED) + { + /* If allocation couldn't be made then return */ + RETVOID; + } + +#ifdef LTEMAC_SPS + if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) +#endif + { + /* Adding UE to RbAllocInfo TX Lst */ + rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc); + } + /* Fill UE alloc Info */ + allocInfo->rbsReq = numRb; + allocInfo->dlSf = subFrm; + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 6. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM6 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM6 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM6(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + RgSchCmnDlUe *ueDl; + S16 ret; + U8 numRb; + + TRC2(rgSCHCmnDlAllocRetxRbTM6); + + ret = ROK; + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + if (ueDl->mimoInfo.forceTD) + { + allocInfo->dciFormat = TFU_DCI_FORMAT_1A; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + } + else + { + allocInfo->dciFormat = TFU_DCI_FORMAT_1B; + allocInfo->raType = RG_SCH_CMN_RA_TYPE2; + /* Fill precoding information for FORMAT 1B */ + /* First 4 least significant bits to indicate PMI. + * 4th most significant corresponds to pmi Confirmation. + */ + allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4; + allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi; + } + + /* Get the Allocation in terms of RBs that are required for + * this retx of TB1 */ + ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0], + 1, &numRb, effBo); + if (ret == RFAILED) + { + /* Allocation couldn't be made for Retx */ + rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc); + RETVOID; + } + /* Adding UE to allocInfo RETX Lst */ + rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc); + /* Fill UE alloc Info */ + allocInfo->rbsReq = numRb; + allocInfo->dlSf = subFrm; + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * transmission for UEs configured with TM 7. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRbTM7 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocTxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocTxRbTM7 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocTxRbTM7(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocTxRbTM7); + rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * retransmission for UEs configured with TM 7. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRbTM7 + * Purpose: + * + * Reference Parameter effBo is filled with alloced bytes. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlAllocRetxRbTM7 +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PRIVATE Void rgSCHCmnDlAllocRetxRbTM7(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + TRC2(rgSCHCmnDlAllocRetxRbTM7); + rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo); + RETVOID; +} + + +/** + * @brief This function invokes the TM specific DL TX RB Allocation routine. + * + * @details + * + * Function: rgSCHCmnDlAllocTxRb + * Purpose: This function invokes the TM specific + * DL TX RB Allocation routine. + * + * Invoked by: Specific Schedulers + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnDlAllocTxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PUBLIC S16 rgSCHCmnDlAllocTxRb(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + U32 newSchBits = 0; + U32 prevSchBits = 0; + RgSchDlRbAlloc *allocInfo; + + TRC2(rgSCHCmnDlAllocTxRb); + + if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) )) + { + ue->dl.aggTbBits = 0; + } + *effBo = 0; + + /* Calculate totals bits previously allocated */ + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + if (allocInfo->tbInfo[0].schdlngForTb) + { + prevSchBits += allocInfo->tbInfo[0].bytesReq; + } + if (allocInfo->tbInfo[1].schdlngForTb) + { + prevSchBits += allocInfo->tbInfo[1].bytesReq; + } + + /* Call TM specific RB allocation routine */ + (dlAllocTxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \ + proc, cellWdAllocInfo); + + if (*effBo) + { + /* Calculate totals bits newly allocated */ + if (allocInfo->tbInfo[0].schdlngForTb) + { + newSchBits += allocInfo->tbInfo[0].bytesReq; + } + if (allocInfo->tbInfo[1].schdlngForTb) + { + newSchBits += allocInfo->tbInfo[1].bytesReq; + } + if (newSchBits > prevSchBits) + { + ue->dl.aggTbBits += ((newSchBits - prevSchBits) * 8); + RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime)) + } + } + + RETVALUE(ROK); +} + +/* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD +/** + * @brief Retransmit decision for TDD. Retx is avoided in below cases + * 1) DL Sf -> Spl Sf + * 2) DL SF -> DL SF 0 + * + * @details + * + * Function: rgSCHCmnRetxAvoidTdd + * Purpose: Avoid allocating RETX for cases 1, 2 + * + * Invoked by: rgSCHCmnRetxAvoidTdd + * + * @param[in] RgSchDlSf *curSf + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlHqProcCb *proc + * @return Bool + * + **/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnRetxAvoidTdd +( +RgSchDlSf *curSf, +RgSchCellCb *cell, +RgSchDlHqProcCb *proc +) +#else +PUBLIC Bool rgSCHCmnRetxAvoidTdd(curSf, cell, proc) +RgSchDlSf *curSf; +RgSchCellCb *cell; +RgSchDlHqProcCb *proc; +#endif +{ + RgSchTddSfType txSfType = 0; + + TRC2(rgSCHCmnRetxAvoidTdd); + + /* Get the RBs of TB that will be retransmitted */ + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + txSfType = proc->tbInfo[0].sfType; + +#ifdef XEON_SPECIFIC_CHANGES +#ifndef XEON_TDD_SPCL + /* Avoid re-transmission on Normal SF when the corresponding TB wss transmitted on SPCL SF */ + if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0) + { + RETVALUE(TRUE); + } +#endif +#endif + } + if (proc->tbInfo[1].state == HQ_TB_NACKED) + { + /* Select the TxSf with the highest num of possible REs + * In ascending order -> 1) SPL SF 2) DL_SF_0 3) DL_SF */ + txSfType = RGSCH_MAX(txSfType, proc->tbInfo[1].sfType); + +#ifdef XEON_SPECIFIC_CHANGES +#ifndef XEON_TDD_SPCL + /* Avoid re-transmission on Normal SF when the corresponding TB wss tranmitted on SPCL SF */ + if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0) + { + RETVALUE(TRUE); + } +#endif +#endif + } + + if (txSfType > curSf->sfType) + { + /* Avoid retx */ + RETVALUE(TRUE); + } + + /* Allow Retx */ + RETVALUE(FALSE); +} + +#else +/* DwPTS Scheduling Changes End */ + +/** + * @brief Avoid allocating RETX incase of collision + * with reserved resources for BCH/PSS/SSS occassions. + * + * @details + * + * Function: rgSCHCmnRetxAllocAvoid + * Purpose: Avoid allocating RETX incase of collision + * with reserved resources for BCH/PSS/SSS occassions + * + * Invoked by: rgSCHCmnDlAllocRetxRb + * + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @return Bool + * + **/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnRetxAllocAvoid +( +RgSchDlSf *subFrm, +RgSchCellCb *cell, +RgSchDlHqProcCb *proc +) +#else +PUBLIC Bool rgSCHCmnRetxAllocAvoid(subFrm, cell, proc) +RgSchDlSf *subFrm; +RgSchCellCb *cell; +RgSchDlHqProcCb *proc; +#endif +{ + U8 reqRbs; + + TRC2(rgSCHCmnRetxAllocAvoid); + + if (proc->tbInfo[0].state == HQ_TB_NACKED) + { + reqRbs = proc->tbInfo[0].dlGrnt.numRb; + } + else + { + reqRbs = proc->tbInfo[1].dlGrnt.numRb; + } + /* Consider the dlGrnt.numRb of the Retransmitting proc->tbInfo + * and current available RBs to determine if this RETX TB + * will collide with the BCH/PSS/SSS occassion */ + if (subFrm->sfNum % 5 == 0) + { + if ((subFrm->bwAssigned < cell->pbchRbEnd) && + (((subFrm->bwAssigned + reqRbs) - cell->pbchRbStart) > 0)) + { + RETVALUE(TRUE); + } + } + RETVALUE(FALSE); +} + +#endif + + +/** + * @brief This function invokes the TM specific DL RETX RB Allocation routine. + * + * @details + * + * Function: rgSCHCmnDlAllocRetxRb + * Purpose: This function invokes the TM specific + * DL RETX RB Allocation routine. + * + * Invoked by: Specific Schedulers + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *effBo + * @param[in] RgSchDlHqProcCb *proc + * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnDlAllocRetxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +U32 bo, +U32 *effBo, +RgSchDlHqProcCb *proc, +RgSchCmnDlRbAllocInfo *cellWdAllocInfo +) +#else +PUBLIC S16 rgSCHCmnDlAllocRetxRb(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +U32 bo; +U32 *effBo; +RgSchDlHqProcCb *proc; +RgSchCmnDlRbAllocInfo *cellWdAllocInfo; +#endif +{ + U32 newSchBits = 0; + RgSchDlRbAlloc *allocInfo; + + TRC2(rgSCHCmnDlAllocRetxRb); + + if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) )) + { + ue->dl.aggTbBits = 0; + } + + *effBo = 0; + /* Check for DL BW exhaustion */ + if (subFrm->bw <= subFrm->bwAssigned) + { + RETVALUE(RFAILED); + } + /* Call TM specific RB allocation routine */ + (dlAllocRetxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \ + proc, cellWdAllocInfo); + + if (*effBo) + { + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + /* Calculate totals bits newly allocated */ + if (allocInfo->tbInfo[0].schdlngForTb) + { + newSchBits += allocInfo->tbInfo[0].bytesReq; + } + if (allocInfo->tbInfo[1].schdlngForTb) + { + newSchBits += allocInfo->tbInfo[1].bytesReq; + } + ue->dl.aggTbBits += (newSchBits * 8); + RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime)) + } + + RETVALUE(ROK); +} + + +/** + * @brief This function determines the RBs and Bytes required for + * Transmission on 1 CW. + * + * @details + * + * Function: rgSCHCmnDlAlloc1CwTxRb + * Purpose: This function determines the RBs and Bytes required + * for Transmission of DL SVC BO on 1 CW. + * Also, takes care of SVC by SVC allocation by tracking + * previous SVCs allocations. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: DL UE Allocation + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqTbCb *tbInfo + * @param[in] U32 bo + * @param[out] U8 *numRb + * @param[out] U32 *effBo + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *tbInfo, +U32 bo, +U8 *numRb, +U32 *effBo +) +#else +PRIVATE S16 rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, tbInfo, bo, numRb, effBo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +RgSchDlHqTbCb *tbInfo; +U32 bo; +U8 *numRb; +U32 *effBo; +#endif +{ + U32 tbSz; + U8 imcs; + U8 iTbs; + RgSchCmnDlUe *ueDl; + RgSchDlRbAlloc *allocInfo; + U32 oldReq; + U32 reqBytes; + /* Correcting wrap around issue. + * This change has been done at mutliple places in this function.*/ + U32 tempNumRb; + TRC2(rgSCHCmnDlAlloc1CwTxRb); + + reqBytes = bo; + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + oldReq = ueDl->outStndAlloc; + +#ifdef RG_5GTF + //TODO_SID: Currently setting max Tb size wrt to 5GTF TM3 + iTbs = ue->ue5gtfCb.mcs; + ueDl->maxTbSz = MAX_5GTF_TB_SIZE * ue->ue5gtfCb.rank; + ueDl->maxRb = MAX_5GTF_PRBS; +#endif + ueDl->outStndAlloc += bo; + /* consider Cumulative amount of this BO and bytes so far allocated */ + bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbSz/8); + /* Get the number of REs needed for this bo. */ + //noRes = ((bo * 8 * 1024) / eff); + + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + //tempNumRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]); + tempNumRb = MAX_5GTF_PRBS; + tbSz = RGSCH_MIN(bo, (rgSch5gtfTbSzTbl[iTbs]/8) * ue->ue5gtfCb.rank); + + /* DwPts Scheduling Changes End */ + *effBo = RGSCH_MIN(tbSz - oldReq, reqBytes); + +#ifdef RG_5GTF + //RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs); + imcs = iTbs; +#endif + + + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbSz, \ + iTbs, imcs, tbInfo, ue->ue5gtfCb.rank); + *numRb = (U8) tempNumRb; + + /* Update the subframe Allocated BW field */ + subFrm->bwAssigned = subFrm->bwAssigned + tempNumRb - allocInfo->rbsReq; + + RETVALUE(ROK); +} + + +/** + * @brief This function is invoked in the event of any TB's allocation + * being underutilized by the specific scheduler. Here we reduce iMcs + * to increase redundancy and hence increase reception quality at UE. + * + * @details + * + * Function: rgSCHCmnRdcImcsTxTb + * Purpose: This function shall reduce the iMcs in accordance with + * the total consumed bytes by the UE at allocation + * finalization. + * + * Invoked by: UE DL Allocation finalization routine + * of specific scheduler. + * + * @param[in] RgSchDlRbAlloc *allocInfo + * @param[in] U8 tbInfoIdx + * @param[in] U32 cnsmdBytes + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnRdcImcsTxTb +( +RgSchDlRbAlloc *allocInfo, +U8 tbInfoIdx, +U32 cnsmdBytes +) +#else +PUBLIC Void rgSCHCmnRdcImcsTxTb(allocInfo, tbInfoIdx, cnsmdBytes) +RgSchDlRbAlloc *allocInfo; +U8 tbInfoIdx; +U32 cnsmdBytes; +#endif +{ + RETVOID; + /*The below functionality is not needed.*/ + U8 noLyr; + U8 iTbs; + U16 numRb; + + TRC2(rgSCHCmnRdcImcsTxTb); + + iTbs = allocInfo->tbInfo[tbInfoIdx].iTbs; + noLyr = allocInfo->tbInfo[tbInfoIdx].noLyr; + numRb = allocInfo->rbsAlloc; + if ( numRb > 0) + { + if ((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) == cnsmdBytes) + { + RETVOID; + } + } + /* Get iTbs as suitable for the consumed bytes */ + while((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) > cnsmdBytes) + { + if (iTbs == 0) + { + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].\ + tbCb->dlGrnt.iMcs); + RETVOID; + } + iTbs--; + } + iTbs++; + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].tbCb->dlGrnt.iMcs); + + RETVOID; +} + + +/** + * @brief This function determines the RBs and Bytes required for + * Transmission on 2 CWs. + * + * @details + * + * Function: rgSCHCmnDlAlloc2CwTxRb + * Purpose: This function determines the RBs and Bytes required + * for Transmission of DL SVC BO on 2 CWs. + * Also, takes care of SVC by SVC allocation by tracking + * previous SVCs allocations. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: TM3 and TM4 DL UE Allocation + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @param[in] RgSchDlHqProcCb bo + * @param[out] U8 *numRb + * @param[out] U32 *effBo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U32 bo, +U8 *numRbRef, +U32 *effBo +) +#else +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, numRbRef, effBo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +RgSchDlHqProcCb *proc; +U32 bo; +U8 *numRbRef; +U32 *effBo; +#endif +{ + U32 noRes; + U32 eff1, eff2; + U32 tb1Sz, tb2Sz; + U8 imcs1, imcs2; + U8 noLyr1, noLyr2; + U8 iTbs1, iTbs2; + RgSchCmnDlCell *cellDl; + RgSchCmnDlUe *ueDl; + RgSchDlRbAlloc *allocInfo; + U32 oldReq; + U32 reqBytes; + /* Fix: MUE_PERTTI_DL */ + U32 numRb; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + U8 cfi = cellSch->dl.currCfi; + S16 availBw; + U32 availBits = 0; +#ifdef LTE_ADV + U32 boTmp = bo; +#endif + + TRC2(rgSCHCmnDlAlloc2CwTxRb); + + reqBytes = bo; + cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + oldReq = ueDl->outStndAlloc; + + + if (ueDl->maxTbBits > ue->dl.aggTbBits) + { + availBits = ueDl->maxTbBits - ue->dl.aggTbBits; + } + /* check if we can further allocate to this UE */ + if ((ue->dl.aggTbBits >= ueDl->maxTbBits) || + (allocInfo->tbInfo[0].bytesReq >= ueDl->maxTbSz/8) || + (allocInfo->tbInfo[1].bytesReq >= ueDl->maxTbSz/8) || + (allocInfo->rbsReq >= ueDl->maxRb)) + { + RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId, + "rgSCHCmnDlAllocRb(): UEs max allocation exceed"); + RETVALUE(RFAILED); + } + + noLyr1 = ueDl->mimoInfo.cwInfo[0].noLyr; + noLyr2 = ueDl->mimoInfo.cwInfo[1].noLyr; + + /* If there is no CFI change, continue to use the BLER based + * iTBS value */ + if (ueDl->lastCfi == cfi) + { + iTbs1 = ueDl->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1]; + iTbs2 = ueDl->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1]; + } + else + { + U8 cqi = ueDl->mimoInfo.cwInfo[0].cqi; +#ifdef LTE_TDD + iTbs1 = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 0, noLyr1); +#else + iTbs1 = (U8) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 0, noLyr1); +#endif + + cqi = ueDl->mimoInfo.cwInfo[1].cqi; +#ifdef LTE_TDD + iTbs2 = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 1, noLyr2); +#else + iTbs2 = (U8) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 1, noLyr2); +#endif + } + + /*ccpu00131191 and ccpu00131317 - Fix for RRC Reconfig failure + * issue for VoLTE call */ + //if ((proc->hasDcch) || (TRUE == rgSCHLaaSCellEnabled(cell))) + if (proc->hasDcch) + { + if (iTbs1 > 5) + { + iTbs1 = iTbs1 - 5; + } + else + { + iTbs1 = 0; + } + if (iTbs2 > 5) + { + iTbs2 = iTbs2 - 5; + } + else + { + iTbs2 = 0; + } + } + else if(!cellSch->dl.isDlFreqSel) + { +#ifdef LTE_TDD + /* for Tdd reduce iTbs only for SF0. SF5 contains only + * SSS and can be ignored */ + if (subFrm->sfNum == 0) + { + (iTbs1 > 1)? (iTbs1 -= 1) : (iTbs1 = 0); + (iTbs2 > 1)? (iTbs2 -= 1) : (iTbs2 = 0); + } + /* For SF 3 and 8 CRC is getting failed in DL. + Need to do proper fix after the replay from + BRCM PHY team*/ +#ifdef CA_PHY_BRDCM_61765 + if ((subFrm->sfNum == 3) || (subFrm->sfNum == 8)) + { + (iTbs1 > 2)? (iTbs1 -= 2) : (iTbs1 = 0); + (iTbs2 > 2)? (iTbs2 -= 2) : (iTbs2 = 0); + } +#endif +#else +#endif + } + +#ifdef LTE_TDD + if(subFrm->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); + } +#endif + + eff1 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1]; + eff2 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2]; + + + bo = RGSCH_MIN(bo,availBits/8); + ueDl->outStndAlloc += bo; + /* consider Cumulative amount of this BO and bytes so far allocated */ + bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbBits/8); + bo = RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff1)/(eff1+eff2)), + ueDl->maxTbSz/8) + + RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff2)/(eff1+eff2)), + (ueDl->maxTbSz)/8) + + 1; /* Add 1 to adjust the truncation at weighted averaging */ + /* Get the number of REs needed for this bo. */ + noRes = ((bo * 8 * 1024) / (eff1 + eff2)); + + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + numRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]); + /* Cannot exceed the maximum number of RBs per UE */ + if (numRb > ueDl->maxRb) + { + numRb = ueDl->maxRb; + } + else + { +#ifdef LTE_ADV + if(RFAILED == rgSCHLaaCmn2CwAdjustPrb(allocInfo, boTmp, &numRb, ueDl, noLyr1, noLyr2, iTbs1, iTbs2)) +#endif + { + while ((numRb <= ueDl->maxRb) && + (rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1] <= ueDl->maxTbSz) && + (rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1] <= ueDl->maxTbSz) && + ((rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8 + + rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8) <= bo)) + { + (numRb)++; + } + } + } + availBw = subFrm->bw - subFrm->bwAssigned; + /* Cannot exceed the total number of RBs in the cell */ + if ((S16)(numRb - allocInfo->rbsReq) > availBw) + { + numRb = availBw + allocInfo->rbsReq; + } + tb1Sz = rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8; + tb2Sz = rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8; + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD + if(subFrm->sfType == RG_SCH_SPL_SF_DATA) + { + /* Max Rb for Special Sf is approximated as 4/3 of maxRb */ + rgSCHCmnCalcDwPtsTbSz2Cw(cell, bo, (U8*)&numRb, ueDl->maxRb*4/3, + &iTbs1, &iTbs2, noLyr1, + noLyr2, &tb1Sz, &tb2Sz, cfi); + /* Check for available Bw */ + if ((S16)numRb - allocInfo->rbsReq > availBw) + { + numRb = availBw + allocInfo->rbsReq; + tb1Sz = rgTbSzTbl[noLyr1-1][iTbs1][RGSCH_MAX(numRb*3/4,1)-1]/8; + tb2Sz = rgTbSzTbl[noLyr2-1][iTbs2][RGSCH_MAX(numRb*3/4,1)-1]/8; + } + } +#endif + /* DwPts Scheduling Changes End */ + /* Update the subframe Allocated BW field */ + subFrm->bwAssigned = subFrm->bwAssigned + numRb - \ + allocInfo->rbsReq; + + *effBo = RGSCH_MIN((tb1Sz + tb2Sz) - oldReq, reqBytes); + +#ifdef LTE_ADV + if (ROK != rgSCHLaaCmn2TBPrbCheck(allocInfo, tb1Sz, tb2Sz, boTmp, effBo, iTbs1, iTbs2, numRb, proc)) + { + RETVALUE(RFAILED); + } +#endif + + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs1, imcs1); + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs2, imcs2); + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tb1Sz, \ + iTbs1, imcs1, &proc->tbInfo[0], noLyr1); + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \ + iTbs2, imcs2, &proc->tbInfo[1], noLyr2); + *numRbRef = (U8)numRb; + + + RETVALUE(ROK); +} + + +/** + * @brief This function determines the RBs and Bytes required for + * Transmission & Retransmission on 2 CWs. + * + * @details + * + * Function: rgSCHCmnDlAlloc2CwTxRetxRb + * Purpose: This function determines the RBs and Bytes required + * for Transmission & Retransmission on 2 CWs. Allocate + * RETX TB on a better CW and restrict new TX TB by + * RETX allocation. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: TM3 and TM4 DL UE Allocation + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqTbCb *reTxTb + * @param[in] RgSchDlHqTbCb *txTb + * @param[out] U8 *numRb + * @param[out] U32 *effBo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *reTxTb, +RgSchDlHqTbCb *txTb, +U8 *numRb, +U32 *effBo +) +#else +PRIVATE S16 rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, reTxTb, txTb, numRb,\ + effBo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +RgSchDlHqTbCb *reTxTb; +RgSchDlHqTbCb *txTb; +U8 *numRb; +U32 *effBo; +#endif +{ + RgSchCmnDlUe *ueDl; + RgSchDlRbAlloc *allocInfo; + U8 imcs1, imcs2; + U8 noLyr2; + U16 tb2Sz; + RgSchCmnDlUeCwInfo *otherCw; + S16 availBw; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U8 cfi = cellDl->currCfi; + U8 iTbs; + + TRC2(rgSCHCmnDlAlloc2CwTxRetxRb); + + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + otherCw = &ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)]; + + + /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB + * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and + * MCS. */ + availBw = subFrm->bw - subFrm->bwAssigned; + *numRb = reTxTb->dlGrnt.numRb; + +#ifdef XEON_TDD_SPCL + *numRb = (reTxTb->initTxNumRbs); + if(reTxTb->sfType == RG_SCH_SPL_SF_DATA && subFrm->sfType != RG_SCH_SPL_SF_DATA) + { + *numRb = (reTxTb->initTxNumRbs*3/4); + + if(*numRb <= 3) + { + RLOG1(L_ERROR," Number of RBs [%d] are less than or equal to 3",*numRb); + RETVALUE(RFAILED); + } + } +#endif + + if ((S16)*numRb > availBw) + { + RETVALUE(RFAILED); + } + /* Update the subframe Allocated BW field */ + subFrm->bwAssigned += *numRb; + noLyr2 = otherCw->noLyr; + RG_SCH_CMN_GET_MCS_FOR_RETX(reTxTb, imcs1); + + /* If there is no CFI change, continue to use the BLER based + * iTBS value */ + if (ueDl->lastCfi == cfi) + { + iTbs = otherCw->iTbs[noLyr2-1]; + } + else + { +#ifdef LTE_TDD + iTbs = (U8) rgSchCmnFetchItbs(cell, ueDl, subFrm, otherCw->cqi, cfi, + !(ueDl->mimoInfo.btrCwIdx), noLyr2); +#else + iTbs = (U8) rgSchCmnFetchItbs(cell, ueDl, otherCw->cqi, cfi, + !(ueDl->mimoInfo.btrCwIdx), noLyr2); +#endif + } + tb2Sz = rgTbSzTbl[noLyr2-1][iTbs][*numRb-1]/8; + /* DwPts Scheduling Changes Start */ +#ifdef LTE_TDD +#endif + /* DwPts Scheduling Changes End */ + RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs2); + + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], reTxTb->tbSz, \ + 0, imcs1, reTxTb, reTxTb->numLyrs); + + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \ + iTbs, imcs2, txTb, noLyr2); + + *effBo = reTxTb->tbSz + tb2Sz; + + RETVALUE(ROK); +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * Retransmission on 2 CWs. + * + * @details + * + * Function: rgSCHCmnDlAlloc2CwRetxRb + * Purpose: This function determines the RBs and Bytes required + * for BO Retransmission on 2 CWs. Allocate larger TB + * on a better CW and check if the smaller TB can be + * accomodated on the other CW. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqProcCb *proc + * @param[out] U8 *numRb + * @param[out] Bool *swpFlg + * @param[out] U32 *effBo + * @return Void + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqProcCb *proc, +U8 *numRb, +Bool *swpFlg, +U32 *effBo +) +#else +PRIVATE S16 rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc,\ + numRb, swpFlg, effBo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +RgSchDlHqProcCb *proc; +U8 *numRb; +Bool *swpFlg; +U32 *effBo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + U8 imcs1; + U8 imcs2; + RgSchDlHqTbCb *lrgTbInfo, *othrTbInfo; + + TRC2(rgSCHCmnDlAlloc2CwRetxRb); + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + + /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB + * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and + * MCS. */ + lrgTbInfo = &proc->tbInfo[0]; + othrTbInfo = &proc->tbInfo[1]; + *numRb = lrgTbInfo->dlGrnt.numRb; +#ifdef XEON_TDD_SPCL + if((lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA || othrTbInfo->sfType == RG_SCH_SPL_SF_DATA)) + { + if(lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA) + { + *numRb = (lrgTbInfo->initTxNumRbs); + } + else + { + *numRb = (othrTbInfo->initTxNumRbs); + } + + if(subFrm->sfType != RG_SCH_SPL_SF_DATA) + { + *numRb = (*numRb)*3/4; + } + + if(*numRb <= 3) + { + RLOG1(L_ERROR," Number of RBs [%d] are less than or equal to 3",*numRb); + RETVALUE(RFAILED); + } + } +#endif + if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned)) + { + RETVALUE(RFAILED); + } + /* Update the subframe Allocated BW field */ + subFrm->bwAssigned += *numRb; + RG_SCH_CMN_GET_MCS_FOR_RETX(lrgTbInfo, imcs1); + RG_SCH_CMN_GET_MCS_FOR_RETX(othrTbInfo, imcs2); + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], lrgTbInfo->tbSz, \ + 0, imcs1, lrgTbInfo, lrgTbInfo->numLyrs); + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], othrTbInfo->tbSz, \ + 0, imcs2, othrTbInfo, othrTbInfo->numLyrs); + *effBo = lrgTbInfo->tbSz + othrTbInfo->tbSz; + + + + RETVALUE(ROK); +} + + +/** + * @brief This function determines the RBs and Bytes required for BO + * Retransmission on 1 CW. + * + * @details + * + * Function: rgSCHCmnDlAlloc1CwRetxRb + * Purpose: This function determines the RBs and Bytes required + * for BO Retransmission on 1 CW, the first CW. + * Returns RFAILED if BO not satisfied at all. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *subFrm + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlHqTbCb *tbInfo + * @param[in] U8 noLyr + * @param[out] U8 *numRb + * @param[out] U32 *effBo + * @return S16 + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +RgSchUeCb *ue, +RgSchDlHqTbCb *tbInfo, +U8 noLyr, +U8 *numRb, +U32 *effBo +) +#else +PRIVATE S16 rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, tbInfo, noLyr,\ + numRb, effBo) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +RgSchUeCb *ue; +RgSchDlHqTbCb *tbInfo; +U8 noLyr; +U8 *numRb; +U32 *effBo; +#endif +{ + RgSchDlRbAlloc *allocInfo; + U8 imcs; + + TRC2(rgSCHCmnDlAlloc1CwRetxRb); + + allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell); + + + /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB + * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and + * MCS. */ + *numRb = tbInfo->dlGrnt.numRb; + if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned)) + { + RETVALUE(RFAILED); + } + /* Update the subframe Allocated BW field */ + subFrm->bwAssigned += *numRb; + imcs = tbInfo->dlGrnt.iMcs; + allocInfo->dciFormat = tbInfo->dlGrnt.dciFormat; + /* Fix: For a RETX TB the iTbs is irrelevant, hence setting 0 */ + RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbInfo->tbSz, \ + 0, imcs, tbInfo, tbInfo->numLyrs); + *effBo = tbInfo->tbSz; + + RETVALUE(ROK); +} + +#ifdef LTEMAC_SPS + +/** + * @brief This function is called to handle Release PDCCH feedback for SPS UE + * + * @details + * + * Function: rgSCHCmnDlRelPdcchFbk + * Purpose: Invokes SPS module to handle release PDCCH feedback + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] Bool isAck + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlRelPdcchFbk +( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isAck +) +#else +PUBLIC Void rgSCHCmnDlRelPdcchFbk(cell, ue, isAck) +RgSchCellCb *cell; +RgSchUeCb *ue; +Bool isAck; +#endif +{ + + TRC2(rgSCHCmnDlRelPdcchFbk); + rgSCHCmnSpsDlRelPdcchFbk(cell, ue, isAck); + RETVOID; + +} + + +/** + * @brief This function is invoked to handle Ack processing for a HARQ proc. + * + * @details + * + * Function: rgSCHCmnDlProcAck + * Purpose: DTX processing for HARQ proc + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlProcAck +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHCmnDlProcAck(cell, hqP) +RgSchCellCb *cell; +RgSchDlHqProcCb *hqP; +#endif +{ + + TRC2(rgSCHCmnDlProcAck); + + if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) + { + /* Invoke SPS module if SPS service was scheduled for this HARQ proc */ + rgSCHCmnSpsDlProcAck(cell, hqP); + } + RETVOID; +} +#ifdef RGSCH_SPS_STATS +extern U32 rgSchStatCrntiCeRcvCnt; +#endif +/** + * @brief This function is invoked to handle CRNTI CE reception for an UE + * + * @details + * + * Function: rgSCHCmnHdlCrntiCE + * Purpose: Handle CRNTI CE reception + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnHdlCrntiCE +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHCmnHdlCrntiCE(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + + TRC2(rgSCHCmnHdlCrntiCE); +#ifdef RGSCH_SPS_STATS + rgSchStatCrntiCeRcvCnt++; +#endif + + /* When UL sync lost happened due to TA timer expiry UE is being moved to + PDCCH order inactivity list.But when CRNTI CE received in msg3 from UE + we are not moving UE into active state due to that RRC Reconfiguration is + not happening. + So here we are moving UE to active list whenever we receive the CRNTI CE and + UE is inactive */ + /* CR ccpu00144525 */ + if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue)) + { + /* Activate this UE if it was inactive */ + RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); + RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE); + } + + /* Handling is same as reception of UE RESET for both DL and UL */ + if (ue->dl.dlSpsCfg.isDlSpsEnabled) + { + rgSCHCmnSpsDlUeReset(cell, ue); + } + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlUeReset(cell, ue); + } + + RETVOID; +} + + +/** + * @brief This function is called to handle relInd from MAC for a UE + * + * @details + * + * Function: rgSCHCmnUlSpsRelInd + * Purpose: Invokes SPS module to handle UL SPS release for a UE + * + * Invoked by: SCH_UTL + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] Bool isExplRel + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlSpsRelInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isExplRel +) +#else +PUBLIC Void rgSCHCmnUlSpsRelInd(cell, ue, isExplRel) +RgSchCellCb *cell; +RgSchUeCb *ue; +Bool isExplRel; +#endif +{ + + TRC2(rgSCHCmnUlSpsRelInd); + rgSCHCmnSpsUlProcRelInd(cell, ue, isExplRel); + RETVOID; + +} /* end of rgSCHCmnUlSpsRelInd */ + +/** + * @brief This function is called to handle SPS Activate Ind from MAC for a UE + * + * @details + * + * Function: rgSCHCmnUlSpsActInd + * Purpose: Invokes SPS module to handle UL SPS activate for a UE + * + * Invoked by: SCH_UTL + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlSpsActInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U16 spsSduSize +) +#else +PUBLIC Void rgSCHCmnUlSpsActInd(cell, ue,spsSduSize) +RgSchCellCb *cell; +RgSchUeCb *ue; +U16 spsSduSize; +#endif +{ + + TRC2(rgSCHCmnUlSpsActInd); + + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlProcActInd(cell, ue,spsSduSize); + } + RETVOID; + +} /* end of rgSCHCmnUlSpsActInd */ + +/** + * @brief This function is called to handle CRC in UL for UEs + * undergoing SPS release + * + * @details + * + * Function: rgSCHCmnUlCrcInd + * Purpose: Invokes SPS module to handle CRC in UL for SPS UE + * + * Invoked by: SCH_UTL + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo crcTime + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlCrcInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo crcTime +) +#else +PUBLIC Void rgSCHCmnUlCrcInd(cell, ue, crcTime) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo crcTime; +#endif +{ + + TRC2(rgSCHCmnUlCrcInd); + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlProcCrcInd(cell, ue, crcTime); + } + RETVOID; + +} /* end of rgSCHCmnUlCrcFailInd */ + +/** + * @brief This function is called to handle CRC failure in UL + * + * @details + * + * Function: rgSCHCmnUlCrcFailInd + * Purpose: Invokes SPS module to handle CRC failure in UL for SPS UE + * + * Invoked by: SCH_UTL + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo crcTime + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUlCrcFailInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo crcTime +) +#else +PUBLIC Void rgSCHCmnUlCrcFailInd(cell, ue, crcTime) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo crcTime; +#endif +{ + + TRC2(rgSCHCmnUlCrcFailInd); + if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) + { + rgSCHCmnSpsUlProcDtxInd(cell, ue, crcTime); + } + RETVOID; + +} /* end of rgSCHCmnUlCrcFailInd */ + +#endif /* LTEMAC_SPS */ + +/** + * @brief BCH,BCCH,PCCH Dowlink Scheduling Handler. + * + * @details + * + * Function: rgSCHCmnDlBcchPcchAlloc + * Purpose: This function calls common scheduler APIs to + * schedule for BCCH/PCCH. + * It then invokes Allocator for actual RB + * allocations. It processes on the actual resources allocated + * against requested to the allocator module. + * + * Invoked by: Common Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnDlBcchPcchAlloc +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnDlBcchPcchAlloc(cell) +RgSchCellCb *cell; +#endif +{ +#ifdef LTE_TDD + U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE; +#else +#ifdef LTEMAC_HDFDD + U8 nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES; +#else + U8 nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES; +#endif +#endif + RgInfSfAlloc *nextsfAlloc = &(cell->sfAllocArr[nextSfIdx]); + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo; + + TRC2(rgSCHCmnDlBcchPcchAlloc); + + + /*Reset the bitmask for BCCH/PCCH*/ + rgSCHUtlResetSfAlloc(nextsfAlloc,TRUE,FALSE); +#ifndef DISABLE_MIB_SIB /* Not sending MIB and SIB to CL */ +#ifdef RGR_SI_SCH + rgSCHChkNUpdSiCfg(cell); + rgSCHSelectSi(cell); +#endif + + /*Perform the scheduling for BCCH,PCCH*/ + rgSCHCmnDlBcchPcch(cell, allocInfo, nextsfAlloc); + + /* Call common allocator for RB Allocation */ + rgSCHBcchPcchDlRbAlloc(cell, allocInfo); + + /* Finalize the Allocations for reqested Against alloced */ + rgSCHCmnDlBcchPcchFnlz(cell, allocInfo); +#endif /* DISABLE_MIB_SIB */ + RETVOID; +} + +/** + * @brief Handles RB allocation for BCCH/PCCH for downlink. + * + * @details + * + * Function : rgSCHBcchPcchDlRbAlloc + * + * Invoking Module Processing: + * - This function is invoked for DL RB allocation of BCCH/PCCH + * + * Processing Steps: + * - If cell is frequency selecive, + * - Call rgSCHDlfsBcchPcchAllocRb(). + * - else, + * - Do the processing + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlRbAllocInfo *allocInfo + * @return Void + **/ + +#ifdef ANSI +PRIVATE Void rgSCHBcchPcchDlRbAlloc +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHBcchPcchDlRbAlloc(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSCHBcchPcchDlRbAlloc); + + + if (cellSch->dl.isDlFreqSel) + { + cellSch->apisDlfs->rgSCHDlfsBcchPcchAllocRb(cell, allocInfo); + } + else + { + rgSCHCmnNonDlfsBcchPcchRbAlloc(cell, allocInfo); + } + + RETVOID; +} + +/** + * @brief Handles RB allocation for BCCH,PCCH for frequency + * non-selective cell. + * + * @details + * + * Function : rgSCHCmnNonDlfsBcchPcchRbAlloc + * + * Invoking Module Processing: + * - SCH shall invoke this if downlink frequency selective is disabled for + * the cell for RB allocation. + * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs + * estimate and subframe for each allocation to be made to SCH. + * + * Processing Steps: + * - Allocate sequentially for BCCH,PCCH common channels. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchCmnDlRbAllocInfo *allocInfo + * @return Void + **/ + +#ifdef ANSI +PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo +) +#else +PRIVATE Void rgSCHCmnNonDlfsBcchPcchRbAlloc(cell, allocInfo) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +#endif +{ + RgSchDlRbAlloc *reqAllocInfo; + + TRC2(rgSCHCmnNonDlfsBcchPcchRbAlloc); + + /* 143473 */ + /* Allocate for PCCH */ + reqAllocInfo = &(allocInfo->pcchAlloc); + if (reqAllocInfo->rbsReq) + { + rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo); + } + /* Allocate for BCCH on DLSCH */ + reqAllocInfo = &(allocInfo->bcchAlloc); + if (reqAllocInfo->rbsReq) + { + rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo); + } + RETVOID; +} + + +#ifdef RGR_SI_SCH +/** + * @brief This function implements the handling to check and + * update the SI cfg at the start of the modificiation period. + * + * @details + * + * Function: rgSCHChkNUpdSiCfg + * Purpose: This function implements handling for update of SI Cfg + * at the start of modification period. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE Void rgSCHChkNUpdSiCfg +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHChkNUpdSiCfg(cell) +RgSchCellCb *cell; +#endif +{ + CmLteTimingInfo pdSchTmInfo; + + TRC2(rgSCHChkNUpdSiCfg); + + + pdSchTmInfo = cell->crntTime; +#ifdef LTEMAC_HDFDD + /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA + + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ + RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); +#else + RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA); +#endif + + + /* Updating the SIB1 for Warning SI message immediately after it is received + * from application. No need to wait for next modification period. + */ + if((pdSchTmInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0) + && (RGSCH_SIB1_TX_SF_NUM == (pdSchTmInfo.subframe % RGSCH_NUM_SUB_FRAMES))) + { + /*Check whether SIB1 with PWS has been updated*/ + if(cell->siCb.siBitMask & RGSCH_SI_SIB1_PWS_UPD) + { + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1, + cell->siCb.newSiInfo.sib1Info.sib1); + cell->siCb.crntSiInfo.sib1Info.mcs = + cell->siCb.newSiInfo.sib1Info.mcs; + cell->siCb.crntSiInfo.sib1Info.nPrb = + cell->siCb.newSiInfo.sib1Info.nPrb; + cell->siCb.crntSiInfo.sib1Info.msgLen = + cell->siCb.newSiInfo.sib1Info.msgLen; + cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_PWS_UPD; + } + } + + /*Check if this SFN and SF No marks the start of next modification + period. If current SFN,SF No doesn't marks the start of next + modification period, then return. */ + if(!((pdSchTmInfo.sfn % cell->siCfg.modPrd == 0) + && (0 == pdSchTmInfo.subframe))) + /*if(!((((pdSchTmInfo.hSfn * 1024) + pdSchTmInfo.sfn) % cell->siCfg.modPrd == 0) + && (0 == pdSchTmInfo.subframe)))*/ + { + RETVOID; + } + + /*Check whether MIB has been updated*/ + if(cell->siCb.siBitMask & RGSCH_SI_MIB_UPD) + { + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.mib, + cell->siCb.newSiInfo.mib); + cell->siCb.siBitMask &= ~RGSCH_SI_MIB_UPD; + } + + /*Check whether SIB1 has been updated*/ + if(cell->siCb.siBitMask & RGSCH_SI_SIB1_UPD) + { + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1, + cell->siCb.newSiInfo.sib1Info.sib1); + cell->siCb.crntSiInfo.sib1Info.mcs = cell->siCb.newSiInfo.sib1Info.mcs; + cell->siCb.crntSiInfo.sib1Info.nPrb = cell->siCb.newSiInfo.sib1Info.nPrb; + cell->siCb.crntSiInfo.sib1Info.msgLen = + cell->siCb.newSiInfo.sib1Info.msgLen; + cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_UPD; + } + + /*Check whether SIs have been updated*/ + if(cell->siCb.siBitMask & RGSCH_SI_SI_UPD) + { + U8 idx; + + /*Check if SI cfg have been modified And Check if numSi have + been changed, if yes then we would need to update the + pointers for all the SIs */ + if((cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) && + (cell->siCfg.numSi != cell->siCb.newSiCfg.numSi)) + { + for(idx = 0;idx < cell->siCb.newSiCfg.numSi;idx++) + { + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si, + cell->siCb.newSiInfo.siInfo[idx].si); + cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si; + cell->siCb.siArray[idx].isWarningSi = FALSE; + + cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs; + cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb; + cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen; + } + + /*If numSi have been reduced then we need to free the + pointers at the indexes in crntSiInfo which haven't + been exercised. If numSi has increased then nothing + additional is requires as above handling has taken + care.*/ + if(cell->siCfg.numSi > cell->siCb.newSiCfg.numSi) + { + for(idx = cell->siCb.newSiCfg.numSi; + idx < cell->siCfg.numSi;idx++) + { + RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si); + cell->siCb.siArray[idx].si = NULLP; + } + } + } + else + { + /*numSi has not been updated, we just need to update the + pointers for the SIs which are set to NON NULLP */ + /*ccpu00118260 - Correct Update of SIB2 */ + for(idx = 0;idx < cell->siCfg.numSi;idx++) + { + if(NULLP != cell->siCb.newSiInfo.siInfo[idx].si) + { + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si, + cell->siCb.newSiInfo.siInfo[idx].si); + + cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si; + cell->siCb.siArray[idx].isWarningSi = FALSE; + cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs; + cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb; + cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen; + } + } + } + cell->siCb.siBitMask &= ~RGSCH_SI_SI_UPD; + } + + /*Check whether SI cfg have been updated*/ + if(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) + { + cell->siCfg = cell->siCb.newSiCfg; + cell->siCb.siBitMask &= ~RGSCH_SI_SICFG_UPD; + } + + RETVOID; +} + + +/** + * @brief This function implements the selection of the SI + * that is to be scheduled. + * + * @details + * + * Function: rgSCHSelectSi + * Purpose: This function implements the selection of SI + * that is to be scheduled. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE Void rgSCHSelectSi +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHSelectSi(cell) +RgSchCellCb *cell; +#endif +{ + CmLteTimingInfo crntTmInfo; + U8 siWinSize; + U16 x; + U16 windowId; + + TRC2(rgSCHSelectSi); + + + crntTmInfo = cell->crntTime; +#ifdef LTEMAC_HDFDD + /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA + + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ + RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); +#else + RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA); +#endif + + siWinSize = cell->siCfg.siWinSize; + + /* Select SI only once at the starting of the new window */ + if(cell->siCb.inWindow) + { + if ((crntTmInfo.sfn % cell->siCfg.minPeriodicity) == 0 && + crntTmInfo.subframe == 0) + { + /* Reinit inWindow at the beginning of every SI window */ + cell->siCb.inWindow = siWinSize - 1; + } + else + { + cell->siCb.inWindow--; + RETVOID; + } + } + else /* New window. Re-init the winSize counter with the window length */ + { + if((cell->siCb.siArray[cell->siCb.siCtx.siId - 1].isWarningSi == TRUE)&& + (cell->siCb.siCtx.retxCntRem != 0)) + { + rgSCHUtlFreeWarningSiPdu(cell); + cell->siCb.siCtx.warningSiFlag = FALSE; + } + + cell->siCb.inWindow = siWinSize - 1; + } + + x = rgSCHCmnGetSiSetId(crntTmInfo.sfn, crntTmInfo.subframe, + cell->siCfg.minPeriodicity); + + /* Window Id within a SI set. This window Id directly maps to a + * unique SI Id */ + windowId = (((crntTmInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) + + crntTmInfo.subframe) - (x * (cell->siCfg.minPeriodicity * 10))) + / siWinSize; + + if(windowId >= RGR_MAX_NUM_SI) + RETVOID; + + /* Update the siCtx if there is a valid SI and its periodicity + * has occurred */ + if (NULLP != cell->siCb.siArray[windowId].si) + { + /* Warning SI Periodicity is same as SIB2 Periodicity */ + if(((cell->siCb.siArray[windowId].isWarningSi == FALSE) && + (x % (cell->siCfg.siPeriodicity[windowId] + /cell->siCfg.minPeriodicity) == 0)) || + ((cell->siCb.siArray[windowId].isWarningSi == TRUE) && + (x % (cell->siCfg.siPeriodicity[0] + /cell->siCfg.minPeriodicity) == 0))) + { + cell->siCb.siCtx.siId = windowId+1; + cell->siCb.siCtx.retxCntRem = cell->siCfg.retxCnt; + cell->siCb.siCtx.warningSiFlag = cell->siCb.siArray[windowId]. + isWarningSi; + cell->siCb.siCtx.timeToTx.sfn = crntTmInfo.sfn; + cell->siCb.siCtx.timeToTx.subframe = crntTmInfo.subframe; + + RG_SCH_ADD_TO_CRNT_TIME(cell->siCb.siCtx.timeToTx, + cell->siCb.siCtx.maxTimeToTx, (siWinSize - 1)) + } + } + else + {/* Update the siCtx with invalid si Id */ + cell->siCb.siCtx.siId = 0; + } + + RETVOID; +} + + +/** + * @brief This function implements scheduler DL allocation for + * SI. + * + * @details + * + * Function: rgSCHDlSiSched + * Purpose: This function implements scheduler for DL allocation + * for SI. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb* cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE Void rgSCHDlSiSched +( +RgSchCellCb *cell, +RgSchCmnDlRbAllocInfo *allocInfo, +RgInfSfAlloc *subfrmAlloc +) +#else +PRIVATE Void rgSCHDlSiSched(cell, allocInfo, subfrmAlloc) +RgSchCellCb *cell; +RgSchCmnDlRbAllocInfo *allocInfo; +RgInfSfAlloc *subfrmAlloc; +#endif +{ + CmLteTimingInfo crntTimInfo; + RgSchDlSf *sf; + U8 nPrb = 0; + U8 mcs = 0; + MsgLen msgLen = 0; + U32 rb=0; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + U16 lostRe; + U8 cfi = cellDl->currCfi; +#endif + /* DwPTS Scheduling Changes End */ + + TRC2(rgSCHDlSiSched); + + + crntTimInfo = cell->crntTime; +#ifdef LTEMAC_HDFDD + /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA + + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */ + RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL); +#else + RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA); +#endif + + /* Compute the subframe for which allocation is being made. + Essentially, we need pointer to the dl frame for this subframe */ + sf = rgSCHUtlSubFrmGet(cell, crntTimInfo); + + /*Check if scheduling of MIB is required */ +#ifdef EMTC_ENABLE + /* since we are adding the MIB repetition logic for EMTC UEs, checking if + * emtcEnabled or not, If enabled MIB would be repeted at as part of EMTC + * feature, otherwise scheduling at (n,0) */ + if(0 == cell->emtcEnable) + { +#endif + if((crntTimInfo.sfn % RGSCH_MIB_PERIODICITY == 0) + && (RGSCH_MIB_TX_SF_NUM == crntTimInfo.subframe)) + { + MsgLen mibLen = 0; + U8 sfnOctet, mibOct2 = 0; + U8 mibOct1 = 0; + /*If MIB has not been yet setup by Application, return*/ + if(NULLP == cell->siCb.crntSiInfo.mib) + RETVOID; + + SFndLenMsg(cell->siCb.crntSiInfo.mib, &mibLen); + sf->bch.tbSize = mibLen; + /*Fill the interface information */ + rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, NULLD, NULLD); + + /*Set the bits of MIB to reflect SFN */ + /*First get the Most signficant 8 bits of SFN */ + sfnOctet = (U8)(crntTimInfo.sfn >> 2); + /*Get the first two octets of MIB, and then update them + using the SFN octet value obtained above.*/ + if(ROK != SExamMsg((Data *)(&mibOct1), + cell->siCb.crntSiInfo.mib, 0)) + RETVOID; + + if(ROK != SExamMsg((Data *)(&mibOct2), + cell->siCb.crntSiInfo.mib, 1)) + RETVOID; + + /* ccpu00114572- Fix for improper way of MIB Octet setting for SFN */ + mibOct1 = (mibOct1 & 0xFC) | (sfnOctet >> 6); + mibOct2 = (mibOct2 & 0x03) | (sfnOctet << 2); + /* ccpu00114572- Fix ends*/ + + /*Now, replace the two octets in MIB */ + if(ROK != SRepMsg((Data)(mibOct1), + cell->siCb.crntSiInfo.mib, 0)) + RETVOID; + + if(ROK != SRepMsg((Data)(mibOct2), + cell->siCb.crntSiInfo.mib, 1)) + RETVOID; + + /*Copy the MIB msg buff into interface buffer */ + SCpyMsgMsg(cell->siCb.crntSiInfo.mib, + rgSchCb[cell->instIdx].rgSchInit.region, + rgSchCb[cell->instIdx].rgSchInit.pool, + &subfrmAlloc->cmnLcInfo.bchInfo.pdu); + /* Added Dl TB count for MIB message transmission + * This counter is incremented 4 times to consider + * the retransmission at the PHY level on PBCH channel*/ +#ifdef LTE_L2_MEAS + cell->dlUlTbCnt.tbTransDlTotalCnt += RG_SCH_MIB_CNT; +#endif + } +#ifdef EMTC_ENABLE + } +#endif + + allocInfo->bcchAlloc.schdFirst = FALSE; + /*Check if scheduling of SIB1 is required. + Check of (crntTimInfo.sfn % RGSCH_SIB1_PERIODICITY == 0) + is not required here since the below check takes care + of SFNs applicable for this one too.*/ + if((crntTimInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0) + && (RGSCH_SIB1_TX_SF_NUM == crntTimInfo.subframe)) + { + /*If SIB1 has not been yet setup by Application, return*/ + if(NULLP == (cell->siCb.crntSiInfo.sib1Info.sib1)) + { + RETVOID; + } + + allocInfo->bcchAlloc.schdFirst = TRUE; + mcs = cell->siCb.crntSiInfo.sib1Info.mcs; + nPrb = cell->siCb.crntSiInfo.sib1Info.nPrb; + msgLen = cell->siCb.crntSiInfo.sib1Info.msgLen; + } + else + { + /*Check if scheduling of SI can be performed.*/ + Bool invalid = FALSE; + + if(cell->siCb.siCtx.siId == 0) + RETVOID; + + /*Check if the Si-Window for the current Si-Context is completed*/ + invalid = rgSCHCmnChkPastWin(crntTimInfo, cell->siCb.siCtx.maxTimeToTx); + if(invalid) + { + /* LTE_ADV_FLAG_REMOVED_START */ + if(cell->siCb.siCtx.retxCntRem) + { + RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011,(ErrVal)cell->siCb.siCtx.siId, + "rgSCHDlSiSched(): SI not scheduled and window expired"); + } + /* LTE_ADV_FLAG_REMOVED_END */ + if(cell->siCb.siCtx.warningSiFlag == TRUE) + { + rgSCHUtlFreeWarningSiPdu(cell); + cell->siCb.siCtx.warningSiFlag = FALSE; + } + RETVOID; + } + + /*Check the timinginfo of the current SI-Context to see if its + transmission can be scheduled. */ + if(FALSE == (rgSCHCmnChkInWin(crntTimInfo, + cell->siCb.siCtx.timeToTx, + cell->siCb.siCtx.maxTimeToTx))) + { + RETVOID; + + } + /*Check if retransmission count has become 0*/ + if(0 == cell->siCb.siCtx.retxCntRem) + { + RETVOID; + } + + /* LTE_ADV_FLAG_REMOVED_START */ + /* Check if ABS is enabled/configured */ + if(RGR_ENABLE == cell->lteAdvCb.absCfg.status) + { + /* The pattern type is RGR_ABS_MUTE, then eNB need to blank the subframe */ + if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE) + { + /* Determine next scheduling subframe is ABS or not */ + if(RG_SCH_ABS_ENABLED_ABS_SF == (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern + [((crntTimInfo.sfn*RGSCH_NUM_SUB_FRAMES) + crntTimInfo.subframe) % RGR_ABS_PATTERN_LEN])) + { + /* Skip the SI scheduling to next tti */ + RETVOID; + } + } + } + /* LTE_ADV_FLAG_REMOVED_END */ + + /*Schedule the transmission of the current SI-Context */ + /*Find out the messg length for the SI message */ + /* warningSiFlag is to differentiate between Warning SI + * and Other SI */ + if((rgSCHUtlGetMcsAndNPrb(cell, &nPrb, &mcs, &msgLen)) != ROK) + { + RETVOID; + } + + cell->siCb.siCtx.i = RGSCH_CALC_SF_DIFF(crntTimInfo, + cell->siCb.siCtx.timeToTx); + } + + + /*Get the number of rb required */ + /*rgSCHCmnClcRbAllocForFxdTb(cell, msgLen, cellDl->ccchCqi, &rb);*/ + if(cellDl->bitsPerRb==0) + { + while ((rgTbSzTbl[0][0][rb]) < (U32) (msgLen*8)) + { + rb++; + } + rb = rb+1; + } + else + { + rb = RGSCH_CEIL((msgLen*8), cellDl->bitsPerRb); + } + /* DwPTS Scheduling Changes Start */ +#ifdef LTE_TDD + if (sf->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi); + + /* Calculate the less RE's because of DwPTS */ + lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]); + + /* Increase number of RBs in Spl SF to compensate for lost REs */ + rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]); + } +#endif + /* DwPTS Scheduling Changes End */ + /*ccpu00115595- end*/ + /* Additional check to see if required RBs + * exceeds the available */ + if (rb > sf->bw - sf->bwAssigned) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHDlSiSched(): " + "BW allocation failed CRNTI:%d",RGSCH_SI_RNTI); + RETVOID; + } + + /* Update the subframe Allocated BW field */ + sf->bwAssigned = sf->bwAssigned + rb; + + /*Fill the parameters in allocInfo */ + allocInfo->bcchAlloc.rnti = RGSCH_SI_RNTI; + allocInfo->bcchAlloc.dlSf = sf; + allocInfo->bcchAlloc.rbsReq = rb; + /*ccpu00116710- MCS is not getting assigned */ + allocInfo->bcchAlloc.tbInfo[0].imcs = mcs; + + /* ccpu00117510 - ADD - Assignment of nPrb and other information */ + allocInfo->bcchAlloc.nPrb = nPrb; + allocInfo->bcchAlloc.tbInfo[0].bytesReq = msgLen; + allocInfo->bcchAlloc.tbInfo[0].noLyr = 1; + RETVOID; +} +#endif /*RGR_SI_SCH*/ + + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT +/** + * @brief This function Updates the DL CQI for the UE. + * + * @details + * + * Function: rgSCHCmnUeDlPwrCtColltCqiRept + * Purpose: Manages PUSH N CQI reporting + * Step 1: Store the CQI in collation array + * Step 2: Increament the tracking count + * Step 3: Check is it time to to send the report + * Step 4: if yes, Send StaInd to RRM + * Step 4.1: Fill StaInd for sending collated N CQI rpeorts + * Step 4.2: Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM + * Step 4.2.1: If sending was not sucessful, return RFAILED + * Step 4.2.2: If sending was sucessful, return ROK + * Step 5: If no, return + * Invoked by: rgSCHCmnDlCqiInd + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeCqiRept *ueCqiRpt + * @return Void + * + **/ +#ifdef ANSI +PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCqiRept *ueCqiRpt +) +#else +PRIVATE S16 rgSCHCmnUeDlPwrCtColltCqiRept(cell, ue, ueCqiRpt) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeCqiRept *ueCqiRpt; +#endif +{ + U8 *cqiCount = NULLP; + S16 retVal; + RgrStaIndInfo *staInfo = NULLP; + + TRC2(rgSCHCmnUeDlPwrCtColltCqiRept) + + /* Step 1: Store the CQI in collation array */ + /* Step 2: Increament the tracking count */ + cqiCount = &(ue->schCqiInfo.cqiCount); + ue->schCqiInfo.cqiRept[(*cqiCount)++] = + *ueCqiRpt; + + + /* Step 3: Check is it time to to send the report */ + if(RG_SCH_CQIR_IS_TIMTOSEND_CQIREPT(ue)) + { + /* Step 4: if yes, Send StaInd to RRM */ + retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo, + sizeof(RgrStaIndInfo)); + if (retVal != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Could not " + "allocate memory for sending StaInd CRNTI:%d",ue->ueId); + RETVALUE(retVal); + } + + /* Step 4.1: Fill StaInd for sending collated N CQI rpeorts */ +#ifdef CA_DBG + { + extern U32 gCqiReptToAppCount; + gCqiReptToAppCount++; + + } + +#endif + retVal = rgSCHUtlFillSndStaInd(cell, ue, staInfo, + ue->cqiReptCfgInfo.numColltdCqiRept); + RETVALUE(retVal); + + } + + RETVALUE(ROK); +} /* End of rgSCHCmnUeDlPwrCtColltCqiRept */ + +#endif /* End of RGR_CQI_REPT */ + +/** + * @brief This function checks for the retransmisson + * for a DTX scenario. + * @details + * + * Function: + * Purpose: + * Invoked by: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnChkRetxAllowDtx +( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +RgSchDlHqProcCb *proc, +Bool *reTxAllwd +) +#else +PUBLIC Void rgSCHCmnChkRetxAllowDtx(cell, ueCb, proc, reTxAllwd) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +RgSchDlHqProcCb *proc; +Bool *reTxAllwd; +#endif +{ + TRC3(rgSCHCmnChkRetxAllowDtx) + + + *reTxAllwd = TRUE; + /* Fix */ + if ((proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX)) + { + *reTxAllwd = FALSE; + } + + RETVOID; +} + +/** + * @brief API for calculating the SI Set Id + * + * @details + * + * Function: rgSCHCmnGetSiSetId + * + * This API is used for calculating the SI Set Id, as shown below + * + * siSetId = 0 siSetId = 1 + * |******************|******************|----------------> + * (0,0) (8,0) (16,0) (SFN, SF) + * + * + * @param[in] U16 sfn + * @param[in] U8 sf + * @return U16 siSetId + **/ +#ifdef ANSI +PUBLIC U16 rgSCHCmnGetSiSetId +( +U16 sfn, +U8 sf, +U16 minPeriodicity +) +#else +PUBLIC U16 rgSCHCmnGetSiSetId(sfn, sf, minPeriodicity) +U16 sfn; +U8 sf +U16 minPeriodicity; +#endif +{ + /* 80 is the minimum SI periodicity in sf. Also + * all other SI periodicities are multiples of 80 */ + RETVALUE (((sfn * RGSCH_NUM_SUB_FRAMES_5G) + sf) / (minPeriodicity * 10)); +} +#ifdef LTE_TDD +/** + * @brief API for calculating the DwPts Rb, Itbs and tbSz + * + * @details + * + * Function: rgSCHCmnCalcDwPtsTbSz + * + * @param[in] RgSchCellCb *cell + * @param[in] U32 bo + * @param[in/out] U8 *rb + * @param[in/out] U8 *iTbs + * @param[in] U8 lyr + * @param[in] U8 cfi + * @return U32 tbSz + **/ +#ifdef ANSI +PRIVATE U32 rgSCHCmnCalcDwPtsTbSz +( +RgSchCellCb *cell, +U32 bo, +U8 *rb, +U8 *iTbs, +U8 lyr, +U8 cfi +) +#else +PRIVATE U32 rgSCHCmnCalcDwPtsTbSz(cell, bo, rb, iTbs, lyr, cfi) +RgSchCellCb *cell; +U32 bo; +U8 *rb; +U8 *iTbs; +U8 lyr; +U8 cfi; +#endif +{ + U32 tbSz; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U32 numRE = *rb * cellDl->noResPerRb[cfi]; + U32 numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]); + + TRC2(rgSCHCmnCalcDwPtsTbSz); + + /* DwPts Rb cannot exceed the cell Bw */ + numDwPtsRb = RGSCH_MIN(numDwPtsRb, cellDl->maxDlBwPerUe); + + /* Adjust the iTbs for optimum usage of the DwPts region. + * Using the same iTbs adjustment will not work for all + * special subframe configurations and iTbs levels. Hence use the + * static iTbs Delta table for adjusting the iTbs */ + RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs); + + if (bo) + { + while(rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1] < bo*8 && + numDwPtsRb < cellDl->maxDlBwPerUe) + { + (numDwPtsRb)++; + } + + tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1]; + } + else + { + tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1]; + } + *rb = numDwPtsRb; + + RETVALUE(tbSz/8); +} + +/** + * @brief API for calculating the DwPts Rb, Itbs and tbSz + * + * @details + * + * Function: rgSCHCmnCalcDwPtsTbSz2Cw + * + * @param[in] RgSchCellCb *cell + * @param[in] U32 bo + * @param[in/out] U8 *rb + * @param[in] U8 maxRb + * @param[in/out] U8 *iTbs1 + * @param[in/out] U8 *iTbs2 + * @param[in] U8 lyr1 + * @param[in] U8 lyr2 + * @return[in/out] U32 *tb1Sz + * @return[in/out] U32 *tb2Sz + * @param[in] U8 cfi + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw +( +RgSchCellCb *cell, +U32 bo, +U8 *rb, +U8 maxRb, +U8 *iTbs1, +U8 *iTbs2, +U8 lyr1, +U8 lyr2, +U32 *tb1Sz, +U32 *tb2Sz, +U8 cfi +) +#else +PRIVATE Void rgSCHCmnCalcDwPtsTbSz2Cw(cell, bo, rb, maxRb, iTbs1, iTbs2, + lyr1, lyr2, tb1Sz, tb2Sz, cfi) +RgSchCellCb *cell; +U32 bo; +U8 *rb; +U8 maxRb; +U8 *iTbs1; +U8 *iTbs2; +U8 lyr1; +U8 lyr2; +U32 *tb1Sz; +U32 *tb2Sz; +U8 cfi; +#endif +{ + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + U32 numRE = *rb * cellDl->noResPerRb[cfi]; + U32 numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]); + + TRC2(rgSCHCmnCalcDwPtsTbSz2Cw); + + /* DwPts Rb cannot exceed the cell Bw */ + numDwPtsRb = RGSCH_MIN(numDwPtsRb, maxRb); + + /* Adjust the iTbs for optimum usage of the DwPts region. + * Using the same iTbs adjustment will not work for all + * special subframe configurations and iTbs levels. Hence use the + * static iTbs Delta table for adjusting the iTbs */ + RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs1); + RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs2); + + while((rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1] + + rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1])< bo*8 && + numDwPtsRb < maxRb) + { + (numDwPtsRb)++; + } + + *tb1Sz = rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8; + *tb2Sz = rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8; + + *rb = numDwPtsRb; + + RETVOID; +} + +#endif + +/** + * @brief Updates the GBR LCGs when datInd is received from MAC + * + * @details + * + * Function: rgSCHCmnUpdUeDataIndLcg(cell, ue, datInd) + * Purpose: This function updates the GBR LCGs + * when datInd is received from MAC. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgInfUeDatInd *datInd + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnUpdUeDataIndLcg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgInfUeDatInd *datInd +) +#else +PUBLIC Void rgSCHCmnUpdUeDataIndLcg(cell, ue, datInd) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgInfUeDatInd *datInd; +#endif +{ + U32 idx = 0; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); +#ifdef DEBUGP + Inst inst = cell->instIdx; +#endif + + TRC2(rgSCHCmnUpdUeDataIndLcg); + + for (idx = 0; (idx < RGINF_MAX_LCG_PER_UE - 1); idx++) + { + if (datInd->lcgInfo[idx].bytesRcvd != 0) + { + U8 lcgId = datInd->lcgInfo[idx].lcgId; + U32 bytesRcvd = datInd->lcgInfo[idx].bytesRcvd; + + if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId])) + { + RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch)); + if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr)) + { + if(bytesRcvd > cmnLcg->effGbr) + { + bytesRcvd -= cmnLcg->effGbr; + cmnLcg->effDeltaMbr = (cmnLcg->effDeltaMbr > bytesRcvd) ? \ + (cmnLcg->effDeltaMbr - bytesRcvd) : (0); + cmnLcg->effGbr = 0; + } + else + { + cmnLcg->effGbr -= bytesRcvd; + } + /* To keep BS updated with the amount of data received for the GBR */ + cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \ + (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0); + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr+cmnLcg->effDeltaMbr); + } + else if(lcgId != 0) + { + ue->ul.effAmbr = (ue->ul.effAmbr > datInd->lcgInfo[idx].bytesRcvd) ? \ + (ue->ul.effAmbr - datInd->lcgInfo[idx].bytesRcvd) : (0); + cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \ + (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0); + cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr); + ue->ul.nonGbrLcgBs = (ue->ul.nonGbrLcgBs > datInd->lcgInfo[idx].bytesRcvd) ? \ + (ue->ul.nonGbrLcgBs - datInd->lcgInfo[idx].bytesRcvd) : (0); + } + ue->ul.nonLcg0Bs = (ue->ul.nonLcg0Bs > datInd->lcgInfo[idx].bytesRcvd) ? \ + (ue->ul.nonLcg0Bs - datInd->lcgInfo[idx].bytesRcvd) : (0); + } + } + else + { + break; + } + } +#ifdef EMTC_ENABLE + if(TRUE == ue->isEmtcUe) + { + if (cellSch->apisEmtcUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "\n rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure")); + } + + } + else +#endif + { + if (cellSch->apisUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "\n rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure")); + } + } +} + + +/** @brief This function initializes DL allocation lists and prepares + * for scheduling + * + * @details + * + * Function: rgSCHCmnInitRbAlloc + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSCHCmnInitRbAlloc +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHCmnInitRbAlloc (cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + CmLteTimingInfo frm; + RgSchDlSf *dlSf; + U8 idx; + + TRC2(rgSCHCmnInitRbAlloc); + +/* Initializing RgSchCmnUlRbAllocInfo structure.*/ + rgSCHCmnInitDlRbAllocInfo(&cellSch->allocInfo); + + frm = cellSch->dl.time; + + dlSf = rgSCHUtlSubFrmGet(cell, frm); +#ifdef RG_5GTF + dlSf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; + dlSf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; + for(idx = 0; idx < MAX_5GTF_BEAMS; idx++) + { + dlSf->sfBeamInfo[idx].totVrbgAllocated = 0; + dlSf->sfBeamInfo[idx].totVrbgRequired = 0; + dlSf->sfBeamInfo[idx].vrbgStart = 0; + } +#endif + dlSf->remUeCnt = cellSch->dl.maxUePerDlSf; + /* Updating the Subframe information in RBAllocInfo */ + cellSch->allocInfo.dedAlloc.dedDlSf = dlSf; + cellSch->allocInfo.msg4Alloc.msg4DlSf = dlSf; + + /* LTE_ADV_FLAG_REMOVED_START */ + /* Determine next scheduling subframe is ABS or not */ + if(RGR_ENABLE == cell->lteAdvCb.absCfg.status) + { + cell->lteAdvCb.absPatternDlIdx = + ((frm.sfn*RGSCH_NUM_SUB_FRAMES_5G) + frm.subframe) % RGR_ABS_PATTERN_LEN; + cell->lteAdvCb.absDlSfInfo = (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern[ + cell->lteAdvCb.absPatternDlIdx]); + + } + else + { + cell->lteAdvCb.absDlSfInfo = RG_SCH_ABS_DISABLED; + } + /* LTE_ADV_FLAG_REMOVED_END */ + +#ifdef RGR_V1 + cellSch->allocInfo.ccchSduAlloc.ccchSduDlSf = dlSf; +#endif +#ifdef LTEMAC_SPS + /* Update subframe-wide allocation information with SPS allocation */ + rgSCHCmnSpsDlUpdDlSfAllocWithSps(cell, frm, dlSf); +#endif + RETVOID; +} + + + +#ifdef DL_LA +/** + * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and + * actual iTbs + * + * @details + * + * Function: rgSCHCmnSendTxModeInd(cell, ueUl, newTxMode) + * Purpose: This function sends the TX mode Change + * indication to RRM + * change + * + * Invoked by: CMN + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 newTxMode + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHCmnSendTxModeInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 newTxMode +) +#else +PRIVATE Void rgSCHCmnSendTxModeInd(cell, ue, newTxMode) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 newTxMode; +#endif +{ + RgmTransModeInd *txModeChgInd; + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + + TRC2(rgSCHCmnSendTxModeInd); + + if(!(ueDl->mimoInfo.forceTD & RG_SCH_CMN_TD_TXMODE_RECFG)) + { + /* Mem Alloc */ + if(SGetSBuf(cell->rgmSap->sapCfg.sapPst.region, + cell->rgmSap->sapCfg.sapPst.pool, (Data**)&txModeChgInd, + sizeof(RgmTransModeInd)) != ROK) + { + RETVOID; + } + RG_SCH_FILL_RGM_TRANSMODE_IND(ue->ueId, cell->cellId, newTxMode, txModeChgInd); + RgUiRgmChangeTransModeInd(&(cell->rgmSap->sapCfg.sapPst), + cell->rgmSap->sapCfg.suId, txModeChgInd); + } + + ue->mimoInfo.txModUpChgFactor = 0; + ue->mimoInfo.txModDownChgFactor = 0; + ueDl->laCb[0].deltaiTbs = 0; + + RETVOID; +} + +/** + * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and + * actual iTbs + * + * @details + * + * Function: rgSchCheckAndTriggerModeChange(cell, ueUl, iTbsNew) + * Purpose: This function update and check for threashold for TM mode + * change + * + * Invoked by: CMN + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 iTbs + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSchCheckAndTriggerModeChange +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 reportediTbs, +U8 previTbs, +U8 maxiTbs +) +#else +PUBLIC Void rgSchCheckAndTriggerModeChange(cell, ue, reportediTbs, previTbs, maxiTbs) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 reportediTbs; +U8 previTbs; +U8 maxiTbs; +#endif +{ + RgrTxMode txMode; /*!< UE's Transmission Mode */ + RgrTxMode modTxMode; /*!< UE's Transmission Mode */ + + TRC2(rgSchCheckAndTriggerModeChange); + + txMode = ue->mimoInfo.txMode; + + /* Check for Step down */ + /* Step down only when TM4 is configured. */ + if(RGR_UE_TM_4 == txMode) + { + if((previTbs <= reportediTbs) && ((reportediTbs - previTbs) >= RG_SCH_MODE_CHNG_STEPDOWN_CHECK_FACTOR)) + { + ue->mimoInfo.txModDownChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR; + } + else + { + ue->mimoInfo.txModDownChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR; + } + + ue->mimoInfo.txModDownChgFactor = + RGSCH_MAX(ue->mimoInfo.txModDownChgFactor, -(RG_SCH_MODE_CHNG_STEPDOWN_THRSHD)); + + if(ue->mimoInfo.txModDownChgFactor >= RG_SCH_MODE_CHNG_STEPDOWN_THRSHD) + { + /* Trigger Mode step down */ + modTxMode = RGR_UE_TM_3; + rgSCHCmnSendTxModeInd(cell, ue, modTxMode); + } + } + + /* Check for Setup up */ + /* Step Up only when TM3 is configured, Max possible Mode is TM4*/ + if(RGR_UE_TM_3 == txMode) + { + if((previTbs > reportediTbs) || (maxiTbs == previTbs)) + { + ue->mimoInfo.txModUpChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR; + } + else + { + ue->mimoInfo.txModUpChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR; + } + + ue->mimoInfo.txModUpChgFactor = + RGSCH_MAX(ue->mimoInfo.txModUpChgFactor, -(RG_SCH_MODE_CHNG_STEPUP_THRSHD)); + + /* Check if TM step up need to be triggered */ + if(ue->mimoInfo.txModUpChgFactor >= RG_SCH_MODE_CHNG_STEPUP_THRSHD) + { + /* Trigger mode chnage */ + modTxMode = RGR_UE_TM_4; + rgSCHCmnSendTxModeInd(cell, ue, modTxMode); + } + } + + RETVOID; +} +#endif + +/** +* @brief Updates the GBR LCGs when datInd is received from MAC + * + * @details + * + * Function: rgSCHCmnIsDlCsgPrio (cell) + * Purpose: This function returns if csg UEs are + * having priority at current time + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgInfUeDatInd *datInd + * @return Void + **/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnIsDlCsgPrio +( +RgSchCellCb *cell +) +#else +PUBLIC Bool rgSCHCmnIsDlCsgPrio(cell) +RgSchCellCb *cell; +#endif +{ + + RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell); + + TRC2(rgSCHCmnIsDlCsgPrio) + /* Calculating the percentage resource allocated */ + if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode) + { + RETVALUE(FALSE); + } + else + { + if(((cmnDlCell->ncsgPrbCnt * 100) / cmnDlCell->totPrbCnt) < cell->minDlResNonCsg) + { + RETVALUE(FALSE); + } + else + { + RETVALUE(TRUE); + } + } +} + +/** +* @brief Updates the GBR LCGs when datInd is received from MAC + * + * @details + * + * Function: rgSCHCmnIsUlCsgPrio (cell) + * Purpose: This function returns if csg UEs are + * having priority at current time + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgInfUeDatInd *datInd + * @return Void + **/ +#ifdef ANSI +PUBLIC Bool rgSCHCmnIsUlCsgPrio +( +RgSchCellCb *cell +) +#else +PUBLIC Bool rgSCHCmnIsUlCsgPrio(cell) +RgSchCellCb *cell; +#endif +{ + RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell); + + TRC2(rgSCHCmnIsUlCsgPrio) + + /* Calculating the percentage resource allocated */ + if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode) + { + RETVALUE(FALSE); + } + else + { + if (((cmnUlCell->ncsgPrbCnt * 100) /cmnUlCell->totPrbCnt) < cell->minUlResNonCsg) + { + RETVALUE(FALSE); + } + else + { + RETVALUE(TRUE); + } + } +} + +/** @brief DL scheduler for SPS, and all other downlink data + * + * @details + * + * Function: rgSchCmnPreDlSch + * + * @param [in] Inst schInst; + * Returns: Void + * + */ +#ifdef ANSI + PUBLIC Void rgSchCmnPreDlSch +( + RgSchCellCb **cell, + U8 nCell, + RgSchCellCb **cellLst + ) +#else +PUBLIC Void rgSchCmnPreDlSch(cell, nCell, cellLst) + RgSchCellCb **cell; + U8 nCell; + RgSchCellCb **cellLst; +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[0]); + RgSchDlSf *sf; + U8 idx; + + TRC2(rgSchCmnPreDlSch); + + if(nCell > CM_LTE_MAX_CELLS) + { + RETVOID; + } + + if (cell[0]->isDlDataAllwd && (cell[0]->stopDlSch == FALSE)) + { + /* Specific DL scheduler to perform UE scheduling */ + cellSch->apisDl->rgSCHDlPreSched(cell[0]); + + /* Rearranging the cell entries based on their remueCnt in SF. + * cells will be processed in the order of number of ue scheduled + * in that cell */ + for (idx = 0; idx < nCell; idx++) + { + U8 j; + cellSch = RG_SCH_CMN_GET_CELL(cell[idx]); + sf = cellSch->allocInfo.dedAlloc.dedDlSf; + + if(idx == 0) + { + cellLst[idx] = cell[idx]; + continue; + } + + for(j = 0; j < idx; j++) + { + RgSchCmnCell *cmnCell = RG_SCH_CMN_GET_CELL(cellLst[j]); + RgSchDlSf *subfrm = cmnCell->allocInfo.dedAlloc.dedDlSf; + + if(sf->remUeCnt < subfrm->remUeCnt) + { + U8 k; + for(k = idx; k > j; k--) + { + cellLst[k] = cellLst[k-1]; + } + break; + } + } + cellLst[j] = cell[idx]; + } + } + else + { + for (idx = 0; idx < nCell; idx++) + { + cellLst[idx] = cell[idx]; + } + } + RETVOID; +} + +/** @brief DL scheduler for SPS, and all other downlink data + * @details + * + * Function: rgSchCmnPstDlSch + * + * @param [in] Inst schInst; + * Returns: Void + * + */ +#ifdef ANSI +PUBLIC Void rgSchCmnPstDlSch +( + RgSchCellCb *cell +) +#else +PUBLIC Void rgSchCmnPstDlSch(cell) + RgSchCellCb *cell +#endif +{ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + TRC2(rgSchCmnPstDlSch); + + if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE)) + { + cellSch->apisDl->rgSCHDlPstSched(cell->instIdx); + } +} + +#ifdef ANSI +PUBLIC U8 rgSCHCmnCalcPcqiBitSz +( + RgSchUeCb *ueCb, + U8 numTxAnt +) +#else +PUBLIC U8 rgSCHCmnCalcPcqiBitSz(ueCb, numTxAnt) + RgSchUeCb *ueCb; + U8 numTxAnt; +#endif +{ + U8 confRepMode; + U8 pcqiSz; + U8 ri; + RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb; + + TRC3(rgSCHCmnCalcPcqiBitSz); + + confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum; + if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) && + (ueCb->mimoInfo.txMode != RGR_UE_TM_4)) + { + ri =1; + } + else + { + ri = cqiCb->perRiVal; + } + switch(confRepMode) + { + case RGR_PRD_CQI_MOD10: + { + pcqiSz = 4; + } + break; + + case RGR_PRD_CQI_MOD11: + { + if(numTxAnt == 2) + { + if (ri ==1) + { + pcqiSz = 6; + } + else + { + pcqiSz = 8; + } + } + else if(numTxAnt == 4) + { + if (ri ==1) + { + pcqiSz = 8; + } + else + { + pcqiSz = 11; + } + } + else + { + /* This is number of antenna case 1. + * This is not applicable for Mode 1-1. + * So setting it to invalid value */ + pcqiSz = 0; + } + } + break; + + case RGR_PRD_CQI_MOD20: + { + if(cqiCb->isWb) + { + pcqiSz = 4; + } + else + { + pcqiSz = 4 + cqiCb->label; + } + } + break; + + case RGR_PRD_CQI_MOD21: + { + if(cqiCb->isWb) + { + if(numTxAnt == 2) + { + if (ri ==1) + { + pcqiSz = 6; + } + else + { + pcqiSz = 8; + } + } + else if(numTxAnt == 4) + { + if (ri ==1) + { + pcqiSz = 8; + } + else + { + pcqiSz = 11; + } + } + else + { + /* This might be number of antenna case 1. + * For mode 2-1 wideband case only antenna port 2 or 4 is supported. + * So setting invalid value.*/ + pcqiSz = 0; + } + } + else + { + if (ri ==1) + { + pcqiSz = 4 + cqiCb->label; + } + else + { + pcqiSz = 7 + cqiCb->label; + } + } + } + break; + default: + pcqiSz = 0; + break; + } + + RETVALUE(pcqiSz); +} + +/** @brief DL scheduler for SPS, and all other downlink data + * + * @details + * + * Function: rgSCHCmnDlSch + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PUBLIC Void rgSCHCmnDlSch +( + RgSchCellCb *cell + ) +#else +PUBLIC Void rgSCHCmnDlSch (cell) + RgSchCellCb *cell; +#endif +{ + RgSchDlSf *dlSf; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); +#ifdef RG_5GTF + RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[cell->instIdx].rgSchDynTdd); + U16 dlCntrlSfIdx; +#endif + + TRC2(rgSCHCmnDlSch); + + dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time); +#ifdef RG_5GTF + if (rgSchDynTddInfo->isDynTddEnbld) + { + RG_SCH_DYN_TDD_GET_SFIDX(dlCntrlSfIdx, rgSchDynTddInfo->crntDTddSfIdx, + RG_SCH_CMN_DL_DELTA); + if(RG_SCH_DYNTDD_DLC_ULD == rgSchDynTddInfo->sfInfo[dlCntrlSfIdx].sfType) + { + if(1 == cell->cellId) + { + ul5gtfsidDlAlreadyMarkUl++; + /* + printf("ul5gtfsidDlAlreadyMarkUl: %d, [sfn:sf] [%04d:%02d]\n", + ul5gtfsidDlAlreadyMarkUl, cellSch->dl.time.sfn, + cellSch->dl.time.subframe); + */ + } + RETVOID; + } + } +#endif + + /* Specific DL scheduler to perform UE scheduling */ + cellSch->apisDl->rgSCHDlNewSched(cell, &cellSch->allocInfo); + /* LTE_ADV_FLAG_REMOVED_END */ + + /* call common allocator for RB Allocation */ + rgSCHCmnDlRbAlloc(cell, &cellSch->allocInfo); + + /* Finalize the Allocations for reqested Against alloced */ + rgSCHCmnDlAllocFnlz(cell); + + /* Perform Pdcch allocations for PDCCH Order Q. + * As of now, giving this the least preference. + * This func call could be moved above other allocations + * as per need */ + rgSCHCmnGenPdcchOrder(cell, dlSf); + + /* Do group power control for PUCCH */ + rgSCHCmnGrpPwrCntrlPucch(cell, dlSf); + + RETVOID; +} + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_cmn.h b/src/5gnrsch/rg_sch_cmn.h similarity index 100% rename from src/5gnrmac/rg_sch_cmn.h rename to src/5gnrsch/rg_sch_cmn.h diff --git a/src/5gnrmac/rg_sch_cmn.x b/src/5gnrsch/rg_sch_cmn.x similarity index 100% rename from src/5gnrmac/rg_sch_cmn.x rename to src/5gnrsch/rg_sch_cmn.x diff --git a/src/5gnrmac/rg_sch_dbm.c b/src/5gnrsch/rg_sch_dbm.c similarity index 100% rename from src/5gnrmac/rg_sch_dbm.c rename to src/5gnrsch/rg_sch_dbm.c diff --git a/src/5gnrmac/rg_sch_dhm.c b/src/5gnrsch/rg_sch_dhm.c similarity index 100% rename from src/5gnrmac/rg_sch_dhm.c rename to src/5gnrsch/rg_sch_dhm.c diff --git a/src/5gnrmac/rg_sch_drx.c b/src/5gnrsch/rg_sch_drx.c similarity index 100% rename from src/5gnrmac/rg_sch_drx.c rename to src/5gnrsch/rg_sch_drx.c diff --git a/src/5gnrsch/rg_sch_empty.c b/src/5gnrsch/rg_sch_empty.c new file mode 100644 index 000000000..253d830da --- /dev/null +++ b/src/5gnrsch/rg_sch_empty.c @@ -0,0 +1,489 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: SCH layer + + Type: C source file + + Desc: C source code file for SPS related functions which are + currently dummy + + File: rg_sch_sps.c + +**********************************************************************/ +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" +#include "rgr.h" +#include "tfu.h" +#include "rgm.h" +#include "rg_env.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_err.h" +#include "rg_sch_cmn.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for Scheduler */ +#include "rg_sch_cmn.x" + +/** + *@brief Initializes the SPS related global data structures + * + *@details + * Function : rgSCHCmnSpsInit + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnSpsInit +( +) +#else /* ANSI */ +PUBLIC Void rgSCHCmnSpsInit () +#endif /* ANSI */ +{ + TRC2(rgSCHCmnSpsInit); + + RETVOID; +} + +/** + *@brief Initializes UE with SPS info + * + *@details + * Function : rgSCHCmnSpsUeCfg + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnSpsUeCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCfg *ueCfg, +RgSchErrInfo *err +) +#else /* ANSI */ +PUBLIC S16 rgSCHCmnSpsUeCfg (cell, ue, ueCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeCfg *ueCfg; +RgSchErrInfo *err; +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsUeCfg); + + return ROK; +} + +/** + *@brief Re-Initializes UE with SPS info + * + *@details + * Function : rgSCHCmnSpsUeReCfg + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnSpsUeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +) +#else /* ANSI */ +PUBLIC S16 rgSCHCmnSpsUeRecfg (cell, ue, ueCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *err; +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsUeRecfg); + + return ROK; +} + +/** + *@brief Clears the UE of SPS info + * + *@details + * Function : rgSCHCmnSpsUeDel + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnSpsUeDel +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else /* ANSI */ +PUBLIC Void rgSCHCmnSpsUeDel (cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsUeDel); + RETVOID; +} + +/** + *@brief Validates cell config for SPS + * + *@details + * Function : rgSCHCmnSpsCellCfg + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnSpsCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +RgSchErrInfo *err +) +#else /* ANSI */ +PUBLIC S16 rgSCHCmnSpsCellCfg(cell, cellCfg, err) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +RgSchErrInfo *err; +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsCellCfg); + return ROK; +} + +/** + *@brief Deletes cell config for SPS + * + *@details + * Function : rgSCHCmnSpsCellDel + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHCmnSpsCellDel +( +RgSchCellCb *cell +) +#else /* ANSI */ +PUBLIC Void rgSCHCmnSpsCellDel (cell) +RgSchCellCb *cell; +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsCellDel); + RETVOID; +} + +/** + *@brief Configures DL LC for SPS + * + *@details + * Function :rgSCHCmnSpsDlLcCfg + * + * @param[in] Void + * + * @return Void + **/ +#ifdef ANSI +PUBLIC S16 rgSCHCmnSpsDlLcCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchCfg *lcCfg, +RgSchErrInfo *err +) +#else /* ANSI */ +PUBLIC S16 rgSCHCmnSpsDlLcCfg(cell, ue, dlLc, lcCfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchCfg *lcCfg; +RgSchErrInfo *err +#endif /* ANSI */ +{ + + TRC2(rgSCHCmnSpsDlLcCfg); + return ROK; +} + +Void rgSchCmnDlSfHqDel +ARGS(( +RgSchUeCb *ue, +RgSchCellCb *cell +)) +{ + TRC2(rgSchCmnDlSfHqDel); + RETVOID; +} + +S16 rgSCHCmnSpsDlLcRecfg ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchRecfg *lcRecfg, +RgSchErrInfo *err +)) +{ + + TRC2(rgSCHCmnSpsDlLcRecfg); + return ROK; +} + +Void rgSCHCmnSpsUlLcgDel ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *lcg +)) +{ + TRC2(rgSCHCmnSpsUlLcgDel); + RETVOID; +} + +Void rgSCHCmnSpsDlLcDel ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc +)) +{ + TRC2(rgSCHCmnSpsUlLcgDel); + RETVOID; +} + +S16 rgSCHCmnSpsUlTti ARGS(( +RgSchCellCb *cell, +RgSchCmnUlRbAllocInfo *allocInfo +)) +{ + + TRC2(rgSCHCmnSpsUlTti); + return ROK; +} + +Void rgSCHCmnSpsDlDedBoUpd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc +)) +{ + + TRC2(rgSCHCmnSpsDlDedBoUpd); + RETVOID; +} + +Void rgSCHCmnSpsDlProcAddToRetx ARGS(( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +)) +{ + + TRC2(rgSCHCmnSpsDlProcAddToRetx); + RETVOID; +} + +Void rgSCHCmnSpsDlCqiIndHndlr ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +)) +{ + + TRC2(rgSCHCmnSpsDlCqiIndHndlr); + RETVOID; +} + +S16 rgSCHCmnSpsUlCqiInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)) +{ + + TRC2(rgSCHCmnSpsUlCqiInd); + return ROK; +} + +S16 rgSCHCmnSpsBsrRpt ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchLcgCb *ulLcg +)) +{ + + TRC2(rgSCHCmnSpsBsrRpt); + return ROK; +} + +Void rgSCHCmnSpsPhrInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)) +{ + + TRC2(rgSCHCmnSpsPhrInd); + RETVOID; +} + +Void rgSCHCmnSpsDlRelPdcchFbk ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isAck +)) +{ + + TRC2(rgSCHCmnSpsDlRelPdcchFbk); + RETVOID; +} + +Void rgSCHCmnSpsDlProcAck ARGS(( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +)) +{ + + TRC2(rgSCHCmnSpsDlProcAck); + RETVOID; +} + +Void rgSCHCmnSpsDlUeReset ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)) +{ + + TRC2(rgSCHCmnSpsDlUeReset); + RETVOID; +} + +Void rgSCHCmnSpsUlUeReset ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue +)) +{ + + TRC2(rgSCHCmnSpsUlUeReset); + RETVOID; +} + +Void rgSCHCmnSpsUlProcRelInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +Bool isExplRel +)) +{ + + TRC2(rgSCHCmnSpsUlProcRelInd); + RETVOID; +} + +Void rgSCHCmnSpsUlProcActInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +U16 spsSduSize +)) +{ + + TRC2(rgSCHCmnSpsUlProcActInd); + RETVOID; +} + +S16 rgSCHCmnSpsUlProcCrcInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo crcTime +)) +{ + + TRC2(rgSCHCmnSpsUlProcActInd); + return ROK; +} + +S16 rgSCHCmnSpsUlProcDtxInd ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo dtxTime +)) +{ + + TRC2(rgSCHCmnSpsUlProcDtxInd); + return ROK; +} + +Void rgSCHCmnSpsDlUpdDlSfAllocWithSps ARGS(( +RgSchCellCb *cell, +CmLteTimingInfo schdTime, +RgSchDlSf *dlSf +)) +{ + + TRC2(rgSCHCmnSpsUlProcDtxInd); + RETVOID; +} + + + + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_err.h b/src/5gnrsch/rg_sch_err.h similarity index 100% rename from src/5gnrmac/rg_sch_err.h rename to src/5gnrsch/rg_sch_err.h diff --git a/src/5gnrsch/rg_sch_ex_ms.c b/src/5gnrsch/rg_sch_ex_ms.c new file mode 100755 index 000000000..b8b68dd22 --- /dev/null +++ b/src/5gnrsch/rg_sch_ex_ms.c @@ -0,0 +1,300 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code SSI Interface Implementation + + File: rg_sch_ex_ms.c + +**********************************************************************/ + +/** @file rg_ex_ms.c +@brief This file contains the implementation of callback functions +registered with SSI during the LTE MAC Task initialization. +*/ +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system services */ +#include "cm5.h" /* common timers defines */ +#include "cm_hash.h" /* common hash list defines */ +#include "cm_llist.h" /* common linked list defines */ +#include "cm_mblk.h" /* memory management */ +#include "cm_tkns.h" /* common tokens */ +#include "cm_lte.h" /* common tokens */ +#include "tfu.h" /* RGU defines */ +#include "lrg.h" /* layer management defines for LTE-MAC */ +#include "rgr.h" /* layer management defines for LTE-MAC */ +#include "rgm.h" /* layer management defines for LTE-MAC */ +#include "rg_env.h" /* customisable defines and macros for LTE-MAC */ +#include "rg_sch_err.h" /* defines and macros for Scheduler */ +#include "rg_sch_inf.h" /* defines and macros for Scheduler */ +#include "rg_sch.h" /* defines and macros for Scheduler */ + + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* RGU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for Scheduler */ + + + + +/** + * @brief Task Activation callback function. + * + * @details + * + * Function : schActvTsk + * + * Primitives invoked by MAC's users/providers through + * a loosely coupled interface arrive here by means of + * SSI's message handling. This API is registered with + * SSI during the Task Registration of MAC. + * + * @param[in] Pst *pst, post structure of the Primitive. + * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer. + * @param[in] Reason reason. + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 schActvTsk +( +Pst *pst, /* post structure */ +Buffer *mBuf /* message buffer */ +) +#else +PUBLIC S16 schActvTsk(pst, mBuf) +Pst *pst; /* post structure */ +Buffer *mBuf; /* message buffer */ +#endif +{ + TRC2(schActvTsk) + + switch(pst->srcEnt) + { + /* The originator of this message is the stack manager, + * unpack and go to the respective primitive processing function */ + case ENTSM: + switch(pst->event) + { +#ifdef LCRGMILRG + case EVTMACSCHGENCFGREQ: + /* Process a config. request */ + cmUnpkLrgSchCfgReq(HandleSchGenCfgReq, pst, mBuf); + break; + case EVTLRGSCHCNTRLREQ: + /* Process a control request */ + cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf); + break; + case EVTLRGSCHSTAIND: + /* Process a control request */ + cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf); + break; +#ifdef LTE_L2_MEAS + case EVTLRGSCHL2MEASREQ: + /* Process L2 Measurement request */ + cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf); + break; + case EVTLRGSCHL2MEASSTOPREQ: + /* Process L2 Measurement Stop request */ + cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf); + break; + case EVTLRGSCHL2MEASSENDREQ: + /* Process L2 Measurement Send request */ + cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf); + break; +#endif +#endif /* LCRGMILRG */ + default: + RGSCH_FREE_MSG(mBuf); + break; + } + break; + case ENTNX: + switch(pst->event) + { +#ifdef LCRGUIRGR + case EVTRGRBNDREQ: + cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf); + break; + case EVTRGRUBNDREQ: + cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf); + break; +#ifdef RGR_SI_SCH + case EVTRGRSICFGREQ: + cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf); + break; + case EVTRGRWARNINGSICFGREQ: + cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf); + break; + + case EVTRGRWARNINGSISTOPREQ: + cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf); + break; +#endif/*RGR_SI_SCH */ + /* LTE_ADV_FLAG_REMOVED_START */ + case EVTRGRLOADINFREQ: + cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf); + break; + /* LTE_ADV_FLAG_REMOVED_END */ +#endif + default: + RGSCH_FREE_MSG(mBuf); + break; + } + break; + case ENTTF: + switch(pst->event) + { +/*#ifdef LCRGLITFU L2Split */ +#if (defined(LCRGLITFU) || defined(LWLCRGLITFU)) + case EVTTFUSCHBNDCFM: + cmUnpkTfuBndCfm(RgLiTfuSchBndCfm, pst, mBuf); + break; + case EVTTFURAREQIND: + cmUnpkTfuRaReqInd(RgLiTfuRaReqInd, pst, mBuf); + break; + case EVTTFUULCQIIND: + cmUnpkTfuUlCqiInd(RgLiTfuUlCqiInd, pst, mBuf); + break; + case EVTTFUHQIND: + cmUnpkTfuHqInd(RgLiTfuHqInd, pst, mBuf); + break; + case EVTTFUSRIND: + cmUnpkTfuSrInd(RgLiTfuSrInd, pst, mBuf); + break; + case EVTTFUDLCQIIND: + cmUnpkTfuDlCqiInd(RgLiTfuDlCqiInd, pst, mBuf); + break; + case EVTTFUCRCIND: + /*cmUnpkTfuCrcIndInfo(RgLiTfuCrcInd, pst, mBuf); */ + cmUnpkTfuCrcInd(RgLiTfuCrcInd, pst, mBuf); + break; + case EVTTFUTIMINGADVIND: + cmUnpkTfuTimingAdvInd(RgLiTfuTimingAdvInd, pst, mBuf); + break; + case EVTTFUSCHTTIIND: + cmUnpkTfuSchTtiInd(RgLiTfuSchTtiInd, pst, mBuf); + break; + case EVTTFUPUCCHDELPWR: + cmUnpkTfuPucchDeltaPwr(RgLiTfuPucchDeltaPwrInd, pst, mBuf); + break; + case EVTTFUDOAIND: + cmUnpkTfuDoaInd(RgLiTfuDoaInd, pst, mBuf); + break; +#ifdef TFU_UPGRADE + case EVTTFURAWCQIIND: + cmUnpkTfuRawCqiInd(RgLiTfuRawCqiInd, pst, mBuf); + break; + case EVTTFUSRSIND: + cmUnpkTfuSrsInd(RgLiTfuSrsInd, pst, mBuf); + break; +#endif + /*LAA: Error Indication on SCell*/ + case EVTTFUERRIND: + cmUnpkTfuErrInd(RgLiTfuErrInd, pst, mBuf); + break; +#endif + default: + RGSCH_FREE_MSG(mBuf); + break; + } + break; + case ENTRG: /* When MAC sends a msg to Scheduler instance */ + switch(pst->event) + { +#ifdef LCSCH + case EVTINFDEDBOUPDTREQ: + cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf); + break; + case EVTINFCMNBOUPDTREQ: + cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf); + break; + case EVTINFSFRECPIND: + cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf); + break; + /*Fix: start: Inform UE delete to scheduler*/ + case EVTINFUEDELIND: + cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf); + break; + /*Fix: end: Inform UE delete to scheduler*/ +#ifdef LTE_L2_MEAS + case EVTINFL2MEASCFM: + cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf); + break; + case EVTINFL2MEASSTOPCFM: + cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf); + break; +#endif +#endif + default: + RGSCH_FREE_MSG(mBuf); + break; + } + break; + case ENTRM: /* When RRM sends msg to scheduler */ + switch(pst->event) + { + case EVTRGMBNDREQ: + cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf); + break; + case EVTRGMUBNDREQ: + cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf); + break; + case EVTRGMCFGPRBRPRT: + cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf); + break; + default: + RGSCH_FREE_MSG(mBuf); + break; + } + break; + default: + RGSCH_FREE_MSG(mBuf); + break; + } + SExitTsk(); + RETVALUE(ROK); +}/* end of schActvTsk */ + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrsch/rg_sch_gom.c b/src/5gnrsch/rg_sch_gom.c new file mode 100755 index 000000000..ad26f4939 --- /dev/null +++ b/src/5gnrsch/rg_sch_gom.c @@ -0,0 +1,1870 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch_gom.c + +**********************************************************************/ + +/** @file rg_sch_gom.c +@brief This module does processing related to handling of upper interface APIs +invoked by RRM towards MAC. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_MODULE_ID=4096; +static int RLOG_FILE_ID=164; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_mblk.h" /* common memory link list library */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" +#include "rgr.h" +#include "tfu.h" +#include "rg_env.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_err.h" +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer */ +#include "ssi.x" /* system service interface */ +#include "cm5.x" /* common timers */ +#include "cm_lib.x" /* common library */ +#include "cm_hash.x" /* common hash list */ +#include "cm_llist.x" /* common linked list library */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common LTE */ +#include "lrg.x" +#include "rgr.x" +#include "tfu.x" +#include "rg_sch_inf.x" +#include "rg_sch.x" + +/* local defines */ +PRIVATE S16 rgSCHGomHndlCfgReq ARGS((RgSchCb *instCb, SpId spId, + RgrCfg *cfg, RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHGomHndlRecfgReq ARGS((RgSchCb *instCb, SpId spId, + RgrRecfg *recfg, RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHGomHndlResetReq ARGS((RgSchCb *instCb,SpId spId,RgrRst *reset, + RgSchErrInfo *errInfo)); +PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq ARGS((RgrCfgReqInfo *rgrCfgReq, + CmLteCellId *cellId)); +PRIVATE S16 rgSCHGomCfgReq ARGS((Region reg, Pool pool, RgSchCb *instCb, + RgrCfgTransId transId, RgrCfgReqInfo *cfgReqInfo)); +PRIVATE S16 rgSCHGomEnqCfgReq ARGS((Region reg, Pool pool, RgSchCellCb *cell, + RgrCfgTransId transId, RgrCfgReqInfo *rgrCfgReq)); +PRIVATE S16 rgSCHGomHndlDelReq ARGS((RgSchCb *instCb,SpId spId, + RgrDel *del,RgSchErrInfo *errInfo)); +#ifdef LTE_ADV +PRIVATE S16 rgSCHGomHndlSCellActDeactReq ARGS((RgSchCb *instCb, SpId spId, + RgrSCellActDeactEvnt *sCellActDeactEvnt, RgSchErrInfo *errInfo, U8 action)); +#endif /* LTE_ADV */ +#ifdef EMTC_ENABLE +EXTERN S16 rgSchEmtcGetSiWinPerd ARGS(( +RgSchCellCb *cell, +U16 *siWinSize, +U16 *minPeriod +)); +extern S16 rgSCHEmtcUtlCalMcsAndNPrb +( + RgSchCellCb *cell, + U8 cfgType, + MsgLen msgLen, + U8 siId + ); + +EXTERN S32 rgSCHEmtcUtlGetAllwdCchTbSzForSI ARGS( +( +U32 bo +)); + +EXTERN Void rgSCHEmtcWarningSiCfg ARGS( +( +RgSchCellCb *cell, +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo, +U16 idx +)); +#endif + + +/* local typedefs */ + +/* local externs */ + +/* forward references */ + + + +/** + * @brief Handler for config request from RRM to Schedular. + * + * @details + * + * Function: rgSCHGomHndlCfg + * + * This API is called from schedulers UIM and it handles config request + * from RRM to Scheduler. + * + * Processing Steps: + * - If the request is for the inactive cell, + * - Handle request.Call rgSCHGomCfgReq. + * - Else, + * - Enqueue the request. Call rgSCHGomEnqCfgReq. + * + * @param[in] Pst *pst + * @param[in] RgSchCb *instCb + * @param[in] RgrCfgTransId transId + * @param[in] RgrCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGomHndlCfg +( +Pst *pst, +RgSchCb *instCb, +RgrCfgTransId transId, +RgrCfgReqInfo *cfgReqInfo +) +#else +PUBLIC S16 rgSCHGomHndlCfg(pst, instCb, transId, cfgReqInfo) +Pst *pst; +RgSchCb *instCb; +RgrCfgTransId transId; +RgrCfgReqInfo *cfgReqInfo; +#endif +{ + S16 ret; + SpId spId = 0; + CmLteCellId cellId; + RgSchCellCb *cell = NULLP; + U8 cfmStatus = RGR_CFG_CFM_NOK; +#ifdef DEBUGP + Inst inst = (instCb->rgSchInit.inst ); +#endif + + TRC2(rgSCHGomHndlCfg); + /* Apply the configuration for Cell Configuration or Delete */ + if (cfgReqInfo->action != RGR_RECONFIG) + { + ret = rgSCHGomCfgReq (pst->region, pst->pool, instCb, + transId, cfgReqInfo); + RETVALUE(ret); + } + + /* Fetch the cell Id for the recieved request */ + if((rgSCHGomGetCellIdFrmCfgReq(cfgReqInfo, &cellId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Action.Config Type Error"); + + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } + /* Extract the cell and Enquee Config Request */ + if(NULLP != instCb->rgrSap[spId].cell) + { + if(cellId != instCb->rgrSap[spId].cell->cellId) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cellId, "Cell with Id %d already exists " + "on sap %d", instCb->rgrSap[spId].cell->cellId, spId); + + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } + cell = instCb->rgrSap[spId].cell; + + /* Enqueue the configuration */ + ret = rgSCHGomEnqCfgReq(pst->region, pst->pool, cell, transId, cfgReqInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "rgSCHGomHndlCfg: Enqueuing CfgReq " + "Failed "); + + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + } + SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus); + RETVALUE(RFAILED); + +}/* rgSCHGomHndlCfg */ + + +/** + * @brief Handler to handle config request from RRM to Scheduler. + * + * @details + * + * Function: rgSCHGomCfgReq + * + * This API handles processing for config request from RRM to Scheduler. + * + * Processing Steps: + * - If Configuration request, call rgSCHGomHndlCfgReq. + * - Else if Reconfiguration request, call rgSCHGomHndlRecfgReq. + * - If successful, send configuration confirm to RRM. + * Call schSendCfgCfm else FAIL. + * + * @param[in] Region reg + * @param[in] Pool pool + * @param[in] RgSchCb *instCb + * @param[in] RgrCfgTransId transId + * @param[in] RgrCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomCfgReq +( +Region reg, +Pool pool, +RgSchCb *instCb, +RgrCfgTransId transId, +RgrCfgReqInfo *cfgReqInfo +) +#else +PRIVATE S16 rgSCHGomCfgReq(reg, pool, instCb, transId, cfgReqInfo) +Region reg; +Pool pool; +RgSchCb *instCb; +RgrCfgTransId transId; +RgrCfgReqInfo *cfgReqInfo; +#endif +{ + SpId spId = 0; + U8 cfmStatus = RGR_CFG_CFM_OK; + S16 ret; + RgSchErrInfo errInfo; +#ifdef DEBUGP + Inst inst = (instCb->rgSchInit.inst ); +#endif + TRC2(rgSCHGomCfgReq); +#ifdef EMTC_ENABLE +printf("\n AT MAC rgSCHGomCfgReq \n"); +#endif + + /* Process Config/Reconfig/Delete request from RRM */ + switch (cfgReqInfo->action) + { + case SCH_CONFIG: + { + ret = rgSCHGomHndlCfgReq(instCb, spId, + &cfgReqInfo->u.cfgInfo, &errInfo); + break; + } + case RGR_RECONFIG: + { + ret = rgSCHGomHndlRecfgReq(instCb, spId, + &cfgReqInfo->u.recfgInfo, &errInfo); + break; + } + case RGR_RESET: + { + ret = rgSCHGomHndlResetReq(instCb, spId, + &cfgReqInfo->u.rstInfo, &errInfo); + break; + } + case RGR_DELETE: + { + ret = rgSCHGomHndlDelReq(instCb, spId, + &cfgReqInfo->u.delInfo, &errInfo); + break; + } +#ifdef LTE_ADV + case RGR_SCELL_ACT: + case RGR_SCELL_DEACT: + case RGR_SCELL_READY: + { + ret = rgSCHGomHndlSCellActDeactReq(instCb, spId, + &cfgReqInfo->u.sCellActDeactEvnt, &errInfo, cfgReqInfo->action); + break; + } +#endif /* LTE_ADV */ + default: + { + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid configuration " + "action %d", cfgReqInfo->action); + ret = RFAILED; + } + } /* End of switch */ + + if (ret != ROK) + { + cfmStatus = RGR_CFG_CFM_NOK; + } + + SPutSBuf(reg, pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; +#ifdef EMTC_ENABLE +printf("\n AT MAC sending RGR cfg cfm \n"); +#endif + + /* Send back confirmation status to RRM */ + schSendCfgCfm(reg, pool, transId, cfmStatus); +#ifdef EMTC_ENABLE +printf("\n AT MAC RGR cfg cfm sent\n"); +#endif + + RETVALUE(ret); +} /* rgSCHGomCfgReq */ + + +/** + * @brief Handler to enqueuing config request from RRM to Scheduler. + * + * @details + * + * Function: rgSCHGomEnqCfgReq + * + * This API enqueues config request from RRM to MAC. + * + * Processing Steps: + * - Allocate the configuration request element. + * - Copy the contents of the recieved configuration to config request + * element and free the recieved configuration pointer. + * - If the configuration is without activation time, + * - Enqueue the request in crntRgrCfgLst of the cell at the end of + * the list. + * - Else + * - Enqueue the request in pndngRgrCfgLst of the cell. + * + * @param[in] Region reg, + * @param[in] Pool pool + * @param[in] RgSchCellCb *cell + * @param[in] RgrCfgTransId transId + * @param[in] RgrCfgReqInfo *rgrCfgReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomEnqCfgReq +( +Region reg, +Pool pool, +RgSchCellCb *cell, +RgrCfgTransId transId, +RgrCfgReqInfo *rgrCfgReq +) +#else +PRIVATE S16 rgSCHGomEnqCfgReq(reg, pool, cell, transId, rgrCfgReq) +Region reg; +Pool pool; +RgSchCellCb *cell; +RgrCfgTransId transId; +RgrCfgReqInfo *rgrCfgReq; +#endif +{ + S16 ret; + U32 sfDiff; + RgSchCfgElem *rgrCfgElem = NULLP; + CmLteTimingInfo actvTime; + Inst inst = cell->instIdx; + + TRC2(rgSCHGomEnqCfgReq); + + /* Allocate memory for config Element */ + ret = rgSCHUtlAllocSBuf(inst, (Data **)&rgrCfgElem, sizeof(RgSchCfgElem)); + if ((ret != ROK) || ((U8 *)rgrCfgElem == NULLP)) + { + RETVALUE(RFAILED); + } + + /* Initialize the configuration element */ + cmMemcpy((U8*)rgrCfgElem->rgrCfg.transId.trans,(U8*)transId.trans, + sizeof(transId.trans)); + rgrCfgElem->rgrCfg.reg = reg; + rgrCfgElem->rgrCfg.pool = pool; + rgrCfgElem->rgrCfg.rgrCfgReq = rgrCfgReq; + rgrCfgElem->cfgReqLstEnt.prev = NULLP; + rgrCfgElem->cfgReqLstEnt.next = NULLP; + rgrCfgElem->cfgReqLstEnt.node = (PTR )rgrCfgElem; + + /* Add configuration element to current/pending cfgLst */ + if (((rgrCfgReq->action == RGR_RECONFIG) && + (rgrCfgReq->u.recfgInfo.recfgType == RGR_CELL_CFG) && + (rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.pres == TRUE))) + + { + actvTime = + rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.actvTime; + + /* Check if the activation time is valid */ + if (actvTime.sfn >= RGSCH_MAX_SFN + || actvTime.subframe >= RGSCH_NUM_SUB_FRAMES_5G) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId, "Invalid activation time for RGR " + "config request: activation sfn %d activation subframe %d current " + "sfn %d current subframe %d", actvTime.sfn, actvTime.subframe, + cell->crntTime.sfn, cell->crntTime.subframe); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem)); + RETVALUE(RFAILED); + } + + sfDiff = RGSCH_CALC_SF_DIFF(actvTime, cell->crntTime); + + if (sfDiff > (RGR_ACTV_WIN_SIZE * RGSCH_NUM_SUB_FRAMES_5G)) + { + RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,"Invalid activation time for RGR" + " config request: activation sfn %d activation subframe %d " + "current sfn %d current subframe %d", actvTime.sfn, + actvTime.subframe, cell->crntTime.sfn, cell->crntTime.subframe); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem)); + RETVALUE(RFAILED); + } + + if (sfDiff) + { + /* Add to pending cfgReqLst */ + rgrCfgElem->actvTime = actvTime; + rgSCHDbmInsPndngRgrCfgElem(cell, rgrCfgElem); + /* Cfm to be sent only after applying request */ + RETVALUE(ROK); + } + } + + /* Add to current cfgReq list */ + rgSCHDbmInsCrntRgrCfgElem(cell, rgrCfgElem); + /* Cfm to be sent only after applying request */ + RETVALUE(ROK); +} /* rgSCHGomEnqCfgReq */ + + +/** + * @brief Handler for TTI processing for configurations recieved from RRM. + * + * @details + * + * Function: rgSCHGomTtiHndlr + * + * This API does TTI processing for configurations recieved from RRM. + * + * Processing Steps: + * - It dequeues config request from the current configuration list. + * For each config request in the list: + * - Processes the request. Call rgSCHGomCfgReq. + * - It dequeues config request for the current tti from the pending + * configuration list. For each config request in the list: + * - Processes the request. Call rgSCHGomCfgReq. + * + * @param[in] RgSchCellCb *cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGomTtiHndlr +( +RgSchCellCb *cell, +SpId spId +) +#else +PUBLIC S16 rgSCHGomTtiHndlr(cell, spId) +RgSchCellCb *cell; +SpId spId; +#endif +{ + RgSchCfgElem *cfgElem; + Inst inst= cell->instIdx; + TRC2(rgSCHGomTtiHndlr); + + /* Dequeue from current config list */ + while ((cfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP) + { + rgSCHDbmDelCrntRgrCfgElem(cell, cfgElem); + rgSCHGomCfgReq(cfgElem->rgrCfg.reg,cfgElem->rgrCfg.pool, + &rgSchCb[inst], cfgElem->rgrCfg.transId, + cfgElem->rgrCfg.rgrCfgReq); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem)); + } + + /* Handle config requests from pending config list */ + while((cfgElem = rgSCHDbmGetPndngRgrCfgElemByKey(cell, cell->crntTime)) != NULLP) + { + rgSCHDbmDelPndngRgrCfgElem(cell, cfgElem); + rgSCHGomCfgReq(cfgElem->rgrCfg.reg, cfgElem->rgrCfg.pool, + &rgSchCb[inst], cfgElem->rgrCfg.transId, + cfgElem->rgrCfg.rgrCfgReq); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem)); + } + + RETVALUE(ROK); +} + + +/** + * @brief Handler to handle configuration request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlCfgReq + * + * This API handles processing for configuration request from RRM to MAC. + * + * - Processing Steps: + * - Validate configuration request parameters at CFG module. + * Call rgSCHCfgVldtRgrCellCfg for cell configuration. + * - If validated successfully, send configuration request to CFG. + * Call rgSCHCfgRgrCellCfg else FAIL. + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrCfg *cfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomHndlCfgReq +( +RgSchCb *instCb, +SpId spId, +RgrCfg *cfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHGomHndlCfgReq(instCb, spId, cfg, errInfo) +RgSchCb *instCb; +SpId spId; +RgrCfg *cfg; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst ); + RgSchUeCb *ue; + + TRC2(rgSCHGomHndlCfgReq); + + errInfo->errType = RGSCHERR_GOM_CFG_REQ; + + /* Validate and process the configuration request */ + switch (cfg->cfgType) + { + case RGR_CELL_CFG: + { + ret = rgSCHCfgVldtRgrCellCfg(inst, &cfg->u.cellCfg, cell, errInfo); + if (ret != ROK) + { + RLOG1(L_ERROR,"Rgr Cell configuration " + "validation FAILED: Cell %d", cfg->u.cellCfg.cellId); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrCellCfg(instCb, spId, &cfg->u.cellCfg, errInfo); + break; + } + case RGR_UE_CFG: + case RGR_SCELL_UE_CFG: + { + ret = rgSCHCfgVldtRgrUeCfg(inst, &cfg->u.ueCfg, &cell, errInfo); + if (ret != ROK) + { + RLOG1(L_ERROR,"Ue configuration validation" + " FAILED: CRNTI:%d", cfg->u.ueCfg.crnti); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrUeCfg(cell, &cfg->u.ueCfg, errInfo); + break; + } + case RGR_LCH_CFG: + { + ret = rgSCHCfgVldtRgrLcCfg(inst, &cfg->u.lchCfg, &cell, &ue, errInfo); + if (ret != ROK) + { + RLOG1(L_ERROR,"LC configuration validation " + "FAILED: LCID:%d", cfg->u.lchCfg.lcId); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrLchCfg(cell, ue, &cfg->u.lchCfg, errInfo); + break; + } + case RGR_LCG_CFG: + { + ret = rgSCHCfgVldtRgrLcgCfg(inst, &cfg->u.lcgCfg, &cell, &ue, errInfo); + if (ret != ROK) + { + RLOG1(L_ERROR,"LCG configuration validation " + "FAILED: LCGID:%d", cfg->u.lcgCfg.ulInfo.lcgId); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrLcgCfg(cell, ue, &cfg->u.lcgCfg, errInfo); + break; + } + case MAC_GNB_CFG: + { + ret = rgSCHCfgVldtRgrSchedEnbCfg(inst, &cfg->u.schedEnbCfg, errInfo); + if (ret != ROK) + { + RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCH ENB configuration validation " + "FAILED: \n" )); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrSchedEnbCfg(inst, spId, &cfg->u.schedEnbCfg, errInfo); + break; + } + default: + { +#if(ERRCLASS & ERRCLS_INT_PAR) + RLOG1(L_ERROR,"Should never come here: " + "cfgType %d", cfg->cfgType); +#endif + RETVALUE(RFAILED); + } + } + + RETVALUE(ret); +} /* rgSCHGomHndlCfgReq */ + +#ifdef LTE_ADV +/** + * @brief Handler to handle re-configuration request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlSCellActDeactReq + * + * This API handles processing for SCell Activation Request from RRM to SCH. + * + * - Processing Steps: + * - Validate sCell Actication request parameters at CFG module. + * - If validated successfully, send configuration request to CFG. + * - call activation function for each SCells configured + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrSCellActDeactEvnt *sCellActDeactEvnt + * @param[in] U8 action + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomHndlSCellActDeactReq +( +RgSchCb *instCb, +SpId spId, +RgrSCellActDeactEvnt *sCellActDeactEvnt, +RgSchErrInfo *errInfo, +U8 action +) +#else +PRIVATE S16 rgSCHGomHndlSCellActDeactReq(instCb, spId, sCellActDeactEvnt, errInfo, action) +RgSchCb *instCb; +SpId spId; +RgrSCellActDeactEvnt *sCellActDeactEvnt; +RgSchErrInfo *errInfo; +U8 action; +#endif +{ + RgSchUeCb *ue = NULLP; + U16 idx = 0; + U16 sCellIdx = 0; + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst); + + TRC2(rgSCHGomHndlSCellActDeactReq); + RGSCHDBGPRM(inst,(rgSchPBuf(inst), "Processing RGR SCell Actication request:" + "%d\n", sCellActDeactEvnt->crnti)); + + errInfo->errType = RGSCHERR_GOM_SCELL_REQ; + + /* Fetch the Ue */ + if ((ue = rgSCHDbmGetUeCb(cell, sCellActDeactEvnt->crnti)) == NULLP) + { + RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UE: does not exist\n", + sCellActDeactEvnt->crnti)); + RETVALUE(RFAILED); + } + + for(idx = 0; idx < sCellActDeactEvnt->numOfSCells; idx++) + { + sCellIdx = sCellActDeactEvnt->sCellActDeactInfo[idx].sCellIdx; + + if (ROK != (rgSCHSCellTrigActDeact(cell, ue, sCellIdx, action))) + { + RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCell Actication failed" + "for UE [%d] with SCellIdx [%d]\n", + sCellActDeactEvnt->crnti, idx)); + RETVALUE(RFAILED); + + } + + } + RGSCHDBGINFO(inst,(rgSchPBuf(inst), "RGR Reconfiguration processed\n")); + RETVALUE(ROK); +} /* rgSCHGomHndlSCellActDeactReq */ + +#endif /* LTE_ADV */ +/** + * @brief Handler to handle re-configuration request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlRecfgReq + * + * This API handles processing for re-configuration request from RRM to MAC. + * + * - Processing Steps: + * - Validate re-configuration request parameters at CFG module. + * Call rgSCHCfgVldtRgrCellRecfg for cell re-configuration. + * - If validated successfully, send configuration request to CFG. + * Call rgSCHCfgRgrCellRecfg else FAIL. + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrRecfg *recfg + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomHndlRecfgReq +( +RgSchCb *instCb, +SpId spId, +RgrRecfg *recfg, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHGomHndlRecfgReq(instCb, spId, recfg, errInfo) +RgSchCb *instCb; +SpId spId; +RgrRecfg *recfg; +RgSchErrInfo *errInfo; +#endif +{ + RgSchUeCb *ue = NULLP; + RgSchDlLcCb *dlLc = NULLP; /* PURIFY_FIX:UMR */ + S16 ret; + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst ); + + TRC2(rgSCHGomHndlRecfgReq); + + errInfo->errType = RGSCHERR_GOM_RECFG_REQ; + + /* Validate and process the re-configuration request */ + switch (recfg->recfgType) + { + case RGR_CELL_CFG: + { + ret = rgSCHCfgVldtRgrCellRecfg(inst, &recfg->u.cellRecfg, &cell, + errInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,recfg->u.cellRecfg.cellId,"Rgr Cell Recfg Validation " + "FAILED"); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrCellRecfg(cell, &recfg->u.cellRecfg, errInfo); + break; + } + case RGR_UE_CFG: + case RGR_SCELL_UE_CFG: + { + ret = rgSCHCfgVldtRgrUeRecfg(inst, &recfg->u.ueRecfg, &cell, &ue, errInfo); + if ( ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.ueRecfg.cellId,"Ue Recfg Validation FAILED" + "OLD CRNTI:%d",recfg->u.ueRecfg.oldCrnti); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrUeRecfg(cell, ue, &recfg->u.ueRecfg, errInfo); + break; + } + case RGR_LCH_CFG: + { + ret = rgSCHCfgVldtRgrLchRecfg(inst, &recfg->u.lchRecfg, &cell, &ue, + &dlLc, errInfo); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lchRecfg.cellId,"Lc Recfg Validation FAILED" + "LCID:%d",recfg->u.lchRecfg.lcId); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrLchRecfg(cell, ue, dlLc, &recfg->u.lchRecfg, errInfo); + break; + } + case RGR_LCG_CFG: + { + ret = rgSCHCfgVldtRgrLcgRecfg(inst, &recfg->u.lcgRecfg, cell, &ue, + errInfo); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lcgRecfg.cellId, "Lcg Recfg Validation FAILED" + "LCGID:%d",recfg->u.lcgRecfg.ulRecfg.lcgId); + RETVALUE(RFAILED); + } + ret = rgSCHCfgRgrLcgRecfg(cell, ue, &recfg->u.lcgRecfg, errInfo); + break; + } + default: + { +#if(ERRCLASS & ERRCLS_INT_PAR) + RLOG1(L_ERROR,"Should never come here: recfgType %d", recfg->recfgType); +#endif + RETVALUE(RFAILED); + } + } + + RETVALUE(ret); +} /* rgSCHGomHndlRecfgReq */ + +/** + * @brief Handler to handle UE reset request from RRM to Scheduler. + * + * @details + * + * Function: rgSCHGomHndlResetReq + * + * This API handles processing for UE reset request from RRM to Scheduler. + * + * - Processing Steps: + * - Validate UE reset request parameters at CFG module. + * Call rgSCHCfgVldtRgrUeReset for UE reset. + * - If validated successfully, send UE reset request to CFG. + * Call rgSCHCfgRgrUeReset else FAIL. + * + * @param[in] RgrRst *rstInfo + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomHndlResetReq +( +RgSchCb *instCb, +SpId spId, +RgrRst *reset, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHGomHndlResetReq(instCb, spId, reset, errInfo) +RgSchCb *instCb; +SpId spId; +RgrRst *reset; +RgSchErrInfo *errInfo; +#endif +{ + S16 ret; + RgSchCellCb *cell= instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst ); + RgSchUeCb *ue = NULLP; + + TRC2(rgSCHGomHndlResetReq); + + + errInfo->errType = RGSCHERR_GOM_RESET_REQ; + + /* Validate and process the UE reset request */ + ret = rgSCHCfgVldtRgrUeReset(inst, reset, cell, &ue, errInfo); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset Validation FAILED" + "CRNTI:%d",reset->crnti); + RETVALUE(RFAILED); + } + + ret = rgSCHCfgRgrUeReset(cell, ue, reset, errInfo); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset FAILED" + "CRNTI:%d",reset->crnti); + RETVALUE(RFAILED); + } + + RETVALUE(ret); +} /* rgSCHGomHndlResetReq */ + + +/** + * @brief Handler for processing Cell/Ue/Logical channel delete request + * recieved from RRM. + * + * @details + * + * Function: rgSCHGomHndlDelReq + * + * This API handles processing of delete request from RRM to MAC. + * + * Processing Steps: + * - Fetch corresponding control block and pass it to CFG module. + * - If control block does not exist, FAIL. + * + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrDel *del + * @param[out] RgSchErrInfo *errInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHGomHndlDelReq +( +RgSchCb *instCb, +SpId spId, +RgrDel *del, +RgSchErrInfo *errInfo +) +#else +PRIVATE S16 rgSCHGomHndlDelReq(instCb, spId, del, errInfo) +RgSchCb *instCb; +SpId spId; +RgrDel *del; +RgSchErrInfo *errInfo; +#endif +{ + + S16 ret; +#ifdef DEBUGP + Inst inst = (instCb->rgSchInit.inst); +#endif + VOLATILE U32 startTime=0; + + TRC2(rgSCHGomHndlDelReq); + + errInfo->errType = RGSCHERR_GOM_DEL_REQ; + + if(instCb->rgrSap[spId].cell == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Cell doesnt exist"); + RETVALUE(RFAILED); + } + + /* Process the delete request */ + switch (del->delType) + { + case RGR_CELL_CFG: + { + ret = rgSCHCfgRgrCellDel(instCb->rgrSap[spId].cell, del, errInfo); + if(ret == ROK) + { + /* TODO::Needs to be revisited after tti flow CaDev Start */ + U8 idx = (U8)((instCb->rgrSap[spId].cell->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1)); + instCb->cells[idx] = NULLP; + /* CaDev End */ + instCb->rgrSap[spId].cell = NULLP; + instCb->tfuSap[spId].cell = NULLP; + } + break; + } + case RGR_UE_CFG: + case RGR_SCELL_UE_CFG: + { + + /*starting Task*/ + SStartTask(&startTime, PID_SCH_UE_DEL); + + ret = rgSCHCfgRgrUeDel(instCb->rgrSap[spId].cell, del, errInfo); + + /*stoping Task*/ + SStopTask(startTime, PID_SCH_UE_DEL); + + break; + } + case RGR_LCH_CFG: + { + ret = rgSCHCfgRgrLcDel(instCb->rgrSap[spId].cell, del, errInfo); + break; + } + case RGR_LCG_CFG: + { + ret = rgSCHCfgRgrLcgDel(instCb->rgrSap[spId].cell, del, errInfo); + break; + } + default: + { +#if(ERRCLASS & ERRCLS_INT_PAR) + RLOG1(L_ERROR,"Should never come here: delType %d", del->delType); +#endif + RETVALUE(RFAILED); + } + } + + RETVALUE(ret); +} /* rgSCHGomHndlDelReq */ + + + + +/*********************************************************** + * + * Func : rgSCHGomGetCellIdFrmCfgReq + * + * + * Desc : + * - Processing Steps: + * - Retrieves the cell Id for a config request. + * + * @param[in] RgrCfgReqInfo *rgrCfgReq + * @param[out] CmLteCellId *cellId + * Ret : ROK on fetching cellId + * RFAILED on failure + * + * Notes: + * + * File : rg_sch_gom.c + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq +( +RgrCfgReqInfo *rgrCfgReq, +CmLteCellId *cellId +) +#else +PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq(rgrCfgReq, cellId) +RgrCfgReqInfo *rgrCfgReq; +CmLteCellId *cellId; +#endif +{ + + TRC2(rgSCHGomGetCellIdFrmCfgReq); + + + /* Extract CellId depending on the action and Config Type in the Request + * As of now this function is called for only re configuration so removed + * othe CASES below if needed we can add them*/ + switch (rgrCfgReq->action) + { + case RGR_RECONFIG: + { + if (rgrCfgReq->u.recfgInfo.recfgType ==RGR_CELL_CFG) + { + *cellId = rgrCfgReq->u.recfgInfo.u.cellRecfg.cellId; + } + else if ((rgrCfgReq->u.recfgInfo.recfgType == RGR_SCELL_UE_CFG) || + (rgrCfgReq->u.recfgInfo.recfgType == RGR_UE_CFG)) + { + *cellId = rgrCfgReq->u.recfgInfo.u.ueRecfg.cellId; + } + else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCH_CFG) + { + *cellId = rgrCfgReq->u.recfgInfo.u.lchRecfg.cellId; + } + else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCG_CFG) + { + *cellId = rgrCfgReq->u.recfgInfo.u.lcgRecfg.cellId; + } + else + { + RETVALUE(RFAILED); + } + break; + } + default: + { + RETVALUE(RFAILED); + } + } /* End of Switch */ + + RETVALUE(ROK); +} /* rgSCHGomGetCellIdFrmCfgReq */ + +#ifdef RGR_SI_SCH +/** + * @brief Handler to handle SI configuration request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlSiCfg + * + * This API handles processing for SI configuration request from RRM to MAC. + * + * - Processing Steps: + * - Validate SI configuration request parameters at CFG module. + * Call rgSCHCfgVldtSiCfg for SI configuration. + * - If validated successfully, send configuration request to CFG. + * Call rgSCHCfgRgrCellCfg else FAIL. + * + * @param[in] Region reg + * @param[in] Pool pool + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrCfgTransId transId + * @param[in] RgrSiCfgReqInfo *cfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGomHndlSiCfg +( +Region reg, +Pool pool, +RgSchCb *instCb, +SpId spId, +RgrCfgTransId transId, +RgrSiCfgReqInfo *cfgReqInfo +) +#else +PUBLIC S16 rgSCHGomHndlSiCfg(reg, pool, instCb, spId, transId, cfgReqInfo) +Region reg; +Pool pool; +RgSchCb *instCb; +SpId spId; +RgrCfgTransId transId; +RgrSiCfgReqInfo *cfgReqInfo; +#endif +{ + S16 ret; + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst ); + RgSchErrInfo errInfo; + U8 cfmStatus = RGR_CFG_CFM_NOK; + MsgLen msgLen = 0, pduLen; + S32 tbSz = 0; + U8 nPrb = 0; + U8 mcs = 0; + + TRC2(rgSCHGomHndlSiCfg); + + + /* check if cell does not exists */ + if (((U8 *)cell == NULLP) || (cell->cellId != cfgReqInfo->cellId)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Cell Control block does not exist" + ); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + + /*Validate the received SI configuration */ + ret = rgSCHCfgVldtRgrSiCfg(inst, cfgReqInfo, cell, &errInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " + "validation FAILED"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + /*ccpu00140789: Stopping SI scheduling*/ + if(RGR_SI_STOP == cfgReqInfo->cfgType) + { + if((cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)&& + (cell->siCb.siArray[cfgReqInfo->siId-1].si != NULLP)) + { + cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP; + RGSCH_FREE_MSG(cell->siCb.siArray[cfgReqInfo->siId-1].si); + cell->siCb.siArray[cfgReqInfo->siId-1].si = NULLP; + if(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP) + { + RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si); + cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP; + } + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + cfmStatus = RGR_CFG_CFM_OK; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); + RETVALUE(ROK); + } + else + { + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); + RETVALUE(RFAILED); + } + } + + /* Check if the pdu sent from application + * matches a transport block size. if not, + * add padding bytes. This is usually done + * by RRC but since we are bypassing RRC, + * MAC is taking over that responsibility + */ + if ( RGR_SI_CFG_TYPE_MIB != cfgReqInfo->cfgType ) + { + SFndLenMsg(cfgReqInfo->pdu, &msgLen); + + /* check if the application pdu matches a tb size */ + tbSz = rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs); + + if ( tbSz != (msgLen*8) ) + { + MsgLen nmPadBytes = 0; + Data* padding = NULLP; + + /* need to add padding bytes */ + nmPadBytes = (tbSz - (msgLen*8))/8; + + if ( SGetSBuf(reg,pool,&padding,nmPadBytes) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " + "SGetSBuf failed for padding failed"); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + + cmMemset((U8*)padding,(U8)0,nmPadBytes); + +#ifdef MS_MBUF_CORRUPTION + MS_BUF_ADD_ALLOC_CALLER(); +#endif + if ( SAddPstMsgMult((Data*)padding,nmPadBytes,cfgReqInfo->pdu) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration " + "Failed to add padding bytes"); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes); + padding = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes); + padding = NULLP; + }/* if (tbSz != ...*/ + }/* if (RGR_SI_CFG_TYPE_SI...*/ + + /*Set the received pdu at the appropriate place */ + switch(cfgReqInfo->cfgType) + { + case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */ + RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.mib, + cell->siCb.newSiInfo.mib, + cfgReqInfo->pdu, cell->siCb.siBitMask, + RGSCH_SI_MIB_UPD); + break; + + case RGR_SI_CFG_TYPE_SIB1_PWS: + { + SFndLenMsg(cfgReqInfo->pdu, &pduLen); + ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" + "value"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + + RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, + cell->siCb.newSiInfo.sib1Info.sib1, + cfgReqInfo->pdu, cell->siCb.siBitMask, + RGSCH_SI_SIB1_PWS_UPD); + } + break; + + case RGR_SI_CFG_TYPE_SIB1: + SFndLenMsg(cfgReqInfo->pdu, &pduLen); + ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" + "value"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, + cell->siCb.newSiInfo.sib1Info.sib1, + cfgReqInfo->pdu, cell->siCb.siBitMask, + RGSCH_SI_SIB1_UPD); + break; + + case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */ + SFndLenMsg(cfgReqInfo->pdu, &pduLen); + ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, + cfgReqInfo->siId); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" + "value"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + /* Si recfg, where numSi changes */ + if (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) + { + Buffer **newSiPdu = &cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si; + if(*newSiPdu != NULLP) + { + RGSCH_FREE_MSG(*newSiPdu); + } + *newSiPdu = (Buffer *)cfgReqInfo->pdu; + cell->siCb.siBitMask |= RGSCH_SI_SI_UPD; + } + else /* Initial Si cfg or si recfg where numSi did not change */ + { + U8 bitMask; + /* Initial Si cfg */ + if (cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si == NULLP) + { + cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu; + cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE; + bitMask = RGSCH_SI_DFLT; + } + else + { + bitMask = RGSCH_SI_SI_UPD; + } + + RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si, + cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si, + cfgReqInfo->pdu, + cell->siCb.siBitMask, bitMask); + } + break; + + case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */ + SFndLenMsg(cfgReqInfo->pdu, &pduLen); + ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, + cfgReqInfo->siId); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" + "value"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + /* No need to wait for Modification period boundary */ + cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu; + RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si, + cfgReqInfo->pdu); + cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE; + break; + default: + RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Invalid cfgType " + "parameter value"); + RGSCH_FREE_MSG(cfgReqInfo->pdu); + SPutSBuf(reg, pool, (Data *)cfgReqInfo, + (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + + SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); + cfgReqInfo = NULLP; + cfmStatus = RGR_CFG_CFM_OK; + rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); + + + RETVALUE(ROK); +} /* rgSCHGomHndlSiCfg */ + + +/** + * @brief Handler to handle Warning SI configuration request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlWarningSiCfg + * + * This API handles processing for Warning SI configuration request from + * RRM to MAC. + * + * + * @param[in] Region reg + * @param[in] Pool pool + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGomHndlWarningSiCfg +( +Region reg, +Pool pool, +RgSchCb *instCb, +SpId spId, +RgrCfgTransId transId, +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo +) +#else +PUBLIC S16 rgSCHGomHndlWarningSiCfg(reg, pool, instCb, spId, transId, +warningSiCfgReqInfo) +Region reg; +Pool pool; +RgSchCb *instCb; +SpId spId; +RgrCfgTransId transId; +RgrWarningSiCfgReqInfo *warningSiCfgReqInfo; +#endif +{ + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + U8 cfmStatus = RGR_CFG_CFM_NOK; + U16 idx; + U8 siId = warningSiCfgReqInfo->siId; + U8 j, mcs=0, nPrb=0; + RgSchWarningSiSeg *warningSiMsg; + RgSchWarningSiPdu *pduNode; + CmLList *node; + MsgLen msgLen = 0; + Bool freeNodeFound = FALSE; + U16 siWinSize = 0; + U16 minPeriod = 0; +#ifdef EMTC_ENABLE + U8 isEmtc = warningSiCfgReqInfo->emtcEnable; +#endif + + TRC2(rgSCHGomHndlWarningSiCfg); + +#ifdef EMTC_ENABLE + if(TRUE == isEmtc) + { + rgSchEmtcGetSiWinPerd(cell, &siWinSize, &minPeriod); + } + else +#endif + { + siWinSize = cell->siCfg.siWinSize; + minPeriod = cell->siCfg.minPeriodicity; + } + /* check if cell does not exists */ + if (((U8 *)cell == NULLP) || + (cell->cellId != warningSiCfgReqInfo->cellId) || + (warningSiCfgReqInfo->siId > + ((minPeriod * 10)/siWinSize))) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,warningSiCfgReqInfo->cellId,"Warning SI Cfg Failed for siId = %d" + "warning cellID:%d",warningSiCfgReqInfo->siId,warningSiCfgReqInfo->cellId); + rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst); + SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + warningSiCfgReqInfo = NULLP; + rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + + /* Search for free index in WarningSi */ + for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) + { + if((cell->siCb.warningSi[idx].siId == 0 || + cell->siCb.warningSi[idx].siId == warningSiCfgReqInfo->siId)) + { + warningSiMsg = (RgSchWarningSiSeg *)&cell->siCb.warningSi[idx].warningSiMsg; + + /* Search for free SI node */ + /* ccpu00136659: CMAS ETWS design changes */ + if (warningSiMsg->segLstCp.first == NULLP) /* Free SI Node */ + { + warningSiMsg->transId = transId; + pduNode = (RgSchWarningSiPdu *)&cell->siCb.warningSi[idx]. + warningSiMsg.pduNode; + CM_LLIST_FIRST_NODE(&warningSiCfgReqInfo->siPduLst, node); + j = 0; + + /* Get the PDUs one by one from the received pduLst of warning + * message and calculate the MCS and nPrb of each pdu once. + * Store the pdu in warningSiMsg pduLst, which will be scheduled + * later while sending warning message as part of SIB11/SIB12 + */ + while((node != NULLP) && (j < RGR_MAX_WARNING_SI_SEG)) + + { + pduNode[j].pdu = (Buffer *)node->node; + if(pduNode[j].pdu != NULLP) + { + SFndLenMsg(pduNode[j].pdu, &msgLen); + /*Get the nPrb and mcs parametr values */ +#ifdef EMTC_ENABLE + if (rgSCHEmtcUtlGetAllwdCchTbSzForSI(msgLen*8) != (msgLen*8)) +#else + if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8)) +#endif + + { + RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011, + (ErrVal)msgLen, + "rgSCHGomHndlWarningSiCfg():msgLen does not match\ + any valid TB Size."); + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Warning SI Cfg Failed" + "for siId = %d", warningSiCfgReqInfo->siId); + rgSCHUtlFreeWarningSiSeg(reg, pool, + &warningSiCfgReqInfo->siPduLst); + SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + warningSiCfgReqInfo = NULLP; + rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, + siId, transId,cfmStatus); + RETVALUE(RFAILED); + + } + } + pduNode[j].mcs = mcs; + pduNode[j].nPrb = nPrb; + pduNode[j].msgLen = msgLen; + /* ccpu00136659: CMAS ETWS design changes */ + cmLListAdd2Tail(&warningSiMsg->segLstCp, &pduNode[j].lnk); + pduNode[j].lnk.node = (PTR)&pduNode[j]; + j++; + node = node->next; + } + + /* ccpu00132385- nodes in received SI config linked list should + * be freed after processing the config.*/ + while(warningSiCfgReqInfo->siPduLst.first != NULLP) + { + node = warningSiCfgReqInfo->siPduLst.first; + cmLListDelFrm(&(warningSiCfgReqInfo->siPduLst), node); + SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList)); + node = NULLP; + } + + cell->siCb.warningSi[idx].siId = warningSiCfgReqInfo->siId; + cell->siCb.warningSi[idx].idx = idx; +#ifdef EMTC_ENABLE + if(TRUE == isEmtc) + { + rgSCHEmtcWarningSiCfg(cell,warningSiCfgReqInfo,idx); + } + else +#endif + { + cell->siCb.siArray[warningSiCfgReqInfo->siId-1].si = + &cell->siCb.warningSi[idx]; + cell->siCb.siArray[warningSiCfgReqInfo->siId-1].isWarningSi = + TRUE; + } + freeNodeFound = TRUE; + break; + } + } + } + + if (freeNodeFound == FALSE) + { + RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"No SI Index is free"); + rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst); + SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + warningSiCfgReqInfo = NULLP; + rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, + cfmStatus); + RETVALUE(RFAILED); + } + + SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, + sizeof(RgrWarningSiCfgReqInfo)); + warningSiCfgReqInfo = NULLP; + RETVALUE(ROK); +} + + +/** + * @brief Handler to handle SI Stop request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlWarningSiStopReq + * + * This API handles processing for SI stop request from RRM to MAC. + * + * @param[in] Region reg + * @param[in] Pool pool + * @param[in] RgSchCb *instCb + * @param[in] SpId siId + * @return void + **/ +#ifdef ANSI +PUBLIC Void rgSCHGomHndlWarningSiStopReq +( +Region reg, +Pool pool, +RgSchCb *instCb, +U8 siId, +RgrCfgTransId transId, +SpId spId +) +#else +PUBLIC Void rgSCHGomHndlWarningSiStopReq(reg, pool, instCb, siId, transId, spId) +Region reg; +Pool pool; +RgSchCb *instCb; +U8 siId; +RgrCfgTransId transId; +SpId spId; +#endif +{ + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + U16 idx; + CmLList *node; + RgSchWarningSiPdu *warningSiPdu; + Buffer *pdu; + + TRC3(rgSCHGomHndlWarningSiStopReq) + + for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++) + { + if(cell->siCb.warningSi[idx].siId == siId) + { + if ((cmMemcmp ((U8 *)&cell->siCb.warningSi[idx].warningSiMsg.transId, + (U8 *)&transId, sizeof(RgrCfgTransId))) == 0) + { + /* ccpu00136659: CMAS ETWS design changes */ + CM_LLIST_FIRST_NODE(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node); + while(node != NULLP) + { + /* On receiving the warning stop message, remove one by one + * each PDU from the warning SI list + */ + /* ccpu00136659: CMAS ETWS design changes */ + node = (CmLList *)&cell->siCb.warningSi[idx].warningSiMsg.segLstCp.first; + warningSiPdu = (RgSchWarningSiPdu *)node->node; + pdu = warningSiPdu->pdu; + cmLListDelFrm(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node); + RGSCH_FREE_MSG(pdu); + node = node->next; + } + } + } + } + RETVOID; +} + +#endif/*RGR_SI_SCH */ + +/* LTE_ADV_FLAG_REMOVED_START */ + +/** + * @brief This function sets the Phigh range for CC users corresponding to the CC Pool + * @details + * + * Function: rgSchUpdtRNTPInfo + * + * Invoked by: rgSCHGomHndlLoadInf + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @param[in] RgrLoadInfReqInfo *loadInfReq + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSchUpdtRNTPInfo +( + RgSchCellCb *cell, + RgSchDlSf *sf, + RgrLoadInfReqInfo *loadInfReq + ) +#else +PRIVATE Void rgSchUpdtRNTPInfo(cell, sf) + RgSchCellCb *cell; + RgSchDlSf *sf; + RgrLoadInfReqInfo *loadInfReq; + +#endif +{ + /* Initialise the variables */ + RgSchSFRPoolInfo *sfrCCPool; + CmLListCp *l; + CmLList *n; + S16 ret = RFAILED; + + TRC2(rgSchUpdtRNTPInfo); + + l = &sf->sfrTotalPoolInfo.ccPool; + + /*Get the first node from the CC Pool*/ + n = cmLListFirst(l); + while(n) + { + sfrCCPool = (RgSchSFRPoolInfo*)n->node; + if (sfrCCPool->poolendRB == loadInfReq->rgrCcPHighEndRb) + { + sfrCCPool->pwrHiCCRange.endRb = loadInfReq->rgrCcPHighEndRb; + sfrCCPool->pwrHiCCRange.startRb = loadInfReq->rgrCcPHighStartRb; + RETVALUE(ROK); + } + else + { + n = cmLListNext(l); + } + } + RETVALUE(ret); +} +/** + * @brief Handler to handle LOAD INF request from RRM to MAC. + * + * @details + * + * Function: rgSCHGomHndlLoadInf + * + * This API handles processing for LOAD INF request from RRM to MAC. + * + * - Processing Steps: + * - Validate LOAD INF request parameters at CFG module. + * Call rgSCHCfgVldtRgrLoadInf for SI configuration. + * - If validated successfully, send configuration request. + * + * @param[in] Region reg + * @param[in] Pool pool + * @param[in] RgSchCb *instCb + * @param[in] SpId spId + * @param[in] RgrCfgTransId transId + * @param[in] RgrLoadInfReqInfo *loadInfReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGomHndlLoadInf +( + Region reg, + Pool pool, + RgSchCb *instCb, + SpId spId, + RgrCfgTransId transId, + RgrLoadInfReqInfo *loadInfReq + ) +#else +PUBLIC S16 rgSCHGomHndlLoadInf(reg, pool, instCb, spId, transId, loadInfReq) + Region reg; + Pool pool; + RgSchCb *instCb; + SpId spId; + RgrCfgTransId transId; + RgrLoadInfReqInfo *loadInfReq; +#endif +{ + S16 ret; + RgSchCellCb *cell = instCb->rgrSap[spId].cell; + Inst inst = (instCb->rgSchInit.inst ); + RgSchErrInfo errInfo; + U16 i; + + TRC2(rgSCHGomHndlLoadInf); + + + /* check if cell does not exists */ + if (((U8 *)cell == NULLP) || (cell->cellId != loadInfReq->cellId)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,loadInfReq->cellId,"Cell Control block does not exist" + "for load cellId:%d",loadInfReq->cellId); + SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); + RETVALUE(RFAILED); + } + + if (cell->lteAdvCb.dsfrCfg.status == RGR_DISABLE) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHGomHndlLoadInf(): DSFR Feature not enabled"); + SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); + RETVALUE(RFAILED); + } + /* Validate the received LOAD INF Configuration */ + ret = rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, &errInfo); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Rgr LOAD INF Configuration " + "validation FAILED"); + SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); + RETVALUE(RFAILED); + } + /* Update the RNTP info rcvd in the respective cell centre pool so that Phigh can be + sent for the UEs scheduled in that particular RB range*/ + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + if((rgSchUpdtRNTPInfo(cell, cell->subFrms[i], loadInfReq) != ROK)) + { + RETVALUE(RFAILED); + } + } + + SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq)); + + + RETVALUE(ROK); +} /* rgSCHGomHndlLoadInf */ +/* LTE_ADV_FLAG_REMOVED_END */ + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_hdfdd.c b/src/5gnrsch/rg_sch_hdfdd.c similarity index 100% rename from src/5gnrmac/rg_sch_hdfdd.c rename to src/5gnrsch/rg_sch_hdfdd.c diff --git a/src/5gnrmac/rg_sch_hdfdd.h b/src/5gnrsch/rg_sch_hdfdd.h similarity index 100% rename from src/5gnrmac/rg_sch_hdfdd.h rename to src/5gnrsch/rg_sch_hdfdd.h diff --git a/src/5gnrmac/rg_sch_hdfdd.x b/src/5gnrsch/rg_sch_hdfdd.x similarity index 100% rename from src/5gnrmac/rg_sch_hdfdd.x rename to src/5gnrsch/rg_sch_hdfdd.x diff --git a/src/5gnrmac/rg_sch_inf.c b/src/5gnrsch/rg_sch_inf.c similarity index 100% rename from src/5gnrmac/rg_sch_inf.c rename to src/5gnrsch/rg_sch_inf.c diff --git a/src/5gnrmac/rg_sch_inf.h b/src/5gnrsch/rg_sch_inf.h similarity index 100% rename from src/5gnrmac/rg_sch_inf.h rename to src/5gnrsch/rg_sch_inf.h diff --git a/src/5gnrsch/rg_sch_inf.x b/src/5gnrsch/rg_sch_inf.x new file mode 100755 index 000000000..51f26a20d --- /dev/null +++ b/src/5gnrsch/rg_sch_inf.x @@ -0,0 +1,1451 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/********************************************************************** + + Name: LTE-MAC layer + + Type: C Include File + + Desc: Structures, variables, and typedefs required by the interface between + MAC and Scheduler. + + File: rg_sch_inf.x + +**********************************************************************/ +/** + @file rg_sch_inf.x + @brief Structure declarations and definitions for MAC-SCH interface. + */ + +#ifndef __GKSCH_X__ +#define __GKSCH_X__ + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef EMTC_ENABLE +/** + * @brief This structure contains the uplink grant information that is sent in + response to the random access request from the UE for CEmodeA. + */ +typedef struct rgInfEmtcCEmodeARarUlGrt +{ + U8 msg3PUSCHNbIdx; /*!< Indicates the Msg3 PUSCH narrowband index. */ + U8 rbStart; /*!< Start Resource block of allocation. */ + U8 numRb; /*!< Number of resource blocks allocated. */ + U8 msg3PUSCHNumRep; /*!< Number of repetitions for Msg3 PUSCH. */ + U8 iMcsCrnt; /*!< Current MCS index of the grant. */ + U8 tpc; /*!< TPC command for the uplink grant. */ + U8 cqiBit; /*!< Indicates the CQI is enabled or not. */ + U8 delayBit; /*!< Indicates the Delay bit. */ + U8 msg34MPDCCHNbIdx; /*!< Indicates Msg3/4 MPDCCH narrowband index. */ +} RgInfEmtcCEmodeARarUlGrnt; + +/** + * @brief This structure contains the uplink grant information that is sent in + response to the random access request from the UE for CEmodeB. + */ +typedef struct rgInfEmtcCEmodeBRarUlGrnt +{ + U8 msg3PUSCHNbIdx; /*!< Indicates the Msg3 PUSCH narrowband index. */ + U8 rbStart; /*!< Start Resource block of allocation. */ + U8 numRb; /*!< Number of resource blocks allocated. */ + U8 msg3PUSCHNumRep; /*!< Number of repetitions for Msg3 PUSCH. */ + U8 iTbsCrnt; /*!< Current TBS index of the grant. */ + U8 msg34MPDCCHNbIdx; /*!< Indicates Msg3/4 MPDCCH narrowband index. */ +}RgInfEmtcCEmodeBRarUlGrnt; + +typedef enum rgEmtcCEmodeType +{ + RG_EMTC_CEMODE_A, + RG_EMTC_CEMODE_B, + RG_EMTC_CEMODE_INV +}RgEmtcCEmodeType; + +/** + * @brief This structure contains the uplink grant information that is sent in + response to the random access request from the UE for EMTC. + */ +typedef struct rgInfEmtcRarUlGrnt +{ + U8 rgEmtcCEmodeType; + union + { + RgInfEmtcCEmodeARarUlGrnt emtcCEmodeARarUlGrnt; + RgInfEmtcCEmodeBRarUlGrnt emtcCEmodeBRarUlGrnt; + }u; +}RgInfEmtcRarUlGrnt; + +#endif /* EMTC_ENABLE */ +/** + * @brief This structure contains common channel buffer occupancy report information. + */ +typedef struct rgInfCmnBoRpt +{ + S16 cellSapId; + CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cell IDs. */ + CmLteLcId lcId; /*!< Identifies the logical channel. lcId value range is defined in + Section 6.2.1 in 36.321 specification. */ + CmLteLcType lcType; /*!< Identifies the Logical channel type.lcType can take the following values: + CM_LTE_LCH_BCCH + CM_LTE_LCH_PCCH + CM_LTE_LCH_CCCH + CM_LTE_LCH_DCCH + CM_LTE_LCH_DTCH */ + S32 bo; /*!< Buffer occupancy reported by RLC in bytes. */ +#ifdef EMTC_ENABLE + U8 emtcDIReason; /*!< Reason for DI message to send. */ + U8 pnb; /*!< Pagging narrowBand on which Ue perfom paging reception*/ +#endif + union /*!< lcType in the primitive is the union selector. */ + { + CmLteTimingInfo timeToTx; /*!< Timing info for the BO, applicable for BCCH and PCCH. */ + CmLteRnti rnti; /*!< Temporary C-RNTI, only for CCCH. RNTI range is specified + in Section 7.1 in 36.321 specification. */ + } u; +} RgInfCmnBoRpt; +/** + * @brief This structure contains dedicated channel buffer occupancy report + * information. + */ +typedef struct rgInfDedBoRpt +{ + S16 cellSapId; /*!< Identifies the cell SAP. cellSapId value must be within the set of configured cell SAP IDs. */ + CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cellIds. */ + CmLteRnti rnti; /*!< Identifies the UE. RNTI value range is specified in Section 7.1 in 25.321 specification. */ + CmLteLcId lcId; /*!< Identifies the logical channel. lcId value range is defined in Section 6.2.1 in 36.321 specification. */ + S32 bo; /*!< Number of bytes reported as Buffer occupancy by RLC. */ +#ifdef CCPU_OPT + Bool staPduPrsnt; /*!< Is status PDU present reported by RLC. */ + U16 estRlcHdrSz;/*!< Estimated hader size reported by RLC */ +#endif + U32 staPduBo; /*!< Number of bytes reported as Buffer occupancy for status PDU by RLC. + This is already included in BO.*/ + U32 oldestSduArrTime; /*!< Oldest SDU Arrival Time from Upper Layer */ + Bool setMaxUlPrio; /*!< set when Pollbit is set from RLC in PDU */ + Bool setMaxDlPrio; /*!< Set when there is a status PDU in the DL*/ +} RgInfDedBoRpt; + +/*Fix: start: Indicate UE deletion from MAC to Scheduler*/ +/** + * @brief This structure contains the RNTI which is deleted at MAC + * information. + */ +typedef struct rgInfUeDelInd +{ + S16 cellSapId; /*!< Identifies the cell SAP. cellSapId value must be within the set of configured cell SAP IDs. */ + CmLteCellId cellId; /*!< Identifies the cell. CellId value must be within the set of configured cellIds. */ + CmLteRnti rnti; /*!< Identifies the UE. RNTI value range is specified in Section 7.1 in 25.321 specification. */ +} RgInfUeDelInd; + +/*Fix: end: Indicate UE deletion from MAC to Scheduler*/ + + + +/** + * @brief This structure contains the uplink grant information that is sent in + response to the random access request from the UE. + */ +typedef struct rgInfRarUlGrnt +{ +#ifndef MAC_5GTF_UPDATE + U8 hop; /*!< Indicates the hopping flag. */ +#else + U8 xPuschRange; /*!< xPUSCH range */ +#endif + U8 rbStart; /*!< Start Resource block of allocation. */ + U8 numRb; /*!< Number of resource blocks allocated. */ + U8 tpc; /*!< TPC command for the uplink grant. */ + U8 iMcsCrnt; /*!< Current MCS index of the grant. */ + U8 delayBit; /*!< Indicates the Delay bit. */ +#ifndef MAC_5GTF_UPDATE + U8 cqiBit; /*!< Indicates the CQI is enabled or not. */ +#else + U8 numBsiRep; /*!< Number of BSI reports. */ + U8 bsiBetaOffIdx; /*!< Index of BSI beta offset used in Msg3 */ + U8 pcrs; /*!< UL dual PCRS */ +#endif +} RgInfRarUlGrnt; + +/** + * @brief This structure carries timing adjustment, uplink grant information for the specific temporary C-RNTI. + */ +typedef struct rgInfCrntiInfo +{ + CmLteRnti tmpCrnti; /*!< Temporary C-RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ + U8 rapId; /*!< rapId identifies the index of the Random Access Preamble. rapId ranges from 0 to 63.*/ + TknU16 ta; /*!< Timing Adjustment. Timing Adjustment Value range is defined in Section 6.1.3.5 in 36.321 specification. */ + RgInfRarUlGrnt grnt; /*!< Uplink Grant to go in RAR. */ + Bool isContFree; /*!< Indicates whether the procedure is contention-free or not. */ +#ifdef EMTC_ENABLE + RgInfEmtcRarUlGrnt emtcGrnt; /*!< Uplink grant for EMTC UE to go in RAR. */ +#endif +}RgInfCrntiInfo; + +/** + * @brief This structure carries information about downlink control format, scheduled TB size, + backoff indicator value, and the set of Random Access Responses within this RA-RNTI. +*/ +typedef struct rgInfRaRntiInfo +{ + U16 raRnti; /*!< RA-RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ + TfuPdschDciInfo dciInfo; /*!< PDCCH allocated for RA-RNTI. For more information + refer to TFU Interface Service Definition (p/n 1100091). */ + U32 schdTbSz; /*!< Scheduled TB size. schdTbSz value range is defined in Section 7.1.7.2.1 in 36.213 + specification. */ + TknU8 backOffInd; /*!< Indicates the Backoff Indicator value. backOffInd value range + is defined in Section 7.2 in 36.321 specification. */ + U8 numCrnti; /*!< Number of valid RARs in the array. */ + RgInfCrntiInfo *crntiInfo; /*!< RAR information. */ +}RgInfRaRntiInfo; + +/** + * @brief This structure contains information about the RA-RNTIs for which + * random access responses are generated. + */ +typedef struct rgInfRarInfo +{ + U8 numRaRntis; /*!< Indicates the number of valid RA-RNTIs present. */ + RgInfRaRntiInfo *raRntiInfo; /*!< Contains allocation information per RA-RNTI. */ + U16 txPwrOffset; /*!< PDSCH tx power offset for RAR transmission */ +}RgInfRarInfo; + +/** + * @brief Logical channel allocation information. + */ +typedef struct rgInfLcDatInfo +{ + CmLList lchLstEnt; /*!< Is not used when part of resource allocation. */ + U8 lcId; /*!< Identifies the logical channel. lcId value range is defined + in Section 6.2.1 in 36.321 specification. */ + U32 numBytes; /*!< Number of bytes allocated/received to logical channel. */ +} RgInfLcDatInfo; + +/** + * @brief This structure contains control element information received from a + * particular UE.Extended PHR information + */ +typedef struct rgInfExtPhrSCellInfo +{ + U8 sCellIdx; /*!< SCELL index for which PHR is reported */ + U8 phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6a in 36.321 specification. */ + U8 pCmax; /*!< PCMAX value. PCMAX value is defined in Table 6.1.3.6a-1 in 36.321 specification. */ + U8 pBackOff; /*!< If UE applied back off due to P-MPRc in 36.321 specification. */ +}RgInfExtPhrSCellInfo; +typedef struct rgInfExtPhrCEInfo +{ + U8 type2Phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6a in 36.321 specification. */ + U8 type2PCMax; /*!< PCMAX value. PCMAX value is defined in Table 6.1.3.6a-1 in 36.321 specification. */ + U8 numServCells; /*!< Number of serving cells for which PHR is reported */ + RgInfExtPhrSCellInfo servCellPhr[CM_LTE_MAX_CELLS]; +}RgInfExtPhrCEInfo; /*!< EXT PHR value. EXT PHR value is defined in Section 6.1.3.6a in 36.321 R10 specification. */ + +/** + * @brief This structure contains control element information received from a + * particular UE. + */ +typedef struct rgInfCeInfo +{ + U16 bitMask; /*!< Bitmask for the MAC Control elements present. */ + struct + { + U16 cRnti; /*!< C-RNTI value. RNTI range is specified in Section 7.1 in 36.321 specification. */ + U8 phr; /*!< PHR value. PHR value is defined in Section 6.1.3.6 in 36.321 specification. */ + union + { + U8 truncBsr; /*!< Truncated BSR value. BSR value is defined in + Section 6.1.3.1 in 36.321 specification. */ + U8 shortBsr; /*!< Short BSR value.BSR value is defined in + Section 6.1.3.1 in 36.321 specification. */ + struct + { + U8 bs1; /*!< Buffer size 1 of long BSR. */ + U8 bs2; /*!< Buffer size 2 of long BSR. */ + U8 bs3; /*!< Buffer size 3 of long BSR. */ + U8 bs4; /*!< Buffer size 4 of long BSR. */ + }longBsr; /*!< BSR value is defined in Section 6.1.3.1 in 36.321 specification. */ + }bsr; + RgInfExtPhrCEInfo extPhr; /*!< EXT PHR value. EXT PHR value is defined in Section 6.1.3.6a in 36.321 R10 specification. */ +#ifdef MAC_5GTF_UPDATE + struct + { + U8 bar; /*!< Beam Adjusment Request */ + U8 numBsiFields; /*!< Number of BSI fields UE sent in BSI Feedback */ + struct + { + U16 bi; /*!< BSI Feedback : 9 bits Beam Index */ + U8 brsrp; /*!< BSI Feedback :7 bits BRSRP */ + }bsiFdbk[4]; + }beam; +#endif + } ces; + /* L2_COUNTERS */ +#ifdef LTE_L2_MEAS + U8 ulActLCs[RGINF_MAX_NUM_DED_LC]; + /*!< List of LCs for which Data is received in UL */ +#endif + + +#ifdef LTEMAC_SPS + U16 spsSduSize; +#endif + +} RgInfCeInfo; + +typedef struct rgInfLcgInfo +{ + U8 lcgId; /*!< LCGID. GBR DRB LCG */ + U32 bytesRcvd; /*!< Contains bytes received for LCG */ +}RgInfLcgInfo; + +/** + * @brief This structure contains control element information received from a + * particular UE identified by the RNTI. + */ +typedef struct rgInfUeDatInd +{ + CmLteRnti rnti; /*!< RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ + CmLList ueLstEnt; /*!< UE linked list entry. */ + RgInfCeInfo ceInfo; /*!< Contains the control elements received from the UE. */ + RgInfLcgInfo lcgInfo[RGINF_MAX_LCG_PER_UE - 1]; /*!< Contains the bytes received per DRB LCG. */ +}RgInfUeDatInd; + +/** + * @brief This structure carries the control element information received for a + set of UEs along with timing information. + */ +typedef struct rgInfSfDatInd +{ + CmMemListCp memCp; /*!< Memory control point. */ + CmLListCp ueLst; /*!< Pointer to the UE linked list. */ + /* RRM_SP1_START */ + U32 qcisUlPrbCnt[RGINF_MAX_GBR_QCI_REPORTS];/*!< UL gbr LC's PRB count*/ + /* RRM_SP1_END */ + S16 cellSapId; /*!< Cell SAP Identifier. CellSAP ID value must be within the set of configured cell SAP IDs. */ + CmLteCellId cellId; /*!< Identifies the cell. CellId must be within the set of configured cell IDs. */ + CmLteTimingInfo timingInfo; /*!< Contains information about SFN and subframe. SFN ranges from 0 to 1023 whereas subframe ranges from 0 to 9. */ +}RgInfSfDatInd; + +/** + * @brief This structure carries the information about scheduled logical + * channels within this transport block along with timing adjustment + * information. + */ +typedef struct rgInfUeTbInfo +{ + Bool disTb; /*!< Currently, not used, but is + applicable in MIMO case. */ + Bool isReTx; /*!< Indicates the TB transmission type. */ + TknU8 ta; /*!< Timing Adjustment. */ +#ifdef LTE_ADV + TknU8 sCellActCe; /* !< SCell Act values and whether + scheduled or not */ +#endif + + /* Changed as a result of CR timer implementation*/ + U8 contResCe; /*!< Indicating presence of Contention Resolution CE across MAC-SCH + interface to + * identify CCCH SDU transmissions which need to + * be done without the + * contention resolution CE.*/ + + U8 numSchLch; /*!< Indicates the number of logical + channels scheduled. */ + U32 schdTbSz; + RgInfLcDatInfo schdDat[RGINF_MAX_NUM_DED_LC]; /*!< Contains + information about scheduled logical + channel. */ +} RgInfUeTbInfo; + +/** + @brief This structure carries the information reagarding secondary MAC like its + instance Id and HARQ process's Id + */ +typedef struct rgLaaTbReqInfo +{ + U8 sMacInstId; + U8 sCellHqPId; + U8 tbId; + U16 hqPStamp; +}RgLaaTbReqInfo; + +/** + * @brief This structure carries the UE-specific Resource allocation + * information like RNTI, downlink control format, HARQ process Identifier, + * scheduled TB size, and Transport Block information. + */ +typedef struct rgInfUeAlloc +{ + CmLteRnti rnti; /*!< RNTI. RNTI range is specified in Section 7.1 in 36.321 specification. */ + +/* Added support for SPS*/ +#ifdef LTEMAC_SPS + CmLteRnti pdcchRnti; /*!< RNTI used for PDCCH scrambling */ +#endif + + + + TfuPdschDciInfo dciInfo; /*!< Contains Downlink Control Information. For more information, + refer to TFU Interface Service Definition (p/n 1100091). */ + U8 hqProcId; /*!< HARQ process Identifier. hqProcId ranges between 1 and 8 for FDD mode and 1 and 15 for TDD mode */ + S8 tbStrtIdx; + TknU32 doa; + TfuTxMode txMode; + Bool puschRptUsd;/*!< True, if Precoding Information in PDCCH has to be + in-accordance with the latest PUSCH report */ + TfuDlCqiPuschInfo puschPmiInfo;/*!< PUSCH report details for explicit PMI + * information to PHY during a PDSCH */ + + + U8 nmbOfTBs; /*!< Indicates the number of TBs. Currently this is set to 1. */ + RgInfUeTbInfo tbInfo[RGINF_MAX_TB_PER_UE]; /*!< Contains TB identifier. */ + /* LTE_ADV_FLAG_REMOVED_START */ +#ifdef TFU_UPGRADE + U8 pa; /*!< DL Power control paramter P_A + configured by higher layers + Ref: RRC 36.331, 6.3.2, PDSCH-Config */ +#endif + U8 isEnbSFR; /*To check if SFR is enabled*/ + /* LTE_ADV_FLAG_REMOVED_END */ +#ifdef LTE_ADV + Bool fillCtrlPdu; /*!< Based upon this flag RLC will fill RLC Control PDU + In a tti if P-cell is present then control PDU + should be kept in P-cell otherwise S-cell*/ +#endif + RgLaaTbReqInfo tbReqInfo; /*!< LAA: TB information for the TBs which + need to be fetched from the SCell*/ +}RgInfUeAlloc; + +/** + * @brief This structure carries the Resource allocation information for the + * set of scheduled UEs. + */ +typedef struct rgInfUeInfo +{ + U8 numUes; /*!< Number of UEs allocated. */ + RgInfUeAlloc *allocInfo; /*!< Allocation information per UE. */ +}RgInfUeInfo; + +/** + * @brief This structure contains the RNTI and downlink control format + * information for the scheduled BCCH logical channel. + */ +typedef struct rgInfBcchInfo +{ + CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ + TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. For more information, + refer to TFU Interface Service Definition (p/n 1100091).*/ +/* Modified for SI Enhancement*/ +#ifndef RGR_SI_SCH + CmLteLcId lcId; /*!< Logical Channel Identifier.lcId value range is defined in + Section 6.2.1 in 36.321 specification. */ + Bool sndStatInd; /*!< Currently this is set to 1 for fresh transmission of BCCH data. */ +#else + Buffer *pdu; /*!< PDU being specified for BCCH. */ +#endif + U16 txPwrOffset; /*!< PDSCH tx power offset for BCCH + transmission */ +}RgInfBcchInfo; + +/** + * @brief This structure contains the RNTI and the downlink control information for the scheduled PCCH logical channel. + */ +typedef struct rgInfPcchInfo +{ + CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ + TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. + For more information, refer to TFU Interface Service Definition (p/n 1100091). */ + CmLteLcId lcId; /*!< Logical Channel Identifier. lcId value range is defined in + Section 6.2.1 in 36.321 specification. */ + + U16 txPwrOffset; /*!< PDSCH tx power offset for PCCH + transmission */ +}RgInfPcchInfo; + +/** + * @brief This structure contains the scheduled logical channel information + * mapped onto the BCH transport channel. + */ +typedef struct rgInfBchInfo +{ +/* Modified for SI Enhancement*/ +#ifndef RGR_SI_SCH + CmLteLcId lcId; /*!< Logical Channel Identifier. lcId value range is defined in Section 6.2.1 in 36.321 specification. */ +#else + Buffer *pdu; /*!< PDU being specified for BCH */ +#endif +}RgInfBchInfo; + +/** + * @brief This structure contains the scheduling information of BCH, PCCH, and + * BCCH channel information. + */ +typedef struct rgInfCmnLcInfo +{ + U16 bitMask; /*!< Bitmask representing all the common channels present. */ + RgInfBchInfo bchInfo; /*!< BCH channel Information. */ + RgInfPcchInfo pcchInfo; /*!< Paging Logical Channel Information. */ + RgInfBcchInfo bcchInfo; /*!< Broadcast Logical Channel Information. */ +}RgInfCmnLcInfo; + +#ifdef EMTC_ENABLE +/** + * @brief This structure contains the scheduled logical channel information + * mapped onto the BCH transport channel. + */ +typedef struct rgInfEmtcBcchInfo +{ + CmLteRnti rnti; /*!< RNTI range is specified in Section 7.1 in 36.321 specification. */ + TfuPdschDciInfo dciInfo; /*!< Downlink Control Information. For more information */ + Buffer *pdu; /*!< PDU being specified for BCH */ +}RgInfEmtcBcchInfo; + +/** + * @brief This structure contains the scheduling information of BCH, PCCH, and + * BCCH channel information. + */ +typedef struct rgInfEmtcCmnLcInfo +{ + U16 bitMask; /*!< Bitmask representing all the common channels present. */ + RgInfBchInfo bchInfo; /*!< BCH channel Information. */ + RgInfPcchInfo pcchInfo; /*!< Paging Logical Channel Information. */ + RgInfEmtcBcchInfo emtcBcchInfo; /*!< Broadcast Logical Channel Information. */ +}RgInfEmtcCmnLcInfo; +#endif + +#ifdef LTE_L2_MEAS +/** + * @brief UE-specific allocation information needed for measurements. + * */ +typedef struct rgInfUeUlAlloc +{ + CmLteRnti rnti; /*!< UE ID */ + U8 numPrb; /*!< Number of total PRB's allocated for this UE */ +} RgInfUeUlAlloc; + +/** + * @brief Allocation information of all UEs in this subframe. + * */ +typedef struct rgInfUlUeInfo +{ + U8 numUes; /*!< Number of UE's*/ + CmLteTimingInfo timingInfo; /*!< Uplink timing information */ + RgInfUeUlAlloc *ulAllocInfo;/*!< Uplink Allocations information */ +}RgInfUlUeInfo; +#endif /*LTE_L2_MEAS */ + +/** +*@brief this structure contains the lcId on which flow control need to be performed and the number of packets allowed for admission */ +typedef struct rgInfLcInfo +{ + CmLteLcId lcId; /*!< lcId for flow control*/ + U32 pktAdmitCnt; /*! NOK and reason -> INVALID */ + union { + RgInfPrbCfm prbCfm; /*!< Avgerage PRB usage per QCI*/ + } u; +} RgInfL2MeasCfm; + +/** + * @brief This API is invoked from l2 Measurements module at scheduler. + * When Scheduler receives a measurement request from stack manager for Average + * PRB usage Per QCI in Uplink, Scheduler invokes this API towards LTE MAC + * for the calculations. LTE MAC utilizes the uplink allocations information provided + * by scheduler for every subframe and data indications received for this calculation. + * This API carries a transId to uniquely identify the confirm received for + * this request from LTEMAC. + * */ +EXTERN S16 RgSchMacL2MeasReq ARGS(( + Pst* pst, + RgInfL2MeasReq* l2MeasReq +)); +/** + * @brief This API is invoked from l2 Measurements module at scheduler. + * When Scheduler receives a measurement send request from stack manager, + * it sends L2 measurement to layer manager. + * */ + +EXTERN S16 RgSchMacL2MeasSendReq ARGS(( + Pst* pst, + RgInfL2MeasSndReq* l2MeasReq +)); +/** + * @brief This API is invoked from l2 Measurements module at scheduler. + * When Scheduler receives a measurement stop request from stack manager, + * it stops L2 Measurement + */ +EXTERN S16 RgSchMacL2MeasStopReq ARGS(( + Pst* pst, + RgInfL2MeasStopReq* l2MeasReq +)); + +/** + * @brief This API is invoked from L2 Measurement module at LTE MAC. When LTE MAC + * completes calculation of Avergae PRB usage per QCI in Uplink for a given time + * period, It invokes this API to indicate result back to scheduler. LTE + * MAC sends the same transId received in measurement request from Scheduler. + * */ +EXTERN S16 RgMacSchL2MeasCfm ARGS(( + Pst* pst, + RgInfL2MeasCfm* l2MeasCfm +)); +/** + * @brief This API is invoked from L2 Measurement module at LTE MAC. When LTE MAC + * stops L2 measurement, it sends L2 measurement cfm. + * */ + +EXTERN S16 RgMacSchL2MeasStopCfm ARGS(( + Pst* pst, + RgInfL2MeasCfm* l2MeasCfm +)); + +EXTERN S16 RgMacSchL2MeasStop ARGS +(( +Pst* pst, +RgInfL2MeasCfm *measInfo +)); +#endif /* LTE_L2_MEAS */ + +typedef struct rgInfLcgRegReq +{ + CmLteCellId cellId; /*!< Cell Identifier */ + CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE + RNTI range is specified in Section + 7.1 in 25.321 Specification. */ + U8 lcgId; + Bool isGbr; /* Indicate if the LCG is Gbr */ +} RgInfLcgRegReq; + + +/* Added support for SPS*/ +#ifdef LTEMAC_SPS +/** + * @brief This structure contains the logical channel information related to + * uplink SPS for a particular UE identified by the CRNTI. + */ +typedef struct rgInfSpsLcInfo +{ + CmLteCellId cellId; /*!< Cell Identifier */ + CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE + RNTI range is specified in Section + 7.1 in 25.321 Specification. */ + CmLteRnti spsRnti; /*!< SPS RNTI. RNTI range is specified in + Section 7.1 in 25.321 Specification. */ + U8 spsLcCnt; /*!< identifies the number of SPS + configured logical channels */ + U8 spsLcId[RGINF_MAX_NUM_DED_LC]; /*!< Logical Channel + Identifier. lcId value range is + defined in Section 6.2.1 + in 36.321 Specification. */ + U8 implRelCnt; /*!< "implicitRelAfter" vallue */ + U16 spsPrd; /*!< SPS periodicity of the UE */ +} RgInfSpsLcInfo; + +/** + * @brief This structure contains UL SPS param Reset related to + * uplink SPS for a particular UE identified by the CRNTI. + */ +typedef struct rgInfUlSpsReset +{ + CmLteCellId cellId; /*!< Cell Identifier */ + CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE + RNTI range is specified in Section + 7.1 in 25.321 Specification. */ +} RgInfUlSpsReset; + + +/** + * @brief This structure contains the information to release UL SPS for a UE */ +typedef struct rgInfSpsRelInfo +{ + S16 cellSapId; /*!< identifies the cell SAP. Value range + should be within the set of + configured cell SAP(s).*/ + CmLteRnti cRnti; /*!< RNTI of the UE */ + Bool isExplRel; /*!< TRUE if explicit release needs to be + sent to UE */ +} RgInfSpsRelInfo; +#endif /* LTEMAC_SPS */ + +/* + * Function Prototypes + */ +/** + * @brief Request from Scheduler to MAC to register a cell. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacCellRegReq ARGS(( + Pst* pst, + RgInfCellReg* regReq +)); + +typedef S16 (*CellRegReq) ARGS(( + Pst* pst, + RgInfCellReg* regReq +)); + +/** + * @brief Request from Scheduler to MAC to register a cell. + * @details The scheduler invokes this primitive after the scheduler cell + * configuration is completed. Before calling this primitive, the scheduler + * creates a mapping of the cell which is uniquely idetified by cell ID and + * scheduler instance that is serving the cell. + */ +EXTERN S16 RgSchMacCellRegReq ARGS(( + Pst* pst, + RgInfCellReg* regReq +)); +/** + * @brief Request from Scheduler to MAC to register a cell. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkSchMacCellRegReq ARGS(( + CellRegReq func, + Pst* pst, + Buffer *mBuf +)); +/** + * @brief Request from MAC to scheduler to update dedicated BO. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkMacSchDedBoUpdtReq ARGS(( + Pst* pst, + RgInfDedBoRpt* boRpt +)); + +typedef S16 (*DedBoUpdtReq) ARGS(( + Pst* pst, + RgInfDedBoRpt* boRpt +)); + +/** + * @brief Request from MAC to scheduler to update dedicated BO. + * @details MAC layer invokes this primitive towards scheduler when it + * receives status response from the RLC for dedicated channels. Scheduler + * takes the buffer occupancy information into consideration while taking + * scheduling decisons. + */ +EXTERN S16 RgMacSchDedBoUpdtReq ARGS(( + Pst* pst, + RgInfDedBoRpt* boRpt +)); +/** + * @brief Request from MAC to scheduler to update dedicated BO. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkMacSchDedBoUpdtReq ARGS(( + DedBoUpdtReq func, + Pst* pst, + Buffer *mBuf +)); +/** + * @brief Request from MAC to scheduler to update common channel BO. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkMacSchCmnBoUpdtReq ARGS(( + Pst* pst, + RgInfCmnBoRpt* boRpt +)); + +typedef S16 (*CmnBoUpdtReq) ARGS(( + Pst* pst, + RgInfCmnBoRpt* boRpt +)); + +/** + * @brief Request from MAC to scheduler to update common channel BO. + * @details MAC layer invokes this primitive towards scheduler when it + * receives status response from the RLC for common channels. Scheduler + * takes the buffer occupancy information into consideration while taking + * scheduling decisons. + */ +EXTERN S16 RgMacSchCmnBoUpdtReq ARGS(( + Pst* pst, + RgInfCmnBoRpt* boRpt +)); +/** + * @brief Request from MAC to scheduler to update common channel BO. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkMacSchCmnBoUpdtReq ARGS(( + CmnBoUpdtReq func, + Pst* pst, + Buffer *mBuf +)); + +/*Fix: start:Indicate UE deletion at MAC to scheduler*/ +/** + * @brief UE delete indication from MAC to scheduler. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkMacSchUeDelInd ARGS(( + Pst* pst, + RgInfUeDelInd* ueDelInd +)); + +typedef S16 (*UeDelInd) ARGS(( + Pst* pst, + RgInfUeDelInd* ueDelInd +)); + +/** + * @brief UE deletion indication from MAC to scheduler. + * @details MAC layer invokes this primitive towards scheduler when it + * receives UE delete Request. As the UE is now deleted at MAC, it should + * not be scheduled. + */ +EXTERN S16 RgMacSchUeDelInd ARGS(( + Pst* pst, + RgInfUeDelInd* ueDelInd +)); +/** + * @brief UE delete Indication Request from MAC to scheduler. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkMacSchUeDelInd ARGS(( + UeDelInd func, + Pst* pst, + Buffer *mBuf +)); +/*Fix: end:Indicate UE deletion at MAC to scheduler*/ +/** + * @brief Data Indication Request from MAC to scheduler. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkMacSchSfRecpInd ARGS(( + Pst* pst, + RgInfSfDatInd* datInd +)); + +typedef S16 (*SfRecpInd) ARGS(( + Pst* pst, + RgInfSfDatInd* datInd +)); + +/** + * @brief Data Indication Request from MAC to scheduler. + * @details MAC layer invokes this primitive towards scheduler when it + * receives MAC Control Elements from the data received from the UE. Scheduler + * takes these control elements into consideration while taking scheduling + * decisons for the uplink. + */ +EXTERN S16 RgMacSchSfRecpInd ARGS(( + Pst* pst, + RgInfSfDatInd* datInd +)); +/** + * @brief Data Indication Request from MAC to scheduler. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkMacSchSfRecpInd ARGS(( + SfRecpInd func, + Pst* pst, + Buffer *mBuf +)); +/** + * @brief Resource Allocation Request from Scheduler to MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacSfAllocReq ARGS(( + Pst* pst, + RgInfSfAlloc* resAllocReq +)); + +typedef S16 (*SfAllocReq) ARGS(( + Pst* pst, + RgInfSfAlloc* resAllocReq +)); + +/** + * @brief Resource Allocation Request from Scheduler to MAC. + * @details Scheduler invokes this primitive for every TTI towards MAC to + * inform the scheduling decisions taken for uplink grants, common channels + * and list of UEs to be scheduling during this TTI. + */ +EXTERN S16 RgSchMacSfAllocReq ARGS(( + Pst* pst, + RgInfSfAlloc* resAllocReq +)); +/** + * @brief Resource Allocation Request from Scheduler to MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkSchMacSfAllocReq ARGS(( + SfAllocReq func, + Pst* pst, + Buffer *mBuf +)); +/** + * @brief Request from Scheduler to release HARQ processes at MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacRlsHqReq ARGS(( + Pst* pst, + RgInfRlsHqInfo* sfHqInfo +)); + +typedef S16 (*RlsHqReq) ARGS(( + Pst* pst, + RgInfRlsHqInfo* sfHqInfo +)); + +/** + * @brief Request from Scheduler to release HARQ processes at MAC. + * @details Scheduler calls this primitive to send the list of UEs for + * which the HARQ buffers are released to MAC. The Scheduler invokes this + * primitive when a positive acknowledgement is received for the TB transmitted + * or a TB is retransmitted for the allowed maximum number of retransmissions. + */ +EXTERN S16 RgSchMacRlsHqReq ARGS(( + Pst* pst, + RgInfRlsHqInfo* sfHqInfo +)); +/** + * @brief Request from Scheduler to release HARQ processes at MAC. + * @details This primitive is used for light-weight loose coupling. + */ + +EXTERN S16 cmUnpkSchMacRlsHqReq ARGS(( + RlsHqReq func, + Pst* pst, + Buffer *mBuf +)); + +/** + * @brief Request from Scheduler to reset HARQ Entity at MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacRstHqEntReq ARGS(( + Pst* pst, + RgInfResetHqEnt* hqEntInfo +)); + +typedef S16 (*RstHqEntReq) ARGS(( + Pst* pst, + RgInfResetHqEnt* hqEntInfo +)); + +/** + * @brief Request from Scheduler to reset HARQ entity at MAC for a scell of an ue. + * This is triggered upon deactivation of a scell + */ +EXTERN S16 RgSchMacRstHqEntReq ARGS(( + Pst* pst, + RgInfResetHqEnt* hqEntInfo +)); +/** + * @brief Request from Scheduler to release HARQ processes at MAC. + * @details This primitive is used for light-weight loose coupling. + */ + +EXTERN S16 cmUnpkSchMacRstHqEntReq ARGS(( + RstHqEntReq func, + Pst* pst, + Buffer *mBuf +)); +/** + * @brief Request from Scheduler to release RNTI at MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacRlsRntiReq ARGS(( + Pst* pst, + RgInfRlsRnti* rlsRnti +)); + +typedef S16 (*RlsRntiReq) ARGS(( + Pst* pst, + RgInfRlsRnti* rlsRnti +)); + +/** + * @brief Request from Scheduler to release RNTI at MAC. + * @details The Scheduler calls this primitive to send the list of RNTIs for + * which the RRC Connection is being rejected. + */ +EXTERN S16 RgSchMacRlsRntiReq ARGS(( + Pst* pst, + RgInfRlsRnti* rlsRnt +)); +/** + * @brief Request from Scheduler to release RNTI at MAC. + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmUnpkSchMacRlsRntiReq ARGS(( + RlsRntiReq func, + Pst* pst, + Buffer *mBuf +)); +/* Added support for SPS*/ + +typedef S16 (*LcgReg) ARGS(( + Pst* pst, + RgInfLcgRegReq *lcgRegReq +)); + +EXTERN S16 cmPkSchMacLcgRegReq ARGS(( + Pst* pst, + RgInfLcgRegReq *lcgRegReq +)); + +EXTERN S16 RgSchMacLcgRegReq ARGS((Pst *pst, RgInfLcgRegReq *lcgRegReq)); + +EXTERN S16 cmUnpkSchMacLcgRegReq ARGS(( + LcgReg func, + Pst *pst, + Buffer *mBuf +)); + +EXTERN S16 RgSchMacLcgReg ARGS((Pst* pst, RgInfLcgRegReq *lcgRegReq)); + +#ifdef LTEMAC_SPS +/** + * @brief Primitive from Scheduler to MAC to register the logical channels of + * a SPS UE + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacSpsLcRegReq ARGS(( + Pst* pst, + RgInfSpsLcInfo *lcInfo +)); + +typedef S16 (*SpsLcReg) ARGS(( + Pst* pst, + RgInfSpsLcInfo *lcInfo +)); + +/** + * @brief Request from Scheduler to register the SPS related logical channels. + * @details Scheduler calls this primitive to send the list of logical channels + * that belong to the SPS logical channel group. + */ +EXTERN S16 RgSchMacSpsLcRegReq ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo)); + +EXTERN S16 cmUnpkSchMacSpsLcRegReq ARGS(( + SpsLcReg func, + Pst *pst, + Buffer *mBuf +)); + + +/** + * @brief Primitive from Scheduler to MAC to Reset UL SPS related Params + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacUlSpsResetReq ARGS(( + Pst* pst, + RgInfUlSpsReset *ulSpsResetInfo +)); + +typedef S16 (*UlSpsReset) ARGS(( + Pst* pst, + RgInfUlSpsReset *ulSpsResetInfo +)); + +/** + * @brief Request from Scheduler to reset UL SPS Params + * @details Scheduler calls this primitive to reset implicit and explicit + * release counters for the UE + */ +EXTERN S16 RgSchMacUlSpsResetReq ARGS((Pst *pst, RgInfUlSpsReset *ulSpsResetInfo)); + +EXTERN S16 cmUnpkSchMacUlSpsResetReq ARGS(( + UlSpsReset func, + Pst *pst, + Buffer *mBuf +)); + + + +/** + * @brief Primitive from Scheduler to MAC to deregister the logical channels of + * a SPS UE + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkSchMacSpsLcDeregReq ARGS(( + Pst* pst, + CmLteCellId cellId, + CmLteRnti crnti +)); + +typedef S16 (*SpsLcDereg) ARGS(( + Pst* pst, + CmLteCellId cellId, + CmLteRnti crnti +)); + +/** + * @brief Request from Scheduler to deregister the SPS related logical channels. + * @details Scheduler calls this primitive to send the deregistration request + * for a UE once SPS is released for it + */ +EXTERN S16 RgSchMacSpsLcDeregReq ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti + crnti)); + +EXTERN S16 cmUnpkSchMacSpsLcDeregReq ARGS(( + SpsLcDereg func, + Pst* pst, + Buffer *mBuf +)); + +/** + * @brief Primitive from MAC to Scheduler to indicate release of UL SPS for a UE + * @details This primitive is used for light-weight loose coupling. + */ +EXTERN S16 cmPkMacSchSpsRelInd ARGS(( + Pst* pst, + RgInfSpsRelInfo* relInfo +)); + +typedef S16 (*SpsRelInd) ARGS(( + Pst* pst, + RgInfSpsRelInfo* relInfo +)); + +/** + * @brief Indication from MAC to Scheduler to release UL SPS for a UE + * @details MAC calls this primitive to inform the scheduler that UL SPS needs + * to be released for a UE + */ +EXTERN S16 RgMacSchSpsRelInd ARGS((Pst *pst, RgInfSpsRelInfo *relInfo)); + +EXTERN S16 cmUnpkMacSchSpsRelInd ARGS(( + SpsRelInd func, + Pst* pst, + Buffer *mBuf +)); + +#endif +#ifdef LTE_L2_MEAS +EXTERN S16 cmPkMacSchL2MeasCfm ARGS(( +Pst* pst, +RgInfL2MeasCfm *measCfm +)); + +EXTERN S16 cmPkMacSchL2MeasStopCfm ARGS(( +Pst* pst, +RgInfL2MeasCfm *measCfm +)); + + +EXTERN S16 cmPkSchMacL2MeasReq ARGS(( + Pst* pst, + RgInfL2MeasReq *measInfo +)); + +EXTERN S16 cmPkSchMacL2MeasStopReq ARGS(( + Pst* pst, + RgInfL2MeasStopReq *measInfo +)); + +EXTERN S16 cmPkSchMacL2MeasSendReq ARGS(( + Pst* pst, + RgInfL2MeasSndReq *measInfo +)); +typedef S16 (*L2MeasReq) ARGS(( + Pst* pst, + RgInfL2MeasReq *measInfo +)); + +typedef S16 (*L2MeasStopReq) ARGS(( + Pst* pst, + RgInfL2MeasStopReq *measInfo +)); + +typedef S16 (*L2MeasSendReq) ARGS(( + Pst* pst, + RgInfL2MeasSndReq *measInfo +)); +typedef S16 (*L2MeasStopCfm) ARGS(( + Pst *pst, + RgInfL2MeasCfm *measCfm +)); + +typedef S16 (*L2MeasCfm) ARGS(( + Pst *pst, + RgInfL2MeasCfm *measCfm +)); +EXTERN S16 cmUnpkMacSchL2MeasCfm ARGS +(( +L2MeasCfm func, +Pst *pst, +Buffer *mBuf +)); +EXTERN S16 cmUnpkSchMacL2MeasReq ARGS(( + L2MeasReq func, + Pst *pst, + Buffer *mBuf +)); +EXTERN S16 cmUnpkSchMacL2MeasSendReq ARGS(( + L2MeasSendReq func, + Pst *pst, + Buffer *mBuf +)); +EXTERN S16 cmUnpkSchMacL2MeasStopReq ARGS(( + L2MeasStopReq func, + Pst *pst, + Buffer *mBuf +)); + +EXTERN S16 cmUnpkMacSchL2MeasStopCfm ARGS(( + L2MeasCfm func, + Pst *pst, + Buffer *mBuf +)); +#endif +EXTERN S16 RgSchMacRlsRnti ARGS((Pst* pst, RgInfRlsRnti* rlsRnti)); +EXTERN S16 RgSchMacRlsHq ARGS((Pst* pst, RgInfRlsHqInfo* sfHqInfo)); +EXTERN S16 RgSchMacSfAlloc ARGS((Pst* pst, RgInfSfAlloc* resAllocReq)); +EXTERN S16 RgSchMacRstHqEnt ARGS((Pst* pst, RgInfResetHqEnt* hqEntInfo)); +EXTERN S16 RgMacSchSfRecp ARGS((Pst* pst, RgInfSfDatInd* datInd)); +EXTERN S16 RgMacSchCmnBoUpdt ARGS(( Pst* pst, RgInfCmnBoRpt* boRpt)); +EXTERN S16 RgMacSchDedBoUpdt ARGS(( Pst* pst, RgInfDedBoRpt* boRpt)); +EXTERN S16 RgSchMacCellReg ARGS((Pst* pst,RgInfCellReg* regReq)); +#ifdef LTE_L2_MEAS +EXTERN S16 RgSchMacL2Meas ARGS((Pst* pst, RgInfL2MeasReq* l2MeasReq)); +EXTERN S16 RgMacSchL2Meas ARGS((Pst* pst, RgInfL2MeasCfm* l2MeasCfm)); +EXTERN S16 RgSchMacL2MeasStop ARGS((Pst* pst, RgInfL2MeasStopReq *measInfo)); +EXTERN S16 RgSchMacL2MeasSend ARGS((Pst* pst, RgInfL2MeasSndReq *measInfo)); +#endif /* LTE_L2_MEAS */ +/* Added support for SPS*/ +#ifdef LTEMAC_SPS +EXTERN S16 RgSchMacSpsLcReg ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo)); +EXTERN S16 RgSchMacUlSpsReset ARGS((Pst *pst, RgInfUlSpsReset *lcInfo)); +EXTERN S16 RgSchMacSpsLcDereg ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti + crnti)); +EXTERN S16 RgMacSchSpsRel ARGS((Pst *pst, RgInfSpsRelInfo* relInfo)); +#endif +EXTERN S16 RgMacSchUeDel ARGS((Pst* pst, RgInfUeDelInd* ueDelInd)); +EXTERN S16 schActvInit ARGS((Ent entity, Inst inst, Region + region, Reason reason)); +#ifdef __cplusplus +} +#endif +#endif /* __GKSCH_X__*/ + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_l2m.c b/src/5gnrsch/rg_sch_l2m.c similarity index 100% rename from src/5gnrmac/rg_sch_l2m.c rename to src/5gnrsch/rg_sch_l2m.c diff --git a/src/5gnrsch/rg_sch_lmm.c b/src/5gnrsch/rg_sch_lmm.c new file mode 100755 index 000000000..b94a6f526 --- /dev/null +++ b/src/5gnrsch/rg_sch_lmm.c @@ -0,0 +1,1460 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Layer Manager Interface Module + + File: rg_sch_lmm.c + +**********************************************************************/ + +/** @file rg_sch_lmm.c +@brief This file contains the Layer Management interface module implementation for scheduler. + The functions for the configuration, control, status and statistics + request primitives are defined here. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_MODULE_ID=4096; +static int RLOG_FILE_ID=167; + +/* header include files (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general */ +#include "ssi.h" /* system services */ +#include "cm_tkns.h" /* Common Token Defines */ +#include "cm_llist.h" /* Common Link List Defines */ +#include "cm_hash.h" /* Common Hash List Defines */ +#include "cm_mblk.h" /* common memory link list library */ +#include "cm_lte.h" /* Common LTE Defines */ +#include "rg_env.h" /* MAC Environment Defines */ +#include "rgr.h" /* RGR Interface defines */ +#include "tfu.h" /* RGU Interface defines */ +#include "lrg.h" /* LRG Interface defines */ +#include "rgm.h" /* RGM Interface defines */ +#include "rg_sch.h" /* Scheduler defines */ +#include "rg_sch_inf.h" /* Scheduler defines */ +#include "rg_sch_err.h" /* MAC error defines */ +#ifdef LTE_L2_MEAS +#include "rg_sch_cmn.h" /* typedefs for Scheduler */ +#endif +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general */ +#include "ssi.x" /* system services */ +#include "cm5.x" /* system services */ +#include "cm_tkns.x" /* Common Token Definitions */ +#include "cm_llist.x" /* Common Link List Definitions */ +#include "cm_lib.x" /* Common Library Definitions */ +#include "cm_hash.x" /* Common Hash List Definitions */ +#include "cm_mblk.x" /* common memory link list library */ +#include "cm_lte.x" /* Common LTE Defines */ +#include "rgr.x" /* RGR Interface includes */ +#include "rgm.x" /* RGM Interface includes */ +#include "tfu.x" /* RGU Interface includes */ +#include "lrg.x" /* LRG Interface includes */ +#include "rg_sch_inf.x" /* Scheduler defines */ +#include "rg_sch.x" /* Scheduler includes */ +#ifdef LTE_L2_MEAS +#include "rg_sch_cmn.x" /* typedefs for Scheduler */ +#endif +#ifndef LTE_L2_MEAS +PUBLIC Void rgSCHCmnInit ARGS((Void)); +#endif +/* forward references */ + + +PRIVATE U16 rgSCHLmmSapCfg ARGS(( + Inst inst, + RgCfg *cfg, + U8 sapIdx, + Elmnt sapType +)); + +PRIVATE Void rgSCHLmmShutdown ARGS(( + Inst inst +)); + + +PUBLIC void printSchCellInfo(void) +{ + U8 idx=0; + U8 inst=0; + for (idx = 0; idx < rgSchCb[inst].numSaps; idx++) + { + /* Unbind all the TFU SAP */ + /* Free the memory held by the cell associated + * with this SAP */ + if (rgSchCb[inst].tfuSap[idx].cell != NULLP) + { + RLOG1(L_INFO,"CELL %d\n", idx); + RLOG1(L_INFO,"NUM UEs :%d\n",rgSchCb[inst].tfuSap[idx].cell->ueLst.nmbEnt); + } + } +} + + +/** + * @brief Task Initiation callback function. + * + * @details + * + * Function : schActvInit + * + * This function is supplied as one of parameters during MAC's + * task registration. SSI will invoke this function once, after + * it creates and attaches this TAPA Task to a system task. + * + * @param[in] Ent Entity, the entity ID of this task. + * @param[in] Inst Inst, the instance ID of this task. + * @param[in] Region Region, the region ID registered for memory + * usage of this task. + * @param[in] Reason Reason. + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 schActvInit +( +Ent entity, /* entity */ +Inst instId, /* instance */ +Region region, /* region */ +Reason reason /* reason */ +) +#else +PUBLIC S16 schActvInit(entity, instId, region, reason) +Ent entity; /* entity */ +Inst instId; /* instance */ +Region region; /* region */ +Reason reason; /* reason */ +#endif +{ + Inst inst = (instId - SCH_INST_START); + + TRC2(schActvInit); + + /* Initialize the MAC TskInit structure to zero */ + cmMemset ((U8 *)&rgSchCb[inst], 0, sizeof(RgSchCb)); + + /* Initialize the MAC TskInit with received values */ + rgSchCb[inst].rgSchInit.ent = entity; + rgSchCb[inst].rgSchInit.inst = inst; + rgSchCb[inst].rgSchInit.region = region; + rgSchCb[inst].rgSchInit.pool = 0; + rgSchCb[inst].rgSchInit.reason = reason; + rgSchCb[inst].rgSchInit.cfgDone = FALSE; + rgSchCb[inst].rgSchInit.acnt = FALSE; + rgSchCb[inst].rgSchInit.usta = FALSE; + rgSchCb[inst].rgSchInit.trc = FALSE; +#ifdef DEBUGP +#ifdef RG_DEBUG + /* disabling debugs by default */ + /* rgSchCb[inst].rgSchInit.dbgMask = 0xffffffff; */ +#endif +#endif /* DEBUGP */ + rgSchCb[inst].rgSchInit.procId = SFndProcId(); + + rgSchCb[inst].rgrSap = NULLP; + rgSchCb[inst].tfuSap = NULLP; + rgSchCb[inst].rgmSap = NULLP; + rgSCHCmnInit(); + + RETVALUE(ROK); +} /* schActvInit */ + + +/** + * @brief SAP Configuration Handler. + * + * @details + * + * Function : rgSCHLmmSapCfg + * + * This function in called by HandleSchGenCfgReq(). It handles the + * interface SAP configuration of the scheduler instance. It + * initializes the sapState to LRG_UNBND. Returns + * reason for success/failure of this function. + * + * @param[in] RgCfg *cfg, the Configuaration information + * @return U16 + * -# LCM_REASON_GENCFG_NOT_DONE + * -# LCM_REASON_INVALID_SAP + * -# LCM_REASON_NOT_APPL + **/ +#ifdef ANSI +PRIVATE U16 rgSCHLmmSapCfg +( +Inst dInst, +RgCfg *cfg, /* Configuaration information */ +U8 sapIdx, /* SAP index */ +Elmnt sapType /* SAP Type */ +) +#else +PRIVATE U16 rgSCHLmmSapCfg(dInst, cfg, sapIdx, sapType) +Inst dInst; +RgCfg *cfg; /* Configuaration information */ +U8 sapIdx; /* SAP index */ +Elmnt sapType; /* SAP Type */ +#endif +{ + U16 ret = LCM_REASON_NOT_APPL; + RgSchLowSapCfgInfo *lowSapCfg = NULLP; + RgSchUpSapCfgInfo *upSapCfg = NULLP; + Inst inst = (dInst - SCH_INST_START); + + TRC2(rgSCHLmmSapCfg) + + /* Check if Gen Config has been done */ + + switch(sapType) + { + case STRGRSAP: +#ifndef CL_MAC_LWLC + if ((cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_TC) && + (cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_LC)) + { + ret = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" + " Selector value for RGR."); + break; + } +#endif + if(rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) + { + rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState = LRG_UNBND; + } + upSapCfg = &rgSchCb[inst].rgrSap[sapIdx].sapCfg; + + upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgrSap[sapIdx].ent; + upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgrSap[sapIdx].inst; + upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgrSap[sapIdx].procId; + upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; + upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + + SCH_INST_START; + upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; + upSapCfg->sapPst.region = cfg->s.schInstCfg.rgrSap[sapIdx].mem.region; + upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgrSap[sapIdx].mem.pool; + upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgrSap[sapIdx].selector; + upSapCfg->sapPst.route = cfg->s.schInstCfg.rgrSap[sapIdx].route; + upSapCfg->sapPst.intfVer = 0; + upSapCfg->sapPst.event = 0; + upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgrSap[sapIdx].prior; + upSapCfg->suId = cfg->s.schInstCfg.rgrSap[sapIdx].suId; + upSapCfg->spId = cfg->s.schInstCfg.rgrSap[sapIdx].spId; + break; + case STTFUSAP: +#ifndef CL_MAC_LWLC + if ((cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_TC) && + (cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_LC)) + { + ret = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" + " Selector value for TFU."); + break; + } +#endif + if (rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) + { + rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState = LRG_UNBND; + } + /* Initialize the sap timer */ + cmInitTimers(&(rgSchCb[inst].tfuSap[sapIdx].tmrBlk), 1); + lowSapCfg = &rgSchCb[inst].tfuSap[sapIdx].sapCfg; + + lowSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.tfuSap[sapIdx].ent; + lowSapCfg->sapPst.dstInst = cfg->s.schInstCfg.tfuSap[sapIdx].inst; + lowSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.tfuSap[sapIdx].procId; + lowSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; + lowSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + + SCH_INST_START; + lowSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; + lowSapCfg->sapPst.region = cfg->s.schInstCfg.tfuSap[sapIdx].mem.region; + lowSapCfg->sapPst.pool = cfg->s.schInstCfg.tfuSap[sapIdx].mem.pool; + lowSapCfg->sapPst.selector = cfg->s.schInstCfg.tfuSap[sapIdx].selector; + lowSapCfg->sapPst.route = cfg->s.schInstCfg.tfuSap[sapIdx].route; + lowSapCfg->sapPst.intfVer = 0; + lowSapCfg->sapPst.event = 0; + lowSapCfg->sapPst.prior = cfg->s.schInstCfg.tfuSap[sapIdx].prior; + lowSapCfg->suId = cfg->s.schInstCfg.tfuSap[sapIdx].suId; + lowSapCfg->spId = cfg->s.schInstCfg.tfuSap[sapIdx].spId; + cmMemcpy((U8 *)&lowSapCfg->bndTmr, + (U8 *)&cfg->s.schInstCfg.tfuSap[sapIdx].bndTmr, + sizeof(TmrCfg)); + break; + case STRGMSAP: +#ifndef RGM_LWLC + if ((cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LWLC) && + (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LC) && + (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_TC)) + { + ret = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported" + " Selector value for RGM."); + break; + } +#endif + if (rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) + { + rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState = LRG_UNBND; + } + upSapCfg = &rgSchCb[inst].rgmSap[sapIdx].sapCfg; + upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgmSap[sapIdx].ent; + upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgmSap[sapIdx].inst; + upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgmSap[sapIdx].procId; + upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent; + upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst + + SCH_INST_START; + upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId; + upSapCfg->sapPst.region = cfg->s.schInstCfg.rgmSap[sapIdx].mem.region; + upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgmSap[sapIdx].mem.pool; + upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgmSap[sapIdx].selector; + upSapCfg->sapPst.route = cfg->s.schInstCfg.rgmSap[sapIdx].route; + upSapCfg->sapPst.intfVer = 0; + upSapCfg->sapPst.event = 0; + upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgmSap[sapIdx].prior; + upSapCfg->suId = cfg->s.schInstCfg.rgmSap[sapIdx].suId; + upSapCfg->spId = cfg->s.schInstCfg.rgmSap[sapIdx].spId; + + break; + default: + /* would never reach here */ + break; + } + RETVALUE(ret); +} + + +/** + * @brief Scheduler instance Configuration Handler. + * + * @details + * + * Function : SchInstCfg + * + * This function in called by HandleSchGenCfgReq(). It handles the + * general and SAP configurations of the scheduler instance. It initializes + * the hash lists of rgSchCb. Returns + * reason for success/failure of this function. + * + * @param[in] RgCfg *cfg, the Configuaration information + * @return U16 + * -# LCM_REASON_NOT_APPL + * -# LCM_REASON_INVALID_MSGTYPE + * -# LCM_REASON_MEM_NOAVAIL + **/ +#ifdef ANSI +PUBLIC U16 SchInstCfg +( +RgCfg *cfg, /* Configuaration information */ +Inst dInst +) +#else +PUBLIC U16 SchInstCfg(cfg,dInst) +RgCfg *cfg; /* Configuaration information */ +Inst dInst; +#endif +{ + U16 ret = LCM_REASON_NOT_APPL; + Inst inst = (dInst - SCH_INST_START); + + TRC2(SchInstCfg) + + printf("\nEntered SchInstCfg()"); + /* Check if Instance Configuration is done already */ + if (rgSchCb[inst].rgSchInit.cfgDone == TRUE) + { + RETVALUE(LCM_REASON_INVALID_MSGTYPE); + } + if ((cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_TC) && + (cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_LC)) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg(): unsupported " + "Selector value for lmPst."); + RETVALUE(LCM_REASON_INVALID_PAR_VAL); + } + /* Update the Pst structure for LM interface */ + cmMemcpy((U8 *)&rgSchCb[inst].rgSchInit.lmPst, + (U8 *)&cfg->s.schInstCfg.genCfg.lmPst, + sizeof(Pst)); + + rgSchCb[inst].rgSchInit.inst = inst; + rgSchCb[inst].rgSchInit.lmPst.srcProcId = rgSchCb[inst].rgSchInit.procId; + rgSchCb[inst].rgSchInit.lmPst.srcEnt = rgSchCb[inst].rgSchInit.ent; + rgSchCb[inst].rgSchInit.lmPst.srcInst = rgSchCb[inst].rgSchInit.inst + + SCH_INST_START; + rgSchCb[inst].rgSchInit.lmPst.event = EVTNONE; + + rgSchCb[inst].rgSchInit.region = cfg->s.schInstCfg.genCfg.mem.region; + rgSchCb[inst].rgSchInit.pool = cfg->s.schInstCfg.genCfg.mem.pool; + rgSchCb[inst].genCfg.tmrRes = cfg->s.schInstCfg.genCfg.tmrRes; +#ifdef LTE_ADV + rgSchCb[inst].genCfg.forceCntrlSrbBoOnPCel = cfg->s.schInstCfg.genCfg.forceCntrlSrbBoOnPCel; + rgSchCb[inst].genCfg.isSCellActDeactAlgoEnable = cfg->s.schInstCfg.genCfg.isSCellActDeactAlgoEnable; +#endif + rgSchCb[inst].genCfg.startCellId = cfg->s.schInstCfg.genCfg.startCellId; + +/* Not adding any SAPs towards SCH now */ +#if 0 + /* allocate RGR saps */ + if (SGetSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data **)&rgSchCb[inst].rgrSap, + (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for " + "RGR saps failed"); + RETVALUE(RFAILED); + } + /* allocate RGM saps */ + if (SGetSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data **)&rgSchCb[inst].rgmSap, + (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for " + "RGM saps failed"); + RETVALUE(RFAILED); + } + + + /* allocate TFU saps */ + if (SGetSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data **)&rgSchCb[inst].tfuSap, + (sizeof(RgSchLowSapCb) * cfg->s.schInstCfg.numSaps)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for TFU " + "saps failed"); + RETVALUE(RFAILED); + } + + /* allocate for bndCfmResponses */ + if (SGetSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data **)&rgSchCb[inst].genCfg.bndCfmResp, + (sizeof(RgSchLmResponse) * cfg->s.schInstCfg.numSaps)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for bind" + " confirm responses failed"); + RETVALUE(RFAILED); + } +#ifdef LTE_ADV + rgSCHLaaInitEnbCb(&rgSchCb[inst]); +#endif + rgSchCb[inst].numSaps = cfg->s.schInstCfg.numSaps; + for (idx = 0; idx < cfg->s.schInstCfg.numSaps; idx++) + { + /* Initialize SAP State and configure SAP */ + rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG; + rgSchCb[inst].rgrSap[idx].cell = NULLP; + rgSCHLmmSapCfg(dInst, cfg, idx, STRGRSAP); + + rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG; + rgSchCb[inst].rgmSap[idx].cell = NULLP; + rgSCHLmmSapCfg(dInst, cfg, idx, STRGMSAP); + + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG; + rgSchCb[inst].tfuSap[idx].cell = NULLP; + rgSCHLmmSapCfg(dInst, cfg, idx, STTFUSAP); + rgSchCb[inst].tfuSap[idx].numBndRetries = 0; + } +#endif + /* Initialzie the timer queue */ + cmMemset((U8 *)&rgSchCb[inst].tmrTq, 0, sizeof(CmTqType)*RGSCH_TQ_SIZE); + /* Initialize the timer control point */ + cmMemset((U8 *)&rgSchCb[inst].tmrTqCp, 0, sizeof(CmTqCp)); + rgSchCb[inst].tmrTqCp.tmrLen = RGSCH_TQ_SIZE; + + /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */ + /* Timer Registration request to SSI */ + if (SRegTmrMt(rgSchCb[inst].rgSchInit.ent, dInst, + (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg(): Failed to " + "register timer."); + RETVALUE(LCM_REASON_MEM_NOAVAIL); + } + + /* Set Config done in TskInit */ + rgSchCb[inst].rgSchInit.cfgDone = TRUE; + printf("\nScheduler gen config done"); + + RETVALUE(ret); +} + + +/*********************************************************** + * + * Func : rgSCHLmmShutdown + * + * + * Desc : Handles the scheduler instance shutdown request. Calls + * rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation. + * + * + * Ret : Void + * + * Notes: + * + * File : rg_sch_lmm.c + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHLmmShutdown +( +Inst inst +) +#else +PRIVATE Void rgSCHLmmShutdown(inst) +Inst inst; +#endif +{ + Inst dInst = inst + SCH_INST_START; + U8 idx; +#ifdef LTE_L2_MEAS + CmLList *lnk = NULLP; + RgSchCb *instCb = &rgSchCb[inst]; + RgSchCellCb *cell = NULLP; + RgSchL2MeasCb *measCb; + U8 ulAllocIdx; + RgSchCmnUlCell *cellUl; + RgSchClcBoRpt *bo = NULL; +#endif + + TRC2(rgSCHLmmShutdown) + +#ifdef LTE_L2_MEAS + for (idx = 0; idx < instCb->numSaps; idx++) + { + /* got the cell break the loop */ + cell = instCb->rgrSap[idx].cell; + if(cell != NULLP) + { + /* Free the memory held up by ulAllocInfo */ + cellUl = RG_SCH_CMN_GET_UL_CELL(cell); +#ifdef LTE_TDD + for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++) +#else + for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++) +#endif + { + if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\ + ulAllocInfo)), + cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc)); + } + } + /* Free the memory allocated to measCb */ + lnk = cell->l2mList.first; + while(lnk != NULLP) + { + measCb = (RgSchL2MeasCb *)lnk->node; + cmLListDelFrm(&cell->l2mList, lnk); + lnk = lnk->next; + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\ + sizeof(RgSchL2MeasCb)); + } + + /* Free mem if any present for boLst for common channels */ + for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++) + { + lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first; + while (lnk) + { + bo = (RgSchClcBoRpt *)(lnk->node); + lnk = lnk->next; + cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt); + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt)); + } + } + } + } +#endif + +#ifdef LTE_ADV + rgSCHLaaDeInitEnbCb(&rgSchCb[inst]); +#endif + for (idx = 0; idx < rgSchCb[inst].numSaps; idx++) + { + /* Unbind all the TFU SAP */ + if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) + { + rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND); + if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) + { + rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]); + } + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; + } + if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND) + { + rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND); + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; + } + /* Free the memory held by the cell associated with this SAP */ + if (rgSchCb[inst].tfuSap[idx].cell != NULLP) + rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell); + rgSchCb[inst].tfuSap[idx].cell = NULLP; + } + /* Free the memory held by the scheduler instance */ + /* Deallocate RGR saps */ + SPutSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data *)rgSchCb[inst].rgrSap, + (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps)); + rgSchCb[inst].rgrSap = NULLP; + /* Deallocate RGM saps */ + SPutSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data *)rgSchCb[inst].rgmSap, + (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps)); + rgSchCb[inst].rgmSap = NULLP; + + /* Deallocate TFU saps */ + SPutSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data *)rgSchCb[inst].tfuSap, + (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps)); + rgSchCb[inst].tfuSap = NULLP; + + /* Deallocate bndCfmResponses */ + SPutSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, + (Data *)rgSchCb[inst].genCfg.bndCfmResp, + (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps)); + rgSchCb[inst].genCfg.bndCfmResp = NULLP; + /* De-register the Timer Service */ + (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst, + (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr); + + /* call back the task initialization function to intialize + * the global rgSchCb[inst] Struct */ + schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.reason); + + /* Set Config done in TskInit */ + rgSchCb[inst].rgSchInit.cfgDone = FALSE; + + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHLmmGenCntrl + * + * + * Desc : Processes the LM control request for STGEN elmnt. + * + * + * Ret : Void + * + * Notes: + * + * File : rg_sch_lmm.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHLmmGenCntrl +( +RgMngmt *cntrl, +RgMngmt *cfm, +Pst *cfmPst +) +#else +PUBLIC Void rgSCHLmmGenCntrl(cntrl, cfm, cfmPst) +RgMngmt *cntrl; +RgMngmt *cfm; +Pst *cfmPst; +#endif +{ + Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance ID */ + TRC2(rgSCHLmmGenCntrl) + + cfm->cfm.status = LCM_PRIM_OK; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + + + switch(cntrl->t.cntrl.action) + { + case AENA: + /* Action is Enable */ + switch(cntrl->t.cntrl.subAction) + { + case SAUSTA: + /* Enable Unsolicited Status (alarms) */ + rgSchCb[inst].rgSchInit.usta = TRUE; + /*Store the response and TransId for sending the Alarms */ + cmMemcpy((U8 *)&rgSchCb[inst].genCfg.ustaResp.response, + (U8 *)&cntrl->hdr.response, sizeof(Resp)); + rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId; + break; + case SADBG: + /* Enable Debug Printing */ +#ifdef DEBUGP + rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask; +#endif + break; +#ifdef PHY_ERROR_LOGING + case SAELMNT: + { + rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs; + rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb; + rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart; + rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart; + rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog; + rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime; + rgSchUlAllocCntr.crcOk = 0; + rgSchUlAllocCntr.crcErr = 0; + rgSchUlAllocCntr.numUlPackets = 0; + rgSchUlAllocCntr.numPrach = 0; + rgSchUlAllocCntr.taZero = 0; +#ifdef MAC_SCH_STATS + /* Reset + * L2 + * statistics + * */ + cmMemset((U8 *)&hqRetxStats, 0, sizeof(RgSchHqRetxStats)); + cmMemset((U8 *)&hqFailStats, 0, sizeof(RgSchNackAckStats)); +#endif + break; + } +#endif + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): " + "invalid subaction=%d", cntrl->t.cntrl.subAction); + break; + } + break; + case ADISIMM: + /* Action is Diable immidiately */ + switch(cntrl->t.cntrl.subAction) + { + case SAUSTA: + /* Disable Unsolicited Status (alarms) */ + rgSchCb[inst].rgSchInit.usta = FALSE; + break; + case SADBG: + /* Disable Debug Printing */ +#ifdef DEBUGP + rgSchCb[inst].rgSchInit.dbgMask &=\ + ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask; +#endif + break; + + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl():" + " invalid subaction=%d", cntrl->t.cntrl.subAction); + break; + } + break; + case ASHUTDOWN: + /* Free all the memory dynamically allocated by MAC */ + rgSCHLmmShutdown(inst); + break; + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): invalid" + " action=%d", cntrl->t.cntrl.action); + break; + } + RgMiLrgSchCntrlCfm(cfmPst, cfm); + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHLmmSapCntrl + * + * + * Desc : Processes the LM control request for STxxxSAP elmnt. + * + * + * Ret : Void + * + * Notes: + * + * File : rg_sch_lmm.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHLmmSapCntrl +( +RgMngmt *cntrl, +RgMngmt *cfm, +Pst *cfmPst +) +#else +PUBLIC Void rgSCHLmmSapCntrl(cntrl, cfm, cfmPst) +RgMngmt *cntrl; +RgMngmt *cfm; +Pst *cfmPst; +#endif +{ + U8 idx; + + /* TODO Pass InstId instead of using InstId from cfmPst */ + Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance Id */ + TRC2(rgSCHLmmSapCntrl) + + /* Only TFU SAP can be controlled by LM */ + switch(cntrl->hdr.elmId.elmnt) + { + case STTFUSAP: + idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.suId; + if (idx > LRG_MAX_SAPS_PER_INST) + { + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_SAP; + } + switch(cntrl->t.cntrl.action) + { + case ABND: + /* Bind Enable Request */ + if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) || + (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)) + { + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_SAP; + } + else + { + if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) + { + rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR, + rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val, + (PTR)&rgSchCb[inst].tfuSap[idx]); + } + /* Change SAP state */ + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM; + rgSchCb[inst].tfuSap[idx].numBndRetries++; + /* Store the response and TransId for sending + * the Control confirm */ + cmMemcpy((U8 *)&rgSchCb[inst].genCfg.bndCfmResp[idx].response, + (U8 *)&cntrl->hdr.response, sizeof(Resp)); + rgSchCb[inst].genCfg.bndCfmResp[idx].transId = + cntrl->hdr.transId; + + cfm->cfm.status = LCM_PRIM_OK_NDONE; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + + /* Sending Control Confirm before sending Bind + * Request to TFU */ + RgMiLrgSchCntrlCfm(cfmPst, cfm); + + rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId, + rgSchCb[inst].tfuSap[idx].sapCfg.spId); + RETVOID; + } + break; + case AUBND: + /* Unbind request */ + + /* Check if the SAP is configured */ + if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) || + (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND)) + { + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE; + } + else + { + rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, + TFU_UBNDREQ_MNGMT); + if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) + { + rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, + (PTR)&rgSchCb[inst].tfuSap[idx]); + } + /* Change SAP state */ + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND; + cfm->cfm.status = LCM_PRIM_OK; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + } + break; + case ADEL: + /* Delete SAP, does initialization of SAP */ + if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) || + (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)) + { + rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, + TFU_UBNDREQ_MNGMT); + if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE) + { + rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, + (PTR)&rgSchCb[inst].tfuSap[idx]); + } + } + cmMemset((U8 *)&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb)); + rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG; + cfm->cfm.status = LCM_PRIM_OK; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + break; + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " + "invalid action=%d", cntrl->t.cntrl.action); + break; + } + break; + case STRGRSAP: + idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId; + if (idx > LRG_MAX_SAPS_PER_INST) + { + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_SAP; + } + switch(cntrl->t.cntrl.action) + { + case ADEL: + cmMemset((U8 *)&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb)); + rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG; + cfm->cfm.status = LCM_PRIM_OK; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + break; + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " + "invalid action=%d", cntrl->t.cntrl.action); + break; + } + break; + case STRGMSAP: + idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId; + if (idx > LRG_MAX_SAPS_PER_INST) + { + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_SAP; + } + switch(cntrl->t.cntrl.action) + { + case ADEL: + cmMemset((U8 *)&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb)); + rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG; + cfm->cfm.status = LCM_PRIM_OK; + cfm->cfm.reason = LCM_REASON_NOT_APPL; + break; + default: + cfm->cfm.status = LCM_PRIM_NOK; + cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL; + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): " + "invalid action=%d", cntrl->t.cntrl.action); + break; + } + break; + + default: + /* Would never come here. */ + RETVOID; + } + RgMiLrgSchCntrlCfm(cfmPst, cfm); + RETVOID; +} + + +/*********************************************************** + * + * Func : SchFillCfmPst + * + * + * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst + * and the cfm->hdr.response. + * + * + * Ret : Void + * + * Notes: + * + * File : rg_sch_lmm.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void SchFillCfmPst +( +Pst *reqPst, +Pst *cfmPst, +RgMngmt *cfm +) +#else +PUBLIC Void SchFillCfmPst(reqPst, cfmPst, cfm) +Pst *reqPst; +Pst *cfmPst; +RgMngmt *cfm; +#endif +{ + Inst inst; + + TRC2(SchFillCfmPst) + + inst = (reqPst->dstInst - SCH_INST_START); + + cfmPst->srcEnt = rgSchCb[inst].rgSchInit.ent; + cfmPst->srcInst = (Inst) 0; + cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId; + cfmPst->dstEnt = reqPst->srcEnt; + cfmPst->dstInst = (Inst) 0; + cfmPst->dstProcId = reqPst->srcProcId; + + cfmPst->selector = cfm->hdr.response.selector; + cfmPst->prior = cfm->hdr.response.prior; + cfmPst->route = cfm->hdr.response.route; + cfmPst->region = cfm->hdr.response.mem.region; + cfmPst->pool = cfm->hdr.response.mem.pool; + + RETVOID; +} + + +/** + * @brief Timer start handler. + * + * @details + * + * Function : rgSCHLmmStartTmr + * + * This function based on the input parameters starts the timer for + * "tmrVal" duration. As of now scheduler instance uses the timer + * functionality for BndReq only. Hence there is no conditional + * code based on "tmrEvnt". + * + * @param[in] S16 tmrEvnt, the Timer Event + * @param[in] U32 tmrVal, the Wait Time + * @param[in] PTR cb, Entry for which Timer expired + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHLmmStartTmr +( +Inst inst, +S16 tmrEvnt, /* Timer Event */ +U32 tmrVal, /* Wait Time */ +PTR cb /* Entry for which Timer Expired */ +) +#else +PUBLIC S16 rgSCHLmmStartTmr(inst, tmrEvnt, tmrVal, cb) +Inst inst; /* scheduler instance ID */ +S16 tmrEvnt; /* Timer Event */ +U32 tmrVal; /* Wait Time */ +PTR cb; /* Entry for which Timer Expired */ +#endif +{ + CmTmrArg arg; +/* Inst dInst = inst + SCH_INST_START; */ + + TRC2(rgSCHLmmStartTmr) + + UNUSED(tmrEvnt); + + /* Initialize the arg structure */ + cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg)); + + arg.tqCp = &rgSchCb[inst].tmrTqCp; + arg.tq = rgSchCb[inst].tmrTq; + arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk; + arg.cb = cb; + arg.tNum = 0; + arg.max = RGSCH_MAX_TIMER; + arg.evnt = RGSCH_BNDREQ_TMR; + arg.wait = tmrVal; + cmPlcCbTq(&arg); + + RETVALUE(ROK); +} + + +/** + * @brief Timer stop handler. + * + * @details + * + * Function : rgSCHLmmStopTmr + * + * This function based on the input parameters stops the timer for + * "tmrEvnt". As of now Scheduler instance uses the timer functionality for + * BndReq only. Hence there is no conditional code based on "tmrEvnt". + * Once the bind happens and this timer is stopped, the timer functionality + * is deregistered with SSI. As there is no further use of timer processing. + * + * @param[in] S16 tmrEvnt, the Timer Event + * @param[in] PTR cb, Entry for which Timer expired + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHLmmStopTmr +( +Inst inst, /* Scheduler instance */ +S16 tmrEvnt, /* Timer Event */ +PTR cb /* Entry for which Timer Expired */ +) +#else +PUBLIC S16 rgSCHLmmStopTmr(inst, tmrEvnt, cb) +Inst inst; /* Scheduler instance */ +S16 tmrEvnt; /* Timer Event */ +PTR cb; /* Entry for which Timer Expired */ +#endif +{ + CmTmrArg arg; + U8 i; + S16 ret; + + TRC2(rgSCHLmmStopTmr) + + ret = RFAILED; + + for(i=0;itmrBlk.tmrEvnt == tmrEvnt) + { + /* Initialize the arg structure */ + cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg)); + + arg.tqCp = &rgSchCb[inst].tmrTqCp; + arg.tq = rgSchCb[inst].tmrTq; + arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk); + arg.cb = cb; + arg.max = RGSCH_MAX_TIMER; + arg.evnt = tmrEvnt; + + arg.tNum = i; + cmRmvCbTq(&arg); + ret = ROK; + break; + } + + } + + + RETVALUE(ret); +} + + +/** + * @brief Timer Expiry handler. + * + * @details + * + * Function : rgSCHLmmTmrExpiry + * + * This is a callback function used as an input parameter to cmPrcTmr() + * to check expiry of any timer. In this function, we are only concerned + * about tmrEvnt=Bind timer. + * + * @param[in] PTR cb, Entry for which Timer expired + * @param[in] S16 tmrEvnt, the Timer Event + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHLmmTmrExpiry +( +PTR cb, /* Pointer to timer control block */ +S16 tmrEvnt /* Timer Event */ +) +#else +PUBLIC S16 rgSCHLmmTmrExpiry(cb,tmrEvnt) +PTR cb; /* Pointer to timer control block */ +S16 tmrEvnt; /* Timer Event */ +#endif +{ + S16 ret = ROK; + RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb; +#ifdef DEBUGP + Inst inst = tfuSap->cell->instIdx; +#endif + TRC2(rgSCHLmmTmrExpiry) + + + switch(tmrEvnt) + { + case RGSCH_BNDREQ_TMR: + tfuSap->numBndRetries++; + if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY) + { + rgSCHLmmStaInd((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START), + (U16)LCM_CATEGORY_INTERFACE, (U16)LCM_EVENT_BND_FAIL, + (U16)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP); + } + else + { + /* Restart the bind timer */ + if (tfuSap->sapCfg.bndTmr.enb == TRUE) + { + ret = rgSCHLmmStartTmr((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START), + RGSCH_BNDREQ_TMR, + (U32)tfuSap->sapCfg.bndTmr.val, cb); + } + + /* Send bind request */ + rgSCHUtlTfuBndReq((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START), + tfuSap->sapCfg.suId, tfuSap->sapCfg.spId); + } + break; + default: + RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmTmrExpiry(): Invalid" + " tmrEvnt=%d", tmrEvnt); + ret = RFAILED; + break; + } + RETVALUE(ret); +} + + +/** + * @brief Layer Manager Control Confirm generation handler + * for Bind Confirm reception at TFU interface. + * RgLiTfuBndCfm() forwards the confirmation to this + * function. All SAP state related handling is restricted + * to LMM modules, hence the cfm forwarding. + * + * @details + * + * Function : rgSCHLmmBndCfm + * + * This API is used by the LIM module of MAC to forward + * the Bind Confirm it receives over the TFU interface. + * + * @param[in] Pst *pst, Post Structure + * @param[in] SuId suId, Service user ID + * @param[in] U8 status, Status + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHLmmBndCfm +( +Pst *pst, /* Post Structure */ +SuId suId, /* Service user ID */ +U8 status /* Status */ +) +#else +PUBLIC S16 rgSCHLmmBndCfm(pst,suId,status) +Pst *pst; /* Post Structure */ +SuId suId; /* Service user Id */ +U8 status; /* Status */ +#endif +{ + S16 ret = ROK; + RgMngmt cntrlCfm; + Pst cfmPst; + Inst inst = (pst->dstInst - SCH_INST_START); /* scheduler instance */ + + TRC2(rgSCHLmmBndCfm) + + + /* check the SAP State */ + switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState) + { + case LRG_WAIT_BNDCFM: + break; + case LRG_BND: + /* SAP is already bound */ + RETVALUE(ROK); + default: + RETVALUE(RFAILED); + } + + cfmPst = rgSchCb[inst].rgSchInit.lmPst; + cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector; + cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior; + cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route; + cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region; + cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool; + + cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt)); + + switch(status) + { + case CM_BND_OK: /* status is OK */ + /* Change SAP state to Bound */ + rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND; + if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE) + { + ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]); + } + /* Send Control Confirm with status as OK to Layer Manager */ + cntrlCfm.cfm.status = LCM_PRIM_OK; + cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL; + /* Sending Status Indication to Layer Manager */ + rgSCHLmmStaInd((U8)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START), + LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK, + LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP); + break; + + default: + /* Change SAP state to UnBound */ + rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND; + if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE) + { + ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]); + } + /* Send Control Confirm with status as NOK to Layer Manager */ + cntrlCfm.cfm.status = LCM_PRIM_NOK; + cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM; + break; + } + rgSchCb[inst].tfuSap[suId].numBndRetries = 0; + cntrlCfm.hdr.elmId.elmnt = STTFUSAP; + cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId; + + ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm); + + RETVALUE(ret); +} + +/** + * @brief Layer Manager Unsolicited Status Indication generation. + * + * @details + * + * Function : rgSCHLmmStaInd + * + * This API is used by the other modules of MAC to send a unsolicited + * status indication to the Layer Manager. + * + * @param[in] U16 category, the Alarm category + * @param[in] U16 event, the Alarm event + * @param[in] U16 cause, the cause of the Alarm + * @param[in] RgUstaDgn *dgn, Alarm Diagonostics + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHLmmStaInd +( +Inst inst, +U16 category, +U16 event, +U16 cause, +RgUstaDgn *dgn +) +#else +PUBLIC S16 rgSCHLmmStaInd(inst, category, event, cause, dgn) +Inst inst; +U16 category; +U16 event; +U16 cause; +RgUstaDgn *dgn; +#endif +{ + RgMngmt usta; + + TRC2(rgSCHLmmStaInd) + + if(rgSchCb[inst].rgSchInit.usta == FALSE) + { + RETVALUE(ROK); + } + + cmMemset((U8 *)&usta, 0, sizeof(RgMngmt)); + + SGetDateTime(&usta.t.usta.cmAlarm.dt); + usta.t.usta.cmAlarm.category = category; + usta.t.usta.cmAlarm.event = event; + usta.t.usta.cmAlarm.cause = cause; + if (dgn != NULLP) + { + cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn)); + } + + rgSchCb[inst].rgSchInit.lmPst.selector = + rgSchCb[inst].genCfg.ustaResp.response.selector; + rgSchCb[inst].rgSchInit.lmPst.prior = + rgSchCb[inst].genCfg.ustaResp.response.prior; + rgSchCb[inst].rgSchInit.lmPst.route = + rgSchCb[inst].genCfg.ustaResp.response.route; + rgSchCb[inst].rgSchInit.lmPst.region = + rgSchCb[inst].genCfg.ustaResp.response.mem.region; + rgSchCb[inst].rgSchInit.lmPst.pool = + rgSchCb[inst].genCfg.ustaResp.response.mem.pool; + usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId; + + RETVALUE(RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta)); +} + + +/** + * @brief Scheduler instance timer call back function registered with SSI. + * + * @details + * + * Function : schActvTmr + * + * This function is invoked by SSI for every timer activation + * period expiry. Note that SS_MT_TMR flag needs to be enabled for this + * as isntId is needed.As part of SRegTmr call for scheduler instance + * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as + * callback function + * + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 schActvTmr +( +Ent ent, +Inst inst +) +#else +PUBLIC S16 schActvTmr(ent, inst) +Ent ent; +Inst inst; +#endif +{ + Inst schInst = (inst - SCH_INST_START); + TRC2(schActvTmr) + + /* Check if any timer in the scheduler instance has expired */ + cmPrcTmr(&rgSchCb[schInst].tmrTqCp, + rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry); + + RETVALUE(ROK); + +} /* end of schActvTmr */ + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_mga.c b/src/5gnrsch/rg_sch_mga.c similarity index 100% rename from src/5gnrmac/rg_sch_mga.c rename to src/5gnrsch/rg_sch_mga.c diff --git a/src/5gnrmac/rg_sch_pt.c b/src/5gnrsch/rg_sch_pt.c similarity index 100% rename from src/5gnrmac/rg_sch_pt.c rename to src/5gnrsch/rg_sch_pt.c diff --git a/src/5gnrmac/rg_sch_pwr.c b/src/5gnrsch/rg_sch_pwr.c similarity index 100% rename from src/5gnrmac/rg_sch_pwr.c rename to src/5gnrsch/rg_sch_pwr.c diff --git a/src/5gnrmac/rg_sch_ram.c b/src/5gnrsch/rg_sch_ram.c similarity index 100% rename from src/5gnrmac/rg_sch_ram.c rename to src/5gnrsch/rg_sch_ram.c diff --git a/src/5gnrmac/rg_sch_sc1.c b/src/5gnrsch/rg_sch_sc1.c similarity index 100% rename from src/5gnrmac/rg_sch_sc1.c rename to src/5gnrsch/rg_sch_sc1.c diff --git a/src/5gnrmac/rg_sch_sc1.h b/src/5gnrsch/rg_sch_sc1.h similarity index 100% rename from src/5gnrmac/rg_sch_sc1.h rename to src/5gnrsch/rg_sch_sc1.h diff --git a/src/5gnrmac/rg_sch_sc1.x b/src/5gnrsch/rg_sch_sc1.x similarity index 100% rename from src/5gnrmac/rg_sch_sc1.x rename to src/5gnrsch/rg_sch_sc1.x diff --git a/src/5gnrmac/rg_sch_scell.c b/src/5gnrsch/rg_sch_scell.c similarity index 100% rename from src/5gnrmac/rg_sch_scell.c rename to src/5gnrsch/rg_sch_scell.c diff --git a/src/5gnrmac/rg_sch_tmr.c b/src/5gnrsch/rg_sch_tmr.c similarity index 100% rename from src/5gnrmac/rg_sch_tmr.c rename to src/5gnrsch/rg_sch_tmr.c diff --git a/src/5gnrsch/rg_sch_tom.c b/src/5gnrsch/rg_sch_tom.c new file mode 100755 index 000000000..6a076edbe --- /dev/null +++ b/src/5gnrsch/rg_sch_tom.c @@ -0,0 +1,8866 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch_tom.c + +**********************************************************************/ + +/** @file rg_sch_tom.c +@brief This module does processing related to handling of lower interface APIs +invoked by PHY towards scheduler. +*/ +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_FILE_ID=228; +static int RLOG_MODULE_ID=4096; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system services */ +#include "cm5.h" /* common timers defines */ +#include "cm_hash.h" /* common hash list defines */ +#include "cm_llist.h" /* common linked list defines */ +#include "cm_mblk.h" /* memory management */ +#include "cm_tkns.h" /* common tokens */ +#include "cm_lte.h" /* common tokens */ +#include "tfu.h" /* RGU defines */ +#include "lrg.h" /* layer management defines for LTE-MAC */ +#include "rgr.h" /* layer management defines for LTE-MAC */ +#include "rgm.h" /* layer management defines for LTE-MAC */ +#include "rg_env.h" /* defines and macros for MAC */ +#include "rg_sch_err.h" /* defines and macros for MAC */ +#include "rg_sch_inf.h" /* defines and macros for MAC */ +#include "rg_sch.h" /* defines and macros for MAC */ +#include "rg_sch_cmn.h" /* typedefs for MAC */ +#include "rl_interface.h" +#include "rl_common.h" + + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* RGU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for MAC */ +#include "rg_sch_cmn.x" /* typedefs for MAC */ +#ifdef EMTC_ENABLE +#include "rg_sch_emtc_ext.x" +#endif +/* local defines */ +#ifdef EMTC_ENABLE +EXTERN Bool rgSCHEmtcChkEmtcUe ARGS( +( +RgSchCellCb *cell, +U16 rapId +)); +EXTERN Void rgSchTomTtiEmtcSched ARGS( +( + RgSchCellCb *cell +)); + +EXTERN S16 rgSCHEmtcRamVldtProcRaReq +( +U8 raRntiCnt, +U8 raReqCnt, +RgSchCellCb *cell, +TfuRaReqIndInfo *raReqInd, +RgSchUeCb *ue, +Bool *isEmtcUe, +RgSchErrInfo *err +); +EXTERN Void rgSCHEmtcUpdCqiInfo +( +RgSchUeCb *ue, +RgSchUePCqiCb *cqiCb, +U16 *cqiIdx +); +EXTERN Void rgSCHEmtcUpdSRInfo +( +RgSchUeCb *ue, +U16 *srIdx +); +EXTERN Void rgSCHCmnEmtcHdlCrcFailInd +( +RgSchCellCb *cell, +RgSchRaCb *raCb +); +EXTERN S16 rgSCHEmtcTomUtlProcAtCrc +( +RgSchCellCb *cell, +CmLteTimingInfo crntHiDci0Frm, +TfuCntrlReqInfo *cntrlInfo, +RgSchErrInfo *err +); +EXTERN Void rgSCHEmtcInitUeRecpReqLst +( +TfuRecpReqInfo *recpReqInfo +); +EXTERN Void rgSCHEmtcFillPucchRecpInfo +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqCb, +U16 *hqRes +); +EXTERN Bool rgSCHEmtcAddRecpInfoToLst +( +RgSchDlHqProcCb *hqCb, +TfuRecpReqInfo *recpReqInfo, +TfuUeRecpReqInfo *pucchRecpInfo, +Bool isEmtcUe +); +EXTERN Void rgSCHEmtcWillUeRptCqi +( +RgSchUeCb *ue, +Bool *willUeRprtCqi +); +EXTERN Void rgSchEmtcTomTtiCnsldtSfAlloc +( +RgSchCellCb *cell +); + +EXTERN S16 rgSchEmtcTomTtiL1DlAndUlCfg +( +RgSchCellCb *cell, +RgTfuCntrlReqInfo *cntrlInfo +); + +EXTERN S16 rgSCHTomEmtcUtlFillDatRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err +); + +EXTERN S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err +); + +EXTERN S16 rgSCHEmtcDhmRlsDlsfHqProc +( +RgSchCellCb *cell, +CmLteTimingInfo timingInfo +); + +EXTERN Void rgSCHEmtcCmnUlSch +( + RgSchCellCb *cell +); + +#ifdef RG_ULSCHED_AT_CRC +EXTERN S16 rgSCHEmtcTomUtlProcDlSfAtCrc +( +RgSchEmtcDlSf *ulSf, +CmLteTimingInfo crntUlFrm, +RgSchCellCb *cell, +TfuCntrlReqInfo *cntrlInfo, +RgSchErrInfo *err +); + +EXTERN RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet +( +RgSchCellCb *cell, +CmLteTimingInfo frm +); +#endif + +EXTERN U32 gDlMpdcchBlank; +EXTERN U32 gUlMpdcchBlank; +EXTERN S16 rgSCHUtlIotResPrcTti +( +RgSchCellCb *cell +); + +#endif + +EXTERN RgSchUeCb* rgSCHCmnGetHoUe +( +RgSchCellCb *cell, +U16 rapId +); +EXTERN RgSchUeCb* rgSCHCmnGetPoUe +( +RgSchCellCb *cell, +U16 rapId, +CmLteTimingInfo timingInfo +); +PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq ARGS( +( + RgSchCellCb *cell, + U8 cqiReq, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + )); + +PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq ARGS( +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + )); + +PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS( +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + )); + +PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq ARGS( +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres + )); + + +#ifdef CA_DBG +EXTERN U32 delayedApiCnt; +U32 gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0; +U32 gSCellSchedCount=0,gPrimarySchedCount=0; +U32 gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0; +U32 gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0; +U32 gHqFdbkCount = 0; + + + +U32 gCqiRecpCount = 0; +U32 gCqiRecpPuschCount = 0; +U32 gCqiRcvdCount = 0; +Bool gF1bCsPres = FALSE; +U32 gRiReqCount = 0; +U32 gCqiReqCount = 0; +U32 gF1bCsCount = 0; +U32 gACqiRcvdCount = 0; +U32 gCqiReptToAppCount = 0; +U32 gRawACqiCount= 0; +U32 gCqiDropCount,gPucchDropCount; +U32 gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount; +U32 gDci0Count = 0; +U32 gUlCrcFailCount = 0; +U32 gUlCrcPassCount = 0; +U32 gPuschCqiDropCount = 0; +U32 gCaDbgCaFrmt = 0; +U32 gCaDbgNonCaFrmt = 0; +U32 gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0; +#endif + +#ifdef EMTC_ENABLE +U32 gUlCrcFailCounter = 0; +U32 gUlCrcPassCounter = 0; +#endif + +#ifdef RG_5GTF +EXTERN U32 gUl5gtfPdcchSend; +PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS( +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + )); +#endif + + +/* local typedefs */ +PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */ +PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */ + +/* local externs */ +/* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI + * processing */ +#ifdef LTE_L2_MEAS + U64 glblTtiCnt = 0; +#endif +U32 ri1Cnt ; +U32 ri2Cnt ; +U32 gDlNumUePerTti[20] = {0}; +U32 gUlNumUePerTti[20] = {0}; +PRIVATE S16 rgSCHTomUtlProcDlSf ARGS(( + RgSchDlSf *dlSf, + RgSchDlSf *ulSf, + RgSchCellCb *cell, + RgTfuCntrlReqInfo *cntrlInfo, + RgSchErrInfo *err)); +#ifdef RG_ULSCHED_AT_CRC +PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS(( + RgSchDlSf *ulSf, + CmLteTimingInfo crntUlFrm, + RgSchCellCb *cell, + TfuCntrlReqInfo *cntrlInfo, + RgSchErrInfo *err)); +#endif /* RG_ULSCHED_AT_CRC */ +#ifdef LTE_TDD +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS(( + RgSchCellCb *cell, + RgSchErrInfo *err)); +#endif /* TFU_UPGRADE */ +#endif +PRIVATE S16 rgSCHTomUtlFillPhich ARGS(( + RgSchCellCb *cell, + TfuCntrlReqInfo *cntrlInfo, + RgSchDlSf *dlSf, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS(( + RgSchCellCb *cell, + TfuCntrlReqInfo *cntrlInfo, + RgSchDlSf *dlSf, + RgSchErrInfo *err)); +PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS(( + RgSchCellCb *cell, + TfuCntrlReqInfo *cntrlInfo, + RgSchDlSf *ulSf, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlProcTA ARGS(( + RgSchCellCb *cell)); +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + RgSchErrInfo *err)); +#endif +#ifdef TFU_UPGRADE + +PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS +(( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo + )); + +PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS +(( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuRecpReqInfo *recpReqInfo, + TfuUeRecpReqInfo *pucchRecpInfo, + U16 validIdx + )); + +PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS +(( + RgSchCellCb *cell, + TfuRecpReqInfo *recpReqInfo, + RgSchUeCb *ue, + TfuUeRecpReqInfo *pucchRecpInfo, + U16 validIdx, + Bool isDatPresOnSecCell + )); + +PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS +(( + RgSchUeCb *ueCb +)); + +PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS +(( +RgSchUeCb *ueCb, +U8 numTxAnt, +U8 *ri +)); + +PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS +(( +RgSchUeCb *ueCb, +TfuCqiPucchMode21 *mode21Info, +U8 numTxAnt, +U8 *ri +)); + +PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +U16 validIdx +)); + +PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchUePCqiCb *cqiCb +)); + +PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchUePCqiCb *riCb +)); + +PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); + +PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS +(( +RgSchCellCb *cell, +RgSchUeCb *ue +)); + +PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS +(( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + TfuRecpReqInfo *recpReqInfo + )); + +PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS(( + RgSchUeCb *ue, + Bool *willueRprtCqiRii)); + +PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); + +PRIVATE S16 rgSCHTomUtlGenIndices ARGS(( + U32 label, + U8 posM, + U8 valN, + U8 valK, + TfuSubbandInfo* sbInfo)); + +#endif +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err)); +#else +PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS(( + TfuRecpReqInfo *recpReq, + RgSchCellCb *cell, + RgSchErrInfo *err)); +#endif + +#ifdef LTE_TDD +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS(( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + U16 validIdx + )); +#else +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS(( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf + )); +#endif +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS(( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + U16 validIdx + )); +#else +PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS(( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf + )); +#endif + +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS(( + RgSchDlHqProcCb *hqCb, + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cellCb, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + CmLteRnti rnti, + RgrTddAckNackMode ackNackMode, + RgSchUePucchRecpInfo **pucchInfoRef, + RgSchPdcch *pdcch, + TknU16 n1PucchTkn, + Bool *allocRef, + U8 hqSz + )); +#endif +#ifdef LTEMAC_SPS +EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell); +#ifndef LTE_TDD +#ifdef TFU_UPGRADE +PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS +(( + RgSchCellCb *cell, + RgSchDlSf *dlSf, + TfuRecpReqInfo *recpReqInfo, + U16 validIdx, + RgSchErrInfo *err + )); +#else + PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS +(( + RgSchCellCb *cell, + RgSchDlSf *dlSf, + TfuRecpReqInfo *recpReqInfo, + RgSchErrInfo *err + )); +#endif +#endif +#endif + +PRIVATE Void rgSchTomTtiMiscFunctions ARGS +(( +RgSchCellCb *cell +)); + +PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS +(( +RgSchCellCb *cell +)); + +PRIVATE Void rgSchTomTtiDlSch ARGS +(( +RgSchCellCb *cell +)); + +PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS +(( +RgSchCellCb *cell +)); + +PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS +(( +RgSchCellCb *cell, +RgTfuCntrlReqInfo *cntrlInfo +)); + +#ifdef RGR_RRM_TICK +PRIVATE Void rgSCHTomUtlSendSfnTick ARGS +(( +RgSchCellCb *cell +)); +#endif + +PRIVATE Void rgSchTomFillCellTtiInfo ARGS +(( +TfuTtiIndInfo *ttiInd, +Inst schInst, +U8 *nCell, +RgSchCellCb *cells[] +)); +#ifdef LTE_TDD +PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS +(( +RgSchCellCb *cell +)); +PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS +(( +RgSchCellCb *cell +)); +#ifdef LTE_ADV +PRIVATE Void rgSCHTomUtlGethqRes ARGS +(( +U8 noFdbks, +RgSchDlSf *dlSf, +RgSchPdcch *pdcch, +RgSchCellCb *cellCb, +U16 *hqRes +)); +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS +(( + RgSchDlHqProcCb *hqCb, + TfuUePucchRecpReq *hqRecpReq, + U8 noFdbks, + RgSchDlSf *dlSf, + RgSchPdcch *pdcch, + RgSchCellCb *cellCb +)); +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS +(( + RgSchDlHqProcCb *hqCb, + TfuUePucchRecpReq *hqRecpReq, + U8 noFdbks, + RgSchDlSf *dlSf, + RgSchPdcch *pdcch, + RgSchCellCb *cellCb, + U8 elemIdx +)); +#endif/*LTE_ADV*/ +#endif/*LTE_TDD*/ + +PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt; + +#ifdef RG_5GTF +U32 rgSch5gtfCqi2Mcs[15] = + {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; +#endif +/* forward references */ +#ifdef TFU_UPGRADE +/*HARQ Feedback interpretation in accordance with Femto Forum. +Note: There is no value as '0' in Femto Forum Spec but in order to retain +the existing usage in MAC (and its Acceptance), its being considered*/ +CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4}; +/*added #defines instead of magic numbers*/ +CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={ +{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28}, +{0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378}, +{0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,1330,1540,1771,2024,2300,2600,2925,3276}, +{0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060,3876,4845,5985,7315,8855,10626,12650,14950,17550,20475}, +{0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568,11628,15504,20349,26334,33649,42504,53130,65780,80730,98280}, +{0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564,27132,38760,54264,74613,100947,134596,177100,230230,296010,376740} +}; + + +/*ccpu00116923 - ADD - SRS present support*/ +/*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */ +/* Table 5.5.3.3-1 */ +#ifndef LTE_TDD +CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = { + {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE}, + {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE}, + {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE}, + {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE}, + {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE}, + {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE}, + {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE}, + {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE} +}; +#else +/* Table 5.5.3.3-2 */ +CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = { + {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, + {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE}, + {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE}, + {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE}, + {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE}, + {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE}, + {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE}, + {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, + {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, + {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE}, + {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE}, + {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE} +}; +#endif +PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4}; +PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1}; +#endif + +/** + * @brief get Ue for dedicated preamble rach + * + * @details + * + * Function: rgSCHGetDedPrmUe + * + * Invoked by: rgSCHTomRaReqInd + * + * @param[in] RgSchCellCb *cell + * @param[in] TfuRaReqIndInfo *raReqInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHGetDedPrmUe +( +RgSchCellCb *cell, +U16 rapId, +CmLteTimingInfo timingInfo, +RgSchUeCb **ue +) +#else +PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue) +RgSchCellCb *cell; +U16 rapId; +CmLteTimingInfo timingInfo; +RgSchUeCb **ue; +#endif +{ + RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch); + + printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm); + /* Finding UE in handOver List */ + if ((rapId < cellSch->rachCfg.dedPrmStart) || + (rapId > cellSch->rachCfg.dedPrmStart + + cellSch->rachCfg.numDedPrm - 1)) + { + /* This ded Preamble corresponds to handover */ + *ue = rgSCHCmnGetHoUe(cell, rapId); + printf(" his ded Preamble corresponds to hando\n"); + } + else/* Finding UE from PDCCH Order Mappings */ + { + /* Get the UE which has transmitted this RaReq */ + *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo); + printf(" ==== inding UE from PDCCH Order Mapping\n"); + } + RETVALUE(ROK); +} +/** + * @brief Handler for processing Random Access request indication + * recieved from PHY. + * + * @details + * + * Function: rgSCHTomRaReqInd + * + * Handler for processing Random Access request indication recieved from + * PHY. + * + * Invoked by: RgLiTfuRaReqInd of LIM + * + * Processing Steps: + * - Validate the information received: cellId value and raRnti values + * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd) + * + * @param[in] RgSchCellCb *cell + * @param[in] TfuRaReqIndInfo *raReqInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomRaReqInd +( +RgSchCellCb *cell, +TfuRaReqIndInfo *raReqInd +) +#else +PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd) +RgSchCellCb *cell; +TfuRaReqIndInfo *raReqInd; +#endif +{ + S16 ret; + U8 raRntiCnt; + U8 raReqCnt; + RgSchErrInfo err; + Bool isEmtcUe = FALSE; + U16 rapId; + RgSchUeCb *ue = NULLP; + + TRC2(rgSCHTomRaReqInd); + + if(cell->cellId != raReqInd->cellId) + { + err.errType = RGSCHERR_TOM_RAREQIND; + err.errCause = RGSCHERR_TOM_INV_CELL_ID; + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)" + " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause); + RETVALUE(RFAILED); + } + + for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++) + { + for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++) + { + rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId; + + if(RGSCH_IS_DEDPRM(cell, rapId)) + { + rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue); + if(NULLP == ue) + { + /* Since rapId is within dedicated range and No ue context + * is found means it is a spurious rach. So ignore it.*/ + continue; + } + } + + if(FALSE == isEmtcUe) + { +#if (ERRCLASS & ERRCLS_DEBUG) + if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI) + { + RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013, + (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti, + ("rgSCHTomRaReqInd(): raRnti is out of range\n")); + continue; + } +#endif + ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti, + (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt], + raReqInd->timingInfo, ue, &err); + if(ret == RFAILED) + { + err.errType = RGSCHERR_TOM_RAREQIND; + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, + "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) " + "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti, + err.errType, err.errCause); + continue; + } + } + } + } + RETVALUE(ROK); +} /* rgSCHTomRaReqInd */ + + +/** + * @brief Handler for processing uplink CQI indication recieved from PHY. + * + * @details + * + * Function: rgSCHTomUlCqiInd + * + * Handler for processing uplink CQI indication recieved from PHY. + * + * Invoked by: RgLiTfuUlCqiInd + * + * Processing Steps: + * - Gets UE + * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd + * + * @param[in] RgSchCellCb *cell + * @param[in] TfuUlCqiIndInfo *ulCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUlCqiInd +( +RgSchCellCb *cell, +TfuUlCqiIndInfo *ulCqiInd +) +#else +PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd) +RgSchCellCb *cell; +TfuUlCqiIndInfo *ulCqiInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuUlCqiRpt *ulCqiInfo; + TRC2(rgSCHTomUlCqiInd); + + node = ulCqiInd->ulCqiRpt.first; + if(cell->cellId != ulCqiInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)", + ulCqiInd->cellId); + RETVALUE(RFAILED); + } + + for (;node; node=node->next) + { + ulCqiInfo = (TfuUlCqiRpt *)node->node; +#if (ERRCLASS & ERRCLS_DEBUG) + if(ulCqiInfo->numSubband == 0) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is" + "out of range RNTI:%d",ulCqiInfo->rnti); + continue; + } +#endif + if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP) + { +#ifdef LTEMAC_SPS + if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get " + "the ue for RNTI:%d", ulCqiInfo->rnti); + continue; + } + } + /* wideband cqi is directly reported now. and also isTxPort0 */ + rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo); + } + RETVALUE(ROK); +} /* rgSCHTomUlCqiInd */ + +/** + * @brief Handler for processing PUCCH power adjustment indication + * + * @details + * + * Function: rgSCHTomPucchDeltaPwrInd + * + * Handler for processing PUCCH power adjustment indication + * received from PHY. + * + * Invoked by: RgLiTfuPucchDeltaPwrInd + * + * Processing Steps: + * - Gets UE + * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd + * + * @param[in] RgSchCellCb *cell + * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomPucchDeltaPwrInd +( +RgSchCellCb *cell, +TfuPucchDeltaPwrIndInfo *pucchDeltaPwr +) +#else +PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr) +RgSchCellCb *cell; +TfuPucchDeltaPwrIndInfo *pucchDeltaPwr; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuPucchDeltaPwr *ueElem; + + TRC2(rgSCHTomPucchDeltaPwrInd); + + if(cell->cellId != pucchDeltaPwr->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)", + pucchDeltaPwr->cellId); + RETVALUE(RFAILED); + } + + node = pucchDeltaPwr->pucchDeltaPwrLst.first; + for (;node; node=node->next) + { + ueElem = (TfuPucchDeltaPwr *)node->node; + if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP) + { +#ifdef LTEMAC_SPS + if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP) +#endif + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d " + "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ", + ueElem->rnti); + continue; + } + } + rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr); + } + RETVALUE(ROK); +} /* rgSCHTomPucchDeltaPwrInd */ + +/** + * @brief Handler for processing harq ACK/NACK indication recieved from PHY. + * + * @details + * + * Function: rgSCHTomHarqAckInd + * + * Handler for processing harq ACK/NACK indication recieved from PHY. + * + * Invoked by: RgLiTfuHqInd + * + * Processing Steps: + * For each HqAckInfo received + * - Get UE + * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd + * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd + * + * @param[in] TfuHqIndInfo *harqAckInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomHarqAckInd +( +RgSchCellCb *cell, +TfuHqIndInfo *harqAckInd +) +#else +PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd) +RgSchCellCb *cell; +TfuHqIndInfo *harqAckInd; +#endif +{ + RgSchErrInfo err; + RgSchUeCb *ue; + RgSchRaCb *raCb; + CmLList *node; + TfuHqInfo *hqInfo; + Pst pst; +#ifdef TFU_UPGRADE + U8 tbCnt; +#endif + + RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); + U32 cellIdx; + RgSchCellCb *iterCellP; + + TRC2(rgSCHTomHarqAckInd); + + if(cell->cellId != harqAckInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get" + " the cell for cellId (%d)", harqAckInd->cellId); + err.errType = RGSCHERR_TOM_HARQACKIND; + err.errCause = RGSCHERR_TOM_INV_CELL_ID; + RETVALUE(RFAILED); + } +#ifdef RG_5GTF + node = harqAckInd->hqIndLst.first; + for (;node; node=node->next) + { + hqInfo = (TfuHqInfo *)node->node; + { + rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); + TfuHqFdbk fdbk = hqInfo->isAck[0]; + raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti); + ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti); + if (ue != NULLP && raCb == NULLP) + { + if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " + "HARQ feedback processing failed errType(%d)errCause(%d)n", + err.errType, err.errCause); + continue; + } + } + } + + } + + if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " + "subframe for cellId (%d) ", cell->cellId); + err.errType = RGSCHERR_TOM_HARQACKIND; + } + + for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) + { + if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) + { + iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; + + rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); + if(rlsHqBufs->numUes) + { + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); + RgSchMacRlsHq (&pst, rlsHqBufs); + } + rlsHqBufs->numUes = 0; + } + } +#else + rlsHqBufs->numUes = 0; + node = harqAckInd->hqIndLst.first; + for (;node; node=node->next) + { + hqInfo = (TfuHqInfo *)node->node; + for(tbCnt=0; tbCntisAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]]; + } + raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti); + ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti); + if (ue == NULLP && raCb != NULLP) + { +#ifdef RG_UNUSED + rgSCHRamMsg4FdbkInd (raCb); +#endif + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d)", + err.errType, err.errCause); + continue; + } + continue; + } + else if (ue != NULLP && raCb == NULLP) + { + /* Get the Downlink HARQ entity from ue */ + if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT, + cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " + "HARQ feedback processing failed errType(%d)errCause(%d)n", + err.errType, err.errCause); + continue; + } + } + else if (ue != NULLP && raCb != NULLP) + { + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d).", + err.errType, err.errCause); + continue; + } + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " + "UE CB or RA CB ", hqInfo->rnti); + err.errType = RGSCHERR_TOM_HARQACKIND; + continue; + } + } + + /* Check with TDD call DHM*/ + if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " + "subframe for cellId (%d) ", harqAckInd->cellId); + err.errType = RGSCHERR_TOM_HARQACKIND; + } + + for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) + { + if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) + { + iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; + + rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); + if(rlsHqBufs->numUes) + { + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); + RgSchMacRlsHq (&pst, rlsHqBufs); + } + rlsHqBufs->numUes = 0; + } + } +#endif + RETVALUE(ROK); +} /* rgSCHTomHarqAckInd */ + + +/** + * @brief Handler for processing Scheduling Request indication + * recieved from PHY for a list of UEs. + * + * @details + * + * Function: rgSCHTomSrInd + * + * Handler for processing Scheduling Request indication recieved from PHY + * for UEs. + * + * Invoked by: RgLiTfuSrInd + * + * Processing Steps: + * - Get UE + * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd + * + * @param[in] TfuSrIndInfo *srInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomSrInd +( +RgSchCellCb *cell, +TfuSrIndInfo *srInd +) +#else +PUBLIC S16 rgSCHTomSrInd(cell, srInd) +RgSchCellCb *cell; +TfuSrIndInfo *srInd; +#endif +{ + S16 ret = RFAILED; + RgSchErrInfo err; + RgSchUeCb *ue; + CmLList *node; + TfuSrInfo *srInfo; + + TRC2(rgSCHTomSrInd); + + if(cell->cellId != srInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId" + ":%d ", srInd->cellId); + err.errType = RGSCHERR_TOM_SRIND; + err.errCause = RGSCHERR_TOM_INV_CELL_ID; + RETVALUE(RFAILED); + } + + + node = srInd->srLst.first; + for (;node; node=node->next) + { + rgNumSrRecvd++; + + srInfo = (TfuSrInfo *)node->node; + ue = rgSCHDbmGetUeCb (cell, srInfo->rnti); + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", + srInfo->rnti); + continue; + } + rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo); + /*Need to activate UE as SR received*/ + if (ue->isDrxEnabled) + { + rgSCHDrxSrInd(cell, ue); + } + ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err); + if (ret != ROK) + { + err.errType = RGSCHERR_TOM_SRIND; + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed " + "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti); + continue; + } + } + RETVALUE(ret); +} /* end of rgSCHTomSrInd */ + +/** + * @brief Handler for processing downlink CQI indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomDoaInd + * + * Handler for processing DOA recieved from PHY + * for a set of UEs. + * + * Invoked by: RgLiTfuDoaInd + * + * Processing Steps: + * - Get UE + * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd + * + * @param[in] TfuDoaIndInfo *doaInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomDoaInd +( +RgSchCellCb *cell, +TfuDoaIndInfo *doaInd +) +#else +PUBLIC S16 rgSCHTomDoaInd(cell, doaInd ) +RgSchCellCb *cell; +TfuDoaIndInfo *doaInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuDoaRpt *doaInfo; + TRC2(rgSCHTomDoaInd); + + if(cell->cellId != doaInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId" + ":%d", doaInd->cellId); + RETVALUE(RFAILED); + } + + + node = doaInd->doaRpt.first; + for (;node; node=node->next) + { + doaInfo = (TfuDoaRpt *)node->node; + ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti); + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", + doaInfo->rnti); + continue; + } + rgSCHUtlDoaInd(cell, ue, doaInfo); + } + RETVALUE(ROK); +} /* rgSCHTomDoaInd */ +/** + * @brief Handler for processing downlink CQI indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomDlCqiInd + * + * Handler for processing downlink CQI indication recieved from PHY + * for a set of UEs. + * + * Invoked by: RgLiTfuDlCqiInd + * + * Processing Steps: + * - Get UE + * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd + * + * @param[in] TfuDlCqiIndInfo *dlCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomDlCqiInd +( +RgSchCellCb *cell, +TfuDlCqiIndInfo *dlCqiInd +) +#else +PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd) +RgSchCellCb *cell; +TfuDlCqiIndInfo *dlCqiInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuDlCqiRpt *dlCqiInfo; + TRC2(rgSCHTomDlCqiInd); + + if(cell->cellId != dlCqiInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" + ":%d", dlCqiInd->cellId); + RETVALUE(RFAILED); + } + + + node = dlCqiInd->dlCqiRptsLst.first; + for (;node; node=node->next) + { + dlCqiInfo = (TfuDlCqiRpt *)node->node; + ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti); + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB", + dlCqiInfo->rnti); + continue; + } + rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo); + rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo); + } + RETVALUE(ROK); +} /* rgSCHTomDlCqiInd */ + +/** + * @brief Handler for moving PCQI instance for the next periodic occasion + * + * @details + * + * Function: rgSCHTomUtlMovePcqiNxtOccasion + * + * Handler for moving PCQI instance for the next periodic occasion + * + * Invoked by: rgSCHTomUtlFill* + * + * Processing Steps: + * - For a UE move its occurence instance to next occasion + * depending on its periodicity + * - Remove it from the current list and insert it to the list + * having the index matching with the derived number. + * + * @param[in] RgSchCellCb *cell, + * [in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion +( + RgSchCellCb *cell, + RgSchUeCb *ue, + RgSchUePCqiCb *cqiCb + ) +#else +PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb) + RgSchCellCb *cell; + RgSchUeCb *ue; + RgSchUePCqiCb *cqiCb; +#endif +{ + U16 cqiIdx = 0; + + CmLteTimingInfo timingInfo; + TRC2(rgSCHTomUtlMovePcqiNxtOccasion); + + if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) + { +#ifdef xLTE_TDD + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA); +#else + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, + TFU_RECPREQ_DLDELTA); +#endif + RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri); + rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb); + } + /* Compute Next Transmission Instance */ + cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx; + cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + /* Delete from current List and move to new list */ + if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst, + &cqiCb->cqiLstEnt)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", + ue->ueId); + } + cqiCb->nCqiTrIdx = cqiIdx; + cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst), + &(cqiCb->cqiLstEnt)); +#ifdef LTE_ADV + rgSCHUtlSCellHndlCqiCollsn(cqiCb); +#endif + + RETVALUE(ROK); +} /* rgSCHTomUtlMovePcqiNxtOccasion */ + +/** + * @brief Handler for moving RI instance for the next periodic occasion + * + * @details + * + * Function: rgSCHTomUtlMovePriNxtOccasion + * + * Handler for moving PCQI instance for the next periodic occasion + * + * Invoked by: rgSCHTomUtlFill* + * + * Processing Steps: + * - For a UE move its occurence instance to next occasion + * depending on its periodicity + * - Remove it from the current list and insert it to the list + * having the index matching with the derived number. + * + * @param[in] RgSchCellCb *cell, + * [in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion +( + RgSchCellCb *cell, + RgSchUeCb *ue, + RgSchUePCqiCb *riCb + ) +#else +PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb) + RgSchCellCb *cell; + RgSchUeCb *ue; + RgSchUePCqiCb *riCb; +#endif +{ + U16 riIdx; + U16 riDist=0; + U16 effPeriodicity; + U16 riTrInsTime; + U16 crntTime; + U16 tempIdx; + + TRC2(rgSCHTomUtlMovePriNxtOccasion); + crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + +(cell->crntTime.subframe); +#ifdef XEON_SPECIFIC_CHANGES + RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime); +#endif + /* Compute Next Transmission Instance */ + if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP) + { + effPeriodicity = riCb->cqiPeri * riCb->riPeri; + tempIdx = effPeriodicity + riCb->nRiTrIdx; + } + else + { + effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri); + /* In case of SFN wraparound, the SB CQI reporting cycle breaks + * and RI->WB CQI->SBCQI.. should resume. RI is repositioned + * accordingly. WBCQI handling is naturally accomplished */ + if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) > + (RGSCH_MAX_SUBFRM_5G - 1)) + { + riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity; + tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime); + /* In case of SFN wraparound, riDist should be distance from crntTime + * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity + * to make riDist calculation consistent for both SFN wraparound + * case and normal case */ + effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime; + } + else + { + tempIdx = effPeriodicity + riCb->nRiTrIdx; + } + } + riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE) + { + riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), + (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity)); + } + else + { + riDist = 0; + } + + /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it + * then the next occasion idx will be same as current Idx, Hence need not + * to delete and add + */ + if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0) + { + /* Delete from current List and move to new list */ + if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst, + &riCb->riLstEnt)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node", + ue->ueId); + } + RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst); + cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst, + &riCb->riLstEnt); + RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst); + } + else + { + if(riDist > 0) + { + riDist--; + } + } + riCb->nRiTrIdx = riIdx; + riCb->riDist = riDist; + +#ifdef LTE_ADV + rgSCHUtlSCellHndlRiCollsn(riCb); +#endif + RETVALUE(ROK); +} /* rgSCHTomUtlMovePriNxtOccasion */ + +/** + * @brief Handler for moving SR instance for the next periodic occasion + * + * @details + * + * Function: rgSCHTomUtlMoveSrNxtOccasion + * + * Handler for moving SR instance for the next periodic occasion + * + * Invoked by: rgSCHTomUtlFill* + * + * Processing Steps: + * - For a UE move its occurence instance to next occasion + * depending on its periodicity + * - Remove it from the current list and insert it to the list + * having the index matching with the derived number. + * + * @param[in] RgSchCellCb *cell, + * [in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion +( + RgSchCellCb *cell, + RgSchUeCb *ue + ) +#else +PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue) + RgSchCellCb *cell; + RgSchUeCb *ue; +#endif +{ + U16 srIdx = 0; + + TRC2(rgSCHTomUtlMoveSrNxtOccasion); + + /* Compute Next Transmission Instance */ + srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx; + srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + /* Delete from current List and move to new list */ + if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst, + &ue->srCb.srLstEnt)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", + ue->ueId); + } + ue->srCb.nSrTrIdx = srIdx; + cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst, + &ue->srCb.srLstEnt); + + RETVALUE(ROK); +} /* rgSCHTomUtlMoveSrNxtOccasion */ + +/** + * @brief Handler for moving SRS instance for the next periodic occasion + * + * @details + * + * Function: rgSCHTomUtlMoveSrsNxtOccasion + * + * Handler for moving SRS instance for the next periodic occasion + * + * Invoked by: rgSCHTomUtlFill* + * + * Processing Steps: + * - For a UE move its occurence instance to next occasion + * depending on its periodicity + * - Remove it from the current list and insert it to the list + * having the index matching with the derived number. + * + * @param[in] RgSchCellCb *cell, + * [in] RgSchUeCb *ue + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion +( + RgSchCellCb *cell, + RgSchUeCb *ue + ) +#else +PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue) + RgSchCellCb *cell; + RgSchUeCb *ue; +#endif +{ + U16 srsIdx; + U16 srsDist; + U16 tempIdx; + U16 crntTime; + + + TRC2(rgSCHTomUtlMoveSrsNxtOccasion); + crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + +(cell->crntTime.subframe); + + /* Compute Next Transmission Instance */ + tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx; + srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE; + if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE) + { + srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA), + (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri)); + } + else + { + srsDist =0; + } + + /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it + * then the next occasion idx will be same as current Idx, Hence need not + * to delete and add + */ + if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0) + { + /* Delete from current List and move to new list */ + if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst, + &ue->srsCb.srsLstEnt)) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node", + ue->ueId); + } + cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst, + &ue->srsCb.srsLstEnt); + } + else + { + if(srsDist > 0) + { + srsDist--; + } + } + ue->srsCb.nSrsTrIdx = srsIdx; + ue->srsCb.srsDist = srsDist; + + RETVALUE(ROK); +} /* rgSCHTomUtlMoveSrsNxtOccasion */ + + +/** + * @brief Handler for processing RAW CQI indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomRawCqiInd + * + * Handler for processing RAW CQI indication recieved from PHY + * for a set of UEs. + * + * Invoked by: RgLiTfuRawCqiInd + * + * Processing Steps: + * - Get UE + * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd + * + * @param[in] TfuRawCqiIndInfo *rawCqiInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomRawCqiInd +( + RgSchCellCb *cell, + TfuRawCqiIndInfo *rawCqiInd +) +#else +PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd) + RgSchCellCb *cell; + TfuRawCqiIndInfo *rawCqiInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuRawCqiRpt* rawCqiInfo; + + RgSchErrInfo err; + U32 cellIdx; + RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); + RgSchCellCb *iterCellP; +#if DL_LA + RgSchCmnDlUe *ueDl; +#endif + U8 cqi; + U8 ri; + U8 hqAck; + Pst pst; + RgSchRaCb *raCb; + TfuHqInfo hqInfo; + + TRC2(rgSCHTomRawCqiInd); + + if(cell->cellId != rawCqiInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" + ":%d", rawCqiInd->cellId); + RETVALUE(RFAILED); + } + + + node = rawCqiInd->rawCqiRpt.first; + for (;node; node=node->next) + { + rawCqiInfo = (TfuRawCqiRpt *)node->node; + ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti); + raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti); + /* + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB", + rawCqiInfo->crnti); + continue; + } + */ +#ifdef RG_5GTF + /* + if (rawCqiInfo->numBits >= 5) + printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", + cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload, + rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.subframe); + */ + if (rawCqiInfo->numBits == 1) + { + rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); + U8 fdbk = TFU_HQFDB_NACK; + /* Process HARQ FdbkInd */ + hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1; + if (hqAck) + { + fdbk = TFU_HQFDB_ACK; + hqInfo.isAck[0] = fdbk; + } + if (ue != NULLP && raCb == NULLP) + { + if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " + "HARQ feedback processing failed errType(%d)errCause(%d)n", + err.errType, err.errCause); + continue; + } + } + else if (ue == NULLP && raCb != NULLP) + { + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d)", + err.errType, err.errCause); + continue; + } + continue; + } + else if (ue != NULLP && raCb != NULLP) + { + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d).", + err.errType, err.errCause); + continue; + } + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " + "UE CB or RA CB ", rawCqiInfo->crnti); + err.errType = RGSCHERR_TOM_HARQACKIND; + continue; + } + /* + printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits, + rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.subframe); + */ + } + else if (rawCqiInfo->numBits == 5) + { + /* Process CQI-RI Ind*/ + ri = (rawCqiInfo->uciPayload >> 27) & 0x1; + cqi = (rawCqiInfo->uciPayload >> 28) & 0xF; + if(ue) { + if (cqi == 0) + { + printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi); + cqi = 15; + } + ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1]; + ue->ue5gtfCb.rank = ri + 1; +#ifdef DL_LA + if (rawCqiInfo->numBits > 1) + { + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + ueDl->mimoInfo.cwInfo[0].cqi = cqi; + ueDl->cqiFlag = TRUE; + rgSCHCmnDlSetUeAllocLmtLa(cell, ue); + // rgSCHCheckAndSetTxScheme(cell, ue); + } +#endif + } + /* + printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri); + */ + } + else if (rawCqiInfo->numBits == 6) + { + RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]); + TfuHqFdbk fdbk = TFU_HQFDB_NACK; + /* Process both HARQ and CQI-RI Ind*/ + ri = (rawCqiInfo->uciPayload >> 26) & 0x1; + cqi = (rawCqiInfo->uciPayload >> 27) & 0xF; + hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1; + if (cqi == 0) + { + printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi); + cqi = 13; + } + ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1]; + ue->ue5gtfCb.rank = ri + 1; +#ifdef DL_LA + if (rawCqiInfo->numBits > 1) + { + ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell); + ueDl->mimoInfo.cwInfo[0].cqi = cqi; + ueDl->cqiFlag = TRUE; + rgSCHCmnDlSetUeAllocLmtLa(cell, ue); + // rgSCHCheckAndSetTxScheme(cell, ue); + } +#endif + if (hqAck) + { + fdbk = TFU_HQFDB_ACK; + hqInfo.isAck[0] = fdbk; + } + if (ue != NULLP && raCb == NULLP) + { + if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() " + "HARQ feedback processing failed errType(%d)errCause(%d)n", + err.errType, err.errCause); + continue; + } + } + else if (ue == NULLP && raCb != NULLP) + { + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d)", + err.errType, err.errCause); + continue; + } + continue; + } + else if (ue != NULLP && raCb != NULLP) + { + if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB, + cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK) + { + err.errType = RGSCHERR_TOM_HARQACKIND; + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ" + " feedback processing failed errType(%d) errCause(%d).", + err.errType, err.errCause); + continue; + } + } + else + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " + "UE CB or RA CB ", rawCqiInfo->crnti); + err.errType = RGSCHERR_TOM_HARQACKIND; + continue; + } + + /* + printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck); + */ + } + } + + if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink " + "subframe for cellId (%d) ", cell->cellId); + err.errType = RGSCHERR_TOM_HARQACKIND; + } + + for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) + { + if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx]) + { + iterCellP = rgSchCb[cell->instIdx].cells[cellIdx]; + + rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]); + if(rlsHqBufs->numUes) + { + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst); + RgSchMacRlsHq (&pst, rlsHqBufs); + } + rlsHqBufs->numUes = 0; + } + } + RETVALUE(ROK); +} /* rgSCHTomRawCqiInd */ + +/** + * @brief Handler for processing SRS indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomSrsInd + * + * Handler for SRS indication recieved from PHY + * for a set of UEs. + * + * Invoked by: RgLiTfuSrsInd + * + * Processing Steps: + * - Get UE + * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd + * + * @param[in] TfuSrsIndInfo *srsInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomSrsInd +( + RgSchCellCb *cell, + TfuSrsIndInfo *srsInd + ) +#else +PUBLIC S16 rgSCHTomSrsInd(cell, srsInd) + RgSchCellCb *cell; + TfuSrsIndInfo *srsInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuSrsRpt* srsInfo; + + TRC2(rgSCHTomSrsInd); + + if(cell->cellId != srsInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" + ":%d", srsInd->cellId); + RETVALUE(RFAILED); + } + + node = srsInd->srsRpt.first; + for (;node; node=node->next) + { + srsInfo = (TfuSrsRpt *)node->node; + ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId); + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the " + "UE CB", srsInfo->ueId); + continue; + } + rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo); + rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo); + } + RETVALUE(ROK); +} /* rgSCHTomSrsInd */ + +/* +* +* Fun: rgSCHTomUtlGenIndices +* +* Desc: This function reconstructs the Subband Indices for +* of M selected Subbands conveyed by the UE for APeriodic Modes +* 2-0 and 2-2. It decodes the Label which uniquely encodes M out +* of N subbands. +* +* +* Ret: ROK +* +* Notes: None +* +* File: rg_sch_utl.c +* +*/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlGenIndices +( + U32 label, + U8 posM, + U8 valN, + U8 valK, + TfuSubbandInfo* sbInfo + ) +#else +PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo) + U32 label; + U8 posM; + U8 valN; + U8 valK; + TfuSubbandInfo* sbInfo; +#endif +{ + U8 idx, kval, xval, xmin; + U32 binCoe; + xmin =1; + for(kval=0; kvallabel) + { + xval = xval+1; + RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1)); + binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1]; + } + idx = xval; + sbInfo[kval].numRb = valK; + sbInfo[kval].rbStart = idx*valK; + xmin = idx+1; + label = label-binCoe; + } + RETVALUE(ROK); +} /* end of rgSCHTomUtlGenIndices*/ +#endif +/** + * @brief Handler for processing decode failure indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomCrcInd + * + * Handler for processing decode failure indication recieved from + * PHY for a set of UEs. + * + * Invoked by: RgLiTfuCrcInd of rg_sch.x + * + * Processing Steps: + * - Validate the information received and retrieve cell and ue. + * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure(). + * + * @param[in] TfuCrcIndInfo *crcInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomCrcInd +( +RgSchCellCb *cell, +TfuCrcIndInfo *crcInd +) +#else +PUBLIC S16 rgSCHTomCrcInd(cell, crcInd) +RgSchCellCb *cell; +TfuCrcIndInfo *crcInd; +#endif +{ + RgSchUeCb *ue = NULLP; + RgSchRaCb *raCb = NULLP; + CmLList *node; + TfuCrcInfo *crcInfo; +#ifdef RG_ULSCHED_AT_CRC + RgSchErrInfo err; + RgSchDlSf *ulSf; + CmLteTimingInfo crntHiDci0Frm; + //RgSchCmnUlCell *cellUl; + Inst inst = cell->instIdx; + TfuCntrlReqInfo *cntrlInfo; + U32 ret; +#ifdef LTE_TDD + U8 Mval; + U8 idx; +#endif +#endif +#ifdef LTE_TDD + RgSchUlHqProcCb *hqProc; +#endif + +#ifdef LTE_L2_MEAS + RgSchUlHqProcCb *ulHqProc; +#endif + + TRC2(rgSCHTomCrcInd); + + if(cell->cellId != crcInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" + ":%d", crcInd->cellId); + RETVALUE(RFAILED); + } +#ifdef RG_ULSCHED_AT_CRC +#ifndef LTE_ADV + { + static CmLteTimingInfo lastCrc = {2000,0}; + CmLteTimingInfo crntCrc = cell->crntTime; + if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc)) + { + /*Removed the WA to drop 2nd CRC*/ + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC " + "twice per TTI @(%u,%u)", cell->crntTime.sfn, + cell->crntTime.subframe); + } + lastCrc = crntCrc; + } +#endif +#endif + node = crcInd->crcLst.first; + for (;node; node=node->next) + { + crcInfo = (TfuCrcInfo*)node->node; + ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti); + if (ue == NULLP) + { +#ifdef LTEMAC_SPS + /* Fetch from SPS List */ + ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti); + if (ue == NULLP) +#endif + { + raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti); + if (raCb == NULLP) + { + continue; + } + } + } + /* Added Ul TB count for Uplink data scheduled*/ +#ifdef LTE_L2_MEAS + if(raCb) + { + ulHqProc = &(raCb->msg3HqProc); + if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1)) + { + cell->dlUlTbCnt.tbTransUlTotalCnt++; + } + } + else + { + rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc); + if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx) + { + cell->dlUlTbCnt.tbTransUlTotalCnt++; + } + } +#endif + + if (crcInfo->isFailure == FALSE) + { + if(raCb) + { + rgSCHRamMsg3DatInd(raCb); +#ifdef LTE_TDD + /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/ + hqProc = &(raCb->msg3HqProc); + RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.subframe, + hqProc); +#endif + raCb = NULLP; + } + else + { +#ifdef EMTC_ENABLE + gUlCrcPassCounter++; +#endif +#ifdef CA_DBG + gUlCrcPassCount++; +#endif + RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime); +#ifndef MAC_SCH_STATS + rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo); + +#else + /** Stats update over here + */ + { + RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell); + + rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]); + } +#endif /* MAC_SCH_STATS */ + + rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo); +#ifdef LTEMAC_SPS + rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo); +#endif + } + } + else + { + if(raCb) + { + /* SR_RACH_STATS : MSG3 Nack / DTX*/ + if (crcInfo->isDtx == TRUE) + { + rgNumMsg3DtxRcvd++; + } + else + { + rgNumMsg3CrcFailed++; + } + rgSCHRamMsg3FailureInd(raCb); +#ifdef EMTC_ENABLE + rgSCHCmnEmtcHdlCrcFailInd(cell, raCb); +#endif + /* Added Ul TB count for CRC Failure of MSG3 */ +#ifdef LTE_L2_MEAS + ulHqProc = &(raCb->msg3HqProc); + if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1)) + { + cell->dlUlTbCnt.tbTransUlFaulty++; + } +#endif + raCb = NULLP; + } + else + { +#ifdef EMTC_ENABLE + gUlCrcFailCounter++; +#endif +#ifdef CA_DBG + gUlCrcFailCount++; +#endif +#ifndef MAC_SCH_STATS + rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv); +#else + { + RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell); + + rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]); + } +#endif /* MAC_SCH_STATS */ + rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo); +#ifdef LTEMAC_SPS + rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo); +#endif + /* Added Ul TB count for CRC Failure of Uplink data */ +#ifdef LTE_L2_MEAS + rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc); + if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx) + { + cell->dlUlTbCnt.tbTransUlFaulty++; + } +#endif + } + } + } + +/* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here + the codebase across TDD and FDD*/ +#ifdef RG_ULSCHED_AT_CRC + /* Changes to do uplink scheduling at CRC Indication */ + //cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA); + + + rgSCHCmnRlsUlSf(cell,0); + + + /* Allocating memory for CntrlReq as it required for both EMTC and + * Normal UEs */ + if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo, + sizeof(TfuCntrlReqInfo))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo " + "for cell"); + RETVALUE(ret); + } + rgSCHCmnUlSch(cell); +#ifdef LTE_L2_MEAS + rgSCHL2Meas(cell,TRUE); +#endif + /* Also, sending UL DCI and PHICH for just scheduled subframe */ + ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm); + + if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process" + " downlink subframe for cellId %d", crcInd->cellId); + err.errType = RGSCHERR_TOM_TTIIND; + RETVALUE(RFAILED); + } +#endif /* RG_ULSCHED_AT_CRC */ + RETVALUE(ROK); +} /* rgSCHTomCrcInd */ + +/** + * @brief Handler for processing timing Advance indication recieved from + * PHY for a UE. + * + * @details + * + * Function: rgSCHTomTimingAdvInd + * + * Handler for processing timing advance indication recieved from PHY + * for a set of UEs. + * + * Invoked by: RgLiTfuTimingAdvInd + * + * Processing Steps: + * - Get UE. + * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa. + * + * @param[in] TfuTimingAdvIndInfo *timingAdvInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomTimingAdvInd +( +RgSchCellCb *cell, +TfuTimingAdvIndInfo *timingAdvInd + ) +#else +PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd) +RgSchCellCb *cell; +TfuTimingAdvIndInfo *timingAdvInd; +#endif +{ + RgSchUeCb *ue; + CmLList *node; + TfuTimingAdvInfo *timingAdvInfo; + + + TRC2(rgSCHTomTimingAdvInd); + + if(cell->cellId != timingAdvInd->cellId) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId" + "=(%d)", timingAdvInd->cellId); + RETVALUE(RFAILED); + } + + + node = timingAdvInd->timingAdvLst.first; + for (;node; node=node->next) + { + timingAdvInfo = (TfuTimingAdvInfo *)node->node; + ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti); + if (ue == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB", + timingAdvInfo->rnti); + continue; + } + rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv); + } + RETVALUE(ROK); +} /* rgSCHTomTimingAdvInd */ + +/** + * @brief Handler for processing TTI indication recieved from + * PHY for 'n' cells. + * + * @details + * + * Function: rgSCHTomTtiInd + * + * Handler for processing TTI indication recieved from PHY + * for a cell. This is split into the below Steps. + * + * 1: Complete the Uplink and Common Channel Scheduling for each Cell + * 2: Complete the UE specific Scheduling for each Cell / across Cells. + * 3: Consolidate the subframe allocations and send to each MAC instance + * 4: Fill the Tfu structures for DL and UL Config requests + * 5: Handle the RGR Config messages per Cell + * + * @param[in] TfuTtiIndInfo *ttiInd + * @param[in] Inst schInst + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHTomTtiInd +( +TfuTtiIndInfo *ttiInd, +Inst schInst +) +#else +PUBLIC Void rgSCHTomTtiInd(ttiInd, schInst) +TfuTtiIndInfo *ttiInd; +Inst schInst; +#endif +{ + RgInfSfAlloc *subfrmAlloc; + RgTfuCntrlReqInfo *cntrlInfo = NULLP; + S16 ret = ROK; + U8 i; + U8 nCell = 0; + RgSchCellCb *cell[CM_LTE_MAX_CELLS]; + RgSchCellCb *cellLst[CM_LTE_MAX_CELLS]; + + TRC2(rgSCHTomTtiInd); + +#ifdef LTE_L2_MEAS + glblTtiCnt++; +#endif + + rgSchTomFillCellTtiInfo(ttiInd, schInst, &nCell, &cell[0]); + for (i = 0; i < nCell; i++) + { + /* Perform UL and DL Common Channel scheduling */ + rgSchTomTtiUlAndDlCmnChSch (cell[i]); + } + + /* Perform scheduling in Order of + * 1. SPS + * 2. CEs + * 3. Retx */ + for (i = 0; i < nCell; i++) + { + + if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE)) + { + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]); + /* Perform DL Retx scheduling */ + cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo); + } + } + + rgSchCmnPreDlSch(cell, nCell, cellLst); + for (i = 0; i < nCell; i++) + { + /* Perform DL scheduling */ + rgSchTomTtiDlSch (cellLst[i]); + } + rgSchCmnPstDlSch(cell[0]); + + for (i = 0; i < nCell; i++) + { +#ifdef LTE_TDD +#ifndef RG_ULSCHED_AT_CRC + /* Perform UL scheduling for TDD */ + rgSCHCmnUlSch (cell[i]); +#endif +#endif + } + /* Init SF Alloc info per Cell */ + for (i = 0; i < nCell; i++) + { + subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]); + rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE); + } + for (i = 0; i < nCell; i++) + { + if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE)) + { + subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]); + /* + * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc + * timingInfo which is being calculated here will be used by MAC + */ + RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo, + RG_DL_DELTA - TFU_DLDATA_DLDELTA); + /* Consolidate the Allocations and send response to MAC instances */ + rgSchTomTtiCnsldtSfAlloc (cell[i]); + } + } + + for (i = 0; i < nCell; i++) + { + if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE)) + { + /* Send the consolidated Alloc Info to MAC instances */ + rgSCHCmnSndCnsldtInfo (cell[i]); + } + } + + for (i = 0; i < nCell; i++) + { + /* Fill control data from scheduler to PHY */ + if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo, + sizeof(RgTfuCntrlReqInfo))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo" + " for cell"); + RETVOID; + } + +#ifdef EMTC_ENABLE + /* Fill the TFU structures and send to CL */ + if(TRUE == cell[i]->emtcEnable) + { + ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo); + } +#endif + if((ROK == ret) + && (NULLP != cntrlInfo)) + { + /* Fill the TFU structures and send to CL */ + rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo); + } + } +#ifdef RGR_RRM_TICK + rgSCHTomUtlSendSfnTick(cell[0]); +#endif + + for (i = 0; i < nCell; i++) + { + /* Invoke non critical functions like measurements, etc */ + rgSchTomTtiMiscFunctions (cell[i]); + } + +#ifdef CA_DBG + { + U32 dbgUeIdChngAndDatReqInClCnt = 0; + static U32 gTtiCount = 0; + gTtiCount++; + + if(gTtiCount == 3000) + { +#ifdef XEON_SPECIFIC_CHANGES + printf("SChed:: (P/S)::(%u/%u) \n", + gPrimarySchedCount,gSCellSchedCount); + + printf("\n HQFDBK :: %u\n",gHqFdbkCount); + + long int total; + long int total2 ; + + total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount; + total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount; + + printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n", + gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount, + gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount); + if ((total != 0 ) && total2 != 0) + { + printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n", + (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100, + (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2); + } + + total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount; + total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount; + + + printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n", + gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount, + gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount); + if ((total != 0 ) && total2 != 0) + { + printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n", + (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100, + (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2); + } + + + printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n", + gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount, + gACqiRcvdCount,gCqiReptToAppCount); + + printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n", + gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount); + + printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n" + "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n" + "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n", + gDci0Count, + gUlCrcPassCount, + gUlCrcFailCount, + gPcellZeroBoOcc, + gScellZeroBoOcc, + dbgUeIdChngAndDatReqInClCnt, + dbgDelayedDatReqInMac, + gDropDatReqCnt, gIccPktRcvrMemDropCnt); +#else + printf("SChed:: (P/S)::(%ld/%ld) \n", + gPrimarySchedCount,gSCellSchedCount); + + printf("\n HQFDBK :: %ld\n",gHqFdbkCount); + + printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n", + gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount, + gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount); + + printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n", + gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount, + gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount); + + printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n", + gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount, + gACqiRcvdCount,gCqiReptToAppCount); + printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount); + + printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n", + gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount); + + printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n" + "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n" + "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n", + gDci0Count, + gUlCrcPassCount, + gUlCrcFailCount, + gPcellZeroBoOcc, + gScellZeroBoOcc, + dbgUeIdChngAndDatReqInClCnt, + dbgDelayedDatReqInMac, + gDropDatReqCnt, gIccPktRcvrMemDropCnt); + //printf ("\n delayedApiCnt:%ld",delayedApiCnt); +#endif + + /*LAA STATS*/ + rgSCHLaaPrintStats(); + + gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0; + + gCaDbgCaFrmt = 0; + + gF1bCsCount = 0; + gCqiReqCount = 0; + gACqiRcvdCount = 0; + gRawACqiCount= 0; + gRiReqCount = 0; + gCqiDropCount = 0; + gPucchDropCount= 0; + + gCqiPucchLowSnrDropCount = 0; + gCqiPucchConfMaskDropCount = 0; + gCqiPuschConfMaskDropCount = 0; + gPuschCqiDropCount = 0; + + gDci0Count = 0; + gUlCrcPassCount = 0; + gUlCrcFailCount = 0; + + gCqiRecpCount = 0; + gCqiRecpPuschCount = 0; + gCqiRcvdCount = 0; + + gCqiReptToAppCount = 0; + + gTtiCount = 0; + + gHqFdbkCount = 0; + gPrimarySchedCount = 0; + gSCellSchedCount = 0; + gSCellTb1AckCount = 0; + gSCellTb2AckCount = 0; + gSCellTb2AckCount = 0; + gSCellTb2NackCount = 0; + gPCellTb1AckCount = 0; + gPCellTb1NackCount = 0; + gPCellTb2AckCount = 0; + gPCellTb2NackCount = 0; + gSCellTb1NackCount=0; + + gPCellTb1DtxCount = 0; + gPCellTb2DtxCount = 0; + gSCellTb1DtxCount = 0; + gSCellTb2DtxCount = 0; + gPcellZeroBoOcc = 0; + gScellZeroBoOcc = 0; + + } + + } + +#endif + RETVOID; +} /* rgSCHTomTtiInd */ + +/** @brief This function does the TTI processin for the uplink subframe, + * already populated by the scheduler. + * + * @details + * + * Function: rgSCHTomUtlProcUlSf + * + * Processing steps: + * - Loop through the Uplink allocations present in the uplink subframe. + * - For each allocation Fill a data reception request to be sent to PHY + * - Also fills the harq reception requests for the expected HQ feedbacks. + * + * + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ + +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlProcUlSf +( +RgSchCellCb *cell, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err) +RgSchCellCb *cell; +RgSchErrInfo *err; +#endif +{ + S16 ret; + TfuRecpReqInfo *recpReqInfo; +#ifdef TFU_UPGRADE + U16 validIdx = 0; /* Index computed from recreq's timing info*/ +#endif + Inst inst = cell->instIdx; + + TRC2(rgSCHTomUtlProcUlSf) + + if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo, + sizeof(TfuRecpReqInfo))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo " + "for cell"); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + recpReqInfo->cellId = cell->cellId; + cmLListInit(&recpReqInfo->ueRecpReqLst); + + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, + TFU_RECPREQ_DLDELTA); + + /* Filling data Reception requests */ + ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell, + validIdx, + err); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption " + "requests for cell"); + RGSCH_FREE_MEM(recpReqInfo); + RETVALUE(ret); + } + /* Filling HARQ Reception requests */ + ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback " + "reception requests for cell"); + RGSCH_FREE_MEM(recpReqInfo); + RETVALUE(ret); + } + /* sending the RecpReq to Phy */ + if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell"); + } + RETVALUE(ROK); +} /* end of rgSCHTomUtlProcUlSf */ + +#ifdef LTE_TDD +#ifdef TFU_UPGRADE +/** @brief This function does the TTI processin for the uplink subframe, + * already populated by the scheduler. + * + * @details + * + * Function: rgSCHTomUtlPrcUlTddSpclSf + * + * Processing steps: + * - Fill the SRS Info for the Special Subframe in Reception Req. + * - Send the Reception Req to TFU + * + * + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf +( +RgSchCellCb *cell, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err) +RgSchCellCb *cell; +RgSchErrInfo *err; +#endif +{ + S16 ret; + TfuRecpReqInfo *recpReqInfo; + U16 validIdx; /* Index computed from recreq's timing info*/ + Inst inst = cell->instIdx; + + TRC2(rgSCHTomUtlPrcUlTddSpclSf) + + if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo, + sizeof(TfuRecpReqInfo))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to " + "Allocate TfuRecpReqInfo for cell"); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + recpReqInfo->cellId = cell->cellId; + cmLListInit(&recpReqInfo->ueRecpReqLst); + + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA); + + RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx); + + /*ccpu00130768 */ + if(cell->srsCfg.isSrsCfgPres && + rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.subframe]) + { + recpReqInfo->srsPres = TRUE; + } + else + { + recpReqInfo->srsPres = FALSE; + } + + /* Filling SRS Reception requests */ + ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill" + " SRS recption requests for cell");; + RGSCH_FREE_MEM(recpReqInfo); + RETVALUE(ret); + } + /* sending the RecpReq to Phy */ + if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send " + "Cntrl info for cell"); + } + RETVALUE(ROK); +} /* end of rgSCHTomUtlPrcUlTddSpclSf */ +#endif +#endif +/** @brief This function does all the processing related to a single downlink + * subframe. + * + * @details + * + * Function: rgSCHTomUtlProcDlSf + * + * Processing steps: + * - collate control data for all UEs and send to PHY + * - collate data buffers for all UEs and send to PHY + * + * @param [in] RgSchDlSf *dlSf + * @param [in] RgSchDlSf *ulSf + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlProcDlSf +( +RgSchDlSf *dlSf, +RgSchDlSf *ulSf, +RgSchCellCb *cell, +RgTfuCntrlReqInfo *cntrlInfo, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err) +RgSchDlSf *dlSf; +RgSchDlSf *ulSf; +RgSchCellCb *cell; +RgTfuCntrlReqInfo *cntrlInfo; +RgSchErrInfo *err; +#endif +{ + Inst inst = cell->instIdx; + S16 ret; + U8 sfTyp = 1; /* Dl Subframe */ + + TRC2(rgSCHTomUtlProcDlSf); + + cmLListInit(&cntrlInfo->phichLst); + cmLListInit(&cntrlInfo->dlPdcchLst); + cmLListInit(&cntrlInfo->ulPdcchLst); + +#ifdef TFU_ALLOC_EVENT_NO_INIT + cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0; +#endif + cntrlInfo->dlTiming = cell->dlDciTime; + cntrlInfo->cellId = cell->cellId; + cntrlInfo->ulTiming = cell->hiDci0Time; + if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.subframe)) + { + //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe); + } + /* Fill PCFICH info */ + /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI + *change happens in that SF then UL PDCCH allocation happens with old CFI + *but CFI in control Req goes updated one since it was stored in the CELL + */ + cntrlInfo->cfi = dlSf->pdcchInfo.currCfi; +#ifndef RG_ULSCHED_AT_CRC + U8 Mval = 1; +#ifdef LTE_TDD + Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx] + [cell->hiDci0Time.subframe]; + if(dlSf->sfType == RG_SCH_SPL_SF_DATA) + { + RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi); + } +#endif + if(Mval) + { + /* Fill PHICH info */ + if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info " + "for cellId (%d)\n", cell->cellId)); + RGSCH_FREE_MEM(cntrlInfo); + RETVALUE(ret); + } + if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != + ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info " + "for cellId (%d)\n", cell->cellId)); + RGSCH_FREE_MEM(cntrlInfo); + RETVALUE(ret); + } + } +#ifdef EMTC_ENABLE + if(0 == cntrlInfo->ulMpdcchLst.count) + { + gUlMpdcchBlank++; + } +#endif +#endif +#ifdef LTE_TDD + sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] + [cell->dlDciTime.subframe]; +#endif + if (sfTyp != 2) /* Uplink subframe */ + { + /* Fill PDCCH info */ + if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info " + "for cellId (%d)\n", cell->cellId)); + RGSCH_FREE_MEM(cntrlInfo); + RETVALUE(ret); + } + rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned; + rgBwAlcnt[dlSf->sfNum] ++; + + } +#ifdef LTEMAC_SPS /* SPS_NEW_CHGS */ + cntrlInfo->isSPSOcc = dlSf->isSPSOcc; +#endif + cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */ + dlSf->numDlActvUes = 0; +#ifdef EMTC_ENABLE +if(0 == cntrlInfo->dlMpdcchLst.count) +{ + gDlMpdcchBlank++; +} +#endif + /* Now always sending down a cntrl req */ + /* sending the cntrl data to Phy */ + if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info " + "for cell"); + } + + RETVALUE(ROK); +} + + +/** @brief This function handles sending of the PHICH information for the + * downlink subframe to be sent in the next TTI. + * + * @details + * + * Function: + * + * Processing steps: + * - Loop through the PHICH information present in the downlink + * subframe and fill the information in cntrlInfo. + * + * @param [out] TfuCntrlReqInfo *cntrlInfo + * @param [in] RgSchDlSf *dlSf + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillPhich +( +RgSchCellCb *cell, +TfuCntrlReqInfo *cntrlInfo, +RgSchDlSf *dlSf, +RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err) +RgSchCellCb *cell; +TfuCntrlReqInfo *cntrlInfo; +RgSchDlSf *dlSf; +RgSchErrInfo *err; +#endif +{ + S16 ret; + CmLList *node; + RgSchPhich *phich; + TfuPhichInfo *harqAck; +#ifdef TFU_UPGRADE + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); +#endif + + TRC2(rgSCHTomUtlFillPhich) + ret = ROK; + /* Traversing the list of Phichs */ + node = dlSf->phichInfo.phichs.first; + while (node) + { + phich = (RgSchPhich*)node->node; + if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo), + &(cntrlInfo->memCp))) != ROK) + { + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + harqAck->txPower = 0; +#endif + /* fill in the tfu structure from the information present in the + * phich node */ + harqAck->rbStart = phich->rbStart; + harqAck->nDmrs = phich->nDmrs; + harqAck->isAck = phich->hqFeedBack; + harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */ +#ifdef LTE_TDD + /* Changes for passing iPhich at TFU interface*/ + harqAck->iPhich = phich->iPhich; +#endif + /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/ +#ifdef TFU_UPGRADE + harqAck->txPower = cellDl->phichTxPwrOffset; +#endif + cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk)); + harqAck->lnk.node = (PTR)harqAck; + node = node->next; + } /* end of while */ + RETVALUE(ret); +} /* end of */ + + +#ifdef LTE_ADV +/** @brief This function is a utility function to restart + * deactivation timer. + * + * @details + * + * Function: rgSCHTmrRestartScellDeactTmr + * + * Processing steps: + * - Starts timer at scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteRnti rnti + * @return Void + */ +#ifdef ANSI +PRIVATE Void rgSCHTmrRestartScellDeactTmr +( + RgSchCellCb *cell, + RgSchUeCb *ueCb + ) +#else +PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb) + RgSchCellCb *cell; + RgSchUeCb *ueCb; + +#endif +{ + RgSchUeCellInfo *sCellInfo = NULLP; + + if(NULLP != ueCb) + { + if(RG_SCH_IS_CELL_SEC(ueCb, cell)) + { + sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])]; + + if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo); + } + if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres) + { + /* + rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT, + ueCb->sCellDeactTmrVal.val); + */ + } + } + } +}/*end of rgSCHTmrRestartScellDeactTmr*/ +#endif + +/** @brief This function will send all the PDCCH's for the given downlink + * subframe. + * + * @details + * + * Function: + * + * Processing steps: + * - Loop through all the scheduled HARQ processes and fill + * the PDCCH information in cntrlInfo. + * + * @param [out] TfuCntrlReqInfo *cntrlInfo + * @param [in] RgSchDlSf *dlSf + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +EXTERN U32 numdlSpsRelSentToTf; +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillDlPdcch +( +RgSchCellCb *cell, +TfuCntrlReqInfo *cntrlInfo, +RgSchDlSf *dlSf, +RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err) +RgSchCellCb *cell; +TfuCntrlReqInfo *cntrlInfo; +RgSchDlSf *dlSf; +RgSchErrInfo *err; +#endif +{ + S16 ret; + CmLList *node; + RgSchPdcch *pdcch; + TfuPdcchInfo *tfuPdcch; + U8 isDcivld = FALSE; + U8 numUePerTti = 0; + + TRC2(rgSCHTomUtlFillDlPdcch) + ret = ROK; + /* Traversing the scheduled Harq processes */ + node = dlSf->pdcchInfo.pdcchs.first; + while (node) + { + pdcch = (RgSchPdcch*)node->node; + switch(pdcch->dci.dciFormat) + { + case TFU_DCI_FORMAT_3: + isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE; + break; + + case TFU_DCI_FORMAT_3A: + isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE; + break; + + default: + isDcivld = TRUE; + break; + } + if(!isDcivld) + { + node = node->next; + continue; + } + + /*ccpu00117179 - ADD - Build only non DCI format-0 messages */ + if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) || + (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) || + (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2)) + { + node = node->next; + continue; + } + + +#ifdef RGSCH_SPS_STATS + if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) && + (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) && + (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) && + (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF)) + { + numdlSpsRelSentToTf++; + } +#endif + + if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo), + &(cntrlInfo->memCp))) != ROK) + { + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef LTEMAC_SPS + tfuPdcch->crnti = pdcch->crnti; + tfuPdcch->isSpsRnti = pdcch->isSpsRnti; +#endif + tfuPdcch->rnti = pdcch->rnti; + +#ifdef LTE_ADV + rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue); +#endif + tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits; + + tfuPdcch->nCce = pdcch->nCce; + tfuPdcch->aggrLvl = pdcch->aggrLvl; + tfuPdcch->dci = pdcch->dci; +#ifdef RG_5GTF + //TODO_SID: Need to check these values during INT + tfuPdcch->sectorId = 0; + tfuPdcch->sccIdx = 0; + tfuPdcch->grpId = +#endif + /* SR_RACH_STATS : Reset isTBMsg4 */ + pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE; + /* To be enhanced later for 2.1 */ + cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk)); + tfuPdcch->lnk.node = (PTR)tfuPdcch; + node = node->next; + if((pdcch->rnti > 60) && (pdcch->rnti < 5000)) + { +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.dl5gtfPdcchSend++; +#endif + numUePerTti++; + } + } /* end of while */ + + if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI )) + { + cell->dlNumUeSchedPerTti[numUePerTti-1]++; + { + gDlNumUePerTti[numUePerTti-1]++; + } + } + RETVALUE(ret); +} /* end of rgSCHTomUtlFillDlPdcch*/ + +#ifdef RGSCH_SPS_STATS +extern U32 rgSchSpsRelSentToTf; +extern U32 rgSchSpsRelPdcchAllocd; +#endif +/** @brief This function will send all the UL PDCCH's for the given + * subframe. + * + * @details + * + * Function: + * + * Processing steps: + * - Loop through all the scheduled HARQ processes and fill + * the PDCCH information in cntrlInfo. + * + * @param [out] TfuCntrlReqInfo *cntrlInfo + * @param [in] RgSchDlSf *dlSf + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillUlPdcch +( +RgSchCellCb *cell, +TfuCntrlReqInfo *cntrlInfo, +RgSchDlSf *dlSf, +RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err) +RgSchCellCb *cell; +TfuCntrlReqInfo *cntrlInfo; +RgSchDlSf *dlSf; +RgSchErrInfo *err; +#endif +{ + S16 ret; + CmLList *node; + RgSchPdcch *pdcch; + TfuPdcchInfo *tfuPdcch; + U8 isDcivld = FALSE; + + TRC2(rgSCHTomUtlFillUlPdcch) + ret = ROK; + /* Traversing the scheduled Harq processes */ + node = dlSf->pdcchInfo.pdcchs.first; + while (node) + { + pdcch = (RgSchPdcch*)node->node; + node = node->next; + /*ccpu00116712- Function should pick only UL allocation related control + * info- start */ + switch(pdcch->dci.dciFormat) + { + case TFU_DCI_FORMAT_A1: + isDcivld = TRUE; + break; + + case TFU_DCI_FORMAT_A2: + isDcivld = TRUE; + break; + + case TFU_DCI_FORMAT_3: + isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE; + break; + + case TFU_DCI_FORMAT_3A: + isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE; + break; + + default: + isDcivld = FALSE; + break; + } + if(!isDcivld) + { + continue; + } +#ifdef CA_DBG + gDci0Count++; +#endif + + /*ccpu00116712- Function should pick only UL allocation related control + * info- end */ + if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo), + &(cntrlInfo->memCp))) != ROK) + { + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + tfuPdcch->rnti = pdcch->rnti; +#ifdef LTE_ADV + rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue); +#endif + tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits; + + tfuPdcch->nCce = pdcch->nCce; + tfuPdcch->aggrLvl = pdcch->aggrLvl; + tfuPdcch->dci = pdcch->dci; +#ifdef RG_5GTF + //TODO_SID: Need to check these values during INT + tfuPdcch->sectorId = 0; + tfuPdcch->sccIdx = 0; + tfuPdcch->grpId = +#endif + /* To be enhanced later for 2.1 */ + gUl5gtfPdcchSend++; +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.ul5gtfPdcchSend++; +#endif + cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk)); + tfuPdcch->lnk.node = (PTR)tfuPdcch; + } /* end of while */ + +#ifdef RGSCH_SPS_STATS + if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd) + { + // abort(); + } +#endif + RETVALUE(ret); +} /* end of rgSCHTomUtlFillUlPdcch*/ + +/** @brief This function does the processing for Timing adjustment. + * + * @details + * + * Function: + * + * Processing steps: + * - Loop through the ue present ueTimeLst, decrement the remaining + * frames left. + * + * + * @param [in] RgSchCellCb *cell + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlProcTA +( +RgSchCellCb *cell +) +#else +PRIVATE S16 rgSCHTomUtlProcTA (cell) +RgSchCellCb *cell; +#endif +{ + CmLList *node; + RgSchUeCb *ue; + + TRC2(rgSCHTomUtlProcTA); + + node = cell->taUeLst.first; + while (node) + { + ue = (RgSchUeCb *)node->node; + node = node->next; + if (ue->dl.taCb.numRemSf == 0) + { + ue->dl.taCb.state = RGSCH_TA_IDLE; + /* If Outstanding Ta is present, schedule it */ + if(ue->dl.taCb.outStndngTa == TRUE) + { + rgSCHUtlReTxTa(cell, ue); + } + else + { + /* We need to reset state and also value of TA, + * then we start the timer */ + ue->dl.taCb.ta = RGSCH_NO_TA_RQD; + /* Start the timer only if TA is cfgd as FINITE value */ + if (ue->dl.taCb.cfgTaTmr) + { + rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr); + } + } + /* need to delete from the link list */ + cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk)); + ue->taLnk.node = NULLP; + } + else + { + ue->dl.taCb.numRemSf--; + } + } /* end of taUeLst */ + + RETVALUE(ROK); +} /* end of rgSCHTomUtlProcTA */ + +/** @brief This function handles filling of Hq reception request to + * Per Hq Proc. + * + * @details + * + * Function: + * + * Processing steps: + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchDlHqProcCb *hqCb, + RgSchDlSf *nxtDlsf, + TfuUeRecpReqInfo *pucchRecpInfo, + RgSchDlHqProcCb *prvHqCb, + RgSchErrInfo *err + ) +#else +PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchDlHqProcCb *hqCb; + RgSchDlSf *nxtDlsf; + TfuUeRecpReqInfo *pucchRecpInfo; + RgSchDlHqProcCb *prvHqCb; + RgSchErrInfo *err; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cell, +RgSchDlHqProcCb *hqCb, +RgSchDlSf *nxtDlsf, +TfuUeRecpReqInfo *pucchRecpInfo, +RgSchDlHqProcCb *prvHqCb, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cell; +RgSchDlHqProcCb *hqCb; +RgSchDlSf *nxtDlsf; +TfuUeRecpReqInfo *pucchRecpInfo; +RgSchDlHqProcCb *prvHqCb; +RgSchErrInfo *err; +#endif +#endif +{ + S16 ret; + RgSchDlHqTbCb *tbCb; + U32 idx; + Bool isAddToLst = FALSE; + + for (idx = 0 ;idx < 2; idx++) + { + if (HQ_TB_WAITING == hqCb->tbInfo[idx].state) + { + tbCb = &hqCb->tbInfo[idx]; + + /* FOR ACK NAK REP */ + if ((hqCb->hqE->ue != NULLP) && + (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE)) + { + if ((tbCb->fbkRecpRepCntr) && + (--tbCb->fbkRecpRepCntr)) + { + /* Add to next subfarme */ + /* Add this hqCb to the next dlSf's ackNakRepQ */ + cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), + &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); + tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; + tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; + } +#ifdef TFU_UPGRADE + rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx); +#endif + continue; + } +#ifdef TFU_UPGRADE + if (hqCb->tbCnt) + { + hqCb->tbCnt--; + /* Go to the next node */ + continue; + } +#endif + + + //if (hqCb != prvHqCb) + { + ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for cell"); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; + if ((hqCb->hqE->ue != NULLP) /*&& + ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt == + TRUE))*/ + ) + { + pucchRecpInfo->rnti = hqCb->hqE->ue->ueId; + } + else + { + if (hqCb->hqE->raCb) + { + pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti; + } + } +#ifndef TFU_UPGRADE +#ifndef TFU_TDD +#ifdef LTEMAC_SPS + if (!hqCb->spsN1PucchRes.pres) +#endif + { + pucchRecpInfo->t.pucchRecpReq.hqType = + TFU_HQ_RECP_REQ_NORMAL; + pucchRecpInfo->t.pucchRecpReq.t.nCce = + hqCb->pdcch->nCce; + } +#ifdef LTEMAC_SPS + else + { + pucchRecpInfo->t.pucchRecpReq.hqType = + TFU_HQ_RECP_REQ_N1PUCCH; + pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = + hqCb->spsN1PucchRes.val; + } +#endif +#endif + /* Handling of other types */ + pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; +#else /* TFU_UPGRADE */ + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; + if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) && + (hqCb->tbInfo[1].state == HQ_TB_WAITING)) + { + pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */ + } + else + { + pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */ + } + { +#ifdef LTEMAC_SPS + /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS + * ocassions */ + if (hqCb->spsN1PucchRes.pres) + { + pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + { + pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn); + } +#ifdef EMTC_ENABLE + rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0])); +#endif + } +#endif/*TFU_UPGRADE*/ + +#ifdef TFU_UPGRADE + rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue, + pucchRecpInfo, validIdx,FALSE); +#endif +#ifdef EMTC_ENABLE + /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/ + isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE); +#endif + if(!isAddToLst) + { + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + } + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + + if ((tbCb->fbkRecpRepCntr) && + (--tbCb->fbkRecpRepCntr)) + { + /* Add to next subfarme */ + /* Add this hqCb to the next dlSf's ackNakRepQ */ + cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), + &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); + tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; + tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; + } + break; + } + } + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillHqFdbkInfo */ + +#ifdef RG_5GTF +/** @brief This function handles filling of Hq reception request to + * Per Hq Proc. + * + * @details + * + * Function:rgSCHTomUtlFillHqFdbkFor5gtf + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx, + * @param [in] RgSchDlHqInfo *dlSfHqInfo, + * @param [in] RgSchDlSf *dlSf, + * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, + * @param [out] RgSchErrInfo *err + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchDlHqInfo *dlSfHqInfo, + RgSchDlSf *dlSf, + TfuUeRecpReqInfo *pucchRecpInfo, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchDlHqInfo *dlSfHqInfo; + RgSchDlSf *dlSf; + TfuUeRecpReqInfo *pucchRecpInfo; + RgSchErrInfo *err; +#endif +{ +#ifdef DEBUGP + Inst inst = cell->instIdx; +#endif + S16 ret; + CmLList *hqPNode; + RgSchUeCb *ue; + TfuUePucchRecpReq *pucchReqInfo = NULLP; + + hqPNode = dlSfHqInfo->hqPLst.first; + ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; + + if (ue == NULLP) + { + RETVALUE(RFAILED); + } + ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if (ret != ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " + "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; + pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI + * instead of SPS-CRNTI */ + + pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); + + pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO; + + /* 5gtf TODO : Hardcoded nPUCCHIdx */ + pucchReqInfo->uciPduInfo.pucchIndex = 0; + + pucchReqInfo->uciPduInfo.numBits = 1; + + /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/ + if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn)) + { + pucchReqInfo->uciPduInfo.numBits += 5; + RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn, + ue->ue5gtfCb.cqiRiPer); + } + + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */ +#endif + +#ifdef LTE_ADV +/** @brief This function handles filling of Hq reception request to + * Per Hq Proc. + * + * @details + * + * Function:rgSCHTomUtlFillHqFdbkForFrmt1B + * + * Processing steps: + * Allocates the N1Pucch Resources based on teh A Value + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx, + * @param [in] RgSchDlHqInfo *dlSfHqInfo, + * @param [in] RgSchDlSf *dlSf, + * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, + * @param [out] RgSchErrInfo *err + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchDlHqInfo *dlSfHqInfo, + RgSchDlSf *dlSf, + TfuUeRecpReqInfo *pucchRecpInfo, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchDlHqInfo *dlSfHqInfo; + RgSchDlSf *dlSf; + TfuUeRecpReqInfo *pucchRecpInfo; + RgSchErrInfo *err; +#endif +#else +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cell, +RgSchDlHqInfo *dlSfHqInfo, +RgSchDlSf *dlSf, +TfuUeRecpReqInfo *pucchRecpInfo, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cell; +RgSchDlHqInfo *dlSfHqInfo; +RgSchDlSf *dlSf; +TfuUeRecpReqInfo *pucchRecpInfo; +RgSchErrInfo *err; +#endif +#endif +{ +#ifdef DEBUGP + Inst inst = cell->instIdx; +#endif + S16 ret; + CmLList *hqPNode; + RgSchDlHqProcCb *hqCb = NULLP; + RgSchUeCb *ue; + TfuUePucchRecpReq *pucchReqInfo = NULLP; + Bool isDatPresOnSecCell = FALSE; + U8 primCellTbCount = 0; + + hqPNode = dlSfHqInfo->hqPLst.first; + ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; + + if (ue == NULLP) + { + RETVALUE(RFAILED); + } + ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if (ret != ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " + "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; + pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI + * instead of SPS-CRNTI */ + + pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); + +#ifndef TFU_UPGRADE + pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL; + /* Handling of other types */ + pucchReqInfo->type = TFU_UCI_HARQ; +#else /* TFU_UPGRADE */ + pucchReqInfo->uciInfo = TFU_PUCCH_HARQ; + /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */ + pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); + /* Fill HqSz by using totalTbCnt based on the TM mode and + * the number of serv cells configured*/ + + pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal; + pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal; + + cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); +#ifdef LTEMAC_SPS + /* Two Resources needs to be configured if the + * serving cell is in mimo mode else single + * resource */ + if ((dlSf->relPdcch != NULLP) && + (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming))) + {/* Pcell is having sps rel pdcch present */ + if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) + {/* prim cell is in mimo mode, use 0 and 1 */ + pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce + + cell->pucchCfg.n1PucchAn); + pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1; + + + }else + { + pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce + + cell->pucchCfg.n1PucchAn); + } + /* Release the pdcch so that it will not further processed */ + rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch); + dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */ + } +#endif/*LTEMAC_SPS*/ +#endif/*TFU_UPGRADE*/ + while(hqPNode) + { + hqCb = (RgSchDlHqProcCb *)hqPNode->node; + hqPNode = hqPNode->next; + /* In case of CSI + 1BCS , CSI will be + * dropped if scheduling is present on + * seconday cell.36.213 10.1.1 + * */ + if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) + { + isDatPresOnSecCell = TRUE; + }else + { + if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) && + (hqCb->tbInfo[1].state == HQ_TB_WAITING)) + { + primCellTbCount = 2; + }else + { + primCellTbCount = 1; + } + } +#ifndef TFU_UPGRADE + pucchReqInfo->t.nCce = hqCb->pdcch->nCce; +#else + { + switch(ue->f1bCsAVal) + {/* A Value */ + case RG_SCH_A_VAL_2: + /* harq(0) is primary harq(1) is secondary) */ + if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) + { + pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\ + cw1N1Res[hqCb->tpc].n1PucchIdx; + } + else/* primary cell */ + { +#ifdef LTEMAC_SPS + /* Need to consider only sps occasions */ + if (hqCb->spsN1PucchRes.pres) + { + pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + { + + pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn); + } + } + break; + case RG_SCH_A_VAL_3: + /* Serving cell in mimo mode should be + * in 0 and 1 and the serving cell in siso + * mode should be in 2 indices */ + if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) + { + U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)]; + if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1) + {/* Sec cell is in mimo mode, use 0 and 1 */ + pucchReqInfo->hqInfo.hqRes[0] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + + pucchReqInfo->hqInfo.hqRes[1] = + ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; + } + else + {/* Sec cell is in siso mode, use 2 */ + pucchReqInfo->hqInfo.hqRes[2] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + } + } + else + {/* primary cell hq */ + if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) + {/* prim cell is in mimo mode, use 0 and 1 */ +#ifdef LTEMAC_SPS + if (hqCb->spsN1PucchRes.pres) + {/* SPS occasions */ + pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1; + } + else +#endif /* LTEMAC_SPS */ + { + pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn); + pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn + 1); + } + } + else + {/* prim cell is in siso mode use 2 */ +#ifdef LTEMAC_SPS + /* Need to consider only sps occasions */ + if (hqCb->spsN1PucchRes.pres) + { + pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + { + + pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn); + + } + } + } + break; + case RG_SCH_A_VAL_4: + { + if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)) + {/* 2 and 3 for sec cell */ + pucchReqInfo->hqInfo.hqRes[2] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + pucchReqInfo->hqInfo.hqRes[3] = + ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; + } + else/* primary cell */ + {/* 0 and 1 are for primary cell */ +#ifdef LTEMAC_SPS + /* Need to consider only sps occasions */ + if (hqCb->spsN1PucchRes.pres) + { + pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1; + } + else +#endif /* LTEMAC_SPS */ + { + + pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn); + pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce + + cell->pucchCfg.n1PucchAn + 1); + } + } + } + + break; + default: + /* TOD:: Add error print */ + break; + } + } +#endif/*TFU_UPGRADE*/ + } +#ifdef TFU_UPGRADE + +#ifdef CA_DBG + { + gF1bCsCount++; + gF1bCsPres = TRUE; + } + +#endif + rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue, + pucchRecpInfo, validIdx,isDatPresOnSecCell); + + /* Channel selection wil not be used in case of + * CQI + HARQ. if the data was present only on + * primary cell */ + if((isDatPresOnSecCell == FALSE) && + (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)) + {/* Data is present only on primary cell */ + + switch(pucchReqInfo->uciInfo) + { + case TFU_PUCCH_HARQ_SRS: + case TFU_PUCCH_HARQ_CQI: + case TFU_PUCCH_HARQ_SR_SRS: + case TFU_PUCCH_HARQ_SR_CQI: + { + dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B; + pucchReqInfo->hqInfo.hqSz = primCellTbCount; + pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); + } + break; + default: + { + break; + } + } + } +#endif/*TFU_UPGRADE*/ + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */ +/** @brief This function handles filling of Hq reception request to + * Per Hq Proc. + * + * @details + * + * Function:rgSCHTomUtlFillHqFdbkForFrmt3 + * + * Processing steps: + * Allocates the N1Pucch Resources based on teh A Value + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx, + * @param [in] RgSchDlHqInfo *dlSfHqInfo, + * @param [in] RgSchDlSf *dlSf, + * @param [in] TfuUeRecpReqInfo *pucchRecpInfo, + * @param [out] RgSchErrInfo *err + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchDlHqInfo *dlSfHqInfo, + RgSchDlSf *dlSf, + TfuUeRecpReqInfo *pucchRecpInfo, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchDlHqInfo *dlSfHqInfo; + RgSchDlSf *dlSf; + TfuUeRecpReqInfo *pucchRecpInfo; + RgSchErrInfo *err; +#endif +#else +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cell, +RgSchDlHqInfo *dlSfHqInfo, +RgSchDlSf *dlSf, +TfuUeRecpReqInfo *pucchRecpInfo, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cell; +RgSchDlHqInfo *dlSfHqInfo; +RgSchDlSf *dlSf; +TfuUeRecpReqInfo *pucchRecpInfo; +RgSchErrInfo *err; +#endif +#endif +{ +#ifdef DEBUGP + Inst inst = cell->instIdx; +#endif + S16 ret; + //CmLList *hqPNode; + RgSchUeCb *ue; + TfuUePucchRecpReq *pucchReqInfo = NULLP; + + //hqPNode = dlSfHqInfo->hqPLst.first; + ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node; + + if (ue == NULLP) + { + RETVALUE(RFAILED); + } + ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if (ret != ROK) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate " + "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId)); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; + pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI + * instead of SPS-CRNTI */ + + pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq); + +#ifndef TFU_UPGRADE + pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL; + /* Handling of other types */ + pucchReqInfo->type = TFU_UCI_HARQ; +#else /* TFU_UPGRADE */ + pucchReqInfo->uciInfo = TFU_PUCCH_HARQ; + /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */ + pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp); + /* Fill HqSz by using totalTbCnt based on the TM mode and + * the number of serv cells configured*/ + + pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal; + pucchReqInfo->hqInfo.pucchResCnt = 1; + + cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); +#endif/*TFU_UPGRADE*/ + pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx; +#ifdef TFU_UPGRADE + rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue, + pucchRecpInfo, validIdx,TRUE); +#endif/*TFU_UPGRADE*/ + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */ + +#endif/*LTE_ADV*/ + +/** @brief This function handles filling of HARQ feedback recption request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +#else +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cell, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cell; +RgSchErrInfo *err; +#endif +#endif +{ + CmLList *node; + RgSchDlHqProcCb *hqCb; + CmLteTimingInfo futTime; + RgSchDlSf *dlSf; + RgSchDlSf *nxtDlsf; + TfuUeRecpReqInfo *pucchRecpInfo = NULLP; + RgSchUeCb *ue; + RgSchDlHqProcCb *prvHqCb=NULLP; + + TRC2(rgSCHTomUtlFillHqFdbkRecpReq); + +#ifdef CA_DBG + { + gF1bCsPres = FALSE; + } +#endif + /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output + * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is + * serving the purpose */ + RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL - + TFU_RECPREQ_DLDELTA)); + dlSf = rgSCHUtlSubFrmGet (cell, futTime); + /* Get the next dlsf as well */ + RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1) + nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime); + + prvHqCb = NULLP; + + if (dlSf->ueLst.count != 0) + { + node = dlSf->ueLst.first; + while (node) + { + ue = (RgSchUeCb *)(node->node); + node = node->next; + + if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE) + {/* This UE is already considered for PUSCH + Ignore for PUCCH */ + continue; + } + rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx, + &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err); + } /* end of while */ + } /* If hq is expected */ + + if (dlSf->msg4HqPLst.count != 0) + { + prvHqCb = NULLP; + node = dlSf->msg4HqPLst.first; + while (node) + { + hqCb = (RgSchDlHqProcCb*)(node->node); + node = node->next; + //TODO_SID: need to check validIdx + rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err); + prvHqCb = hqCb; + } /* end of while */ + } + + /* Check with TDD Code */ + /* FOR ACK NACK REP */ + RETVALUE(ROK); +} /* end of rgSCHTomUtlFillHqFdbkRecpReq */ +#ifdef TFU_UPGRADE +/** @brief This function handles filling of SR reception request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSrRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + CmLList *node; + TfuUeRecpReqInfo *pucchRecpInfo; + S16 ret; + + RgSchUeCb *ue; + Bool isAddToLst; +#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe = NULL; +#endif + + + TRC2(rgSCHTomUtlFillSrRecpReq); + + isAddToLst = FALSE; + + node = cell->pCqiSrsSrLst[validIdx].srLst.first; + while(node) + { + ue = (RgSchUeCb *)(node->node); + /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ + node = node->next; + if(ue == NULLP) + { + continue; + } + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + /*Fill SR params*/ + + +#ifdef LTEMAC_SPS + /* Should we check for Rel8 and above??? + * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is + * active*/ + ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell); + /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/ + if((ue->ul.ulSpsCfg.isLcSRMaskEnab) && + (ulSpsUe->isUlSpsActv)) + { + rgSCHTomUtlMoveSrNxtOccasion(cell, ue); + continue; + } +#endif + + pucchRecpInfo->rnti = ue->ueId; + pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx = + ue->srCb.srCfg.srSetup.srResIdx; + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR; + rgSCHTomUtlMoveSrNxtOccasion(cell, ue); + rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo, + pucchRecpInfo, validIdx); +#ifdef EMTC_ENABLE + isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe); +#endif + if(!isAddToLst) + { + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + } + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillSrRecpReq */ + + +/** @brief This function tells will the UE has a periodic CQI/PMI/RI + * reporting + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [in] RgSchUeCb *ue + * @param [out] Bool *willueRprtCqiRi + * @return S16 + * -# ROK + * -# RFAILED + */ + +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi +( + RgSchUeCb *ue, + Bool *willueRprtCqiRi + ) +#else +PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi) + RgSchUeCb *ue; + Bool *willueRprtCqiRi; +#endif +{ + TRC2(rgSCHTomUtlWillUeRprtCqiRi); + + /* Intialising Reporting probability as TRUE */ + *willueRprtCqiRi = TRUE; + + /* Checking the cases in which UE will not report CQIPMI/RI */ + if(ue->isDrxEnabled && ue->drxCb) + { +#ifdef LTEMAC_R9 + if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP) + {/*cqiMask is setup by upper layers */ + if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) == + RG_SCH_DRX_ONDUR_BITMASK) + {/*onDuration NOT running, do not expect cqi/pmi/ri*/ + *willueRprtCqiRi = FALSE; + } + RETVALUE(ROK); + } +#endif /*end of LTEMAC_R9*/ + /* ccpu00134258: Fix for CQI DRX issue*/ + if(ue->drxCb->onDurTmrLen > 2) + { + if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) ) + {/*UE is not active, do not expect cqi/pmi/ri*/ + *willueRprtCqiRi = FALSE; + } + } + }/*ue->isDrxEnabled*/ + + RETVALUE(ROK); +} /*End of rgSCHTomUtlWillUeRprtCqiRi*/ + +/** @brief This function handles filling of RI reception request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillRiRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + CmLList *node; + TfuUeRecpReqInfo *pucchRecpInfo; + S16 ret; + RgSchUeCb *ue; + Bool willUeRprtCqi; /* Flag set due to CQI Mask + and UE inactive state (DRX) */ + RgSchUePCqiCb *riCb = NULLP; + TRC2(rgSCHTomUtlFillRiRecpReq); + + node = cell->pCqiSrsSrLst[validIdx].riLst.first; + while(node) + { + riCb = (RgSchUePCqiCb *)(node->node); + ue = riCb->servCellInfo->ue; + /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ + node = node->next; + if(riCb->riRecpPrcsd) + { + /*ccpu00140578:: RI Proecssing is already done for this TTI + * as part of PUSCH reception process or HARQ + * Reception processing. Hence skipping this UE + * */ + riCb->riRecpPrcsd = FALSE; + continue; + } + if(riCb->riDist ==0) + { + rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); +#ifdef XEON_SPECIFIC_CHANGES + if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime)) + { + continue; + } +#endif +#ifdef LTE_ADV + if((TRUE == riCb->isRiIgnoByCollsn) + || (willUeRprtCqi == FALSE)) +#else + if(willUeRprtCqi == FALSE) +#endif + { + rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); + continue; + } + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + /*Fill RI params*/ + pucchRecpInfo->rnti = ue->ueId; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + riCb->cqiCfg.cqiSetup.cqiPResIdx; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits; + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI; + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + riCb->servCellInfo->sCellIdx; +#endif + rgSCHTomUtlFillRiBitWidthInfo(ue); + rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); + if (ue->nPCqiCb->nCqiTrIdx == validIdx) + { + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb); + } + if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0)) + { + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + } + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + else + { + riCb->riDist--; + } + } + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillRiRecpReq */ + +#ifdef RG_5GTF +/** @brief This function handles filling of 5GTF CQI-RI reception request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + TfuUeRecpReqInfo *pucchRecpInfo; + RgSchUeCb *ue = NULLP; + U16 ret; + + TRC2(rgSCHTomUtlFillCqiRiRecpReq); + + while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP) + { + if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn)) + { + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + pucchRecpInfo->rnti = ue->ueId; + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO; + pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0; + pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5; + + RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn, + ue->ue5gtfCb.cqiRiPer); + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + } + + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillCqiRiRecpReq */ +#endif + +/** @brief This function handles filling of PCQI reception request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + CmLList *node; + TfuUeRecpReqInfo *pucchRecpInfo; + S16 ret; + + RgSchUeCb *ue; + U8 ri; /*RI value*/ + Bool willUeRprtCqi; /* Flag set due to CQI Mask + and UE Inactive state (DRX)*/ + U8 cqiPmiSz; + RgSchUePCqiCb *cqiCb = NULLP; + Bool isAddToLst = FALSE; + + TRC2(rgSCHTomUtlFillPcqiRecpReq); + + node = cell->pCqiSrsSrLst[validIdx].cqiLst.first; + while(node) + { + cqiCb = (RgSchUePCqiCb*)(node->node); + ue = cqiCb->servCellInfo->ue; + /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ + node = node->next; + rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); +#ifdef LTE_ADV + if ((cqiCb->isCqiIgnoByCollsn == TRUE) || + (willUeRprtCqi == FALSE)) +#else + if(willUeRprtCqi == FALSE) +#endif + { + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + continue; + } + + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + cqiCb->servCellInfo->sCellIdx; +#endif + cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); + if(!cqiPmiSz) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi " + "size", ue->ueId); + continue; + } + + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + + /*Fill PCQI params*/ + pucchRecpInfo->rnti = ue->ueId; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + cqiCb->cqiCfg.cqiSetup.cqiPResIdx; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz; + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI; + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0)) + { + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + } +#ifdef EMTC_ENABLE + isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe); +#endif + if(!isAddToLst) + { + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + } + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillPcqiRecpReq */ + +/** @brief This function handles filling of SRS reception request to + * PHY. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSrsRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + CmLList *node; + TfuUeRecpReqInfo *pucchRecpInfo; + S16 ret; + RgSchUeCb *ue; + + TRC2(rgSCHTomUtlFillSrsRecpReq); + + node = cell->pCqiSrsSrLst[validIdx].srsLst.first; + while(node) + { + ue = (RgSchUeCb *)(node->node); + /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */ + node = node->next; + if(ue->srsCb.srsRecpPrcsd) + { + /* ccpu00140578::SRS Proecssing is already done for this TTI + * as part of PUSCH or HARQ reception process and + * hence skipping this UE */ + ue->srsCb.srsRecpPrcsd = FALSE; + continue; + } + + if(ue->srsCb.srsDist ==0) + { + /* We need to add the recp request to be sent on the pucchANRep value. */ + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + +#ifdef TFU_ALLOC_EVENT_NO_INIT + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + + /*Fill SRS params*/ + pucchRecpInfo->rnti = ue->ueId; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = + (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = + ue->srsCb.srsCfg.srsSetup.fDomPosi; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = + (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = + ue->srsCb.srsCfg.srsSetup.txComb; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = + ue->srsCb.srsCfg.srsSetup.srsCfgIdx; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = + (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; + + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS; + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + else + { + ue->srsCb.srsDist--; + } + } + RETVALUE(ROK); +}/* end of rgSCHTomUtlFillSrsRecpReq */ +#endif +#ifndef TFU_UPGRADE +/** @brief This function handles filling of data reception requests for + * PUSCH and MSG3. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillDatRecpReq +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cell, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cell; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + + TRC2(rgSCHTomUtlFillDatRecpReq) + + /* processing steps are + * - Run through the UL allocations going out in this subframe. + * - Run through the UL receptions expected the next subframe. + */ + alloc = rgSCHUtlFirstRcptnReq (cell); + while(alloc) + { + /* FOR ACK NACK REP */ + if (NULLP != alloc->ue) + { + /* If measuring or ackNakRep we shall not send dat RecpReq */ + if ((alloc->ue->measGapCb.isMeasuring == TRUE) || + (alloc->ue->ackNakRepCb.isAckNakRep == TRUE)) + { + alloc = rgSCHUtlNextRcptnReq (cell, alloc); + continue; + } + + } + if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo, + sizeof(TfuUeRecpReqInfo), + &(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + if (!alloc->forMsg3) + { + datRecpInfo->type = TFU_RECP_REQ_PUSCH; + rgSCHUtlAllocRcptInfo (alloc, + &datRecpInfo->rnti, + &datRecpInfo->t.puschRecpReq.mcs, + &datRecpInfo->t.puschRecpReq.rbStart, + &datRecpInfo->t.puschRecpReq.numRb, + &datRecpInfo->t.puschRecpReq.rv, + &datRecpInfo->t.puschRecpReq.size, + &datRecpInfo->t.puschRecpReq.modType, + &datRecpInfo->t.puschRecpReq.isRtx, + &datRecpInfo->t.puschRecpReq.nDmrs, + &datRecpInfo->t.puschRecpReq.ndi, + &datRecpInfo->t.puschRecpReq.harqProcId + ); + } + else + { + datRecpInfo->type = TFU_RECP_REQ_MSG3; + rgSCHUtlAllocRcptInfo (alloc, + &datRecpInfo->rnti, + &datRecpInfo->t.msg3RecpReq.mcs, + &datRecpInfo->t.msg3RecpReq.rbStart, + &datRecpInfo->t.msg3RecpReq.numRb, + /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/ + &datRecpInfo->t.msg3RecpReq.rv, + &datRecpInfo->t.msg3RecpReq.size, + &datRecpInfo->t.msg3RecpReq.modType, + &datRecpInfo->t.msg3RecpReq.isRtx, + &datRecpInfo->t.msg3RecpReq.nDmrs, + &datRecpInfo->t.msg3RecpReq.ndi, + &datRecpInfo->t.msg3RecpReq.harqProcId + ); + + } + /* Other fields of datRecpInfo shall be filled + * here for new features */ + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk)); + datRecpInfo->lnk.node = (PTR)datRecpInfo; + + alloc = rgSCHUtlNextRcptnReq (cell, alloc); + } /* end of while */ + RETVALUE(ROK); +} /* end of rgSCHTomUtlFillDatRecpReq */ + +#else +/** @brief This function handles filling of data reception requests for + * PUSCH and MSG3. + * + * @details + * + * Function: + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [in] U16 validIdx + * @param [out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillDatRecpReq +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cell, + U16 validIdx, + RgSchErrInfo *err + ) +#else +PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cell; + U16 validIdx; + RgSchErrInfo *err; +#endif +{ + CmLteTimingInfo dci0Time; + U8 idx; + S16 ret; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + + Bool hqPres; /*Set when HARQ Rec Req is present*/ + Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */ + U8 numUePerTti = 0; + + TRC2(rgSCHTomUtlFillDatRecpReq); + + if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.subframe)) + { + //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.subframe); + } + /* processing steps are + * - Run through the UL allocations going out in this subframe. + * - Run through the UL receptions expected the next subframe. + */ + + alloc = rgSCHUtlFirstRcptnReq (cell); + while(alloc) + { + isAperiodic = FALSE; + ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if(ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate " + "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } +#ifdef TFU_ALLOC_EVENT_NO_INIT + datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE; + datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE; +#endif + datRecpInfo->type = TFU_RECP_REQ_PUSCH; + /* ccpu00131944 - Intializing hqPres in each iteration*/ + hqPres = FALSE; + /* Check if this if for MSG3 - no scope for feedback along with it. */ + if ((FALSE == alloc->forMsg3)) + { + /* Check if any DL HARQ processes has a feedback coming at the time of + * this reception request. + */ +/* ACC-TDD */ + if(alloc->ue) + { + RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST)); + + idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.subframe)% + RGSCH_ULCTRL_RECP_DIST; + UNUSED(idx); + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA; + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + } + } + else /*Enters for Msg3 == TRUE condition*/ + { + /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity + * occur at same time */ + if(NULLP != alloc->ue) + { + + /* Only DATA is expected */ + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA; + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + } + } + if(alloc->ue) + { + if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA && + datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS && + isAperiodic == FALSE) + { + datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE; + datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs; + } + else + { + datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE; + } + } + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk)); + datRecpInfo->lnk.node = (PTR)datRecpInfo; + alloc = rgSCHUtlNextRcptnReq (cell, alloc); + numUePerTti++; + } /* end of while */ + + if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI)) + { + cell->ulNumUeSchedPerTti[numUePerTti-1]++; + gUlNumUePerTti[numUePerTti - 1]++; + } + RETVALUE(ROK); +} /* end of rgSCHTomUtlFillDatRecpReq */ +#endif +/* rg009.201. Added changes of TFU_UPGRADE */ +#ifdef TFU_UPGRADE +/*********************************************************** + * + * Func : rgSCHTomUtlFillRiBitWidthInfo + * + * + * Desc : Fills the RI BitWidth and stores it for decoding. + * + * Ret : S16 + * ROK - Success + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo +( + RgSchUeCb *ueCb + ) +#else +PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb) + RgSchUeCb *ueCb; +#endif +{ + RgSchUePCqiCb *riCb = ueCb->nPRiCb; + TRC2(rgSCHTomUtlFillRiBitWidthInfo); + + if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 && + ueCb->mimoInfo.txMode != RGR_UE_TM_4) + { + RETVALUE(RFAILED); + } + + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode= + (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum; + switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode) + { + case TFU_PUCCH_CQI_MODE10: + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri = + riCb->riNumBits; + break; + case TFU_PUCCH_CQI_MODE11: + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri = + riCb->riNumBits; + break; + case TFU_PUCCH_CQI_MODE20: + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri = + riCb->riNumBits; + break; + case TFU_PUCCH_CQI_MODE21: + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri = + riCb->riNumBits; + break; + default: + break; + } + + RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHTomUtlFetchPcqiBitSz + * + * + * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity. + * + * Ret : U8 + * ROK - Success + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz +( + RgSchUeCb *ueCb, + U8 numTxAnt, + U8 *ri + ) +#else +PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri) + RgSchUeCb *ueCb; + U8 numTxAnt; + U8 *ri; +#endif +{ + U8 confRepMode; + U8 pcqiSz; + TfuCqiPucchMode10 *mode10Info; + TfuCqiPucchMode11 *mode11Info; + TfuCqiPucchMode20 *mode20Info; + TfuCqiPucchMode21 *mode21Info; + RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb; + + TRC3(rgSCHTomUtlFetchPcqiBitSz); + + confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum; + if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) && + (ueCb->mimoInfo.txMode != RGR_UE_TM_4)) + { + *ri =1; + } + else + { + *ri = cqiCb->perRiVal; + } + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode= + (TfuDlCqiPucchMode)confRepMode; + switch(confRepMode) + { + case RGR_PRD_CQI_MOD10: + { + mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info; + pcqiSz = 4; + mode10Info->type = TFU_RPT_CQI; + mode10Info->u.cqi = 4; + } + break; + + case RGR_PRD_CQI_MOD11: + { + mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info; + mode11Info->type = TFU_RPT_CQI; + if(numTxAnt == 2) + { + if (*ri ==1) + { + pcqiSz = 6; + mode11Info->u.cqi.cqi = 4; + mode11Info->u.cqi.wideDiffCqi.pres = FALSE; + mode11Info->u.cqi.pmi = 2; + } + else + { + pcqiSz = 8; + mode11Info->u.cqi.cqi = 4; + mode11Info->u.cqi.wideDiffCqi.pres = TRUE; + mode11Info->u.cqi.wideDiffCqi.val = 3; + mode11Info->u.cqi.pmi = 1; + } + } + else if(numTxAnt == 4) + { + if (*ri ==1) + { + pcqiSz = 8; + mode11Info->u.cqi.cqi = 4; + mode11Info->u.cqi.wideDiffCqi.pres = FALSE; + mode11Info->u.cqi.pmi = 4; + } + else + { + pcqiSz = 11; + mode11Info->u.cqi.cqi = 4; + mode11Info->u.cqi.wideDiffCqi.pres = TRUE; + mode11Info->u.cqi.wideDiffCqi.val = 3; + mode11Info->u.cqi.pmi = 4; + } + } + else + { + /* This is number of antenna case 1. + * This is not applicable for Mode 1-1. + * So setting it to invalid value */ + pcqiSz = 0; + } + } + break; + + case RGR_PRD_CQI_MOD20: + { + mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info; + mode20Info->type = TFU_RPT_CQI; + if(cqiCb->isWb) + { + pcqiSz = 4; + mode20Info->u.cqi.isWideband = TRUE; + mode20Info->u.cqi.u.wideCqi = 4; + } + else + { + pcqiSz = 4 + cqiCb->label; + mode20Info->u.cqi.isWideband = FALSE; + mode20Info->u.cqi.u.subCqi.cqi = 4; + mode20Info->u.cqi.u.subCqi.l = cqiCb->label; + } + } + break; + + case RGR_PRD_CQI_MOD21: + { + mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info; + mode21Info->type = TFU_RPT_CQI; + //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb, + // mode21Info, numTxAnt, ri); + } + break; + default: + pcqiSz = 0; + break; + } + + RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + RETVALUE(pcqiSz); +} + + +/*********************************************************** + * + * Func : rgSCHTomUtlPcqiSbCalcBpIdx + * + * + * Desc : Determines the BP index from the timing info + * + * Ret : S16 + * ROK - Success + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx +( + CmLteTimingInfo crntTimInfo, + RgSchUeCb *ueCb, + RgSchUePCqiCb *cqiCb + ) +#else +PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb) + CmLteTimingInfo crntTimInfo; + RgSchUeCb *ueCb; + RgSchUePCqiCb *cqiCb; +#endif +{ + U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.subframe); + U16 prdNum = tti/cqiCb->cqiPeri; + + TRC2(rgSCHTomUtlPcqiSbCalcBpIdx); + if((prdNum % cqiCb->h) == 0) + { + cqiCb->isWb = TRUE; +#ifdef LTE_ADV + cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1; +#endif + } + else + { + cqiCb->isWb = FALSE; + cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J; +#ifdef LTE_ADV + cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0; +#endif + } + RETVALUE(ROK); +} + + +/** + * @brief Function which moves PCQI, RI, SR and SRS to next periodicity + * Occasions as that needs to be done in case of Ack/Nack repetition + * reception request occasions or during Measurement Gap occasions. + * + * @details + * + * Function: rgSCHTomUtlMoveNxtOccasion + * + * Function which moves PCQI, RI, SR and SRS to next perodicity + * Occasions as that needs to be done in case of Ack/Nack repetition + * reception request occasions or during Measurement Gap occasions. + * + * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Check whether the current Tx Instance matches with the rec req time + * - If true, then move them to their next Tx Instance + * + * @param[in] RgSchCellCb *cell, + * RgSchUeCb *ue, + * U16 validIdx + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlMoveNxtOccasion +( + RgSchCellCb *cell, + RgSchUeCb *ue, + U16 validIdx + ) +#else +PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx) + RgSchCellCb *cell; + RgSchUeCb *ue; + U16 validIdx; +#endif +{ + RgSchUePCqiCb *cqiCb = ue->nPCqiCb; + RgSchUePCqiCb *riCb = ue->nPRiCb; + TRC2(rgSCHTomUtlMoveNxtOccasion); + + /* ccpu00140578::Skip the UE if already RI recpetion + * is processed in the same subframe */ + if ((riCb->nRiTrIdx == validIdx) && + (riCb->riRecpPrcsd == FALSE)) + { + if(riCb->riDist ==0) + { + rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); + } + else + { + riCb->riDist--; + } + /* ccpu00140578:: As this UE is considered for this TTI + * Same UE should not get processed for RI reception + * or for updating th RI distance.*/ + if(riCb->nRiTrIdx == validIdx) + { + riCb->riRecpPrcsd = TRUE; + } + } + if (cqiCb->nCqiTrIdx == validIdx) + { + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + } + + /* ccpu00140578::Skip the UE if SRS recpetion + * is already processed in the same subframe */ + if ((ue->srsCb.nSrsTrIdx == validIdx) && + (ue->srsCb.srsRecpPrcsd == FALSE)) + { + if(ue->srsCb.srsDist ==0) + { + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + } + else + { + ue->srsCb.srsDist--; + } + /* ccpu00140578:: As this UE is considered for this TTI + * Same UE should not get processed for SRS reception + * or for updating th SRS distance.*/ + if(ue->srsCb.nSrsTrIdx == validIdx) + { + ue->srsCb.srsRecpPrcsd = TRUE; + } + } + if (ue->srCb.nSrTrIdx == validIdx) + { + rgSCHTomUtlMoveSrNxtOccasion(cell, ue); + } + RETVALUE(ROK); +} /* rgSCHTomUtlMoveNxtOccasion */ + + +/*********************************************************** + * + * Func : rgSCHTomPrepareAcqiRecp + * + * + * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them + * for decoding. Fill RECP request and prepare the scartchpad + * to aid decoding of Aperiodic CQI. + * + * Ret : Void + * ROK - RETVOID + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHTomPrepareAcqiRecp +( + RgSchUeCb *ueCb, + RgSchCellCb *cell, + TfuUePuschCqiRecpInfo *cqiRecpReqInfo, + U8 ccIdx + ) +#else +PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx) + RgSchUeCb *ueCb; + RgSchCellCb *cell; + TfuUePuschCqiRecpInfo *cqiRecpReqInfo; + U8 ccIdx; +#endif +{ + U8 confRepMode; + RgSchCqiRawPuschMode12 *mode12Info; + RgSchCqiRawPuschMode20 *mode20Info; + RgSchCqiRawPuschMode22 *mode22Info; + RgSchCqiRawPuschMode30 *mode30Info; + RgSchCqiRawPuschMode31 *mode31Info; + U8 numTxAnt = cell->numTxAntPorts; + U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)]; + U8 numOfCells = 0; + RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb; + + TRC2(rgSCHTomPrepareAcqiRecp); + + /* Fill TFU Recp */ + cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */ + if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 || + ueCb->mimoInfo.txMode == RGR_UE_TM_4) + { + cqiRecpReqInfo->riSz[ccIdx].pres = TRUE; + cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits; + } + /* This flag will be rmeoved after making changes in BRDCM CL + * Sachin is doing the change + * */ +#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)) + //LTE_ADV_ACQI_SUPP + cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1; + cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1; +#else + if(ueCb->nPCqiCb->perRiVal == 1) + { + cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1; + } + else + { + cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1; + } +#endif + /* Fill scratchpad to aid decoding of aper CQI upon + * reception */ + confRepMode = acqiCb->aCqiCfg.aprdModeEnum; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH; + + numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells; + + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ + puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode; + + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ + puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres; + + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ + puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val; + + /* Setting the sCellIdx */ + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\ + sCellIdx = sCellIdx; + + switch(confRepMode) + { + case RGR_APRD_CQI_MOD12: + { + mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ + cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info; + mode12Info->wideBCqiCw0 = 4; + mode12Info->r1WideBCqiCw1 = 0; + mode12Info->rg1WideBCqiCw1 = 4; + if(numTxAnt == 2) + { + mode12Info->r1TotalPmiBitLen = 2*acqiCb->N; + mode12Info->rg1TotalPmiBitLen = acqiCb->N; + } + else if(numTxAnt == 4) + { + mode12Info->r1TotalPmiBitLen = 4*acqiCb->N; + mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N; + } + } + break; + + case RGR_APRD_CQI_MOD20: + { + mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ + cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info; + mode20Info->wideBCqiCw = 4; + mode20Info->subBandDiffCqi = 2; + mode20Info->posOfM = acqiCb->L; + } + break; + + case RGR_APRD_CQI_MOD22: + { + mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ + cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info; + mode22Info->wideBCqiCw0 = 4; + mode22Info->sBDiffCqiCw0 = 2; + mode22Info->r1WideBCqiCw1 = 0; + mode22Info->r1SbDiffCqiCw1 = 0; + mode22Info->rg1WideBCqiCw1 = 4; + mode22Info->rg1SbDiffCqiCw1 = 2; + mode22Info->posOfM = acqiCb->L; + if(numTxAnt == 2) + { + mode22Info->r1PmiBitLen = 4; + mode22Info->rg1PmiBitLen = 2; + } + else if(numTxAnt == 4) + { + mode22Info->r1PmiBitLen = 8; + mode22Info->rg1PmiBitLen = 8; + } + } + break; + + case RGR_APRD_CQI_MOD30: + { + mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ + cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info; + mode30Info->wideBCqiCw = 4; + mode30Info->totLenSbDiffCqi = 2*acqiCb->N; + } + break; + + case RGR_APRD_CQI_MOD31: + { + mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\ + cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info; + mode31Info->wideBCqiCw0 = 4; + mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N; + mode31Info->r1WideBCqiCw1 = 0; + mode31Info->r1TotLenSbDiffCqiCw1 =0; + mode31Info->rg1WideBCqiCw1 = 4; + mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N; + if(numTxAnt == 2) + { + mode31Info->r1PmiBitLen = 2; + mode31Info->rg1PmiBitLen = 1; + } + else if(numTxAnt == 4) + { + mode31Info->r1PmiBitLen = 4; + mode31Info->rg1PmiBitLen = 4; + } + } + break; + default: + break; + } + RETVOID; +} + +/** + * @brief Function which handles the filling of Aperiodic CQI/RI reception + * request values + * + * @details + * + * Function: rgSCHTomUtlFillDatAperRecpReq + * + * Function which handles the filling of Aperiodic CQI/RI reception + * request values + * + * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the data arriving on the ULSCH + * - Fill the reception request information for the Aperiodic CQI/PMI/RI + * + * @param[in] RgSchCellCb *cell, + * RgSchUlAlloc *alloc, + * TfuUeRecpReqInfo *datRecpInfo, + * CmLteTimingInfo *timeInfo, + * Bool hqPres + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq +( + RgSchCellCb *cell, + U8 cqiReq, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + ) +#else +PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx) + RgSchCellCb *cell; + U8 cqiReq; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + CmLteTimingInfo *timeInfo; + Bool hqPres; + U16 validIdx; +#endif +{ + TfuUePuschCqiRecpInfo *cqiRecpReqInfo; + RgSchUeCb *ueCb = alloc->ue; +#ifdef LTE_ADV + U8 triggerSet = 0; + U8 sIdx = 0; +#endif + TRC2(rgSCHTomUtlFillDatAperRecpReq); + + /*Fill RI Reception Params*/ + cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; + cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst; + cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst; + + + cqiRecpReqInfo->cCNum = 0; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0; + +#ifdef LTE_ADV + rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet); + for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++) + { + /* The Aperiodic request for SCell index sIdx */ + if ((triggerSet >> (7 - sIdx)) & 0x01) + { + /* The Aperiodic request for SCell index sIdx */ + rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum); + cqiRecpReqInfo->cCNum++; + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++; + } + } +#else + rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum); + ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++; +#endif + + RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + + if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) + { + rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; + + } + if(hqPres && + (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; + } + else if (hqPres) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; + } + else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; + } + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + RETVALUE(ROK); +} /* rgSCHTomUtlFillDatAperRecpReq */ + + + +/** + * @brief Function which handles the filling of Periodic RI reception + * request values which arrives along with UL Data on ULSCH + * + * @details + * + * Function: rgSCHTomUtlFillDatPriRecpReq + * + * Function which handles the filling of Periodic RI reception + * request values which arrives along with UL Data on ULSCH + * + * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the data arriving on the ULSCH + * - Fill the reception request information for the Periodic RI + * + * @param[in] RgSchCellCb *cell, + * RgSchUlAlloc *alloc, + * TfuUeRecpReqInfo *datRecpInfo, + * CmLteTimingInfo *timeInfo, + * Bool hqPres + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + ) +#else +PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo, +hqPres, validIdx) + RgSchCellCb *cell; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + CmLteTimingInfo *timeInfo; + Bool hqPres; + U16 validIdx; +#endif +{ + TfuUePuschCqiRecpInfo *cqiRecpReqInfo; + TRC2(rgSCHTomUtlFillDatPriRecpReq); + + /*Fill RI Reception Params*/ + cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; +#ifdef TFU_ALLOC_EVENT_NO_INIT + cqiRecpReqInfo->cqiBetaOff = 0; + /* Fill only the first RI index since Periodic can come + * only for 1 CC */ + cqiRecpReqInfo->cqiPmiSzR1[0] = 0; + cqiRecpReqInfo->cqiPmiSzRn1[0] = 0; +#endif + cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */ + cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst; + + /* Fill only the first RI index since Periodic can come + * only for 1 CC */ + cqiRecpReqInfo->cCNum = 1; + cqiRecpReqInfo->riSz[0].pres = TRUE; + cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits; + /*Other params*/ + rgSCHTomUtlFillRiBitWidthInfo(alloc->ue); + if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) + { + rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; + + } + if(hqPres && + (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; + } + else if (hqPres) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; + } + else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; + } + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + RETVALUE(ROK); +} /* rgSCHTomUtlFillDatPriRecpReq */ + + +/** + * @brief Function which handles the filling of Periodic CQI/PMI reception + * request values which arrives along with UL Data on ULSCH + * + * @details + * + * Function: rgSCHTomUtlFillDatPCqiRecpReq + * + * Function which handles the filling of Periodic CQI/PMI reception + * request values which arrives along with UL Data on ULSCH + * + * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the data arriving on the ULSCH + * - Fill the reception request information for the Periodic CQI/PMI + * + * @param[in] RgSchCellCb *cell, + * RgSchUlAlloc *alloc, + * TfuUeRecpReqInfo *datRecpInfo, + * CmLteTimingInfo *timeInfo, + * Bool hqPres + * @return S16 + * -# ROK + * -# RFAILED + **/ + +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres, + U16 validIdx + ) +#else +PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo, + timeInfo, hqPres, validIdx) + RgSchCellCb *cell; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + CmLteTimingInfo *timeInfo; + Bool hqPres; + U16 validIdx; +#endif +{ + TfuUePuschCqiRecpInfo *cqiRecpReqInfo; + U8 cqiPmiSz; /*Raw CQI/PMI Size*/ + U8 ri; + + TRC2(rgSCHTomUtlFillDatPCqiRecpReq); + + + /*Fill CQI Reception Params*/ + cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo; +#ifdef TFU_ALLOC_EVENT_NO_INIT + cqiRecpReqInfo->riBetaOff = 0; +#endif + cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst; + cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri); + if(0 == cqiPmiSz) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill " + "CqiPmi size RNTI:%d",alloc->rnti); + RETVALUE(RFAILED); + } + + /* Fill only the first RI index since Periodic can come + * only for 1 CC */ + cqiRecpReqInfo->cCNum = 1; + cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */ + /* This flags will be removed once Sachin does changes + * in BRDCM CL */ +#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)) + cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz; + cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz; +#else + if (ri ==1) + { + cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz; + cqiRecpReqInfo->cqiPmiSzRn1[0] = 0; + } + else + { + cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz; + cqiRecpReqInfo->cqiPmiSzR1[0] = 0; + } +#endif + cqiRecpReqInfo->riSz[0].pres = FALSE; + + if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0)) + { + rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS; + } + if(hqPres && + (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS)) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS; + } + else if (hqPres) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ; + } + else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI; + } + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + RETVALUE(ROK); +} /* rgSCHTomUtlFillDatPCqiRecpReq */ + +/** + * @brief Function which handles the filling of SRS reception + * request values which arrives along with UL Data on ULSCH + * + * @details + * + * Function: rgSCHTomUtlFillDatSrsRecpReq + * + * Function which handles the filling of SRS reception + * request values which arrives along with UL Data on ULSCH + * + * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the data arriving on the ULSCH + * - Fill the reception request information for the SRS + * + * @param[in] RgSchCellCb *cell, + * RgSchUlAlloc *alloc, + * TfuUeRecpReqInfo *datRecpInfo, + * CmLteTimingInfo *timeInfo, + * Bool hqPres + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo, + CmLteTimingInfo *timeInfo, + Bool hqPres + ) +#else +PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo, + hqPres) + RgSchCellCb *cell; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; + CmLteTimingInfo *timeInfo; + Bool hqPres; +#endif +{ + TRC2(rgSCHTomUtlFillDatSrsRecpReq); + datRecpInfo->rnti = alloc->rnti; + rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo); + if(hqPres) + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS; + } + else + { + datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS; + } + datRecpInfo->rnti = alloc->rnti; + rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo, + &datRecpInfo->t.puschRecpReq.ulSchInfo); + RETVALUE(ROK); +} /* rgSCHTomUtlFillDatSrsRecpReq */ + +/** + * @brief Function which handles the filling of only SRS reception + * request values on ULSCH + * + * @details + * + * Function: rgSCHTomFillOnlySrsRecpReq + * + * Function which handles the filling of SRS reception + * request values which arrives along with UL Data on ULSCH + * + * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the data arriving on the ULSCH + * - Fill the reception request information for the SRS + * + * @param[in] RgSchCellCb *cell, + * RgSchUlAlloc *alloc, + * TfuUeRecpReqInfo *datRecpInfo, + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHTomFillOnlySrsRecpReq +( + RgSchCellCb *cell, + RgSchUlAlloc *alloc, + TfuUeRecpReqInfo *datRecpInfo + ) +#else +PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo) + RgSchCellCb *cell; + RgSchUlAlloc *alloc; + TfuUeRecpReqInfo *datRecpInfo; +#endif +{ + TfuUePuschSrsRecpInfo *srsRecpReqInfo; + TRC2(rgSCHTomFillOnlySrsRecpReq); + + srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo; + srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw; + srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi; + srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw; + srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb; + srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx; + srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift; + + /* ccpu00117050 - ADD - nSrs setting + * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/ + datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1; + + RETVALUE(ROK); +} /* rgSCHTomFillOnlySrsRecpReq */ + +/** + * @brief Function which handles the filling of PCQI/RI, SRS and SR + * Reception Request Information along + * with the HARQ reception Request + * + * @details + * + * Function: rgSCHTomUtlFillCqiSrSrsWithHq + * + * Function which handles the filling of PCQI/RI, SRS ans SR + * Reception Request Information along + * with the HARQ reception Request + * + * + * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq & + * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for the Control Info arriving on the PUCCH + * - Fill the reception request information for the SR, RI, CQI, SRS + * + * @param[in] RgSchCellCb *cell, + * TfuRecpReqInfo *recpReqInfo, + * RgSchDlHqProcCb *hqCb, + * @param[out] TfuUeRecpReqInfo *pucchRecpInfo + * @param[in] U16 validIdx + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq +( + RgSchCellCb *cell, + TfuRecpReqInfo *recpReqInfo, + RgSchUeCb *ue, + TfuUeRecpReqInfo *pucchRecpInfo, + U16 validIdx, + Bool isDatPresOnSecCell + ) +#else +PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue, + pucchRecpInfo, validIdx,isDatPresOnSecCell) +RgSchCellCb *cell; +TfuRecpReqInfo *recpReqInfo; +RgSchUeCb *ue; +TfuUeRecpReqInfo *pucchRecpInfo; +U16 validIdx; +Bool isDatPresOnSecCell; +#endif +{ + RgSchUePCqiCb *cqiCb; + RgSchUePCqiCb *riCb; + U8 ri; /*To fetch RI value*/ + Bool willUeRprtCqi; /* Flag set due to CQI Mask and + UE Inactive state (DRX)*/ + Bool willUeRprtSr = TRUE; + TfuAckNackMode hqFdbkMode; + U8 numCqiBit; + U8 totalPucchBits; + Bool dropCqi = FALSE; +#ifdef LTEMAC_SPS + RgSchCmnUlUeSpsInfo *ulSpsUe = NULL; +#endif +#ifdef EMTC_ENABLE + RgSchEmtcUeInfo *emtcUe = NULLP; +#endif + + TRC2(rgSCHTomUtlFillCqiSrSrsWithHq); + + if(ue) + { + /*Changes for PUCCH Format3 */ + hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode; + numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts); + totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit; + +#ifdef EMTC_ENABLE + emtcUe = RG_GET_EMTC_UE_CB(ue); +#endif + rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); +#ifdef EMTC_ENABLE /*VINU*/ + if (ue->isEmtcUe) + { + if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1)) + { + willUeRprtCqi = FALSE; + willUeRprtSr = FALSE; + } + } +#endif + if(ue->srCb.nSrTrIdx == validIdx) + { + +#ifdef LTEMAC_SPS + /* Should we check for Rel8 and above??? + * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is + * active*/ + ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell); + /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/ + if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) && + (ulSpsUe->isUlSpsActv))) + { +#endif + + if(willUeRprtSr) + { + /*Fill SR params*/ + pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx = + ue->srCb.srCfg.srSetup.srResIdx; + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; + /* FORMAT3: If SR is present it will be appended after HARQ */ + totalPucchBits = totalPucchBits + 1; + } + +#ifdef LTEMAC_SPS + } +#endif + + rgSCHTomUtlMoveSrNxtOccasion(cell, ue); + } + /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present + * on sec cell(isDatPresOnSecCell)*/ +#ifdef LTE_TDD + if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION) +#else + if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS) +#endif + { + if (isDatPresOnSecCell == TRUE) + { + dropCqi = TRUE; + } + } +#ifdef LTE_ADV +#ifndef LTE_TDD + /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3 + is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped + Spec 36.213 Sec 10.1.1 */ + else if (hqFdbkMode == TFU_UCI_FORMAT_3) + { + if ((isDatPresOnSecCell == TRUE) && + ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22))) + { + dropCqi = TRUE; + } + } +#endif +#endif + riCb = ue->nPRiCb; + cqiCb = ue->nPCqiCb; + if(riCb->nRiTrIdx == validIdx) + { + /*ccpu00140578:: Skip the UE if the RI is already processed + * for PUSCH */ + if(riCb->riRecpPrcsd == FALSE) + { + if(riCb->riDist == 0) + { + if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&& + (isDatPresOnSecCell == FALSE)) + { + /*Fill RI params*/ + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + riCb->cqiCfg.cqiSetup.cqiPResIdx; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = + riCb->riNumBits; + if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR) + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI; + } + else + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI; + } + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + ue->nPRiCb->servCellInfo->sCellIdx; +#endif + rgSCHTomUtlFillRiBitWidthInfo(ue); + if (ue->nPCqiCb->nCqiTrIdx == validIdx) + { + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb); + } +#ifdef CA_DBG + { + if(gF1bCsPres) + { + gRiReqCount++; + } + } + +#endif + + + + } + rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); + } + else + { + riCb->riDist--; + } + /* Skip the UE for RI processing on PUCCH + * in the same subframe as it already processed */ + if(riCb->nRiTrIdx == validIdx) + { + /* As the new idx is same is current idx + * then PUCCH reception processing will consider + * RI also in the same subframe. To block this + * below flag is used*/ + riCb->riRecpPrcsd = TRUE; + } + } + } + else if(cqiCb->nCqiTrIdx == validIdx) + { + if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&& + (isDatPresOnSecCell == FALSE)) + { + /*Fill CQI Params*/ + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + cqiCb->cqiCfg.cqiSetup.cqiPResIdx; + + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + cqiCb->servCellInfo->sCellIdx; +#endif + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = + rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); + if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d " + "Unable to Fill CqiPmi size", ue->ueId); + RETVALUE(RFAILED); + } + if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR) + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI; + } + else + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI; + } + } +#ifdef CA_DBG + { + if(gF1bCsPres) + { + gCqiReqCount++; + } + } + +#endif + + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + } + if(ue->srsCb.nSrsTrIdx == validIdx) + { + /* ccpu00140578::Skip the UE for SRS reception processing + * if already done as part of PUSCH recpetion + * process*/ + if(ue->srsCb.srsRecpPrcsd == FALSE) + { + if(ue->srsCb.srsDist ==0 ) + { + if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI) + && (ue->srsCb.srsCfg.srsSetup.sANSrs) + && (isDatPresOnSecCell == FALSE)) + { + /*Fill SRS params*/ + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = + (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = + ue->srsCb.srsCfg.srsSetup.fDomPosi; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = + (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = + ue->srsCb.srsCfg.srsSetup.txComb; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = + ue->srsCb.srsCfg.srsSetup.srsCfgIdx; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = + (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; + /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */ + switch(pucchRecpInfo->t.pucchRecpReq.uciInfo) + { + case TFU_PUCCH_HARQ_SR: + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS; + break; + case TFU_PUCCH_HARQ_SR_CQI: + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS; + break; + default: + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS; + break; + } + } + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + } + else + { + ue->srsCb.srsDist--; + } + /* Skip the UE for SRS processing on PUCCH + * in the same subframe as it already processed */ + if(ue->srsCb.nSrsTrIdx == validIdx) + { + /* As the new idx is same is current idx + * then PUCCH reception processing will consider + * SRS also in the same subframe. To block this + * below flag is used*/ + ue->srsCb.srsRecpPrcsd = TRUE; + } + + } + } + } + UNUSED(dropCqi); + RETVALUE(ROK); +} /* rgSCHTomUtlFillCqiSrSrsWithHq */ + +/** + * @brief Function which handles the filling of PCQI/RI, SRS + * Reception Request Information along with SR reception + * Request + * + * @details + * + * Function: rgSCHTomUtlFillCqiSrsWithSr + * + * Function which handles the filling of PCQI/RI, SRS + * Reception Request Information along + * with the SR reception Request + * + * + * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c + * + * Processing Steps: + * - Fill the reception request for CQI/RI, SRS if they occur + * in the same instance as of SR. + * + * @param[in] RgSchCellCb *cell, + * RgSchUeCb *ue + * TfuRecpReqInfo *recpReqInfo, + * @param[out] TfuUeRecpReqInfo *pucchRecpInfo + * @param[in] U16 validIdx + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr +( + RgSchCellCb *cell, + RgSchUeCb *ue, + TfuRecpReqInfo *recpReqInfo, + TfuUeRecpReqInfo *pucchRecpInfo, + U16 validIdx + ) +#else +PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo, + pucchRecpInfo, validIdx) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuRecpReqInfo *recpReqInfo; +TfuUeRecpReqInfo *pucchRecpInfo; +U16 validIdx; +#endif +{ + RgSchUePCqiCb *cqiCb; + RgSchUePCqiCb *riCb; + U8 ri; /*To fetch RI value*/ + Bool willUeRprtCqi; /* Flag set due to CQI Mask and + UE Inactive state (DRX)*/ + TRC2(rgSCHTomUtlFillCqiSrsWithSr); + + riCb = ue->nPRiCb; + cqiCb = ue->nPCqiCb; + rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi); +#ifdef EMTC_ENABLE + rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi); +#endif + if(riCb->nRiTrIdx == validIdx) + { + /*ccpu00140578:: Skip the UE if the RI is already processed + * for PUSCH */ + if(riCb->riRecpPrcsd == FALSE) + { + if(riCb->riDist == 0) + { + if(willUeRprtCqi == TRUE) + { + /*Fill RI params*/ + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + riCb->cqiCfg.cqiSetup.cqiPResIdx; + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = + riCb->riNumBits; + + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI; + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + ue->nPRiCb->servCellInfo->sCellIdx; +#endif + rgSCHTomUtlFillRiBitWidthInfo(ue); + /* TODO:: syed Shouldn't this be done outside this if condition */ + if (cqiCb->nCqiTrIdx == validIdx) + { + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + } + } + rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb); + } + else + { + riCb->riDist--; + } + if(riCb->nRiTrIdx == validIdx) + {/* Need to skip this UE during PUCCH RI recpetion process + in the current subframe */ + riCb->riRecpPrcsd = TRUE; + } + } + } + else if(cqiCb->nCqiTrIdx == validIdx) + { + if(willUeRprtCqi == TRUE) + { + /*Fill CQI Params*/ + pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx = + cqiCb->cqiCfg.cqiSetup.cqiPResIdx; + + ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo; + +#ifdef LTE_ADV + ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx = + cqiCb->servCellInfo->sCellIdx; +#endif + pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = + rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri); + if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d" + " Unable to Fill CqiPmi size", ue->ueId); + RETVALUE(RFAILED); + } + + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI; + } + rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb); + } + if(ue->srsCb.nSrsTrIdx == validIdx) + { + /* ccpu00140578:: Cnsider the SRS processing + * only if not done in the same TTI + * as part of PUSCH or HARQ reception process*/ + if(ue->srsCb.srsRecpPrcsd == FALSE) + { + if(ue->srsCb.srsDist ==0 ) + { + if(ue->srsCb.srsCfg.srsSetup.sANSrs) + { + /*Fill SRS params*/ + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw = + (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc = + ue->srsCb.srsCfg.srsSetup.fDomPosi; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw = + (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw; + pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb = + ue->srsCb.srsCfg.srsSetup.txComb; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx = + ue->srsCb.srsCfg.srsSetup.srsCfgIdx; + pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft = + (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift; + /* ccpu00116923 - ADD - New Reception Request types for CQI and + * SRS with SR */ + if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI) + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS; + } + else + { + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS; + } + + } + rgSCHTomUtlMoveSrsNxtOccasion(cell, ue); + } + else + { + ue->srsCb.srsDist--; + } + /* Skip the UE for SRS processing on PUCCH + * in the same subframe as it already processed */ + if(ue->srsCb.nSrsTrIdx == validIdx) + { + /* As the new idx is same is current idx + * then PUCCH reception processing will consider + * SRS also in the same subframe. To block this + * below flag is used*/ + ue->srsCb.srsRecpPrcsd = TRUE; + } + + } + } + RETVALUE(ROK); +} /* rgSCHTomUtlFillCqiSrsWithSr */ + +#endif + + +#ifdef LTE_TDD +/** @brief This function handles filling of HARQ feedback repetition + * recption request for each subframe + * + * @details + * + * Function: rgSCHTomUtlFillSfRepHqFdbk + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @param [in] RgSchDlSf *dlSf + * @param [in] U8 noFdbks + * @param [in] CmMemListCp *memCp + * @param [in] U8 elemIdx + * @param [in] RgSchDlSf *nxtDlsf + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cellCb, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + U16 validIdx + ) +#else +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf, +noFdbks, memCp, elemIdx, nxtDlsf, validIdx) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cellCb; + RgSchErrInfo *err; + RgSchDlSf *dlSf; + U8 noFdbks; + CmMemListCp *memCp; + U8 elemIdx; + RgSchDlSf *nxtDlsf; + U16 validIdx; +#endif +#else +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk +( +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cellCb, +RgSchErrInfo *err, +RgSchDlSf *dlSf, +U8 noFdbks, +CmMemListCp *memCp, +U8 elemIdx, +RgSchDlSf *nxtDlsf +) +#else +PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf, +noFdbks, memCp, elemIdx, nxtDlsf) + TfuRecpReqInfo *recpReqInfo; + RgSchCellCb *cellCb; + RgSchErrInfo *err; + RgSchDlSf *dlSf; + U8 noFdbks; + CmMemListCp *memCp; + U8 elemIdx; + RgSchDlSf *nxtDlsf; +#endif +#endif +{ + RgSchDlHqProcCb *hqCb; + CmLList *node; + S16 ret; + RgSchUeCb *ueCb; + TfuUeRecpReqInfo *pucchRecpInfo; +#ifdef TFU_UPGRADE + TfuUePucchHqRecpInfo *hqRecpReq; +#endif + RgSchDlHqTbCb *tbCb; + RgSchDlHqProcCb *prvHqCb = NULLP; + + TRC2(rgSCHTomUtlFillSfRepHqFdbk) + + node = dlSf->ackNakRepQ.first; + while (node) + { + tbCb = (RgSchDlHqTbCb *)(node->node); + hqCb = tbCb->hqP; + ueCb = hqCb->hqE->ue; + + if (--tbCb->fbkRecpRepCntr) + { + /* Add to next subfarme */ + /* Add this hqCb to the next dlSf's ackNakRepQ */ + cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), + &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); + tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; + tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; + } + +#ifdef TFU_UPGRADE + if (hqCb->tbCnt) + { + hqCb->tbCnt--; + /* Go to the next node */ + node = node->next; + continue; + } +#endif + if ((hqCb->hqE->ue != NULLP) && + (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE) + && (hqCb != prvHqCb) + ) + { + /* We need to add the recp request to be sent on the pucchANRep + * value. + */ + ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo, + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp)); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to" + "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + pucchRecpInfo->rnti = ueCb->ueId; +#ifndef TFU_UPGRADE + pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; +#else + pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; +#endif + + /* FOR repetition Feedback shall come on n1PucchAnRep Configured per + * UE. + */ +#ifndef TFU_UPGRADE + pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH; + pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes; +#else + pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; + hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo); + /* ACK NACK rep works only in bundling mode . */ + hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL; + if ((hqCb->hqPSfLnk.node != NULLP) && + (hqCb->hqPSfLnk.node != NULLP)) + { + + hqRecpReq->hqSz = 2; + } + else + { + hqRecpReq->hqSz = 1; + } + hqRecpReq->pucchResCnt = 1; + hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes; +#endif + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk)); + pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo; + } + /* In a given dlSf, if there is 2 TBs context + * stored for a given harq, then they are added + * adjacent to each other in the subframe. To avoid + * adding duplicate recpnInfo for each TB, store this + * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then + * do not add reception req info.*/ + prvHqCb = hqCb; +#ifdef TFU_UPGRADE + RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue); + rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx); +#endif + /* Go to the next node */ + node = node->next; + } + + RETVALUE(ROK); +} + +/** @brief This function handles filling of HARQ feedback recption request + * for each subframe + * + * @details + * + * Function: rgSCHTomUtlFillSfHqFdbkInfo + * + * Processing steps: + * + * @param [out] TfuRecpReqInfo *recpReqInfo + * @param [in] RgSchCellCb *cell + * @param [out] RgSchErrInfo *err + * @param [in] RgSchDlSf *dlSf + * @param [in] U8 noFdbks + * @param [in] CmMemListCp *memCp + * @param [in] U8 elemIdx + * @param [in] RgSchDlSf *nxtDlsf +* @param [in] U16 validIdx; + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef TFU_UPGRADE +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cellCb, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + U16 validIdx, + RgSchDlHqProcCb *hqCb, + RgSchUePucchRecpInfo *pucchInfo, + Bool alloc, + RgSchDlHqProcCb *prvHqCb + ) +#else +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf, + noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cellCb; +RgSchErrInfo *err; +RgSchDlSf *dlSf; +U8 noFdbks; +CmMemListCp *memCp; +U8 elemIdx; +RgSchDlSf *nxtDlsf; +U16 validIdx; +RgSchDlHqProcCb *hqCb; +RgSchUePucchRecpInfo *pucchInfo; +Bool alloc; +RgSchDlHqProcCb *prvHqCb; +#endif +#else +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo +( + TfuRecpReqInfo *recpReqInfo, + RgSchCellCb *cellCb, + RgSchErrInfo *err, + RgSchDlSf *dlSf, + U8 noFdbks, + CmMemListCp *memCp, + U8 elemIdx, + RgSchDlSf *nxtDlsf, + RgSchDlHqProcCb *hqCb, + RgSchUePucchRecpInfo *pucchInfo, + Bool alloc, + RgSchDlHqProcCb *prvHqCb + ) +#else +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf, + noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb) +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cellCb; +RgSchErrInfo *err; +RgSchDlSf *dlSf; +U8 noFdbks; +CmMemListCp *memCp; +U8 elemIdx; +RgSchDlSf *nxtDlsf; +RgSchDlHqProcCb *hqCb; +RgSchUePucchRecpInfo *pucchInfo; +Bool alloc; +RgSchDlHqProcCb *prvHqCb; +#endif +#endif +{ + S16 ret; + RgSchUeCb *ueCb = hqCb->hqE->ue; +#ifndef TFU_UPGRADE + CmLteTimingInfo futTime; + RgSchTddANInfo *anInfo; +#else +#endif + RgrTddAckNackMode ackNackMode; + RgSchDlHqTbCb *tbCb; + CmLteRnti rnti; + U8 hqSz = 0; + U32 idx = 0; + + TRC2(rgSCHTomUtlFillSfHqFdbkInfo) + +#ifndef TFU_UPGRADE + RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA); +#endif + + + for (idx = 0 ;idx < 2; idx++) + { + if (HQ_TB_WAITING == hqCb->tbInfo[idx].state) + { + + tbCb = &hqCb->tbInfo[idx]; + if (ueCb) + { + rnti = ueCb->ueId; + ackNackMode = ueCb->dl.ackNackMode; +#ifndef TFU_UPGRADE + if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) + { + anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime); + /* Only the last scheduled TB for the UE is for HARQ + * ACK/NACK reception in Bundling case */ + if((anInfo == NULLP) || + (anInfo->latestMIdx != dlSf->dlFdbkInfo.m)) + { + RETVALUE(ROK); + } + } + else + { + /* Get the TFU reception request pointer, if present */ + cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId, + sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo); + } +#else + /* For upgrade we shall use the existing logic of pending list. */ + cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId, + sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo); +#endif + } + else if(hqCb->hqE->raCb != NULLP) + { + /* For RACH it is set to Bundling */ + ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL; + rnti = hqCb->hqE->raCb->tmpCrnti; + } + else + { + RETVALUE(ROK); + } + + /* Do not proceed if PUSCH + reception req is already filled*/ +#ifdef TFU_UPGRADE + if (hqCb->tbCnt) + { + hqCb->tbCnt--; + /* Go to the next node */ + continue; + } +#endif + if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE)) + &&(hqCb != prvHqCb) + ) + { + TknU16 n1PucchTkn = {FALSE, 0}; + RgSchPdcch *pdcch; + U8 tbIndx; + pdcch = tbCb->hqP->pdcch; +#ifdef LTEMAC_SPS + n1PucchTkn = hqCb->spsN1PucchRes; +#endif + for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++) + { + if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING && + (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime, + recpReqInfo->timingInfo))) + { + hqSz++; + hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai; + } + } + ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks, + memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch, + n1PucchTkn, &alloc, hqSz); + if (ret != ROK) + { + RETVALUE(ret); + } + /* TODO:: In case of F1BCS and CSI in same subframe + * UE shall drop the CSI if there was at least one + * PDSCH transmission in any of the DL subframe + * mapping to this UL subframe + * */ +#ifdef TFU_UPGRADE + rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue, + pucchInfo->pucchRecpInfo, validIdx,FALSE); +#ifdef LTE_ADV + if((hqCb->hqE->ue) && + (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)) + { + + if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell)) + { + switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo) + { + case TFU_PUCCH_HARQ_SR_CQI: + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; + RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + break; + case TFU_PUCCH_HARQ_CQI: + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; + RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + break; + case TFU_PUCCH_HARQ_SR_CQI_SRS: + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS; + RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx); + break; + case TFU_PUCCH_HARQ_SR_SRS: + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR; + break; + case TFU_PUCCH_HARQ_SRS: + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ; + break; + default: + break; + } + } + } +#endif + +#endif + + /* TODO antz - pushing the following code (under TFU_UPGRADE) + * into the above function (...ForOneUe) did not work (caused + * two additional TCs to fail). Don't know why. If this + * is done later, make sure that the code branch + * for relPdcch (later in this func) is also modified appropriately. + */ + /* Now add to the recp request or pending list */ + //if((elemIdx != (noFdbks - 1))) + { + cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo, + (U8 *)&rnti ,(U16) sizeof(CmLteRnti)); + alloc = FALSE; + } + + } /* If measuring */ + /* Go to the next node */ + if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr)) + { + /* Add to next subfarme */ + /* Add this hqCb to the next dlSf's ackNakRepQ */ + cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ), + &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr])); + tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb; + tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf; + } + /* In a given dlSf, if there is 2 TBs context + * stored for a given harq, then they are added + * adjacent to each other in the subframe. To avoid + * adding duplicate recpnInfo for each TB, store this + * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then + * do not add reception req info.*/ + prvHqCb = hqCb; + } + } + RETVALUE(ROK); +} + +#ifdef LTE_ADV +/** @brief This function calculates the pucch resource idx + * that is to be filled in harq reception request + * + * @details + * + * Function: rgSCHTomUtlGethqRes + * + * Processing steps: + * -Calculate the pucch resource idx + * Harq Reception Request for Format 1B with + * Channel Selection + * + * @param [in] U8 noFdbks + * @param [in] RgSchDlSf *dlSf + * @param [in] RgSchPdcch *pdcch + * @param [in] RgSchCellCb *cellCb + * @param [out]U16 *hqRes + * @return void + */ +#ifdef ANSI +PRIVATE Void rgSCHTomUtlGethqRes +( +U8 noFdbks, +RgSchDlSf *dlSf, +RgSchPdcch *pdcch, +RgSchCellCb *cellCb, +U16 *hqRes +) +#else +PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes) +U8 noFdbks; +RgSchDlSf *dlSf; +RgSchPdcch *pdcch; +RgSchCellCb *cellCb; +U16 *hqRes; +#endif +{ + U8 M; + U8 P; + U8 m; + U8 nP; + U8 nPlusOne; + U8 nCce; + + M = noFdbks; + m = dlSf->dlFdbkInfo.m; + nCce = pdcch->nCce; + P = rgSCHCmnGetPValFrmCCE(cellCb, nCce); + nP = cellCb->rgSchTddNpValTbl[P]; + nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; + *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce + + cellCb->pucchCfg.n1PucchAn; + + RETVOID; +} + +/** @brief This function fills the harq reception request for + * TDD in case of Fomat 1B with CS for M=1 + * + * @details + * + * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 + * + * Processing steps: + * -Fill Harq Reception Request for Format 1B with + * Channel Selection + * + * @param [in] RgSchDlHqProcCb *hqCb + * @param [in] TfuUePucchRecpReq *hqRecpReq + * @param [in] U8 noFdbks + * @param [in] RgSchDlSf *dlSf + * @param [in] RgSchPdcch *pdcch + * @param [in] RgSchCellCb *cellCb + * @return void + */ +#ifdef ANSI +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 +( + RgSchDlHqProcCb *hqCb, + TfuUePucchRecpReq *hqRecpReq, + U8 noFdbks, + RgSchDlSf *dlSf, + RgSchPdcch *pdcch, + RgSchCellCb *cellCb +) +#else +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq, + noFdbks,dlSf,pdcch,cellCb) + RgSchDlHqProcCb *hqCb; + TfuUePucchRecpReq *hqRecpReq; + U8 noFdbks; + RgSchDlSf *dlSf; + RgSchPdcch *pdcch; + RgSchCellCb *cellCb; +#endif +{ + RgSchUeCb *ue = NULLP; + Bool isCellSec = FALSE; + U16 hqRes; + + /*ccpu00147920: UeCb is NULL for SPS activation*/ + if(pdcch && pdcch->ue) + {/* SPS Release pdcch or dynamic data */ + ue = pdcch->ue; + }else + {/* SPS occasion */ +#ifdef ERRCLS_KW + if(hqCb == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + ue = hqCb->hqE->ue; + } + + if((hqCb != NULLP) && + (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) + { + isCellSec = TRUE; + } + + switch(ue->f1bCsAVal) + { + case RG_SCH_A_VAL_2: + /* harq(0) is primary harq(1) is secondary) */ + if(isCellSec) + { + hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb. + cw1N1Res[hqCb->tpc].n1PucchIdx; + } + else/* primary cell */ + { +#ifdef LTEMAC_SPS + /* hqCb will be null in case of sps rel pdcch */ + if ((hqCb) && hqCb->spsN1PucchRes.pres) + {/* SPS occasion or dyn sched*/ + hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + {/* dyn data or sps release */ +#ifdef ERRCLS_KW + if(pdcch == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + + rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); + hqRecpReq->hqInfo.hqRes[0] = hqRes; + } + } + break; + case RG_SCH_A_VAL_3: + { + /* Serving cell in mimo mode should be + * in 0 and 1 and the serving cell in siso + * mode should be in 2 indices */ + if(isCellSec) + { + U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx, + hqCb->hqE->cell->cellId, + hqCb->hqE->ue); + + if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1) + {/* Sec cell is in mimo mode, use 0 and 1 */ + hqRecpReq->hqInfo.hqRes[0] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + hqRecpReq->hqInfo.hqRes[1] = + ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; + } + else + {/* Sec cell is in siso mode, use 2 */ + hqRecpReq->hqInfo.hqRes[2] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + } + } + else + {/* primary cell hq */ + + if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1) + {/* prim cell is in mimo mode, use 0 and 1 */ +#ifdef LTEMAC_SPS + if (hqCb && hqCb->spsN1PucchRes.pres) + {/* Not sps release */ + hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + {/* sps rel or dyn */ +#ifdef ERRCLS_KW + if(pdcch == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + + rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); + hqRecpReq->hqInfo.hqRes[0] = hqRes; + hqRecpReq->hqInfo.hqRes[1] = hqRes + 1; + } + } + else + {/* prim cell is in siso mode use 2 */ +#ifdef LTEMAC_SPS + /* Consider sps occasions */ + if (hqCb && hqCb->spsN1PucchRes.pres) + {/* Not sps release */ + hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + { +#ifdef ERRCLS_KW + if(pdcch == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + + rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); + hqRecpReq->hqInfo.hqRes[2] = hqRes; + } + } + } + } + break; + case RG_SCH_A_VAL_4: + {/* Both the serv cells are in mimo mode */ + if(isCellSec) + {/* 2 and 3 for sec cell */ + hqRecpReq->hqInfo.hqRes[2] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + hqRecpReq->hqInfo.hqRes[3] = + ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; + } + else/* primary cell */ + {/* 0 and 1 are for primary cell */ +#ifdef LTEMAC_SPS + if (hqCb && hqCb->spsN1PucchRes.pres) + {/* Not sps release */ + hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val; + } + else +#endif /* LTEMAC_SPS */ + { +#ifdef ERRCLS_KW + if(pdcch == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + + rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); + hqRecpReq->hqInfo.hqRes[0] = hqRes; + hqRecpReq->hqInfo.hqRes[1] = hqRes + 1; + } + } + } + break; + default: + break; + } + RETVOID; +} + +/** @brief This function fills the harq reception request for + * TDD in case of Fomat 1B with CS for M>=2 + * + * @details + * + * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 + * + * Processing steps: + * -Fill Harq Reception Request for Format 1B with + * Channel Selection + * + * @param [in] RgSchDlHqProcCb *hqCb + * @param [in] TfuUePucchRecpReq *hqRecpReq + * @param [in] U8 noFdbks + * @param [in] RgSchDlSf *dlSf + * @param [in] RgSchPdcch *pdcch + * @param [in] RgSchCellCb *cellCb + * @param [in] U8 elemIdx + * @return void + */ +#ifdef ANSI +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 +( + RgSchDlHqProcCb *hqCb, + TfuUePucchRecpReq *hqRecpReq, + U8 noFdbks, + RgSchDlSf *dlSf, + RgSchPdcch *pdcch, + RgSchCellCb *cellCb, + U8 elemIdx +) +#else +PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234( + hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx) + RgSchDlHqProcCb *hqCb; + TfuUePucchRecpReq *hqRecpReq; + U8 noFdbks; + RgSchDlSf *dlSf; + RgSchPdcch *pdcch; + RgSchCellCb *cellCb; + U8 elemIdx; +#endif +{ + RgSchUeCb *ue; + Bool isCellSec = FALSE; + U16 hqRes = 0; + U8 servCellIdx; + + if(pdcch) + {/* SPS Release pdcch or dynamic data */ + ue = pdcch->ue; + }else + {/* SPS occasion */ +#ifdef ERRCLS_KW + if(hqCb == NULLP) + { + /* This is not supposed to happen + * Error case. hqCB has to be ter + * when pdcch is present . Adding + * if check bcs of kwork*/ + RETVOID; + } +#endif + ue = hqCb->hqE->ue; + } + + if((hqCb != NULLP) && (ue != NULLP) && + (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) + { + isCellSec = TRUE; + } + + if(isCellSec) + {/* Sec Cell indices are 2 and 3*/ + servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx, + hqCb->hqE->cell->cellId, + hqCb->hqE->ue); + + hqRecpReq->hqInfo.hqRes[2] = + ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx; + + if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1) + { + hqRecpReq->hqInfo.hqRes[3] = + ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx; + } + } + else + {/* Primary cell indices are 0 and 1 */ + /* SPS occasions + * M > 2 if SPS occasion is present in any of the + * DL subframe in the bundle, the n1Pucch(0) is + * the SPS resource and n1Pucch(1) is the resource + * derived from pdcch with DAI = 1 + * If No SPS Occasion + * Then n1Pucch(0) is from pdcch with DAI =1 + * and n1Pucch(1) is from pdcch with DAI = 2 + * */ + + if(hqCb != NULLP) + {/* this is not sps release pdcch */ + if(hqCb->spsN1PucchRes.pres == TRUE) + {/* SPS occasion*/ + hqRes = hqCb->spsN1PucchRes.val; + } + } + + if(pdcch) + {/*Dynamic scheduling or SPS Release + Derive from pdcch */ + if(pdcch->dlDai < 3) + {/* No need to calcualte from DAI > 2 */ + rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes); + } + } + + if(2 == noFdbks) + {/* M == 2 case */ + hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes; + } + else + {/* Pdcch with DAI = 1 and 2 needs to be used + for resource calculation*/ + if(hqCb && hqCb->spsN1PucchRes.pres == TRUE) + {/* dyn or sps occasion */ + /* Shift the hqRes[0] if it was filled + * if there was a pdcch with DAI 1 before to this + * subframe*/ + if(hqCb->ulDai > 1) + {/* SPS occasion happened in the middle + of the bundle */ + /* shifting the non SPS resource to n1Pucch(1) */ + hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0]; + } + + hqRecpReq->hqInfo.hqRes[0] = hqRes; + } +#ifdef ERRCLS_KW + else if(pdcch && pdcch->dlDai < 3) +#else + else if(pdcch->dlDai < 3) +#endif + {/* sps rel or dyn sched */ + /* hqCb wil not be present for sps release pdcch */ + if(hqCb && (pdcch->dlDai != hqCb->ulDai)) + {/* there was a SPS occasion before to this */ + if(pdcch->dlDai == 1) + { + hqRecpReq->hqInfo.hqRes[1] = hqRes; + }/* ignore the DAI 2 in this case */ + }else + {/* There was no SPS occasion before to this */ +#ifdef ERRCLS_KW + if(pdcch->dlDai) +#endif + {/* Added check to ignore kwork warning */ + hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes; + } + } + } + } + } + RETVOID; +} + +/** @brief This function fills the harq reception request for + * TDD in case of Fomat 1B with CS + * + * @details + * + * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS + * + * Processing steps: + * -Fill Harq Reception Request for Format 1B with + * Channel Selection + * + * @param [in] RgSchDlSf *ulSf + * @param [in] RgSchCellCb *cell + * @param [out]TfuUePucchRecpReq *hqRecpReq + * @return S16 + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS +( + RgSchDlHqProcCb *hqCb, + TfuUePucchRecpReq *hqRecpReq, + U8 noFdbks, + RgSchDlSf *dlSf, + RgSchPdcch *pdcch, + U8 elemIdx, + RgSchCellCb *cellCb +) +#else +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch, + n1PucchTkn,elemIdx,cellCb) + RgSchDlHqProcCb *hqCb; + TfuUePucchRecpReq *hqRecpReq; + U8 noFdbks; + RgSchDlSf *dlSf; + RgSchPdcch *pdcch; + U8 elemIdx; + RgSchCellCb *cellCb; +#endif +{ + /* Update teh fdbk mode if something different is present + * in L1 API file for F1BS *//* 1 --> F1BCS */ + hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION; + + switch(noFdbks) + {/* M Value */ + case RG_SCH_M_VAL_1: + { + + rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq, + noFdbks,dlSf,pdcch,cellCb); + break; + } + case RG_SCH_M_VAL_2: + case RG_SCH_M_VAL_3: + case RG_SCH_M_VAL_4: + { + /* Spatial bundling will be applied */ + rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq, + noFdbks,dlSf,pdcch,cellCb,elemIdx); + break; + } + default: + break; + } + RETVALUE(ROK); +} +#endif + +/*********************************************************** + * + * Func : rgSCHTomUtlFillSfHqFdbkForOneUe + * + * Desc : Fill HARQ feedback info for one UE/entry + * + * Ret : ROK/RFAILED + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe +( +RgSchDlHqProcCb *hqCb, +TfuRecpReqInfo *recpReqInfo, +RgSchCellCb *cellCb, +RgSchErrInfo *err, +RgSchDlSf *dlSf, +U8 noFdbks, +CmMemListCp *memCp, +U8 elemIdx, +RgSchDlSf *nxtDlsf, +CmLteRnti rnti, +RgrTddAckNackMode ackNackMode, +RgSchUePucchRecpInfo **pucchInfoRef, +RgSchPdcch *pdcch, +TknU16 n1PucchTkn, +Bool *allocRef, +U8 hqSz +) +#else +PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, + noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef, + pdcch, n1PucchTkn, allocRef, hqSz) +RgSchDlHqProcCb *hqCb; +TfuRecpReqInfo *recpReqInfo; +RgSchCellCb *cellCb; +RgSchErrInfo *err; +RgSchDlSf *dlSf; +U8 noFdbks; +CmMemListCp *memCp; +U8 elemIdx; +RgSchDlSf *nxtDlsf; +CmLteRnti rnti; +RgrTddAckNackMode ackNackMode; +RgSchUePucchRecpInfo **pucchInfoRef; +RgSchPdcch *pdcch; +TknU16 n1PucchTkn; +Bool *allocRef; +U8 hqSz; +#endif +{ + RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef; + Bool alloc = FALSE; + S16 ret; + TfuUePucchRecpReq *hqRecpReq; +#ifdef TFU_UPGRADE + U8 M; + U8 P; + U8 m; + U8 nP; + U8 nPlusOne; + U16 pucchRes; + U8 resIdx; + U8 nCce; + U8 prevHqSize; +#else + U8 multCnt; +#endif +#ifdef LTEMAC_SPS + Bool isFirstFdbk = FALSE; +#endif + if(pucchInfo == NULLP) + { + if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo, + sizeof(RgSchUePucchRecpInfo), memCp)) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to " + "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + alloc = TRUE; +#ifdef TFU_ALLOC_EVENT_NO_INIT + pucchInfo->hashLstEnt.hashVal = 0; + pucchInfo->hashLstEnt.keyLen = 0; + pucchInfo->hashLstEnt.key = 0; + pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0; +#endif + if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo), + sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to " + "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti); + err->errCause = RGSCHERR_TOM_MEM_EXHAUST; + RETVALUE(ret); + } + cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES); +#ifdef TFU_ALLOC_EVENT_NO_INIT + cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq)); +#endif + pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH; + pucchInfo->pucchRecpInfo->rnti = rnti; +#ifdef TFU_UPGRADE + pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ; +#endif +#ifdef LTEMAC_SPS + isFirstFdbk = TRUE; +#endif + } + /* Fill m, M, P */ + /* Calculation of resources same for both bundling and muxing for M = 1 + * */ +#ifdef LTE_ADV + RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti); + if((ue) && (1 == ue->numSCells)) + { + if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS) + { + hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); + rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq, + noFdbks,dlSf,pdcch,elemIdx,cellCb); + + if(noFdbks == 1) + {/* M = 1 case . size is same as A Value*/ + hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal; + hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz; + }else + {/* M > 1 case */ + hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */ + hqRecpReq->hqInfo.pucchResCnt = 4; + } + hqRecpReq->hqInfo.a = ue->f1bCsAVal; + /* handling for SPS occasions*/ + if(elemIdx == 0) + { + /* set the datPresinFirstSUbframe to TRUE if this + * is for pcell txion*/ +#ifdef ERRCLS_KW + RgSchTddANInfo *anInfo = NULLP; +#endif + /* if this txion is on pcell + * sps occaion, dyn sched or sps release pdcch + * set the sched present in first + * dl subframe of the bundle to TRUE. This + * is required for mapping the feedbak when SPS occasion + * is present in any of the DL subframe in the bundle in + * case of M > 2*/ + + /* SPS will happen only on pcell */ + if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))) + { +#ifdef ERRCLS_KW + anInfo = rgSCHUtlGetUeANFdbkInfo(ue, + &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX); + if(anInfo == NULL) + {/* ANInfo must be there. adding block + because of kworks*/ + RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx), + "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId)); + RETVALUE(RFAILED); + + } +#endif + } + } + }else + {/* This needs to be revisited while + adding support for PUCCH format 3 */ + RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured..")); + RETVALUE(RFAILED); + } + } + else +#endif + { + if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) || + ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT))) + { + hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); +#ifdef TFU_UPGRADE + prevHqSize = hqRecpReq->hqInfo.hqSz; +#endif +#ifndef TFU_UPGRADE + /* Only one index for bundling case */ + hqRecpReq->M = noFdbks; + hqRecpReq->hqType = + TFU_HQ_RECP_REQ_NORMAL; + hqRecpReq->multCnt = 1; + hqRecpReq->t.nCce[0] = + pdcch->nCce; + hqRecpReq->m[0] = + dlSf->dlFdbkInfo.m; + hqRecpReq->p[0] = + rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); + + hqRecpReq->type = TFU_UCI_HARQ; + +#else /* TFU_UPGRADE */ + +#ifdef LTEMAC_SPS + if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres)) + { + hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode; + hqRecpReq->hqInfo.pucchResCnt=1; + hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val; + hqRecpReq->hqInfo.hqSz = hqSz; + } + /* ccpu00139413 */ + else if (FALSE == n1PucchTkn.pres) +#endif + { + hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode; + M = noFdbks; + P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); + nP = cellCb->rgSchTddNpValTbl[P]; + nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; + m = dlSf->dlFdbkInfo.m; + /* In case of no UE */ + pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce + + cellCb->pucchCfg.n1PucchAn; + /*ccpu00130164:MOD-Changed to maitain value of + hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/ + /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1 + * and resource should be update at index-0*/ + hqRecpReq->hqInfo.pucchResCnt=1; + hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes; + + if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize)) + hqRecpReq->hqInfo.hqSz = hqSz; + else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT) + hqRecpReq->hqInfo.hqSz = hqSz; + else + hqRecpReq->hqInfo.hqSz = prevHqSize; + } +#endif /* TFU_UPGRADE */ +#ifndef TFU_UPGRADE + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, + &(pucchInfo->pucchRecpInfo->lnk)); + pucchInfo->pucchRecpInfo->lnk.node = + (PTR)pucchInfo->pucchRecpInfo; +#endif + } + else /* Multiplexing */ + { +#ifndef TFU_UPGRADE + pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks; +#ifdef LTEMAC_SPS + if (n1PucchTkn.pres == TRUE) + { + pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType = + TFU_HQ_RECP_REQ_N1PUCCH; + pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val; + } + else +#endif + { + pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType = + TFU_HQ_RECP_REQ_NORMAL; + multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt; + pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] = + pdcch->nCce; + pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] = + dlSf->dlFdbkInfo.m; + pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] = + rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce); + + pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++; + } +#else /* TFU_UPGRADE */ + + hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq); + hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT; + hqRecpReq->hqInfo.hqSz = noFdbks; + + resIdx = hqRecpReq->hqInfo.pucchResCnt; + hqRecpReq->hqInfo.pucchResCnt++; + +#ifdef LTEMAC_SPS + if (n1PucchTkn.pres == TRUE) + { + hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val; + } + else +#endif + { + M = noFdbks; + m = dlSf->dlFdbkInfo.m; + nCce = pdcch->nCce; + P = rgSCHCmnGetPValFrmCCE(cellCb, nCce); + nP = cellCb->rgSchTddNpValTbl[P]; + nPlusOne = cellCb->rgSchTddNpValTbl[P + 1]; + hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP + + (m * nPlusOne) + pdcch->nCce + + cellCb->pucchCfg.n1PucchAn; + } +#endif /* TFU_UPGRADE */ + /* If all the DL subframes are scanned, then + * send TFU request*/ +#ifndef TFU_UPGRADE + if((elemIdx != noFdbks) && alloc) + { + cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo, + (U8 *)&rnti, (U16) sizeof(rnti)); + alloc = FALSE; + } + else + { + pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ; + cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, + &(pucchInfo->pucchRecpInfo->lnk)); + pucchInfo->pucchRecpInfo->lnk.node = + (PTR)pucchInfo->pucchRecpInfo; + /* Delete the entry after addition to the list */ + cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo); + } +#endif + } + } + + *pucchInfoRef = pucchInfo; + *allocRef = alloc; + RETVALUE(ROK); +} +#endif + +#ifdef RG_ULSCHED_AT_CRC +/** @brief This function does all the processing related to a single downlink + * subframe. + * + * @details + * + * Function: rgSCHTomUtlProcDlSfAtCrc + * + * Processing steps: + * - collate control data for all UEs and send to PHY + * - collate data buffers for all UEs and send to PHY + * + * @param [in] RgSchDlSf *ulSf + * @param [in] RgSchCellCb *cell + * @param [in] TfuCntrlReqInfo *cntrlInfo + * @param [out] RgSchErrInfo *err + * @return S16 + */ +#ifdef ANSI +PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc +( +RgSchDlSf *ulSf, +CmLteTimingInfo crntUlFrm, +RgSchCellCb *cell, +TfuCntrlReqInfo *cntrlInfo, +RgSchErrInfo *err +) +#else +PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err) +RgSchDlSf *ulSf; +CmLteTimingInfo crntUlFrm; +RgSchCellCb *cell; +TfuCntrlReqInfo *cntrlInfo; +RgSchErrInfo *err; +#endif +{ + Inst inst = cell->instIdx; + S16 ret; + + TRC2(rgSCHTomUtlProcDlSfAtCrc); + + + cntrlInfo->numDlActvUes = 0; + cmLListInit(&cntrlInfo->phichLst); + cmLListInit(&cntrlInfo->dlPdcchLst); + cmLListInit(&cntrlInfo->ulPdcchLst); +#ifdef TFU_ALLOC_EVENT_NO_INIT + cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0; + cntrlInfo->cfi = 0; +#endif + + cntrlInfo->ulTiming = crntUlFrm; + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA); + + cntrlInfo->cellId = cell->cellId; + /* Fill PHICH info */ + if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for " + "cell"); + RGSCH_FREE_MEM(cntrlInfo); + RETVALUE(ret); + } + + /* Fill UL Pdcch */ + if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for " + "cell"); + RGSCH_FREE_MEM(cntrlInfo); + RETVALUE(ret); + } + +#ifdef EMTC_ENABLE + if(0 == cntrlInfo->ulMpdcchLst.count) + { + gUlMpdcchBlank++; + } +#endif + +#ifdef EMTC_ENABLE + if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo)) +#else + if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) +#endif + { + if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) + != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for" + " cell"); + } + } + else + { + RGSCH_FREE_MEM(cntrlInfo); + } + + RETVALUE(ROK); +} /* end of */ +#endif /* #ifdef RG_ULSCHED_AT_CRC*/ + +#ifdef RGR_RRM_TICK +/** @brief This function sends the SFN Tick to L3 + * subframe. + * + * @details + * + * Function: rgSCHTomUtlSendSfnTick + * + * @param [in] RgSchCellCb *cell + */ +#ifdef ANSI +PRIVATE Void rgSCHTomUtlSendSfnTick +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHTomUtlSendSfnTick (cell) +RgSchCellCb *cell; +#endif +{ + RgrTtiIndInfo *rgrTtiInd; + + TRC2(rgSCHTomUtlSendSfnTick); + + /* TTI to be sent to RRM only once per system frame */ + /* Added support for period = 0 to disable tick to RRM */ + if ((cell->rrmTtiIndPrd != 0) && + ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) && + (cell->crntTime.subframe == 0)) + { + /* Allocate a TTI indication structure and send to RRM over RGR interface */ + if (rgSCHUtlAllocSBuf (cell->instIdx, + (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK) + { + RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx), + "Mem alloc failed for RGR TTI ind, cellId (%d))\n", + cell->cellId)); + RETVOID; + } + rgrTtiInd->cellId = cell->cellId; + rgrTtiInd->hSfn = cell->crntTime.hSfn; + rgrTtiInd->sfn = cell->crntTime.sfn; + + if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK) + { + RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx), + "Failed to send RGR TTI ind, cellId (%d))\n", + cell->cellId)); + rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd, + sizeof(RgrTtiIndInfo)); + RETVOID; + } + } + RETVOID; +} +#endif + +#ifdef RG_5GTF + +/* @brief Mark Dyn TDD CrntSfIdx. + * + * @details + * + * Function: rgSCHDynTDDMrkCrntSfIdx + * Purpose: update the dyn tdd sunframe index + * @param[in] Inst schInst + * @RETVALUE None + */ +#ifdef ANSI +PRIVATE Void rgSCHDynTDDMrkCrntSfIdx +( +Inst schInst +) +#else /* ANSI */ +PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst) +Inst schInst; +#endif /* ANSI */ +{ + RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd); + + TRC2(rgSCHDynTDDMrkCrntSfIdx) + + RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx, + RG_SCH_DYNTDD_NOTDEF); + rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) % + RG_SCH_DYNTDD_MAX_SFINFO; + + //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx); + + RETVOID; +} + +#endif +/** @brief This function fills the TTI timinig info for each cell + * + * @details + * + * Function: rgSchTomFillCellTtiInfo + * + * @param [in] TfuTtiIndInfo *ttiInd + * @param [in] Inst schInst + * @param [out] U8 *nCell + * @param [out] RgSchCellCb *cell[] + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomFillCellTtiInfo +( +TfuTtiIndInfo *ttiInd, +Inst schInst, +U8 *nCell, +RgSchCellCb *cells[] +) +#else +PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells) +TfuTtiIndInfo *ttiInd; +Inst schInst; +U8 *nCell; +RgSchCellCb *cells[]; +#endif +{ + U8 i = 0; + U8 strtCellId; + TfuTtiCellInfo *cellInfo; + RgSchCellCb *cell; + U32 Idx1; + + CmLteTimingInfo frm; + + TRC2 (rgSchTomFillCellTtiInfo); + + if (CM_LTE_MAX_CELLS < ttiInd->numCells) + { + RETVOID; + } + +#ifdef RG_5GTF + rgSCHDynTDDMrkCrntSfIdx(schInst); +#endif + + for (i = 0; i < ttiInd->numCells; i++) + { + cellInfo = &ttiInd->cells[i]; + strtCellId = rgSchCb[schInst].genCfg.startCellId; + Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1)); + cell = rgSchCb[schInst].cells[Idx1]; + /* Validate the cell */ + if (cell == NULLP) + { + /* Use SCH inst 0 print buff */ + RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst), + "RgLiTfuTtiInd()No cell exists for cellId %d\n", + cellInfo->cellId)); + continue; + } + *nCell = *nCell + 1; + cells[i] = (RgSchCellCb *)cell; + + /* 4UE_TTI_DELTA */ + if(cell->schTickDelta != cellInfo->schTickDelta) + { + printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n" + "dlblankSf=%d ulblankSf=%d dummyTti=%d \n", + cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf, + cellInfo->isDummyTti); + } + RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta); + cell->schTickDelta = cellInfo->schTickDelta; + /* 4UE_TTI_DELTA */ + + cell->stopSiSch = cellInfo->dlBlankSf; + cell->stopDlSch = cellInfo->dlBlankSf; + cell->stopUlSch = cellInfo->ulBlankSf; + if (cellInfo->isDummyTti) + { + cell->stopDlSch = TRUE; + } + if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.subframe)) + { + //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.subframe); + } +#ifndef EMTC_ENABLE + RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime); + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time, + TFU_ULCNTRL_DLDELTA); + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime, + TFU_DLCNTRL_DLDELTA); + RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime, + TFU_RECPREQ_DLDELTA); + RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime, + TFU_HQFBKIND_ULDELTA); + RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime, + RGSCH_RLS_SF_IDX); +#else + RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime); + RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time, + TFU_ULCNTRL_DLDELTA); + RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime, + TFU_DLCNTRL_DLDELTA); + RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime, + TFU_RECPREQ_DLDELTA); + RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime, + TFU_HQFBKIND_ULDELTA); + RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime, + RGSCH_RLS_SF_IDX); +#endif + rgSCHCmnUpdVars(cell); + cell->isDlDataAllwd = TRUE; +/* Get DownLink SubFrame */ + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + frm = cell->crntTime; +#ifndef EMTC_ENABLE + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); +#else + RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA); +#endif + cellSch->dl.time = frm; + +#ifdef RG_PFS_STATS + cell->totalTime++; +#endif +#ifdef LTE_TDD + U8 idx = (cell->crntTime.subframe + RG_SCH_CMN_DL_DELTA) % + RGSCH_NUM_SUB_FRAMES_5G; + + cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx); + + /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/ + if((cell->crntTime.sfn == 0) && (cell->crntTime.subframe == 0)) + { + /* sfn Cycle used for Tdd UL Harq Proc Determination. + This sfn Cycle will have values from 0 to numUl Harq-1. */ + cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) % + (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]); + } +#endif +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + rgSCHUtlEmtcResPrcTti(cell); + } +#endif + } +} + +/** @brief This function prepares the TTI for scheduling and + * invokes the Common channel scheduler. Uplink scheduler + * is invoked first if UL Scheduling at CRC is not enabled + * + * @details + * + * Function: rgSchTomTtiUlAndDlCmnChSch + * + * @param [out] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomTtiUlAndDlCmnChSch +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell) +RgSchCellCb *cell; +#endif +{ + + TRC2(rgSchTomTtiUlAndDlCmnChSch); + + cell->rlsHqArr[cell->crntHqIdx].numUes = 0; + cell->crntHqIdx++; + cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES; + + cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr); + rgSCHMeasGapANRepTtiHndl (cell); + /* We need to fill the PHICH for the UL Data, first we need to get the UL + * SF from Scheduler, next we fill the dlSf that goes out this TTI. + * This must be performed prior to any other processing of the TTI + * so that we do not wrap around and generate feedback prior to + * reception of UL data. + */ +#ifndef RG_ULSCHED_AT_CRC + { + U8 Mval = 1; + U8 idx; /* Index into Uplink Sf array */ +#ifdef LTE_TDD + Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx] + [cell->hiDci0Time.subframe]; +#endif + if(Mval) + { + for(idx=0; idx < Mval; idx++) + { + rgSCHCmnRlsUlSf(cell, idx); + } + } + } +#endif + + /* DTX processing for those Harq's which did not get feedback from L1 */ + rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime); + /* Re-Init the Downlink subframe */ + rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime); + /* Added handling to retransmit + * release PDCCH in case of DTX + */ + + /*Check for DRX every TTI*/ + rgSCHDrxTtiInd(cell); + + /* For TDD, UL scheduling should happen after DL scheduling */ +#ifndef LTE_TDD +#ifndef RG_ULSCHED_AT_CRC + /* Perform UL scheduling */ + rgSCHCmnUlSch(cell); +#endif +#endif + /* Perform DL scheduling for Common channels */ + rgSCHCmnDlCommonChSch(cell); + + RETVOID; +} + +/** @brief This function invokes the Non critical procedures like measurements, + * and RGR configurations. + * + * @details + * + * Function: rgSchTomTtiMiscFunctions + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomTtiMiscFunctions +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSchTomTtiMiscFunctions (cell) +RgSchCellCb *cell; +#endif +{ + U8 suId = cell->tfuSap->sapCfg.suId; + + TRC2(rgSchTomTtiMiscFunctions); + + /* Invoke RAM Tti Handler */ + rgSCHRamTtiHndlr(cell); + + /* Handle RGR configurations */ + rgSCHGomTtiHndlr(cell, suId); +#ifdef LTE_L2_MEAS + if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld) + && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0))) + { + rgSCHUtlUpdAvgPrbUsage(cell); + } + rgSCHL2Meas(cell,FALSE); +#endif + + /* LTE_ADV_FLAG_REMOVED_START */ + /* Report ABS Load information to application periodically */ + if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) && + (cell->lteAdvCb.absCfg.absLoadPeriodicity)) + { + RgrLoadInfIndInfo *rgrLoadInf; + U8 idx; + + cell->lteAdvCb.absLoadTtiCnt++; + if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity) + { + /* ccpu00134492 */ + if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf, + sizeof(RgrLoadInfIndInfo)) != ROK) + { + RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not " + "allocate memory for sending LoadInfo\n")); + RETVOID; + } + cell->lteAdvCb.absLoadTtiCnt = 0; + rgrLoadInf->cellId = cell->cellId; + rgrLoadInf->bw = cell->bwCfg.dlTotalBw; + rgrLoadInf->type = RGR_ABS; + for(idx= 0; idxu.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx]; + cell->lteAdvCb.absLoadInfo[idx] = 0; + } + rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf); + } + } + +#ifdef LTE_TDD + if(cell->isDlDataAllwd) + { + /* Calling function to update CFI parameters*/ + rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA); + } + else + { + /* Incrementing the ttiCnt in case of UL subframe */ + if(!cell->dynCfiCb.switchOvrInProgress) + { + cell->dynCfiCb.ttiCnt++; + } + } +#else + rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA); +#endif + + /* LTE_ADV_FLAG_REMOVED_END */ + RETVOID; +} + + +/** @brief This function invokes the Downlink scheduler + * + * @details + * + * Function: rgSchTomTtiDlSch + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomTtiDlSch +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSchTomTtiDlSch (cell) +RgSchCellCb *cell; +#endif +{ + TRC2(rgSchTomTtiDlSch); + + if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE)) + { + rgSCHCmnDlSch(cell); + } + + RETVOID; +} + +/** @brief This function invokes Consolidates the allocations + * send the Subframe allocation info to MAC + * + * @details + * + * Function: rgSchTomTtiCnsldtSfAlloc + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomTtiCnsldtSfAlloc +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell) +RgSchCellCb *cell; +#endif +{ + RgSchDlSf *dlSf; + RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell); + + dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time); + + TRC2(rgSchTomTtiCnsldtSfAlloc); + + /* Prepare Subframe allocation info and send to MAC */ + rgSCHCmnCnsldtSfAlloc(cell); + + /* Call ACK NACK module to add to dlsf Queue */ + rgSCHAckNakRepAddToQ(cell, dlSf); + + rgSCHTomUtlProcTA(cell); + + RETVOID; +} + +/** @brief This function prepares the DL and UL Config requests + * and sends to CL + * + * @details + * + * Function: rgSchTomTtiL1DlAndUlCfg + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomTtiL1DlAndUlCfg +( +RgSchCellCb *cell, +RgTfuCntrlReqInfo *cntrlInfo +) +#else +PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo) +RgSchCellCb *cell; +RgTfuCntrlReqInfo *cntrlInfo; +#endif +{ + RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime); + RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time); + RgSchErrInfo err; + + TRC2(rgSchTomTtiL1DlAndUlCfg); + + rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err); + /* Mark this frame as sent */ + dlSf->txDone = TRUE; + + rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned; + rgBwAlcnt[dlSf->sfNum] ++; + + +#ifdef LTE_TDD + rgSCHTomUtlProcTddUlSf(cell); +#else + rgSCHTomUtlProcUlSf (cell, &err); +#endif + + RETVOID; +} +#ifdef LTE_TDD +/** @brief This function prepares does the Downlink subframe re-init and + * Harq DTX processing + * + * @details + * + * Function: rgSchTomUtlTddRlsSfAndHarq + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSchTomUtlTddRlsSfAndHarq +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell) +RgSchCellCb *cell; +#endif +{ + TRC2(rgSchTomUtlTddRlsSfAndHarq); + + /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2). + * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper + * UL subframes*/ + /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper + * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() + * as it is serving the purpose */ + if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe]. + numFdbkSubfrms) + { + /* ccpu00132341-MOD- Providing the UL SF timing for avoiding + * calculation inside the function */ + rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime); + rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime); + } + RETVOID; +} + +/** @brief This function processes the UL subframe and fills TFU reception + * request + * + * @details + * + * Function: rgSCHTomUtlProcTddUlSf + * + * @param [in] RgSchCellCb *cell + * + * Returns: Void + * + */ +#ifdef ANSI +PRIVATE Void rgSCHTomUtlProcTddUlSf +( +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHTomUtlProcTddUlSf (cell) +RgSchCellCb *cell; +#endif +{ + RgSchErrInfo err; + + TRC2(rgSCHTomUtlProcTddUlSf); + + if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] + [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME) + { + if (rgSCHTomUtlProcUlSf (cell, &err) != ROK) + { + /* fill in err type and call sta ind */ + RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx), + "Unable to process Uplink subframe for cellId (%d))\n", + cell->cellId)); + } + } + /* TDD Fix , to allow Special SF SRS CFg */ + else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx] + [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME) + { + if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK) + { + /* fill in err type and call sta ind */ + RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx), + "Unable to process Sipceial subframe for cellId (%d))\n", + cell->cellId)); + } + } + + RETVOID; +} +#endif + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrsch/rg_sch_uhm.c b/src/5gnrsch/rg_sch_uhm.c new file mode 100755 index 000000000..fa58038de --- /dev/null +++ b/src/5gnrsch/rg_sch_uhm.c @@ -0,0 +1,1086 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch_uhm.c + +**********************************************************************/ + +/** @file rg_sch_uhm.c +@brief This module handles uplink harq related functionality in MAC. +*/ + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ + +#include "gen.h" /* general */ +#include "ssi.h" /* system services */ + +#include "cm_lte.h" /* Common LTE */ +#include "cm_tkns.h" /* Common Token Defines */ +#include "cm_llist.h" /* Common Link List Defines */ +#include "cm_hash.h" /* Common Hash List Defines */ +#include "cm_mblk.h" /* memory management */ + +#include "rg_env.h" /* MAC Environment Defines */ +#include "tfu.h" /* TFU Interface defines */ +#include "rgr.h" /* RGR Interface defines */ +#include "lrg.h" /* LRG Interface defines */ + +#include "rg_sch.h" /* Scheduler defines */ +#include "rg_sch_inf.h" /* Scheduler defines */ +#include "rg_sch_err.h" /* MAC error defines */ + +/* header/extern include files (.x) */ +#include "gen.x" /* general */ +#include "ssi.x" /* system services */ +#include "cm5.x" /* system services */ +#include "cm_lte.x" /* Common LTE */ +#include "cm_tkns.x" /* Common Token Definitions */ +#include "cm_llist.x" /* Common Link List Definitions */ +#include "cm_lib.x" /* Common Library Definitions */ +#include "cm_hash.x" /* Common Hash List Definitions */ +#include "cm_mblk.x" /* memory management */ + +#include "tfu.x" /* TFU Interface defines */ +#include "rgr.x" /* RGR Interface includes */ +#include "lrg.x" /* LRG Interface includes */ +#include "rgm.x" +#include "rg_sch_inf.x" /* Scheduler defines */ +#include "rg_sch.x" /* Scheduler includes */ +#include "rg_sch_cmn.h" +#include "rg_sch_cmn.x" + +/* local defines */ + +/* local typedefs */ + +/* local externs */ + +/* forward references */ + +#ifdef EMTC_ENABLE + U32 gUlRetxPassCntr = 0; + /*EXTERN U32 gUlRetxFailCntr; + EXTERN U32 gUlCrcPassCounter; + EXTERN U32 gUlCrcFailCounter;*/ +#endif +PUBLIC U8 rgRvIdxTable[] = {0, 3, 1, 2}; /* This gives rvIdx for a given rv */ +PUBLIC U8 rgRvTable[] = {0, 2, 3 ,1}; /* This gives rv for a given rvIdx */ + +#ifdef EMTC_ENABLE +PUBLIC Void rgSCHCmnEmtcHdlHarqProcFail +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchUlHqProcCb *hqProc, +CmLteTimingInfo frm +); +PUBLIC Void rgSCHEmtcInitUlUeHqEnt +( +RgSchCellCb *cell, +RgrUeCfg *ueCfg, +RgSchUeCb *ueCb +); + +#endif + +/** + * @brief Handler for HARQ processing on recieving Data indication from PHY. + * + * @details + * + * Function: rgSCHUhmProcDatInd + * + * Invoked by: rgSCHTomTfuDatInd of TOM + * + * Processing Steps: + * - Set rcvdCrcInd variable to TRUE + * + * @param[in] *cell + * @param[in] *ue + * @param[in] frm + * @return Void + **/ +#ifndef MAC_SCH_STATS +#ifdef ANSI +PUBLIC Void rgSCHUhmProcDatInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm +) +#else +PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +#endif +#else /* MAC_SCH_STATS */ +#ifdef ANSI +PUBLIC Void rgSCHUhmProcDatInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm, +U8 cqi +) +#else +PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm, cqi) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +U8 cqi; +#endif +#endif /* MAC_SCH_STATS */ +{ + RgSchUlHqProcCb *hqProc; +#ifdef UL_LA + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + S32 iTbs; + U8 maxiTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend] + [ueUl->maxUlCqi]; +#endif + + TRC2(rgSCHUhmProcDatInd); + + rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc); + if (hqProc == NULLP) + { + printf("UE[%d] failed to find UL HqProc for [%d:%d]\n", + ue->ueId, frm.sfn, frm.subframe); + RETVOID; + } + hqProc->rcvdCrcInd = TRUE; + +#ifdef UL_LA + { + ueUl->ulLaCb.deltaiTbs += UL_LA_STEPUP; + iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; + + if (iTbs > maxiTbs) + { + ueUl->ulLaCb.deltaiTbs = (maxiTbs * 100) - ueUl->ulLaCb.cqiBasediTbs; + } + + } +#endif +#ifdef MAC_SCH_STATS + /** Stats update over here + */ + { + hqFailStats.ulCqiStat[cqi - 1].numOfAcks++; + } +#endif + +#ifdef TENB_STATS + /* UL stats are filled in primary index as of now */ + cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++; + if(hqProc->alloc) + { + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulTpt += (hqProc->alloc->grnt.datSz << 3); + cell->tenbStats->sch.ulTtlTpt +=(hqProc->alloc->grnt.datSz << 3);//pverma + } +#endif + + RETVOID; +} /* rgSCHUhmProcDatInd */ + +/** + * @brief Handler for HARQ processing on recieving Data indication from PHY. + * + * @details + * + * Function: rgSCHUhmProcMsg3DatInd + * + * Invoked by: rgSCHTomTfuDatInd of TOM + * + * Processing Steps: + * - Set rcvdCrcInd variable to TRUE + * + * @param[in,out] *hqProc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmProcMsg3DatInd +( +RgSchUlHqProcCb *hqProc +) +#else +PUBLIC Void rgSCHUhmProcMsg3DatInd(hqProc) +RgSchUlHqProcCb *hqProc; +#endif +{ + TRC2(rgSCHUhmProcMsg3DatInd); + hqProc->rcvdCrcInd = TRUE; + hqProc->remTx = 0; /*Reseting the value of rem Tx*/ + printf("\nrgSCHUhmProcMsg3DatInd,id:%u\n",hqProc->procId); + RETVOID; +} /* rgSCHUhmProcMsg3DatInd */ + +/** + * @brief Handler for HARQ processing on recieving Data indication from PHY. + * + * @details + * + * Function: rgSCHUhmProcMsg3Failure + * + * Invoked by: rgSCHTomTfuDatInd of TOM + * + * Processing Steps: + * - Set rcvdCrcInd variable to TRUE + * + * @param[in,out] *hqProc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmProcMsg3Failure +( +RgSchUlHqProcCb *hqProc +) +#else +PUBLIC Void rgSCHUhmProcMsg3Failure(hqProc) +RgSchUlHqProcCb *hqProc; +#endif +{ + TRC2(rgSCHUhmProcMsg3Failure); +#ifdef EMTC_ENABLE + RG_SCH_EMTC_IS_CRCIND_RCVD_CHK_RACB(hqProc); +#endif + if(hqProc->rcvdCrcInd != TRUE) + { + hqProc->rcvdCrcInd = FALSE; + } + + RETVOID; +} /* rgSCHUhmProcMsg3Failure */ + +/** + * @brief Handler for HARQ processing on recieving Decode failure from PHY. + * + * @details + * + * Function: rgSCHUhmProcHqFailure + * + * Invoked by: rgSCHTomTfuDecFailInd of TOM + * + * Processing Steps: + * - Update NACK information in harq info. + * - Update RV index of received RV from PHY in harq info. + * - Set PhichInfo in DlSf + * + * @param[in] *cell + * @param[in] *ue + * @param[in] frm + * @param[in] rv + * @return Void + **/ +#ifndef MAC_SCH_STATS +#ifdef ANSI +PUBLIC Void rgSCHUhmProcHqFailure +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm, +TknU8 rv +) +#else +PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +TknU8 rv; +#endif +#else /* MAC_SCH_STATS */ +#ifdef ANSI +PUBLIC Void rgSCHUhmProcHqFailure +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm, +TknU8 rv, +U8 cqi +) +#else +PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv, cqi) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +TknU8 rv; +U8 cqi; +#endif +#endif /* MAC_SCH_STATS */ +{ + RgSchUlHqProcCb *hqProc; +#ifdef UL_LA + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell); + S32 iTbs; +#endif + TRC2(rgSCHUhmProcHqFailure); + + rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc); + if (hqProc == NULLP) + { + printf("UE[%d] failed to find UL HqProc for [%d:%d]\n", + ue->ueId, frm.sfn, frm.subframe); + RETVOID; + } +#ifdef UL_LA + { + ueUl->ulLaCb.deltaiTbs -= UL_LA_STEPDOWN; + iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100; + + if (iTbs < 0) + { + ueUl->ulLaCb.deltaiTbs = -(ueUl->ulLaCb.cqiBasediTbs); + } + + } +#endif +#ifdef MAC_SCH_STATS + /** Stats update over here */ + { + static U32 retxCnt = 0; + ++retxCnt; + hqFailStats.ulCqiStat[cqi - 1].numOfNacks++; + } +#endif /* MAC_SCH_STATS */ + if(hqProc->rcvdCrcInd != TRUE) + { + hqProc->rcvdCrcInd = FALSE; + } +#ifdef TENB_STATS + /* UL stats are filled in primary index as of now */ + cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++; + cell->tenbStats->sch.ulNack[rgRvTable[hqProc->rvIdx]]++; + ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNackCnt++; +#endif + hqProc->rvIdxPhy.pres = rv.pres; + if(rv.pres) + { + hqProc->rvIdxPhy.val = rgRvIdxTable[rv.val]; + } + RETVOID; +} /* rgSCHUhmProcHqFailure */ + +/** + * @brief Handler for identifying the HARQ process cb associated with the + * index. + * + * @details + * + * Function: rgSCHUhmGetUlHqProc + * + * Processing Steps: + * - Return pointer to uplink harq process corresponding to the timing + * information passed. + * + * @param[in] *ue + * @param[in] idx + * @return RgSchUlHqProcCb* + * -# Pointer to harq process corresponding to index + * -# NULL + **/ +#ifdef ANSI +PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 idx +) +#else +PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc(cell, ue, idx) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 idx; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + TRC2(rgSCHUhmGetUlHqProc); + +#if (ERRCLASS & ERRCLS_DEBUG) + if(idx >= ueUl->hqEnt.numHqPrcs) + { + RETVALUE(NULLP); + } +#endif + RETVALUE(&(ueUl->hqEnt.hqProcCb[idx])); +} /* rgSCHUhmGetUlHqProc */ + +/** + * @brief Handler for HARQ processing on recieving new trasmission indication + * from USM. + * + * @details + * + * Function: rgSCHUhmNewTx + * + * Invoked by: USM + * + * Processing Steps: + * - Update harq info with values indicating new HARQ transmission. + * + * @param[in,out] *hqProc + * @param[in] *alloc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmNewTx +( +RgSchUlHqProcCb *hqProc, +U8 maxHqRetx, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUhmNewTx(hqProc, maxHqRetx, alloc) +RgSchUlHqProcCb *hqProc; +U8 maxHqRetx; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUhmNewTx); + + hqProc->ndi ^= 1; + hqProc->alloc = alloc; + hqProc->remTx = maxHqRetx; + hqProc->rcvdCrcInd = FALSE; + hqProc->rvIdx = 0; + hqProc->rvIdxPhy.pres = FALSE; +#ifdef LTE_L2_MEAS + if (hqProc->alloc->ue) + { + ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs++; + } +#endif + RETVOID; +} /* rgSCHUhmNewTx */ + +/** + * @brief Free an uplink HARQ process. + * + * @details + * + * Function: rgSCHUhmFreeProc + * + * Invoked by: USM + * + * Processing Steps: + * - Set alloc pointer to NULLP + * + * @param[in] RgSchUlHqProcCb *hqProc + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmFreeProc +( +RgSchUlHqProcCb *hqProc, +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHUhmFreeProc(hqProc, cell) +RgSchUlHqProcCb *hqProc; +RgSchCellCb *cell; +#endif +{ +#ifdef LTE_L2_MEAS + RgSchUeCb *ueCb; + U8 qci = 1; +#endif + TRC2(rgSCHUhmFreeProc); + +#ifdef LTE_L2_MEAS + if (hqProc->alloc && hqProc->alloc->ue) + { + ueCb = hqProc->alloc->ue; + if (ueCb && cell) + { + U32 nonLcg0ReportedBs = ((RgSchCmnLcg *)(ueCb->ul.lcgArr[1].sch))->reportedBs + \ + ((RgSchCmnLcg *)(ueCb->ul.lcgArr[2].sch))->reportedBs + \ + ((RgSchCmnLcg *)(ueCb->ul.lcgArr[3].sch))->reportedBs; + ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs--; + if (! ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs && !(nonLcg0ReportedBs)) + { + while (ueCb->ulActiveLCs) + { + if (ueCb->ulActiveLCs & 0x1) + { + cell->qciArray[qci].ulUeCount--; + } + qci++; + ueCb->ulActiveLCs >>= 1; + } + } + } + } +#endif + + + if(hqProc && (RgUeUlHqCb*)hqProc->hqEnt) + { + +#ifdef UL_ADPT_DBG + printf("\n\n########HARQ FREED HARQPROC ID (%d )after rgSCHUhmFreeProc inuse %ld free %ld \n",hqProc->alloc->grnt.hqProcId, (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,(CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count); +#endif + hqProc->alloc = NULLP; + hqProc->ulSfIdx = RGSCH_INVALID_INFO; + /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/ + hqProc->isRetx = FALSE; + hqProc->remTx = 0; /*Reseting the remTx value to 0*/ +#ifdef EMTC_ENABLE + RG_SCH_EMTC_SET_ISDTX_TO_FALSE(hqProc); +#endif + cmLListDelFrm(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse,&hqProc->lnk); + cmLListAdd2Tail(&((RgUeUlHqCb*)hqProc->hqEnt)->free, &hqProc->lnk); + + /* + printf("after rgSCHUhmFreeProc inuse %ld free %ld \n", + (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count, + (CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count); + */ + } + else + { + printf("\nhqEnt is NULL\n"); + } + RETVOID; +} /* rgSCHUhmFreeProc */ + +/** + * @brief Handler for HARQ processing on recieving re-trasmission + * indication from USM. + * + * @details + * + * Function: rgSCHUhmRetx + * + * Invoked by: USM + * + * Processing Steps: + * - Update harq info with values corresponding to + * re-transmission. + * + * @param[in,out] *hqProc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmRetx +( +RgSchUlHqProcCb *hqProc, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUhmRetx(hqProc, alloc) +RgSchUlHqProcCb *hqProc; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUhmRetx); + + hqProc->alloc = alloc; + --hqProc->remTx; + hqProc->rvIdx = (hqProc->rvIdx + 1) % 4; + hqProc->rvIdxPhy.pres = FALSE; + RETVOID; +} /* rgSCHUhmRetx */ + + +/** + * @brief Handler for initializing the HARQ entity. + * + * @details + * + * Function: rgSCHUhmRgrUeCfg + * + * Invoked by: RGR + * + * Processing Steps: + * - Initialize maxHqRetx + * + * @param[in] *cellCb + * @param[in,out] *ueCb + * @param[in] *ueCfg + * @param[out] *err + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmRgrUeCfg +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +RgrUeCfg *ueCfg +) +#else +PUBLIC Void rgSCHUhmRgrUeCfg(cellCb, ueCb, ueCfg) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +RgrUeCfg *ueCfg; +#endif +{ + U8 i; + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); + + TRC2(rgSCHUhmRgrUeCfg); + + ueUl->hqEnt.maxHqRetx = ((ueCfg->ueUlHqCfg.maxUlHqTx) - 1); +#ifdef TFU_UPGRADE + /* Storing the delta HARQ offset for HARQ + PUSCH */ + ueCb->ul.betaHqOffst = ueCfg->puschDedCfg.bACKIdx; +#endif + cmLListInit(&ueUl->hqEnt.free); + cmLListInit(&ueUl->hqEnt.inUse); + for(i=0; i < ueUl->hqEnt.numHqPrcs; i++) + { + ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt); + ueUl->hqEnt.hqProcCb[i].procId = i; + ueUl->hqEnt.hqProcCb[i].remTx = 0; + ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO; + ueUl->hqEnt.hqProcCb[i].alloc = NULLP; +#ifdef LTEMAC_SPS + /* ccpu00139513- Initializing SPS flags*/ + ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE; + ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE; +#endif + cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk); + ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i]; + } + +#ifdef EMTC_ENABLE + rgSCHEmtcInitUlUeHqEnt(cellCb, ueCfg, ueCb); +#endif + RETVOID; +} /* rgSCHUhmRgrUeCfg */ + +/** + * @brief Handler for re-initializing the HARQ entity. + * + * @details + * + * Function: rgSCHUhmRgrUeRecfg + * + * Invoked by: RGR + * + * Processing Steps: + * - Re-initialize maxHqRetx + * + * @param[in] *cellCb + * @param[in,out] *ueCb + * @param[in] *ueCfg + * @param[out] *err + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmRgrUeRecfg +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +RgrUeRecfg *ueRecfg +) +#else +PUBLIC Void rgSCHUhmRgrUeRecfg(cellCb, ueCb, ueRecfg) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +RgrUeRecfg *ueRecfg; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); + TRC2(rgSCHUhmRgrUeRecfg); + + /* [ccpu00123958]-ADD- Check for HARQ Reconfig from the bit mask */ + if(RGR_UE_ULHARQ_RECFG & ueRecfg->ueRecfgTypes) + { + ueUl->hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1); + } + + RETVOID; +} /* rgSCHUhmRgrUeRecfg */ + +/** + * @brief Handler for de-initializing the HARQ entity. + * + * @details + * + * Function: rgSCHUhmFreeUe + * + * Invoked by: RGR + * + * Processing Steps: + * - + * + * @param[in,out] *ueCb + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUhmFreeUe +( +RgSchCellCb *cellCb, +RgUeUlHqCb *hqEnt +) +#else +PUBLIC Void rgSCHUhmFreeUe(cellCb, hqEnt) +RgSchCellCb *cellCb; +RgUeUlHqCb *hqEnt; +#endif +{ + TRC2(rgSCHUhmFreeUe); +#ifdef LTE_TDD + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cellCb->instIdx, + (Data **)(&(hqEnt->hqProcCb)), + hqEnt->numHqPrcs * sizeof(RgSchUlHqProcCb)); +#endif + + RETVOID; +} /* rgSCHUhmFreeUe */ + + +/** +* @brief Handler for appending the PHICH information in to the dlSf. +* +* @details +* +* Function: rgSCHUhmAppendPhich +* +* Invoked by: TOM +* +* Processing Steps: +* - Set PhichInfo in DlSf for each Hq +* +* @param[in] *RgSchCellCb +* @param[in] CmLteTimingInfo +* @param[in] idx +* @return Void +*/ +#ifdef ANSI +PUBLIC S16 rgSCHUhmAppendPhich +( +RgSchCellCb *cellCb, +CmLteTimingInfo frm, +U8 idx +) +#else +PUBLIC S16 rgSCHUhmAppendPhich (cellCb, frm, idx) +RgSchCellCb *cellCb; +CmLteTimingInfo frm; +U8 idx; +#endif +{ + U8 nDmrs; + U8 rbStart; +#ifdef LTE_TDD + U8 iPhich; +#endif + RgSchUlAlloc *ulAlloc; +#ifdef LTEMAC_HDFDD + Bool allwNack = TRUE; +#endif /* LTEMAC_HDFDD */ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cellCb); + + TRC2(rgSCHUhmAppendPhich) + +#ifdef RG_5GTF + RETVALUE(ROK); +#endif + if(cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO) + { + ulAlloc = rgSCHUtlFirstHqFdbkAlloc (cellCb, idx); + while (ulAlloc) + { + /*ccpu00106104 MOD added check for ACKNACK rep*/ + /*added check for acknack so that adaptive retx considers ue + inactivity due to ack nack repetition*/ + if((ulAlloc->ue != NULLP) && ((TRUE != ulAlloc->forMsg3) && + ((ulAlloc->ue->measGapCb.isMeasuring == TRUE) || + (ulAlloc->ue->ackNakRepCb.isAckNakRep == TRUE)))) + { + /* Mark the UE for retransmission */ + /* If UE is measuring then we should not be sending PHICH unless msg3 */ + /*UE assumes ack, if nack then do adaptive re-transmission*/ + /*ulAlloc->hqProc->rcvdCrcInd = FALSE;--*/ + ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx); + continue; + } +#ifdef LTE_TDD + if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs, &iPhich) != ROK) +#else + if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs) != ROK) +#endif + { + RETVALUE (RFAILED); + } + if(nDmrs != RGSCH_INVALID_NDMRS) + { + if(cellCb->dynCfiCb.switchOvrInProgress) + { + ulAlloc->hqProc->rcvdCrcInd = TRUE; + } + + if(ulAlloc->hqProc->rcvdCrcInd) + { +#ifdef LTE_TDD + rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, iPhich); +#else + rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3); +#endif + } + /* Sending NACK in PHICH for failed UL TX */ + else + { +#ifdef LTE_TDD + rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, iPhich); +#else +#ifdef LTEMAC_HDFDD + if (ulAlloc->ue != NULLP && ulAlloc->ue->hdFddEnbld) + { + rgSCHCmnHdFddChkNackAllow( cellCb, ulAlloc->ue, frm, &allwNack); + /* Present implementaion of non-HDFDD does not send phich req + incase of NACK. So commented this part to maintain same right + now.*/ + + if (allwNack) + { + rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); + } + else + { + rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3); + } + } + else + { + rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); + } +#else + rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3); +#endif/* LTEMAC_HDFDD */ +#endif + } + } + ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx); + } + } + RETVALUE(ROK); +} /* rgSCHUhmAppendPhich */ + +/** + * @brief This function initializes the DL HARQ Entity of UE. + * + * @details + * + * Function: rgSCHUhmHqEntInit + * Purpose: This function initializes the UL HARQ Processes of + * UE control block. This is performed at the time + * of creating UE control block. + * + * Invoked by: configuration module + * + * @param[in] RgSchUeCb* ueCb + * @return S16 + * -# ROK + * -# RFAILED + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUhmHqEntInit +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb +) +#else +PUBLIC S16 rgSCHUhmHqEntInit(cellCb, ueCb) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb); +#ifdef LTE_TDD + Inst inst = ueCb->cell->instIdx; +#endif + TRC2(rgSCHUhmHqEntInit) + +#ifndef LTE_TDD + /* Init the HARQ processes */ + ueUl->hqEnt.numHqPrcs = RGSCH_NUM_UL_HQ_PROC; +#else + /* Init the HARQ processes */ + ueUl->hqEnt.numHqPrcs = + rgSchTddUlNumHarqProcTbl[ueCb->cell->ulDlCfgIdx]; + if (rgSCHUtlAllocSBuf(inst, (Data **)&ueUl->hqEnt.hqProcCb, + ueUl->hqEnt.numHqPrcs * \ + sizeof(RgSchUlHqProcCb)) != ROK) + { + RETVALUE(RFAILED); + } +#endif + + RETVALUE(ROK); +} /* rgSCHUhmHqEntInit */ + +#ifdef RG_5GTF +/** + * @brief This function gets an available HARQ process. + * + * @details + * + * Function: rgSCHUhmGetAvlHqProc + * Purpose: This function returns an available HARQ process in + * the UL direction. All HARQ processes are maintained + * in queues of free and inuse. + * + * 1. Check if the free queue is empty. If yes, return + * RFAILED + * 2. If not empty, update the proc variable with the + * first process in the queue. Return ROK. + * + * Invoked by: scheduler + * + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo timingInfo + * @param[out] RgSchDlHqProc **hqP + * @return S16 + * -#ROK if successful + * -#RFAILED otherwise + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUhmGetAvlHqProc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchUlHqProcCb **hqP +) +#else +PUBLIC S16 rgSCHUhmGetAvlHqProc (cell, ue, hqP) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchUlHqProcCb **hqP; +#endif +{ + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + RgSchUlHqProcCb *tmpHqProc; + CmLList *tmp; + RgUeUlHqCb *hqE; + + TRC2(rgSCHUhmGetAvlHqProc); + + hqE = &ueUl->hqEnt; + + CM_LLIST_FIRST_NODE(&(hqE->free), tmp); + + if (NULLP == tmp) + { + //RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, + // "rgSCHUhmGetAvlHqProc free %ld inUse %ld ue %d" + // , hqE->free.count, hqE->inUse.count, ue->ueId); + //printf("5GTF_ERROR rgSCHUhmGetAvlHqProc cellId %d %ld inUse %ld ue %d" + //, cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId); + /* No Harq Process available in the free queue. */ + RETVALUE(RFAILED); + } + + tmpHqProc = (RgSchUlHqProcCb *)(tmp->node); + + /* Remove the element from the free Queue */ + cmLListDelFrm(&hqE->free, tmp); + + /* Add the element into the inUse Queue as well */ + cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk); + +#ifdef UL_ADPT_DBG + printf("rgSCHUhmGetAvlHqProc cellId %d free %ld inUse %ld ue %d time (%d %d)\n",cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId,cellUl->schdTime.sfn,cellUl->schdTime.subframe); +#endif + tmpHqProc->schdTime = cellUl->schdTime; + + *hqP = tmpHqProc; + + RETVALUE(ROK); +} /* rgSCHUhmGetAvlHqProc */ + +/** + * @brief Handler for identifying the HARQ process cb associated with the + * TX Time. + * + * @details + * + * Function: rgSCHUhmGetUlProcByTime + * + * Processing Steps: + * - Return pointer to uplink harq process corresponding to the timing + * information passed. + * + * @param[in] *ue + * @param[in] idx + * @return RgSchUlHqProcCb* + * -# Pointer to harq process corresponding to index + * -# NULL + **/ +#ifdef ANSI +PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm +) +#else +PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime(cell, ue, frm) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +#endif +{ + RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell); + CmLListCp *lst = &ueUl->hqEnt.inUse; + CmLList *lnk = lst->first; + RgSchUlHqProcCb *proc; + + TRC2(rgSCHUhmGetUlProcByTime); + + while (lnk) + { + proc = (RgSchUlHqProcCb *)(lnk->node); + lnk = lnk->next; + // printf("compare rgSCHUhmGetUlProcByTime time (%d %d) CRC time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe,frm.sfn,frm.subframe ,proc->procId); + if (RGSCH_TIMEINFO_SAME(proc->schdTime, frm)) + { + // printf("Harq timing Matched rgSCHUhmGetUlProcByTime time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe, proc->procId); + RETVALUE(proc); + } + } + + RETVALUE(NULLP); +} /* rgSCHUhmGetUlProcByTime */ +#endif + + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrsch/rg_sch_utl.c b/src/5gnrsch/rg_sch_utl.c new file mode 100755 index 000000000..2be7491ec --- /dev/null +++ b/src/5gnrsch/rg_sch_utl.c @@ -0,0 +1,12639 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/************************************************************************ + + Name: LTE-MAC layer + + Type: C source file + + Desc: C source code for Entry point fucntions + + File: rg_sch_utl.c + +**********************************************************************/ + +/** @file rg_sch_utl.c +@brief This file implements the schedulers main access to MAC layer code. +*/ + +static const char* RLOG_MODULE_NAME="MAC"; +static int RLOG_MODULE_ID=4096; +static int RLOG_FILE_ID=177; + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" +#include "rgr.h" +#include "tfu.h" +#include "rg_env.h" +#include "rg_sch_err.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "rg_sch_cmn.h" +#include "rgm.h" +#include "rl_interface.h" +#include "rl_common.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "rgr.x" /* layer management typedefs for MAC */ +#include "rgm.x" +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "rg_sch.x" /* typedefs for Scheduler */ +#include "rg_sch_cmn.x" /* typedefs for Scheduler */ +#ifdef EMTC_ENABLE +#include "rg_sch_emtc_ext.x" +#endif + + +/* SR_RACH_STATS */ +U32 rgNumPrachRecvd =0; /* Num of Rach Req received including dedicated preambles */ +U32 rgNumRarSched =0; /* Num of RARs sent */ +U32 rgNumBI =0; /* Num of BackOff Ind sent */ +U32 rgNumMsg3CrcPassed =0; /* Num of CRC success for Msg3 */ +U32 rgNumMsg3CrcFailed =0; /* Num of CRC fail for Msg 3 */ +U32 rgNumMsg3FailMaxRetx =0; /* Num of Msg3 fail after Max Retx attempts */ +U32 rgNumMsg4Ack =0; /* Num of Acks for Msg4 Tx */ +U32 rgNumMsg4Nack =0; + /* Num of Nacks for Msg4 Tx */ +U32 rgNumMsg4FailMaxRetx =0; /* Num of Msg4 Tx failed after Max Retx attempts */ +U32 rgNumSrRecvd =0; /* Num of Sched Req received */ +U32 rgNumSrGrant =0; /* Num of Sched Req Grants sent */ +U32 rgNumMsg3CrntiCE =0; /* Num of Msg 3 CRNTI CE received */ +U32 rgNumDedPream =0; /* Num of Dedicated Preambles recvd */ +U32 rgNumMsg3CCCHSdu =0; /* Num of Msg 3 CCCH Sdus recvd */ +U32 rgNumCCCHSduCrntiNotFound =0; /*UE Ctx not found for CCCH SDU Msg 3 */ +U32 rgNumCrntiCeCrntiNotFound =0; /*UE Ctx not found for CRNTI CE Msg 3 */ +U32 rgNumMsg4WithCCCHSdu =0; /* Num of Msg4 with CCCH Sdu */ +U32 rgNumMsg4WoCCCHSdu =0; /* Num of Msg4 without CCCH Sdu */ +U32 rgNumMsg4Dtx =0; /* Num of DTX received for Msg 4 */ +U32 rgNumMsg3AckSent =0; /* Num of PHICH Ack sent for Msg 3 */ +U32 rgNumMsg3NackSent =0; /* Num of PHICH Nack sent for Msg 3 */ +U32 rgNumMsg4PdcchWithCrnti =0; /* Num of PDCCH for CRNTI based contention resolution */ +U32 rgNumRarFailDuetoRntiExhaustion =0; /* Num of RACH Failures due to RNTI pool exhaution */ +U32 rgNumTAModified =0; /* Num of times TA received is different from prev value */ +U32 rgNumTASent =0; /* Num of TA Command sent */ +U32 rgNumMsg4ToBeTx =0; /* Num of times MSG4 that should be sent */ +U32 rgNumMsg4Txed =0; /* Num of MSG4 actually sent *//* ysNumMsg4ToBeTx -ysNumMsg4Txed == Failed MSG4 TX */ +U32 rgNumMsg3DtxRcvd =0; /* CRC Fail with SINR < 0 */ + +U32 rgNumDedPreamUECtxtFound =0; /* Num of Dedicated Preambles recvd */ + +PRIVATE U8 rgSchDciAmbigSizeTbl[61] = {0,0,0,0,0,0,0,0,0,0,0, + 0,1,0,1,0,1,0,0,0,1, + 0,0,0,1,0,1,0,0,0,0, + 0,1,0,0,0,0,0,0,0,1, + 0,0,0,1,0,0,0,0,0,0, + 0,0,0,0,0,1,0,0,0,0}; + +/* local defines */ + +EXTERN U32 rgSchCmnBetaCqiOffstTbl[16]; +EXTERN U32 rgSchCmnBetaRiOffstTbl[16]; +EXTERN RgSchdApis rgSchCmnApis; +EXTERN PUBLIC S16 RgUiRgmSendPrbRprtInd ARGS(( +Pst* pst, +SuId suId, +RgmPrbRprtInd *prbRprtInd +)); + +EXTERN PUBLIC S16 RgUiRgmSendTmModeChangeInd ARGS(( +Pst* pst, +SuId suId, +RgmTransModeInd *txModeChngInd +)); +#ifdef EMTC_ENABLE +EXTERN PUBLIC S16 rgSCHEmtcUtlGetSfAlloc ARGS(( +RgSchCellCb *cell +)); +EXTERN PUBLIC S16 rgSCHEmtcUtlPutSfAlloc ARGS(( +RgSchCellCb *cell +)); +EXTERN PUBLIC Void rgSCHEmtcUtlUpdUeDciSize ARGS(( +RgSchCellCb *cell, +RgSchUeCb *ueCb +)); +EXTERN PUBLIC Void rgSCHEmtcGetDciFrmt61ASize ARGS(( +RgSchCellCb *cell +)); +EXTERN PUBLIC Void rgSCHEmtcGetDciFrmt60ASize ARGS(( +RgSchCellCb *cell +)); +EXTERN PUBLIC S16 rgSCHEmtcUtlFillPdschDciInfo ARGS(( +TfuPdschDciInfo *pdsch, +TfuDciInfo *pdcchDci +)); +EXTERN PUBLIC Void rgSCHEmtcUtlRlsRnti ARGS(( +RgSchCellCb *cell, +RgSchRntiLnk *rntiLnk, +U8 *isLegacy +)); +EXTERN PUBLIC S16 rgSCHEmtcPdcchAlloc ARGS(( +RgSchCellCb *cell, +RgSchPdcch *pdcch +)); +EXTERN PUBLIC Void rgSCHEmtcPdcchFree ARGS(( +RgSchCellCb *cell, +RgSchPdcch *pdcch +)); +#endif +/* Functions specific to TM1/TM2/TM6/TM7 for PRB calculation*/ +PUBLIC Void rgSchUtlDlCalc1CwPrb ARGS(( RgSchCellCb *cell, + RgSchUeCb *ue, + U32 bo, + U32 *prbReqrd)); + +/* Functions specific to TM3/TM4 for PRB calculation*/ +PUBLIC Void rgSchUtlDlCalc2CwPrb ARGS(( RgSchCellCb *cell, + RgSchUeCb *ue, + U32 bo, + U32 *prbReqrd)); + +#ifdef LTE_ADV +PUBLIC RgSchCellCb* rgSchUtlGetCellCb ARGS(( Inst inst, + U16 cellId +)); +#endif + +typedef Void (*RgSchUtlDlCalcPrbFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, + U32 bo, U32 *prbRequrd)); +#ifndef LTE_ADV +/* Functions specific to each transmission mode for PRB calculation*/ +RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[7] = {rgSchUtlDlCalc1CwPrb, +rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb, +NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb}; + +#else +/* Functions specific to each transmission mode for PRB calculation*/ +RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[9] = {rgSchUtlDlCalc1CwPrb, +rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb, +NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb, NULLP, NULLP}; + +#endif + +#ifdef LTE_TDD +/* The below table will be used to map the UL SF number in a TDD Cfg 0 + frame to the ul Sf array maintained in cellCb */ +PRIVATE U8 rgSchTddCfg0UlSfTbl[] = {2, 3, 4, 7, 8, 9}; +#endif + +PRIVATE S16 rgSCHUtlUlAllocDbInit ARGS(( + RgSchCellCb *cell, + RgSchUlAllocDb *db, + U8 maxAllocs + )); +PRIVATE Void rgSCHUtlUlAllocDbDeinit ARGS(( + RgSchCellCb *cell, + RgSchUlAllocDb *db + )); +PRIVATE S16 rgSCHUtlUlHoleDbInit ARGS(( + RgSchCellCb *cell, + RgSchUlHoleDb *db, + U8 maxHoles, + U8 start, + U8 num + )); +PRIVATE Void rgSCHUtlUlHoleDbDeinit ARGS(( + RgSchCellCb *cell, + RgSchUlHoleDb *db + )); + +PRIVATE S16 rgSCHChkBoUpdate ARGS(( + RgSchCellCb *cell, + RgInfCmnBoRpt *boUpdt + )); +#ifdef TFU_UPGRADE +PRIVATE U8 rgSCHUtlFetchPcqiBitSz ARGS(( + RgSchCellCb *cell, + RgSchUeCb *ueCb, + U8 numTxAnt + )); +#endif +/* sorted in ascending order of tbSz */ +CONSTANT struct rgSchUtlBcchPcchTbSz +{ + U8 rbIndex; /* RB index {2,3} */ + U16 tbSz; /* one of the Transport block size in bits of + * rbIndex 2 or 3 */ + /* Corrected allocation for common channels */ + U8 mcs; /* imcs */ +} rgSchUtlBcchPcchTbSzTbl[44] = { + { 2, 32, 0 }, { 2, 56, 1 }, { 2, 72, 2 }, { 3, 88, 1 }, + { 2, 104, 3 }, { 2, 120, 4 }, { 2, 144, 5 }, { 2, 176, 6 }, + { 3, 208, 4 }, { 2, 224, 7 }, { 2, 256, 8 }, { 2, 296, 9 }, + { 2, 328, 10 }, { 2, 376, 11 }, { 3, 392, 8 }, { 2, 440, 12 }, + { 3, 456, 9 }, { 2, 488, 13 }, { 3, 504, 10 }, { 2, 552, 14 }, + { 3, 584, 11 }, { 2, 600, 15 }, { 2, 632, 16 }, { 3, 680, 12 }, + { 2, 696, 17 }, { 3, 744, 13 }, { 2, 776, 18 }, { 2, 840, 19 }, + { 2, 904, 20 }, { 3, 968, 16 }, { 2, 1000, 21 }, { 2, 1064, 22 }, + { 2, 1128, 23 }, { 3, 1160, 18 }, { 2, 1192, 24 }, { 2, 1256, 25 }, + { 3, 1288, 19 }, { 3, 1384, 20 }, { 2, 1480, 26 }, { 3, 1608, 22 }, + { 3, 1736, 23 }, { 3, 1800, 24 }, { 3, 1864, 25 }, { 3, 2216, 26 } +}; + +/* local typedefs */ + +/* local externs */ + +/* forward references */ +#ifdef LTE_TDD +PRIVATE Void rgSCHUtlUpdPrachOcc ARGS(( +RgSchCellCb *cell, +RgrTddPrachInfo *cellCfg)); +#endif + +#define RGSCH_NUM_PCFICH_REG 4 +#define RGSCH_NUM_REG_PER_CCE 9 +#define RGSCH_NUM_REG_PER_PHICH_GRP 3 + +#ifdef LTE_TDD +#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _iPhich) {\ + (_phich)->hqFeedBack = _hqFeedBack; \ + (_phich)->rbStart = _rbStart; \ + (_phich)->nDmrs = _nDmrs; \ + (_phich)->iPhich = _iPhich; \ + (_phich)->lnk.next = NULLP; \ + (_phich)->lnk.prev = NULLP; \ + (_phich)->lnk.node = (PTR)(_phich); \ +} +#else +#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _isForMsg3) {\ + (_phich)->hqFeedBack = _hqFeedBack; \ + (_phich)->rbStart = _rbStart; \ + (_phich)->nDmrs = _nDmrs; \ + (_phich)->isForMsg3 = _isForMsg3; \ + (_phich)->lnk.next = NULLP; \ + (_phich)->lnk.prev = NULLP; \ + (_phich)->lnk.node = (PTR)(_phich); \ +} +#endif + +#define RGSCH_PHICH_ALLOC(_inst,_dataPtr, _size, _ret) {\ + _ret = rgSCHUtlAllocSBuf(_inst, (Data **)&_dataPtr, _size); \ +} + +/* ccpu00117052 - MOD - Passing double pointer +for proper NULLP assignment*/ +#define RGSCH_PHICH_FREE(_inst, _dataPtr, _size) {\ + rgSCHUtlFreeSBuf(_inst, (Data **)(&(_dataPtr)), _size); \ +} + +#ifdef TFU_UPGRADE +#define RGSCH_GETBIT(a, b) ((((U8*)a)[(b)>>3] >> ((7-((b)&7)))) & 1) + +/* +* +* Fun: rgSCHUtlPower +* +* Desc: This function finds of the Power of x raised to n +* +* Ret: value of x raised to n +* +* Notes: None +* +* File: rg_sch_utl.c +* +*/ +#ifdef ANSI +PUBLIC F64 rgSCHUtlPower +( +F64 x, +F64 n +) +#else +PUBLIC F64 rgSCHUtlPower(x, n) +F64 x; +F64 n; +#endif +{ + if( n==0 ) + { + RETVALUE( 1 ); + } + else if ( n>0 ) + { + RETVALUE( x * rgSCHUtlPower( x, n-1 ) ); + } + else + { + RETVALUE( (1/x) * rgSCHUtlPower( x, n+1 ) ); + } +} /* end of rgSCHUtlPower*/ + +/* +* +* Fun: rgSCHUtlParse +* +* Desc: This function parses bits x to y of an array and +* returns the integer value out of it. +* +* Ret: integer value of z bits +* +* Notes: None +* +* File: rg_sch_utl.c +* +*/ +#ifdef ANSI +PUBLIC U32 rgSCHUtlParse +( +U8 *buff, +U8 startPos, +U8 endPos, +U8 buffSize +) +#else +PUBLIC U32 rgSCHUtlParse(buff, startPos, endPos, buffSize) +U8 *buff; +U8 startPos; +U8 endPos; +U8 buffSize; +#endif +{ + U8 pointToChar,pointToEnd, loop; + U8 size = endPos - startPos; + F64 result = 0; + TRC2(rgSCHUtlParse); + pointToEnd = (startPos)%8; + for ( loop=0; loopinstIdx; + S16 ret; + U16 offsetStepMask; + + TRC2(rgSCHUtlPdcchAvail); + + /* V5G_213 : 10.1 */ + offset = 0; + byte = &pdcchInfo->map[0]; + initMask = (0xffff >> (16 - aggrLvl)); + currMask = initMask; + /* if N(symbol, xPDCCH) =2, then xPDCCH will be candidates in + * search space of index {0,1,2,3} and {8,9,..14} + */ + if ((cell->cell5gtfCb.cfi == 2) && (aggrLvl == CM_LTE_AGGR_LVL2)) + { + offsetStepMask = 0xc; + } + else + { + offsetStepMask = 0xc0; + } + + /* Loop till the number of bytes available in the CCE map */ + while (offset < ((pdcchInfo->nCce+ 7) >> 3)) + { + byte = &pdcchInfo->map[offset]; + /* Checking for available CCE */ + if ((*byte & currMask) == 0) + { + break; + } + /* if the number of CCEs required are not available, move to next offset */ + if (currMask & offsetStepMask) + { + offset++; + currMask = initMask; + } + else + { + /* Move to the next available CCE index in the current byte(cce map) */ + currMask = currMask << aggrLvl; + } + } + + if ((offset >= ((pdcchInfo->nCce + 7) >> 3)) || + ((aggrLvl == CM_LTE_AGGR_LVL16) && (offset > 0))) + { + RETVALUE(FALSE); + } + + byte = &pdcchInfo->map[offset]; + + if (cell->pdcchLst.first != NULLP) + { + *pdcch = (RgSchPdcch *)(cell->pdcchLst.first->node); + cmLListDelFrm(&cell->pdcchLst, cell->pdcchLst.first); + } + else + { + ret = rgSCHUtlAllocSBuf(inst, (Data **)pdcch, sizeof(RgSchPdcch)); + if(ROK != ret) + { + RETVALUE(FALSE); + } + } + + if (*pdcch) + { + (*byte) |= currMask; + /* ALL CCEs will be used in case of level 16 */ + if (aggrLvl == CM_LTE_AGGR_LVL16) + { + *(byte+1) |= currMask; + } + (*pdcch)->aggrLvl = aggrLvl; + cmLListAdd2Tail(&pdcchInfo->pdcchs, &((*pdcch)->lnk)); + (*pdcch)->lnk.node = (PTR)*pdcch; + (*pdcch)->nCce = aggrLvl; + (*pdcch)->ue = NULLP; + } + RETVALUE(TRUE); +} + + + +/** + * @brief This function releases a PDCCH + * + * @details + * + * Function: rgSCHUtlPdcchPut + * Purpose: This function releases a PDCCH. + * steps: + * 1. Locate the set of bits that represent the PDCCH for + * the provided location. + * 2. Set all of the bits to zero. + * 3. Release the memory of PDCCH to the cell free Q + * + * Invoked by: scheduler + * + * @param[in] RgSchPdcchInfo* pdcchInfo + * @param[in] U8 loc + * @param[in] U8 aggrLvl + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlPdcchPut +( +RgSchCellCb *cell, +RgSchPdcchInfo *pdcchInfo, +RgSchPdcch *pdcch +) +#else +PUBLIC Void rgSCHUtlPdcchPut(cell, pdcchInfo, pdcch) +RgSchCellCb *cell; +RgSchPdcchInfo *pdcchInfo; +RgSchPdcch *pdcch; +#endif +{ + U8 *byte; + U8 offset; + U8 mask; + + TRC2(rgSCHUtlPdcchPut); + + switch(pdcch->aggrLvl) + { + case CM_LTE_AGGR_LVL2: + offset = (pdcch->nCce >> 1) & 3; + mask = 0x3 << (offset * 2); /*ccpu00128826 - Offset Correction */ + break; + case CM_LTE_AGGR_LVL4: + offset = (pdcch->nCce >> 2) & 1; + mask = 0xf << (offset * 4);/*ccpu00128826 - Offset Correction */ + break; + case CM_LTE_AGGR_LVL8: + mask = 0xff; + break; + case CM_LTE_AGGR_LVL16: + mask = 0xffff; + break; + default: + RETVOID; + } + /* Placing common computation of byte from all the cases above here + for optimization */ + byte = &pdcchInfo->map[pdcch->nCce >> 3]; + + cmLListDelFrm(&pdcchInfo->pdcchs, &pdcch->lnk); + cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk); + pdcch->lnk.node = (PTR)pdcch; + pdcch->ue = NULLP; + (*byte) &= ~mask; + + RETVOID; +} + + +/** + * @brief This function initializes PDCCH information for frame + * + * @details + * + * Function: rgSCHUtlPdcchInit + * Purpose: This function initializes PDCCH information for + * a subframe. It removes the list of PDCCHs allocated + * in the prior use of this subframe structure. + * + * Invoked by: rgSCHUtlSubFrmPut + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlPdcchInit +( +RgSchCellCb *cell, +RgSchDlSf *subFrm, +U16 nCce +) +#else +PUBLIC Void rgSCHUtlPdcchInit(cell, subFrm, nCce) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +U16 nCce; +#endif +{ + RgSchPdcchInfo *pdcchInfo; + RgSchPdcch *pdcch; + Inst inst = cell->instIdx; + U8 extraBits; + U32 cceMapSz; + + TRC2(rgSCHUtlPdcchInit); + + pdcchInfo = &subFrm->pdcchInfo; + while(pdcchInfo->pdcchs.first != NULLP) + { + pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node; + cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first); + cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk); + pdcch->ue = NULLP; + } + cmLListInit(&pdcchInfo->pdcchs); + +#ifdef LTEMAC_SPS + subFrm->relPdcch = NULLP; +#endif + + cceMapSz = ((pdcchInfo->nCce + 7) >> 3); + + /* The bitMap array size is the number of ceiling(CCEs/8) */ + /* If nCce received is not the same as the one stored in + * pdcchInfo, free the pdcchInfo map */ + + if(pdcchInfo->nCce != nCce) + { + if(pdcchInfo->nCce) + { + rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)), cceMapSz); + } + pdcchInfo->nCce = nCce; + cceMapSz = ((pdcchInfo->nCce + 7) >> 3); + rgSCHUtlAllocSBuf(inst, (Data **)&pdcchInfo->map, + cceMapSz); + if (pdcchInfo->map == NULLP) + { + /* Generate log error here */ + RETVOID; + } + } + + cmMemset(subFrm->pdcchInfo.map, 0, cceMapSz); + /* If nCce is not exactly same as the bitMap size(no of bits allocated + * to represent the Cce's, then mark the extra bits as unavailable + extra bits = (((pdcchInfo->nCce + 7) >> 3)*8) - pdcchInfo->nCce + The last byte of bit map = subFrm->pdcchInfo.map[((pdcchInfo->nCce + 7) >> 3) - 1] + NOTE : extra bits are most significant of the last byte eg. */ + extraBits = (cceMapSz)*8 - pdcchInfo->nCce; + subFrm->pdcchInfo.map[cceMapSz - 1] |= + ((1 << extraBits) - 1) << (8 - extraBits); + RETVOID; +} + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + * @brief This function frees Pool + * @details + * + * Function: rgSchSFRTotalPoolFree + * + * Invoked by: rgSchSFRTotalPoolInit + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSchSFRTotalPoolFree +( + RgSchSFRTotalPoolInfo *sfrTotalPoolInfo, + RgSchCellCb *cell + ) +#else +PUBLIC Void rgSchSFRTotalPoolFree(sfrTotalPoolInfo, cell) + RgSchSFRTotalPoolInfo *sfrTotalPoolInfo; + RgSchCellCb *cell; +#endif +{ + CmLListCp *l; + CmLList *n; + TRC2(rgSchSFRTotalPoolFree); + + /*Deinitialise if these cc pools and ce pools are already existent*/ + l = &sfrTotalPoolInfo->ccPool; + n = cmLListFirst(l); + while (n != NULL) + { + /*REMOVING Cell Centred POOLS IF ANY*/ + n = cmLListDelFrm(l, n); + + /* Deallocate buffer */ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo)); + + /* Deallocate buffer */ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList)); + n = cmLListNext(l); + } + + /*REMOVING Cell Edged POOLS IF ANY*/ + l = &sfrTotalPoolInfo->cePool; + n = cmLListFirst(l); + while (n != NULL) + { + n = cmLListDelFrm(l, n); + + /* Deallocate buffer */ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo)); + + /* Deallocate buffer */ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList)); + n = cmLListNext(l); + } + +} + +/** + * @brief This function resets temporary variables in Pool + * @details + * + * Function: rgSchSFRResetPoolVariables + * + * Invoked by: rgSCHSFRUtlTotalPoolInit + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSchSFRTotalPoolInit +( + RgSchCellCb *cell, + RgSchDlSf *sf + ) +#else +PRIVATE Void rgSchSFRTotalPoolInit(cell, sf) + RgSchCellCb *cell; + RgSchDlSf *sf; +#endif +{ + /* Initialise the variables */ + RgSchSFRPoolInfo *sfrCCPool; + RgSchSFRPoolInfo *sfrCEPool; + CmLListCp *l; + CmLList *n; + CmLList *temp = NULLP; + S16 ret = 0; + + TRC2(rgSchSFRTotalPoolInit); + + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell); + sf->sfrTotalPoolInfo.CCPool1BwAvlbl = 0; + sf->sfrTotalPoolInfo.CCPool2BwAvlbl = 0; + sf->sfrTotalPoolInfo.CEPoolBwAvlbl = 0; + sf->sfrTotalPoolInfo.CC1 = FALSE; + sf->sfrTotalPoolInfo.CC2 = FALSE; + /*Initialise the CE Pools*/ + cmLListInit (&(sf->sfrTotalPoolInfo.cePool)); + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CE Pool memory allocation FAILED for cell"); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell); + RETVALUE(RFAILED); + } + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CE Pool memory allocation FAILED for cell "); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); + RETVALUE(RFAILED); + } + + l = &sf->sfrTotalPoolInfo.cePool; + cmLListAdd2Tail(l, temp); + + /*Initialise Bandwidth and startRB and endRB for each pool*/ + n = cmLListFirst(l); + + /* Initialise the CE Pools */ + sfrCEPool = (RgSchSFRPoolInfo*)n->node; + + sfrCEPool->poolstartRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb; + sfrCEPool->poolendRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb; + sfrCEPool->bw = sfrCEPool->poolendRB - sfrCEPool->poolstartRB + 1; + sf->sfrTotalPoolInfo.CEPoolBwAvlbl = sfrCEPool->bw; + + sfrCEPool->bwAlloced = 0; + sfrCEPool->type2Start = sfrCEPool->poolstartRB; + sfrCEPool->type2End = RGSCH_CEIL(sfrCEPool->poolstartRB, cell->rbgSize); + sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1; + sfrCEPool->pwrHiCCRange.startRb = 0; + sfrCEPool->pwrHiCCRange.endRb = 0; + + /*Initialise CC Pool*/ + cmLListInit (&(sf->sfrTotalPoolInfo.ccPool)); + + /*Add memory and Update CCPool*/ + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CC Pool memory allocation FAILED for cell "); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); + RETVALUE(RFAILED); + } + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CC Pool memory allocation FAILED for cell "); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); + RETVALUE(RFAILED); + } + + l = &sf->sfrTotalPoolInfo.ccPool; + cmLListAdd2Tail(l, temp); + + /*Initialise Bandwidth and startRB and endRB for each pool*/ + if(sfrCEPool->poolstartRB) + { + n = cmLListFirst(l); + sfrCCPool = (RgSchSFRPoolInfo*)n->node; + + sfrCCPool->poolstartRB = 0; + sfrCCPool->poolendRB = sfrCEPool->poolstartRB - 1; + sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; + sf->sfrTotalPoolInfo.CCPool1BwAvlbl = sfrCCPool->bw; + sfrCCPool->bwAlloced = 0; + sfrCCPool->type2Start = 0; + sfrCCPool->type2End = 0; + sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; + sf->sfrTotalPoolInfo.CC1 = TRUE; + sfrCCPool->pwrHiCCRange.startRb = 0; + sfrCCPool->pwrHiCCRange.endRb = 0; + } + else + { + n = cmLListFirst(l); + sfrCCPool = (RgSchSFRPoolInfo*)n->node; + + sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1; + sfrCCPool->poolendRB = sf->bw - 1; + sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; + sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw; + sfrCCPool->CCPool2Exists = TRUE; + sfrCCPool->bwAlloced = 0; + sfrCCPool->type2Start = sfrCCPool->poolstartRB; + sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize); + sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; + sf->sfrTotalPoolInfo.CC2 = TRUE; + sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */ + sfrCCPool->pwrHiCCRange.startRb = 0; + sfrCCPool->pwrHiCCRange.endRb = 0; + } + + if((sfrCEPool->poolendRB != sf->bw - 1) && (!sfrCCPool->poolstartRB)) + { + /*Add memory and Update CCPool*/ + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CC Pool memory allocation FAILED for cell "); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); + RETVALUE(RFAILED); + } + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo)); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, + "CC Pool memory allocation FAILED for cell "); + rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell); + RETVALUE(RFAILED); + } + + cmLListAdd2Tail(l, temp); + + n = cmLListCrnt(l); + sfrCCPool = (RgSchSFRPoolInfo*)n->node; + + sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1; + sfrCCPool->poolendRB = sf->bw - 1; + sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1; + sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw; + sfrCCPool->CCPool2Exists = TRUE; + sfrCCPool->bwAlloced = 0; + sfrCCPool->type2Start = sfrCCPool->poolstartRB; + sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize); + sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1; + sf->sfrTotalPoolInfo.CC2 = TRUE; + sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */ + sfrCCPool->pwrHiCCRange.startRb = 0; + sfrCCPool->pwrHiCCRange.endRb = 0; + } + + sf->sfrTotalPoolInfo.CCRetx = FALSE; + sf->sfrTotalPoolInfo.CERetx = FALSE; + + sf->sfrTotalPoolInfo.ccBwFull = FALSE; + sf->sfrTotalPoolInfo.ceBwFull = FALSE; + sf->sfrTotalPoolInfo.isUeCellEdge = FALSE; + RETVALUE(ROK); +} +/** + * @brief This function resets temporary variables in RNTP Prepration + * @details + * + * Function: rgSchDSFRRntpInfoInit + * + * Invoked by: rgSCHSFRUtlTotalPoolInit + * + * @param[in] TknStrOSXL* rntpPtr + * @param[in] RgSubFrm* subFrm + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSchDSFRRntpInfoInit +( + TknStrOSXL *rntpPtr, + RgSchCellCb *cell, + U16 bw + ) +#else +PRIVATE Void rgSchDSFRRntpInfoInit(rntpPtr, cell, bw) + TknStrOSXL *rntpPtr; + RgSchCellCb *cell; + U16 bw; +#endif +{ + Inst inst = cell->instIdx; + U16 len; + + TRC2(rgSchDSFRRntpInfoInit); + + rntpPtr->pres = PRSNT_NODEF; + + len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1); + + rntpPtr->len = len; + + /* Allocate memory for "scheduled UE" Info */ + if((rgSCHUtlAllocSBuf(inst, (Data**)&(rntpPtr->val), + (len * sizeof(U8)))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for RNTP Alloc"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} + +/** + * @brief This function release RNTP pattern from subFrame and Cell + * @details + * + * Function: rgSchDSFRRntpInfoFree + * + * Invoked by: rgSCHSFRUtlTotalPoolInit + * + * @param[in] TknStrOSXL* rntpPtr + * @param[in] RgSubFrm* subFrm + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSchDSFRRntpInfoFree +( + TknStrOSXL *rntpPtr, + RgSchCellCb *cell, + U16 bw + ) +#else +PRIVATE Void rgSchDSFRRntpInfoFree(rntpPtr, cell, bw) + TknStrOSXL *rntpPtr; + RgSchCellCb *cell; + U16 bw; +#endif +{ + Inst inst = cell->instIdx; + U16 len; + + TRC2(rgSchDSFRRntpInfoFree); + + len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1); + + if(rntpPtr->pres == PRSNT_NODEF) + { + rgSCHUtlFreeSBuf(inst, (Data **)(&(rntpPtr->val)),(len * sizeof(U8))); + rntpPtr->pres = NOTPRSNT; + rntpPtr->len = 0; + } + + RETVALUE(ROK); +} + +/** + * @brief This function resets temporary variables in Pool + * @details + * + * Function: rgSchSFRResetPoolVariables + * Purpose: Initialise the dynamic variables in each pool. + * Reset bwAlloced, bwAssigned, type2End, type0End, type2Start + * Invoked by: rgSCHSFRUtlTotalPoolReset + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchSFRPoolInfo *pool + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSchSFRResetPoolVariables +( + RgSchCellCb *cell, + RgSchSFRPoolInfo *pool + ) +#else +PRIVATE Void rgSchSFRResetPoolVariables(cell, pool) + RgSchCellCb *cell; + RgSchSFRPoolInfo *pool; +#endif +{ + + TRC2(rgSchSFRResetPoolVariables); + pool->bwAlloced = 0; + + /*type0end will be the last RBG in pool with all available RBs*/ + pool->type0End = (((pool->poolendRB + 1)/cell->rbgSize) - 1); + + /*type2end will be the first RBG in pool with all available RBs*/ + pool->type2End = RGSCH_CEIL(pool->poolstartRB, cell->rbgSize); + pool->type2Start = pool->poolstartRB; + pool->bw = pool->poolendRB - pool->poolstartRB + 1; + + RETVOID; +} +/** + * @brief This function resets SFR Pool information for frame + * + * @details + * + * Function: rgSCHSFRUtlTotalPooReset + * Purpose: Update the dynamic variables in each pool as they will be modified in each subframe. + * Dont modify the static variables like startRB, endRB, BW + * Invoked by: rgSCHUtlSubFrmPut + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlSf* subFrm + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHSFRUtlTotalPoolReset +( + RgSchCellCb *cell, + RgSchDlSf *subFrm + ) +#else +PRIVATE Void rgSCHSFRUtlTotalPoolReset(cell, subFrm) + RgSchCellCb *cell; + RgSchDlSf *subFrm; +#endif +{ + RgSchSFRTotalPoolInfo *totalPoolInfo = &subFrm->sfrTotalPoolInfo; + CmLListCp *ccPool = &totalPoolInfo->ccPool; + CmLListCp *cePool = &totalPoolInfo->cePool; + CmLList *node = NULLP; + RgSchSFRPoolInfo *tempPool = NULLP; + + TRC2(rgSCHSFRUtlTotalPoolReset); + + totalPoolInfo->ccBwFull = FALSE; + totalPoolInfo->ceBwFull = FALSE; + totalPoolInfo->isUeCellEdge = FALSE; + totalPoolInfo->CCPool1BwAvlbl = 0; + totalPoolInfo->CCPool2BwAvlbl = 0; + totalPoolInfo->CEPoolBwAvlbl = 0; + totalPoolInfo->CCRetx = FALSE; + totalPoolInfo->CERetx = FALSE; + + node = ccPool->first; + while(node) + { + tempPool = (RgSchSFRPoolInfo *)(node->node); + node = node->next; + rgSchSFRResetPoolVariables(cell, tempPool); + if(tempPool->poolstartRB == 0) + totalPoolInfo->CCPool1BwAvlbl = tempPool->bw; + else + totalPoolInfo->CCPool2BwAvlbl = tempPool->bw; + } + + node = cePool->first; + while(node) + { + tempPool = (RgSchSFRPoolInfo *)(node->node); + node = node->next; + rgSchSFRResetPoolVariables(cell, tempPool); + totalPoolInfo->CEPoolBwAvlbl = tempPool->bw; + } + + RETVOID; +} +/* LTE_ADV_FLAG_REMOVED_END */ +/** + * @brief This function appends PHICH information for frame + * + * @details + * + * Function: rgSCHUtlAddPhich + * Purpose: This function appends PHICH information for + * a subframe. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @param[in] U8 hqFeedBack + * @param[in] U8 nDmrs + * @param[in] U8 rbStart + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef LTE_TDD +#ifdef ANSI +PUBLIC S16 rgSCHUtlAddPhich +( +RgSchCellCb *cell, +CmLteTimingInfo frm, +U8 hqFeedBack, +U8 nDmrs, +U8 rbStart, +U8 iPhich +) +#else +PUBLIC S16 rgSCHUtlAddPhich(cell, frm, hqFeedBack, nDmrs, rbStart, iPhich) +RgSchCellCb *cell; +CmLteTimingInfo frm; +U8 hqFeedBack; +U8 nDmrs; +U8 rbStart; +U8 iPhich; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHUtlAddPhich +( +RgSchCellCb *cell, +CmLteTimingInfo frm, +U8 hqFeedBack, +U8 nDmrs, +U8 rbStart, +Bool isForMsg3 +) +#else +PUBLIC S16 rgSCHUtlAddPhich(cell, frm, hqFeedBack, nDmrs, rbStart, isForMsg3) +RgSchCellCb *cell; +CmLteTimingInfo frm; +U8 hqFeedBack; +U8 nDmrs; +U8 rbStart; +Bool isForMsg3; +#endif +#endif +{ + S16 ret; + RgSchPhich *phich; + RgSchDlSf *dlSf; + Inst inst = cell->instIdx; + TRC2(rgSCHUtlAddPhich); + + dlSf = rgSCHUtlSubFrmGet(cell, frm); + RGSCH_PHICH_ALLOC(inst, phich,sizeof(RgSchPhich), ret); + + if(ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, " rgSCHUtlAddPhich(): " + "Allocation of RgSchPhich failed"); + RETVALUE(RFAILED); + } +#ifdef LTE_TDD + RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, iPhich); +#else + RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, isForMsg3); /*SR_RACH_STATS */ +#endif + cmLListAdd2Tail(&dlSf->phichInfo.phichs, &phich->lnk); + RETVALUE(ROK); +} /* rgSCHUtlAddPhich */ + +/** + * @brief This function resets PHICH information for frame + * + * @details + * + * Function: rgSCHUtlPhichReset + * Purpose: This function initializes PHICH information for + * a subframe. It removes the list of PHICHs allocated + * in the prior use of this subframe structure. + * + * Invoked by: rgSCHUtlSubFrmPut + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHUtlPhichReset +( +RgSchCellCb *cell, +RgSchDlSf *subFrm +) +#else +PRIVATE Void rgSCHUtlPhichReset(cell, subFrm) +RgSchCellCb *cell; +RgSchDlSf *subFrm; +#endif +{ + RgSchPhichInfo *phichInfo; + RgSchPhich *phich; + + UNUSED(cell); + + TRC2(rgSCHUtlPhichReset); + + phichInfo = &subFrm->phichInfo; + while(phichInfo->phichs.first != NULLP) + { + phich = (RgSchPhich *)phichInfo->phichs.first->node; + cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first); + RGSCH_PHICH_FREE(cell->instIdx, phich, sizeof(RgSchPhich)); + } + cmLListInit(&phichInfo->phichs); + RETVOID; +} /* rgSCHUtlPhichReset */ + + +/** + * @brief This function returns subframe data structure for a cell + * + * @details + * + * Function: rgSCHUtlSubFrmGet + * Purpose: This function resets the subframe data structure + * when the subframe is released + * + * Invoked by: scheduler + * + * @param[in] RgSubFrm subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC RgSchDlSf* rgSCHUtlSubFrmGet +( +RgSchCellCb *cell, +CmLteTimingInfo frm +) +#else +PUBLIC RgSchDlSf* rgSCHUtlSubFrmGet(cell, frm) +RgSchCellCb *cell; +CmLteTimingInfo frm; +#endif +{ + RgSchDlSf *sf; + U8 dlIdx; + + TRC2(rgSCHUtlSubFrmGet); + +#ifdef LTE_TDD + dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm); + //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); + sf = cell->subFrms[dlIdx]; +#else + /* Changing the idexing + so that proper subframe is selected */ + dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.subframe % RGSCH_NUM_SUB_FRAMES)); + RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx); + sf = cell->subFrms[dlIdx]; +#endif + /* CA dev Start */ + sf->dlIdx = dlIdx; + /* CA dev End */ + RETVALUE(sf); +} + + +/** + * @brief This function returns subframe data structure for a cell + * + * @details + * + * Function: rgSCHUtlSubFrmPut + * Purpose: This function resets the subframe data structure + * when the subframe is released + * + * Invoked by: scheduler + * + * @param[in] RgSubFrm subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlSubFrmPut +( +RgSchCellCb *cell, +RgSchDlSf *sf +) +#else +PUBLIC Void rgSCHUtlSubFrmPut(cell, sf) +RgSchCellCb *cell; +RgSchDlSf *sf; +#endif +{ + U8 i; + U8 noRaRsps; + + TRC2(rgSCHUtlSubFrmPut); + +#ifdef LTE_TDD + /* Release all the held PDCCH information */ + rgSCHUtlPdcchInit(cell, sf, sf->nCce); +#else + /* Release all the held PDCCH information */ + rgSCHUtlPdcchInit(cell, sf, cell->nCce); +#endif + rgSCHUtlPhichReset(cell, sf); + + /* Reset the bw allocated. */ + sf->bwAssigned = 0; +#ifdef LTEMAC_SPS + /* Setting allocated bandwidth to SPS bandwidth for non-SPS RB allocator */ + sf->bwAlloced = ((cell->spsCellCfg.maxSpsDlBw + + cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize; + if (sf->bwAlloced > sf->bw) + { + sf->bwAlloced = sf->bw; + } + sf->spsAllocdBw = 0; + sf->type2Start = sf->bwAlloced; + cmMemset((U8*) &sf->dlSfAllocInfo, 0, sizeof(RgSchDlSfAllocInfo)); +#else + sf->bwAlloced = 0; + /* Fix for ccpu00123918*/ + sf->type2Start = 0; + /* LTE_ADV_FLAG_REMOVED_START */ + /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ + if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + cmMemset((U8*) sf->rntpInfo.val, 0, sf->rntpInfo.len); + } + /* LTE_ADV_FLAG_REMOVED_END */ +#endif + sf->txDone = FALSE; + /*[ccpu00138609]-ADD-Reset the CCCH UE counter */ + sf->schdCcchUe = 0; + + /* Non DLFS scheduling using Type0 RA requires the following + * parameter's tracking */ + /* Type 2 localized allocations start from 0th RBG and onwards */ + /* Type 0 allocations start from last RBG and backwards*/ +#ifndef LTEMAC_SPS + sf->type2End = 0; +#else + sf->type2End = RGSCH_CEIL(sf->bwAlloced,cell->rbgSize); +#endif + sf->type0End = cell->noOfRbgs - 1; + /* If last RBG is of incomplete size then special handling */ + (sf->bw % cell->rbgSize == 0)? (sf->lstRbgDfct = 0) : + (sf->lstRbgDfct = cell->rbgSize - (sf->bw % cell->rbgSize)); + /* This resets the allocation for BCCH and PDCCH */ +#ifdef EMTC_ENABLE + /* TODO we need to move this reset for emtc functions */ + if(!(cell->emtcEnable)) + { + sf->bch.tb = NULLP; + sf->bch.tbSize = 0; + } +#else + sf->bch.tb = NULLP; + sf->bch.tbSize = 0; +#endif + sf->bcch.pdcch = NULLP; + sf->pcch.pdcch = NULLP; +#ifdef LTE_TDD + noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC; +#else + noRaRsps = RGSCH_MAX_RA_RSP_ALLOC; +#endif + for (i = 0; i < noRaRsps; i++) + { + sf->raRsp[i].pdcch = NULLP; + cmLListInit(&(sf->raRsp[i].raRspLst)); + } + /* LTE_ADV_FLAG_REMOVED_START */ + if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) + { + rgSCHSFRUtlTotalPoolReset(cell, sf); + } + /* LTE_ADV_FLAG_REMOVED_END */ +#ifdef LTE_ADV + cmLListInit(&sf->n1PucchResLst); +#endif + + sf->cceCnt = 0; + sf->isCceFailure = FALSE; + sf->dlUlBothCmplt = 0; + RETVOID; +} + + +/** + * @brief This function computes log N (32 bit Unsigned) to the base 2 + * + * @details + * + * Function: rgSCHUtlLog32bitNbase2 + * Purpose: This function computes log N (32 bit Unsigned) to the base 2. + * For n= 0,1 ret = 0. + * + * Invoked by: Scheduler + * + * @param[in] U32 n + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHUtlLog32bitNbase2 +( +U32 n +) +#else +PUBLIC U8 rgSCHUtlLog32bitNbase2(n) +U32 n; +#endif +{ + U32 b[] = {0x2, 0xc, 0xf0, 0xff00, 0xffff0000}; + U32 s[] = {1, 2, 4, 8, 16}; + S16 i; + U8 ret = 0; + + TRC2(rgSCHUtlLog32bitNbase2) + + for (i=4; i >= 0; i--) + { + if (n & b[i]) + { + n >>= s[i]; + ret |= s[i]; + } + } + RETVALUE(ret); +} + +#ifdef LTEMAC_SPS + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlRelPdcchFbk + * Purpose: Calls scheduler's handler for SPS release PDCCH feedback + * information. + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 isAck + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlRelPdcchFbk +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 isAck +) +#else +PUBLIC Void rgSCHUtlDlRelPdcchFbk(cell, ue, isAck) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 isAck; +#endif +{ + TRC2(rgSCHUtlDlRelPdcchFbk); + cell->sc.apis->rgSCHDlRelPdcchFbk(cell, ue, isAck); + RETVOID; +} + + + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlProcAck + * Purpose: Calls scheduler's handler to process Ack + * information. + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlHqProcCb *hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlProcAck +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHUtlDlProcAck(cell, hqP) +RgSchCellCb *cell; +RgSchDlHqProcCb *hqP; +#endif +{ + TRC2(rgSCHUtlDlProcAck); + cell->sc.apis->rgSCHDlProcAck(cell, hqP); + RETVOID; +} + +/** + * @brief CRNTI CE Handler + * + * @details + * + * Function : rgSCHUtlHdlCrntiCE + * + * - Call scheduler common API + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[out] RgSchErrInfo *err + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlHdlCrntiCE +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHUtlHdlCrntiCE(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlHdlCrntiCE); + + cell->sc.apis->rgSCHHdlCrntiCE(cell, ue); + RETVOID; +} /* rgSCHUtlHdlCrntiCE */ +#endif /* LTEMAC_SPS */ + +/*********************************************************** + * + * Func : rgSCHUtlCalcTotalRegs + * + * Desc : Calculate total REGs, given a bandwidth, CFI + * and number of antennas. + * + * Ret : Total REGs (U16) + * + * Notes: Could optimise if bw values are limited + * (taken from RRC spec) by indexing values from + * a table. + * Input values are not validated. CFI is assumed + * to be 1/2/3/4. + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE U16 rgSCHUtlCalcTotalRegs +( +U8 bw, +U8 cfi, +U8 numAntna, +Bool isEcp +) +#else +PRIVATE U16 rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp) +U8 bw; +U8 cfi; +U8 numAntna; +Bool isEcp; +#endif +{ + U16 regs = 0; + TRC2(rgSCHUtlCalcTotalRegs); + + /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ + + if (bw <= 10) + ++cfi; + switch (cfi) + { + /* Refer 36.211 section 6.10.1.2 + * For symbols 2 and 4, the REGs per RB will be based on cyclic prefix + * and number of antenna ports. + * For symbol 1, there are 2 REGs per RB always. Similarly symbol 3 + * will have 3 REGS. + */ + case 4: + /*CR changes [ccpu00124416] - MOD*/ + if(isEcp) + { + regs = bw * RGSCH_NUM_REGS_4TH_SYM_EXT_CP; + } + else + { + regs = bw * RGSCH_NUM_REGS_4TH_SYM_NOR_CP; + } + case 3: + regs += bw * RGSCH_NUM_REGS_3RD_SYM; + case 2: + /*CR changes [ccpu00124416] - MOD using number of antenna ports*/ + regs += (numAntna == RGSCH_NUM_ANT_PORT_FOUR) ? \ + (bw * RGSCH_NUM_REGS_2ND_SYM_FOUR_ANT_PORT) : \ + (bw * RGSCH_NUM_REGS_2ND_SYM_1OR2_ANT_PORT); + default: /* case 1 */ + regs += bw * RGSCH_NUM_REGS_1ST_SYM; + } + RETVALUE(regs); +} + +/*********************************************************** + * + * Func : rgSCHUtlCalcPhichRegs + * + * Desc : Calculates number of PHICH REGs + * + * Ret : Number of PHICH REGs (U8) + * + * Notes: ng6 is Ng multiplied by 6 + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE U16 rgSCHUtlCalcPhichRegs +( +U8 bw, +U8 ng6 +) +#else +PRIVATE U16 rgSCHUtlCalcPhichRegs(bw, ng6) +U8 bw; +U8 ng6; +#endif +{ + TRC2(rgSCHUtlCalcPhichRegs); + /* ccpu00115330: Corrected the calculation for number of PHICH groups*/ + RETVALUE(RGSCH_CEIL((bw * ng6) ,(8 * 6)) * RGSCH_NUM_REG_PER_PHICH_GRP); +} + +#ifdef LTE_TDD +/** + * @brief Calculates total CCEs (N_cce) + * + * @details + * + * Function: rgSCHUtlCalcNCce + * Purpose: This function calculates and returns total CCEs for a + * cell, given the following: bandwidth, Ng configuration + * (multiplied by six), cfi (actual number of control + * symbols), m factor for PHICH and number of antennas. + * + * Invoked by: Scheduler + * + * @param[in] U8 bw + * @param[in] U8 ng6 + * @param[in] U8 cfi + * @param[in] U8 mPhich + * @param[in] U8 numAntna + * @param[in] Bool isEcp + * @return N_cce (U8) + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHUtlCalcNCce +( +U8 bw, +RgrPhichNg ng, +U8 cfi, +U8 mPhich, +U8 numAntna, +Bool isEcp +) +#else +PUBLIC U8 rgSCHUtlCalcNCce(bw, ng, cfi, mPhich, numAntna, isEcp) +U8 bw; +RgrPhichNg ng; +U8 cfi; +U8 mPhich; +U8 numAntna; +Bool isEcp; +#endif +{ + U16 totalRegs; + U16 phichRegs; + U16 cceRegs; + U8 ng6; + TRC2(rgSCHUtlCalcNCce); + + /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ + + switch (ng) + { + case RGR_NG_ONESIXTH: + ng6 = 1; + break; + case RGR_NG_HALF: + ng6 = 3; + break; + case RGR_NG_ONE: + ng6 = 6; + break; + case RGR_NG_TWO: + default: + ng6 = 12; + break; + } + + totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp); + phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6); + cceRegs = totalRegs - mPhich*phichRegs - RGSCH_NUM_PCFICH_REG; + + RETVALUE((U8)(cceRegs/RGSCH_NUM_REG_PER_CCE)); +} + +#else +/** + * @brief Calculates total CCEs (N_cce) + * + * @details + * + * Function: rgSCHUtlCalcNCce + * Purpose: This function calculates and returns total CCEs for a + * cell, given the following: bandwidth, Ng configuration + * (multiplied by six), cfi (actual number of control + * symbols) and number of antennas. + * + * Invoked by: Scheduler + * + * @param[in] U8 bw + * @param[in] U8 ng6 + * @param[in] U8 cfi + * @param[in] U8 numAntna + * @return N_cce (U8) + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHUtlCalcNCce +( +U8 bw, +RgrPhichNg ng, +U8 cfi, +U8 numAntna, +Bool isEcp +) +#else +PUBLIC U8 rgSCHUtlCalcNCce(bw, ng, cfi, numAntna, isEcp) +U8 bw; +RgrPhichNg ng; +U8 cfi; +U8 numAntna; +Bool isEcp; +#endif +{ + U16 totalRegs; + U16 phichRegs; + U16 cceRegs; + U8 ng6; + TRC2(rgSCHUtlCalcNCce); + + /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/ + + switch (ng) + { + case RGR_NG_ONESIXTH: + ng6 = 1; + break; + case RGR_NG_HALF: + ng6 = 3; + break; + case RGR_NG_ONE: + ng6 = 6; + break; + case RGR_NG_TWO: + default: + ng6 = 12; + break; + } + + totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp); + phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6); + cceRegs = totalRegs - phichRegs - RGSCH_NUM_PCFICH_REG; + + RETVALUE((U8)(cceRegs/RGSCH_NUM_REG_PER_CCE)); +} +#endif + +/** + * @brief Returns PHICH info associated with an uplink + * HARQ process allocation + * + * @details + * + * Function: rgSCHUtlGetPhichInfo + * Purpose: This function returns PHICH info associated with + * an uplink HARQ process allocation. PHICH info + * comprises RB start and N_dmrs. + * + * @param[in] RgSchUlHqProcCb *hqProc + * @param[out] U8 *rbStartRef + * @param[out] U8 *nDmrsRef + * @return S16 + **/ +#ifdef LTE_TDD +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetPhichInfo +( +RgSchUlHqProcCb *hqProc, +U8 *rbStartRef, +U8 *nDmrsRef, +U8 *iPhich +) +#else +PUBLIC S16 rgSCHUtlGetPhichInfo(hqProc, rbStartRef, nDmrsRef, iPhich) +RgSchUlHqProcCb *hqProc; +U8 *rbStartRef; +U8 *nDmrsRef; +U8 *iPhich; +#endif +#else +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetPhichInfo +( +RgSchUlHqProcCb *hqProc, +U8 *rbStartRef, +U8 *nDmrsRef +) +#else +PUBLIC S16 rgSCHUtlGetPhichInfo(hqProc, rbStartRef, nDmrsRef) +RgSchUlHqProcCb *hqProc; +U8 *rbStartRef; +U8 *nDmrsRef; +#endif +#endif +{ +/* ACC-TDD */ + S16 ret = RFAILED; + + TRC2(rgSCHUtlGetPhichInfo); + + if ((hqProc != NULLP) && (hqProc->alloc != NULLP)) + { + *rbStartRef = hqProc->alloc->grnt.rbStart; + *nDmrsRef = hqProc->alloc->grnt.nDmrs; +#ifdef LTE_TDD + *iPhich = hqProc->iPhich; +#endif + ret = ROK; + } + RETVALUE(ret); +} +#ifndef TFU_UPGRADE +/** + * @brief Returns uplink grant information required to permit + * PHY to receive data + * + * @details + * + * Function: rgSCHUtlAllocRcptInfo + * Purpose: Given an uplink allocation, this function returns + * uplink grant information which is needed by PHY to + * decode data sent from UE. This information includes: + * - RB start + * - Number of RBs + * - RV + * + * @param[in] RgSchUlAlloc *alloc + * @param[out] U8 *rbStartRef + * @param[out] U8 *numRbRef + * @param[out] U8 *rvRef + * @param[out] U16 *size + * @param[out] TfuModScheme *modType + * @param[out] Bool *isRtx + * @param[out] U8 *nDmrs + * @param[out] Bool *ndi + * @param[out] U8 *hqPId + * @return S16 + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAllocRcptInfo +( +RgSchUlAlloc *alloc, +CmLteRnti *rnti, +U8 *iMcsRef, +U8 *rbStartRef, +U8 *numRbRef, +U8 *rvRef, +U16 *size, +TfuModScheme *modType, +Bool *isRtx, +U8 *nDmrs, +Bool *ndi, +U8 *hqPId +) +#else +PUBLIC S16 rgSCHUtlAllocRcptInfo(alloc, rnti, iMcsRef, rbStartRef, numRbRef, + rvRef, size, modType, isRtx, nDmrs, ndi, + hqPId) +RgSchUlAlloc *alloc; +CmLteRnti *rnti; +U8 *iMcsRef; +U8 *rbStartRef; +U8 *numRbRef; +U8 *rvRef; +U16 *size; +TfuModScheme *modType; +Bool *isRtx; +U8 *nDmrs; +Bool *ndi; +U8 *hqPId; +#endif +{ + /* Modulation order for 16qam UEs would be + * min(4,modulation order in grant). Please refer to 36.213-8.6.1*/ + CmLteUeCategory ueCtgy; + + TRC2(rgSCHUtlAllocRcptInfo); +#if (ERRCLASS & ERRCLS_DEBUG) + if ((alloc == NULLP) || (alloc->hqProc == NULLP)) + { + RETVALUE(RFAILED); + } +#endif + + if ( !alloc->forMsg3 ) + { + if ( ((alloc->ue) == NULLP) || (RG_SCH_CMN_GET_UE(alloc->ue, alloc->ue->cell) == NULLP)) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,alloc->ue->cell->cellId, + "Failed: ue->sch is null RNTI:%d,isRetx=%d", + alloc->rnti, alloc->grnt.isRtx); + RETVALUE(RFAILED); + } + ueCtgy = (RG_SCH_CMN_GET_UE_CTGY(alloc->ue)); + } + + *iMcsRef = alloc->grnt.iMcs; + *rbStartRef = alloc->grnt.rbStart; + *numRbRef = alloc->grnt.numRb; + *rvRef = rgRvTable[alloc->hqProc->rvIdx]; + *rnti = alloc->rnti; + *size = alloc->grnt.datSz; + *modType = (alloc->forMsg3)? alloc->grnt.modOdr: + ((ueCtgy == CM_LTE_UE_CAT_5)? + alloc->grnt.modOdr: + (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr))); + *isRtx = alloc->grnt.isRtx; + *nDmrs = alloc->grnt.nDmrs; + *ndi = alloc->hqProc->ndi; + *hqPId = alloc->hqProc->procId; + + RETVALUE(ROK); +} +#else +/** + * @brief Returns uplink grant information required to permit + * PHY to receive data + * + * @details + * + * Function: rgSCHUtlAllocRcptInfo + * Purpose: Given an uplink allocation, this function returns + * uplink grant information which is needed by PHY to + * decode data sent from UE. This information includes: + * - RB start + * - Number of RBs + * - RV + * + * @param[in] RgSchUlAlloc *alloc + * @param[out] U8 *rbStartRef + * @param[out] U8 *numRbRef + * @param[out] U8 *rvRef + * @param[out] U16 *size + * @param[out] TfuModScheme *modType + * @return S16 + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAllocRcptInfo +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc, +CmLteTimingInfo *timeInfo, +TfuUeUlSchRecpInfo *recpReq +) +#else +PUBLIC S16 rgSCHUtlAllocRcptInfo(cell, alloc, timeInfo, recpReq) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +CmLteTimingInfo *timeInfo; +TfuUeUlSchRecpInfo *recpReq; +#endif +{ + TRC2(rgSCHUtlAllocRcptInfo); +#if (ERRCLASS & ERRCLS_DEBUG) + if ((alloc == NULLP) || (alloc->hqProc == NULLP)) + { + RETVALUE(RFAILED); + } +#endif + recpReq->size = alloc->grnt.datSz; + recpReq->rbStart = alloc->grnt.rbStart; + recpReq->numRb = alloc->grnt.numRb; + /* Modulation order min(4,mod in grant) for 16 qam UEs. + * Please refer to 36.213-8.6.1*/ +#ifdef FOUR_TX_ANTENNA + recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr: + (/*(alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)? + alloc->grnt.modOdr: *//* Chandra:TmpFx-TM500 Cat5 with Only16QAM */ + (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr)))); +#else + recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr: + ((alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)? + alloc->grnt.modOdr: + (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr)))); +#endif + recpReq->nDmrs = alloc->grnt.nDmrs; + recpReq->hoppingEnbld = FALSE; + recpReq->hoppingBits = 0; + recpReq->isRtx = alloc->grnt.isRtx; + recpReq->ndi = alloc->hqProc->ndi; + recpReq->rv = rgRvTable[alloc->hqProc->rvIdx]; +#ifndef LTE_TDD + recpReq->harqProcId = alloc->hqProc->procId; +#else + recpReq->harqProcId = rgSCHCmnGetUlHqProcIdx(timeInfo, cell); +#endif + /* Transmission mode is SISO till Uplink MIMO is implemented. */ + recpReq->txMode = 0; + /* This value needs to filled in in the case of frequency hopping. */ + recpReq->crntTxNb = 0; + + recpReq->mcs = alloc->grnt.iMcs; +#ifdef RG_5GTF + recpReq->rbgStart = alloc->grnt.vrbgStart; + recpReq->numRbg = alloc->grnt.numVrbg; + recpReq->xPUSCHRange = alloc->grnt.xPUSCHRange; + //TODO_SID Need to check + recpReq->nAntPortLayer = 0; + recpReq->SCID = alloc->grnt.SCID; + recpReq->PMI = alloc->grnt.PMI; + recpReq->uciWoTBFlag = alloc->grnt.uciOnxPUSCH; + if(alloc->ue) + { + recpReq->beamIndex = alloc->ue->ue5gtfCb.BeamId; + } +#endif + +#ifdef TENB_STATS + if (!alloc->forMsg3) + { + if (alloc->grnt.isRtx) + { + alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulRetxOccns++; + } + else + { + alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulTxOccns++; + alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulSumiTbs += \ + rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); + alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulNumiTbs ++; + cell->tenbStats->sch.ulSumiTbs += \ + rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs); + cell->tenbStats->sch.ulNumiTbs ++; + } + alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulPrbUsg += alloc->grnt.numRb; + cell->tenbStats->sch.ulPrbUsage[0] += alloc->grnt.numRb; + } +#endif + /* ccpu00117050 - DEL - nSrs setting at rgSCHUtlAllocRcptInfo */ + RETVALUE(ROK); +} +#endif + +#ifdef LTE_TDD +/** + * @brief This function initialises the PRACH subframe occasions + * + * @details + * + * Function: rgSCHUtlUpdPrachOcc + * Purpose: This function updates the PRACH subframes based on + * RGR configuration. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrTddPrachInfo *cellCfg + * @return Void + * + **/ +#ifdef ANSI +PRIVATE Void rgSCHUtlUpdPrachOcc +( +RgSchCellCb *cell, +RgrTddPrachInfo *cellCfg +) +#else +PRIVATE Void rgSCHUtlUpdPrachOcc(cell, cellCfg) +RgSchCellCb *cell; +RgrTddPrachInfo *cellCfg; +#endif +{ + U8 idx; + U8 count = 0; + U8 size; + U8 startIdx; + U8 endIdx; + + TRC2(rgSCHUtlUpdPrachOcc) + + /* In the 1st half frame */ + if(cellCfg->halfFrm == 0) + { + startIdx = 2; + endIdx = 6; + } + /* In the 2nd half frame */ + else + { + startIdx = 6; + endIdx = 10; + } + for(idx = startIdx; idx < endIdx; idx++) + { + if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] + == RG_SCH_TDD_UL_SUBFRAME) + { + if(cellCfg->ulStartSfIdx == count) + { + size = cell->rachCfg.raOccasion.size; + cell->rachCfg.raOccasion.subFrameNum[size] = idx; + cell->rachCfg.raOccasion.size++; + break; + } + count ++; + } + } + RETVOID; +} + +/** + * @brief This function initialises the PRACH occasions + * + * @details + * + * Function: rgSCHUtlPrachCfgInit + * Purpose: This function initialises the PRACH occasions based on + * RGR configuration. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellCfg *cellCfg + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlPrachCfgInit +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg +) +#else +PUBLIC Void rgSCHUtlPrachCfgInit(cell, cellCfg) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +#endif +{ + U8 idx; + U8 subfrmIdx; + U8 splFrm; + + TRC2(rgSCHUtlPrachCfgInit) + if(cellCfg->prachRscInfo.numRsc <= 0) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "Invalid" + "PRACH resources Configuration "); + RETVOID; + } + + /* Update SFN occasions */ + cell->rachCfg.raOccasion.sfnEnum = + cellCfg->prachRscInfo.prachInfo[0].sfn; + + cell->rachCfg.raOccasion.size = 0; + + /* Update subframe occasions */ + for(idx = 0; idx < cellCfg->prachRscInfo.numRsc; idx++) + { + if(cellCfg->prachRscInfo.prachInfo[idx].freqIdx == 0) + { + if(cellCfg->prachRscInfo.prachInfo[idx].halfFrm == 0) + { + splFrm = 1; + } + else + { + splFrm = 6; + } + if(cellCfg->prachRscInfo.prachInfo[idx].ulStartSfIdx == + RGR_TDD_SPL_UL_IDX) + { + subfrmIdx = cell->rachCfg.raOccasion.size; + cell->rachCfg.raOccasion.subFrameNum[subfrmIdx] = splFrm; + cell->rachCfg.raOccasion.size++; + } + else + { + rgSCHUtlUpdPrachOcc(cell, + &cellCfg->prachRscInfo.prachInfo[idx]); + } + } + } + RETVOID; +} + +/** + * @brief This function performs RGR cell initialization + * + * @details + * + * Function: rgSCHUtlRgrCellCfg + * Purpose: This function initialises the cell with RGR configuration + * and subframe related initialization. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellCfg *cellCfg + * @param[in] RgSchErrInfo *errInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +RgSchErrInfo *errInfo; +#endif +{ + U8 i; + U8 sfn=0; + U8 sfNum = 0; + RgSchDlSf *sf; + CmLteTimingInfo frm; + U8 ulDlCfgIdx = cellCfg->ulDlCfgIdx; + U8 maxSubframes ; + U8 maxDlSubframes; + S16 ret = ROK; + U16 bw; /*!< Number of RBs in the cell */ + + TRC2(rgSCHUtlRgrCellCfg); + + cmMemset((U8 *)&frm,0,sizeof(CmLteTimingInfo)); + + /* ccpu00132657-MOD- Determining DLSF array size independent of DELTAS */ + maxDlSubframes = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + maxSubframes = 2 * maxDlSubframes; + cell->numDlSubfrms = maxSubframes; +/* ACC-TDD */ + cell->tddHqSfnCycle = -1; + cell->ulDlCfgIdx = ulDlCfgIdx; + + /* PRACH Occasions Initialization */ + rgSCHUtlPrachCfgInit(cell, cellCfg); + + /* ccpu00132658- Moved out of below for loop since the updating rbgSize and + * bw are independent of sfNum*/ + /* determine the RBG size and no of RBGs for the configured + * DL BW */ + if (cell->bwCfg.dlTotalBw > 63) + { + cell->rbgSize = 4; + } + else if (cell->bwCfg.dlTotalBw > 26) + { + cell->rbgSize = 3; + } + else if (cell->bwCfg.dlTotalBw > 10) + { + cell->rbgSize = 2; + } + else + { + cell->rbgSize = 1; + } + cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize); + + bw = cell->bwCfg.dlTotalBw; + + rgSCHUtlAllocSBuf(cell->instIdx, + (Data **)&cell->subFrms, sizeof(RgSchDlSf *) * maxSubframes); + if (cell->subFrms == NULLP) + { + RETVALUE(RFAILED); + } + + /* Create memory for each frame. */ + for(i = 0; i < maxSubframes; i++) + { + while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] == + RG_SCH_TDD_UL_SUBFRAME) + { + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + + rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf, sizeof(RgSchDlSf)); + if (sf == NULLP) + { + break; + } + cmMemset((U8 *)sf, 0, sizeof(*sf)); + +#ifdef LTE_ADV + if (ROK != rgSCHLaaInitDlSfCb(cell, sf)) + { + break; + } +#endif + sf->sfNum = sfNum; + sf->bw = bw; +#ifdef LTEMAC_SPS + /* Mark SPS bandwidth to be occupied */ + sf->bwAlloced = ((cellCfg->spsCfg.maxSpsDlBw + + cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize; + sf->spsAllocdBw = 0; + sf->type2End = sf->bwAlloced/cell->rbgSize; +#else + sf->bwAlloced = 0; + /* Fix for ccpu00123918*/ + sf->type2Start = 0; +#endif /* LTEMAC_SPS */ + /* Initialize the ackNakRepQ here */ +#ifdef RG_MAC_MEASGAP + cmLListInit (&(sf->ackNakRepQ)); +#endif + cell->subFrms[i] = sf; + sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES; + } + if (i != maxSubframes) + { + for (; i > 0; i--) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cell->subFrms[i-1])), sizeof(RgSchDlSf)); +#ifdef LTE_ADV + rgSCHLaaDeInitDlSfCb(cell, sf); +#endif + } + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, + (Data **)(&(cell->subFrms)), sizeof(RgSchDlSf *) * maxSubframes); + + RETVALUE(RFAILED); + } + + if (cell->sc.apis == NULLP) + { + cell->sc.apis = &rgSchCmnApis; + } + ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo); + + if (ret != ROK) + { + /* ccpu00132286- Removed deletion of sf nodes as the deletion will be + * happening during CellDelete. Added return handling to provide negative + * confirm*/ + RETVALUE(ret); + } + + /* Release the subframes and thereby perform the initialization */ + for (i = 0; i < maxSubframes; i++) + { + if((i > 0) && (i%maxDlSubframes == 0)) + { + sfn++; + } + frm.sfn = sfn; + frm.subframe = cell->subFrms[i]->sfNum; + rgSCHUtlDlRlsSubFrm(cell, frm); + } + + RETVALUE(ret); +} + +#else + +/** + * @brief This function performs scheduler related cell creation + * + * @details + * + * Function: rgSCHUtlRgrCellCfg + * Purpose: This function creates the subframes needed for the + * cell. It then peforms init of the scheduler by calling + * scheduler specific cell init function. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellCfg *cellCfg + * @param[in] RgSchErrInfo *errInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrCellCfg +( +RgSchCellCb *cell, +RgrCellCfg *cellCfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo) +RgSchCellCb *cell; +RgrCellCfg *cellCfg; +RgSchErrInfo *errInfo; +#endif +{ + U8 i; + RgSchDlSf *sf; + CmLteTimingInfo frm; + S16 ret; + Inst inst = cell->instIdx; + /* LTE_ADV_FLAG_REMOVED_START */ + U16 len; + len = (U16)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /*KW fix for LTE_ADV */ + /* LTE_ADV_FLAG_REMOVED_END */ + TRC2(rgSCHUtlRgrCellCfg); + + cmMemset((U8 *)&frm,0,sizeof(CmLteTimingInfo)); + + /* determine the RBG size and no of RBGs for the configured + * DL BW */ + if (cell->bwCfg.dlTotalBw > 63) + { + cell->rbgSize = 4; + } + else if (cell->bwCfg.dlTotalBw > 26) + { + cell->rbgSize = 3; + } + else if (cell->bwCfg.dlTotalBw > 10) + { + cell->rbgSize = 2; + } + else + { + cell->rbgSize = 1; + } + cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize); + /* Create memory for each frame. */ + /* Changing loop limit from + RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_SUBFRAMES */ + for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + rgSCHUtlAllocSBuf(inst, (Data **)&sf, sizeof(RgSchDlSf)); + if (sf == NULLP) + { + break; + } + cmMemset((U8 *)sf, 0, sizeof(*sf)); + +#ifdef LTE_ADV + if (ROK != rgSCHLaaInitDlSfCb(cell, sf)) + { + break; + } +#endif + /* Doing MOD operation before assigning value of i */ + sf->sfNum = i % RGSCH_NUM_SUB_FRAMES; + sf->bw = cell->bwCfg.dlTotalBw; + /* Initialize the ackNakRepQ here */ +#ifdef RG_MAC_MEASGAP + cmLListInit (&(sf->ackNakRepQ)); +#endif + cell->subFrms[i] = sf; + /* LTE_ADV_FLAG_REMOVED_START */ + if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + /*initialize the RNTP Buffer*/ + if(rgSchDSFRRntpInfoInit(&sf->rntpInfo, cell, sf->bw)) + { + RETVALUE(RFAILED); + } + } + + if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) + { + /*initialise the pools of CC and CE*/ + if(rgSchSFRTotalPoolInit(cell, sf)) + { + RETVALUE(RFAILED); + } + } + /* LTE_ADV_FLAG_REMOVED_END */ + } + + /* LTE_ADV_FLAG_REMOVED_START */ + /* Allocate memory for "scheduled UE" Info */ + if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) + { + if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val), + (len * sizeof(U8)))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for RNTP Alloc"); + RETVALUE(RFAILED); + } + cell->rntpAggrInfo.pres = PRSNT_NODEF; + cell->rntpAggrInfo.len = len; + } + /* LTE_ADV_FLAG_REMOVED_END */ + + /* Changing loop limit from + RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_SUBFRAMES */ + if (i != RGSCH_NUM_DL_SUBFRAMES) + { + for (; i > 0; i--) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i-1])), + sizeof(RgSchDlSf)); +#ifdef LTE_ADV + rgSCHLaaDeInitDlSfCb(cell, sf); +#endif + } + RETVALUE(RFAILED); + } + + if (cell->sc.apis == NULLP) + { + cell->sc.apis = &rgSchCmnApis; + } + + /* Release the subframes and thereby perform the initialization */ + for (i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++) + { + if (i >= RGSCH_NUM_SUB_FRAMES) + { + /* [ccpu00123828]-MOD-The below statement sfn += 1incorrectly modified + * the value of sfn for i>=10 thru 19. Correct way is to assign + it to one */ + frm.sfn = 1; + } + frm.subframe = i % RGSCH_NUM_SUB_FRAMES; + rgSCHUtlDlRlsSubFrm(cell, frm); + } + + ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo); + if (ret != ROK) + { + errInfo->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + /* TODO: Repetition framework in RGR and APP */ + if (rgSCHUtlEmtcResMngmtInit( + cell, + RGSCH_IOT_PDSCH_POOLSZ, RGSCH_IOT_PDSCH_DELTA, cellCfg->bwCfg.dlTotalBw, + RGSCH_IOT_PUSCH_POOLSZ, RGSCH_IOT_PUSCH_DELTA, RGSCH_IOT_PUSCH_MAXFREQSZ, + RGSCH_IOT_PUCCH_POOLSZ, RGSCH_IOT_PUCCH_DELTA, RGSCH_IOT_PUCCH_MAXFREQSZ) != ROK) + { + errInfo->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + } +#endif + + RETVALUE(ret); +} +#endif + + +/** + * @brief This function performs the cell reconfiguration at RGR interface + * + * @details + * + * Function: rgSCHUtlRgrCellRecfg + * Purpose: This function updates the reconfigurable parameters + * on the cell control block for the scheduler. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgrCellCfg *cellCfg + * @param[in] RgSchErrInfo *errInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrCellRecfg +( +RgSchCellCb *cell, +RgrCellRecfg *recfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlRgrCellRecfg(cell, recfg, err) +RgSchCellCb *cell; +RgrCellRecfg *recfg; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlRgrCellRecfg); + RETVALUE(cell->sc.apis->rgSCHRgrCellRecfg(cell, recfg, err)); +} + + + +/** + * @brief This function returns the Y value of UE for a sub frame + * + * @details + * + * Function: rgSCHUtlFreeCell + * Purpose: This function updates the value of Y stored in the + * UE control block. It uses the previously computed + * value for computing for this subframe. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFreeCell +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlFreeCell(cell) +RgSchCellCb *cell; +#endif +{ + U8 i; + CmLListCp *lst; + RgSchPdcch *pdcch; + RgSchPdcchInfo *pdcchInfo; + RgSchPhichInfo *phichInfo; + RgSchPhich *phich; + Inst inst = cell->instIdx; + U8 maxSubframes; +#ifdef LTE_TDD + RgSchRaReqInfo *raReqInfo; + U8 idx; +#endif + TRC2(rgSCHUtlFreeCell); + +#ifdef LTE_TDD + maxSubframes = cell->numDlSubfrms; +#else + maxSubframes = RGSCH_NUM_DL_SUBFRAMES; +#endif + + + /* Invoke the index for scheduler, cell deletion */ + cell->sc.apis->rgSCHFreeCell(cell); + + /* Release the subframes allocated */ + for (i = 0; i < maxSubframes; i++) + { +#ifdef LTE_ADV + rgSCHLaaDeInitDlSfCb(cell, cell->subFrms[i]); +#endif + pdcchInfo = &cell->subFrms[i]->pdcchInfo; + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)), + (pdcchInfo->nCce + 7) >> 3); + while (pdcchInfo->pdcchs.first != NULLP) + { + pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node; + cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)&pdcch, sizeof(RgSchPdcch)); + } + + phichInfo = &cell->subFrms[i]->phichInfo; + while(phichInfo->phichs.first != NULLP) + { + phich = (RgSchPhich *)phichInfo->phichs.first->node; + cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first); + RGSCH_PHICH_FREE(inst, phich, sizeof(RgSchPhich)); + } + + /* LTE_ADV_FLAG_REMOVED_START */ + /*releasing SFR pool entries*/ + rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell); + + /*releasing dsfr rntp pattern info*/ + rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, + cell->bwCfg.dlTotalBw); + /* LTE_ADV_FLAG_REMOVED_END */ + + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i])), sizeof(RgSchDlSf)); + } +#ifdef LTE_TDD + /* Release the subframe pointers */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data **) (&(cell->subFrms)), sizeof(RgSchDlSf *) * maxSubframes); + + for(idx=0; idx < cell->raInfo.lstSize; idx++) + { + lst = &cell->raInfo.raReqLst[idx]; + while (lst->first != NULLP) + { + raReqInfo = (RgSchRaReqInfo *)lst->first->node; + cmLListDelFrm(lst, &raReqInfo->raReqLstEnt); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst,(Data **)&raReqInfo, sizeof(RgSchRaReqInfo)); + } + } + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data **)(&(cell->raInfo.raReqLst)), + sizeof(CmLListCp) * (cell->raInfo.lstSize)); +#endif + + /* Release allocated pdcchs */ + lst = &cell->pdcchLst; + while (lst->first != NULLP) + { + pdcch = (RgSchPdcch *)lst->first->node; + cmLListDelFrm(lst, &pdcch->lnk); +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + rgSCHEmtcPdcchFree(cell, pdcch); + rgSCHUtlEmtcResMngmtDeinit(cell); + } +#endif + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst,(Data **)&pdcch, sizeof(RgSchPdcch)); + } +#ifdef LTE_ADV + rgSCHLaaFreeLists(cell); +#endif + + /* LTE_ADV_FLAG_REMOVED_START */ + /* releasing RNTP Aggregation Info from CellCb*/ + rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw); + /* LTE_ADV_FLAG_REMOVED_END */ + + RETVALUE(ROK); +} + + +/** + * @brief This function adds the UE to scheduler + * + * @details + * + * Function: rgSCHUtlRgrUeCfg + * Purpose: This function performs addition of UE to scheduler + * 1. First, it updates the Y table in the UE + * 2. Then, it calls the scheduler's handler for UE addition + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrUeCfg *cfg + * @param[in] RgSchErrInfo *err + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrUeCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeCfg *cfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlRgrUeCfg(cell, ue, cfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeCfg *cfg; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlRgrUeCfg); + + /* Assign TM 1 as UE's default TM */ + ue->mimoInfo.txMode = RGR_UE_TM_1; + ue->txModeTransCmplt = TRUE; + cmInitTimers(&ue->txModeTransTmr, 1); + if (cfg->txMode.pres == PRSNT_NODEF) + { + /* DL MU-MIMO not supported */ + if (cfg->txMode.txModeEnum == RGR_UE_TM_5) + { + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ue->mimoInfo.txMode = cfg->txMode.txModeEnum; + } + ue->ul.ulTxAntSel = cfg->ulTxAntSel; + ue->mimoInfo.cdbkSbstRstrctn = cfg->ueCodeBookRstCfg; +#ifdef TFU_UPGRADE + ue->ueCatEnum = cfg->ueCatEnum; + if ((cfg->puschDedCfg.bACKIdx > 15) || + (cfg->puschDedCfg.bCQIIdx > 15) || + (cfg->puschDedCfg.bRIIdx > 15)) + { + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } + ue->ul.betaHqOffst = cfg->puschDedCfg.bACKIdx; + ue->ul.betaCqiOffst = cfg->puschDedCfg.bCQIIdx; + ue->ul.betaRiOffst = cfg->puschDedCfg.bRIIdx; +#endif + ue->csgMmbrSta = cfg->csgMmbrSta; +#ifdef RG_PFS_STATS + cmMemset((U8 *)&ue->pfsStats, 0, sizeof(RgSchPfsStats)); +#endif + /* Call the handler of the scheduler based on cell configuration */ + RETVALUE(cell->sc.apis->rgSCHRgrUeCfg(cell, ue, cfg, err)); +} +/* Start : LTEMAC_2.1_DEV_CFG */ + +/** + * @brief This function adds a service to scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcCfg + * Purpose: This function performs addition of service to scheduler + * The addition is performed for each direction based + * the direction field of the configuration + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlLcCb *dlLc + * @param[in] RgrLchCfg *cfg + * @param[in] RgSchErrInfo *err + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLcCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchCfg *cfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHUtlRgrLcCfg(cell, ue, dlLc, cfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchCfg *cfg; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHUtlRgrLcCfg); + RETVALUE(cell->sc.apis->rgSCHRgrLchCfg(cell, ue, dlLc, cfg, errInfo)); +} + + +/** + * @brief This function modifies a service to scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcRecfg + * Purpose: This function performs modification of a service in + * scheduler. The modification is performed for each direction + * based the direction field of the configuration + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchDlLcCb *dlLc + * @param[in] RgrLchRecfg *recfg + * @param[in] RgSchErrInfo *err + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLcRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *dlLc, +RgrLchRecfg *recfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlRgrLcRecfg(cell, ue, dlLc, recfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *dlLc; +RgrLchRecfg *recfg; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlRgrLcRecfg); + RETVALUE(cell->sc.apis->rgSCHRgrLchRecfg(cell, ue, dlLc, recfg, err)); +} + +/** + * @brief This function deletes a Lc in scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcDel + * Purpose: This function performs deletion of Lc in scheduler + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteLcId lcId + * @param[in] U8 lcgId + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLcDel +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteLcId lcId, +U8 lcgId +) +#else +PUBLIC S16 rgSCHUtlRgrLcDel(cell, ue, lcId, lcgId) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteLcId lcId; +U8 lcgId; +#endif +{ + TRC2(rgSCHUtlRgrLcDel); + cell->sc.apis->rgSCHRgrLchDel(cell, ue, lcId, lcgId); + + RETVALUE (ROK); +} /* rgSCHUtlRgrLcDel */ + +/** + * @brief This function adds a service to scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcgCfg + * Purpose: This function performs addition of service to scheduler + * The addition is performed for each direction based + * the direction field of the configuration + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrLchCfg *cfg + * @param[in] RgSchErrInfo *err + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLcgCfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrLcgCfg *cfg, +RgSchErrInfo *errInfo +) +#else +PUBLIC S16 rgSCHUtlRgrLcgCfg(cell, ue, cfg, errInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrLcgCfg *cfg; +RgSchErrInfo *errInfo; +#endif +{ + TRC2(rgSCHUtlRgrLcgCfg); + RETVALUE(cell->sc.apis->rgSCHRgrLcgCfg(cell, ue, &(ue->ul.lcgArr[cfg->ulInfo.lcgId]), cfg, errInfo)); +} + + +/** + * @brief This function modifies a service to scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcgRecfg + * Purpose: This function performs modification of a service in + * scheduler. The modification is performed for each direction + * based the direction field of the configuration + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrLcgRecfg *recfg + * @param[in] RgSchErrInfo *err + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLcgRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrLcgRecfg *recfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlRgrLcgRecfg(cell, ue, recfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrLcgRecfg *recfg; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlRgrLcgRecfg); + RETVALUE(cell->sc.apis->rgSCHRgrLcgRecfg(cell, ue, &(ue->ul.lcgArr[recfg->ulRecfg.lcgId]), recfg, err)); +} /* rgSCHUtlRgrLcRecfg */ + +/** + * @brief This function modifies a service to scheduler + * + * @details + * + * Function: rgSCHUtlRgrLcgDel + * Purpose: This function performs modification of a service in + * scheduler. The modification is performed for each direction + * based the direction field of the configuration + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgrDel *lcDelInfo + * @return S16 + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlRgrLcgDel +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 lcgId +) +#else +PUBLIC Void rgSCHUtlRgrLcgDel(cell, ue, lcgId) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 lcgId; +#endif +{ + TRC2(rgSCHUtlRgrLcgDel); + cell->sc.apis->rgSCHFreeLcg(cell, ue, &ue->ul.lcgArr[lcgId]); + + /* Stack Crash problem for TRACE5 changes. added the return below . */ + RETVOID; + +} /* rgSCHUtlRgrLcgDel */ + + +/* End: LTEMAC_2.1_DEV_CFG */ + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDoaInd + * Purpose: Updates the DOA for the UE + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDoaRpt *doaRpt + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDoaInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuDoaRpt *doaRpt +) +#else +PUBLIC Void rgSCHUtlDoaInd(cell, ue, doaRpt) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuDoaRpt *doaRpt; +#endif +{ + TRC2(rgSCHUtlDoaInd); + ue->mimoInfo.doa.pres = PRSNT_NODEF; + ue->mimoInfo.doa.val = doaRpt->doa; + RETVOID; +} + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlCqiInd + * Purpose: Updates the DL CQI for the UE + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuDlCqiRpt *dlCqiRpt + * @param[in] CmLteTimingInfo timingInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlCqiInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuDlCqiRpt *dlCqiRpt, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHUtlDlCqiInd(cell, ue, dlCqiRpt, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuDlCqiRpt *dlCqiRpt; +CmLteTimingInfo timingInfo; +#endif +{ + RgSchCellCb *sCellCb = NULLP; + TRC2(rgSCHUtlDlCqiInd); + if (dlCqiRpt->isPucchInfo) + { + sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pucchCqi.cellIdx]->cell; + sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \ + (Void *)&dlCqiRpt->dlCqiInfo.pucchCqi, timingInfo); + } + else + { + U32 idx; + for (idx = 0; idx < dlCqiRpt->dlCqiInfo.pusch.numOfCells; idx++) + { + sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx].cellIdx]->cell; + sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \ + (Void *)&dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx], timingInfo); + } + } + RETVOID; +} + + +#ifdef TFU_UPGRADE +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlSrsInd + * Purpose: Updates the UL SRS for the UE + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuSrsRpt* srsRpt + * @param[in] CmLteTimingInfo timingInfo + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlSrsInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuSrsRpt *srsRpt, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHUtlSrsInd(cell, ue, srsRpt, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuSrsRpt *srsRpt; +CmLteTimingInfo timingInfo; +#endif +{ + TRC2(rgSCHUtlSrsInd); + cell->sc.apis->rgSCHSrsInd(cell, ue, srsRpt, timingInfo); + RETVOID; +} +#endif + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlTARpt + * Purpose: Reports PHY TA for a UE. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlTARpt +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHUtlDlTARpt(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlDlTARpt); + cell->sc.apis->rgSCHDlTARpt(cell, ue); + RETVOID; +} + + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlRlsSubFrm + * Purpose: Releases scheduler Information from DL SubFrm. + * + * Invoked by: DHM + * + * @param[in] RgSchCellCb *cell + * @param[out] CmLteTimingInfo subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlRlsSubFrm +( +RgSchCellCb *cell, +CmLteTimingInfo subFrm +) +#else +PUBLIC Void rgSCHUtlDlRlsSubFrm(cell, subFrm) +RgSchCellCb *cell; +CmLteTimingInfo subFrm; +#endif +{ + TRC2(rgSCHUtlDlRlsSubFrm); + cell->sc.apis->rgSCHDlRlsSubFrm(cell, subFrm); + RETVOID; +} + +#ifdef TFU_UPGRADE +/** + * @brief This API is invoked to update the AperCQI trigger + * weight. + * + * @details + * + * Function : rgSCHUtlUpdACqiTrigWt + * - If HqFdbk is ACK then add up weight corresponding + * to ACK to the AcqiTrigWt. + * - If HqFdbk is NACK then add up weight corresponding + * to NACK to the AcqiTrigWt. + * - If AcqiTrigWt crosses threshold then trigger + * grant req for APERCQI to SCH. + * + * @param[in] RgSchUeCb *ue + * @param[in] U8 isAck + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUpdACqiTrigWt +( +RgSchUeCb *ue, +RgSchUeCellInfo *cellInfo, +U8 isAck +) +#else +PUBLIC Void rgSCHUtlUpdACqiTrigWt(ue,cellInfo, isAck) +RgSchUeCb *ue; +RgSchUeCellInfo *cellInfo; +U8 isAck; +#endif +{ +#ifdef LTE_ADV + U8 triggerSet = 0; + U8 sIdx = 0; +#endif + + TRC2(rgSCHUtlUpdACqiTrigWt); + + if (isAck == TFU_HQFDB_ACK) + { + cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_ACK_WGT; + } + else + { + cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_NACK_WGT; + } + + if (cellInfo->acqiCb.aCqiTrigWt > RG_APER_CQI_THRESHOLD_WGT) + { + RgSchCellCb *cell = ue->cell; + RgSchErrInfo unUsed; + + if(ue->dl.reqForCqi) + { + /* Already one ACQI trigger procedure is going on + * which is not yet satisfied. Delaying this request till + * the previous is getting satisfied*/ + RETVOID; + } + + ue->dl.reqForCqi = TRUE; +#ifdef LTE_ADV + rgSchCmnSetCqiReqField(cellInfo,ue,&ue->dl.reqForCqi); + //Reset aCqiTrigWt for all the serving cells for which we have triggered ACQI + rgSCHTomUtlGetTrigSet(cell, ue, ue->dl.reqForCqi, &triggerSet); + for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++) + { + /* The Aperiodic requested for SCell index sIdx */ + if ((triggerSet >> (7 - sIdx)) & 0x01) + { + /* The Aperiodic request for SCell index sIdx */ + ue->cellInfo[sIdx]->acqiCb.aCqiTrigWt = 0; + } + } + +#endif + /* Force SCH to send UL grant by indicating fake SR. + * If this UE already in UL SCH Qs this SR Ind will + * be ignored */ + rgSCHUtlSrRcvd(cell, ue, cell->crntTime, &unUsed); + } + + RETVOID; +} +#endif + +/** + * @brief This API is invoked to indicate scheduler of a CRC indication. + * + * @details + * + * Function : rgSCHUtlHdlUlTransInd + * This API is invoked to indicate scheduler of a CRC indication. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo timingInfo + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlHdlUlTransInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHUtlHdlUlTransInd(cell, ue, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo timingInfo; +#endif +{ + TRC2(rgSCHUtlHdlUlTransInd); + cell->sc.apis->rgSCHHdlUlTransInd(cell, ue, timingInfo); + RETVOID; +} +#ifdef LTEMAC_SPS +/** + * @brief This API is invoked to indicate scheduler of a CRC failure. + * + * @details + * + * Function : rgSCHUtlHdlCrcInd + * This API is invoked to indicate CRC to scheduler. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo timingInfo + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlHdlCrcInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHUtlHdlCrcInd(cell, ue, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo timingInfo; +#endif +{ + TRC2(rgSCHUtlHdlCrcFail); + cell->sc.apis->rgSCHUlCrcInd(cell, ue, timingInfo); + RETVOID; +} /* end of rgSCHUtlHdlCrcFailInd */ + +/** + * @brief This API is invoked to indicate scheduler of a CRC failure. + * + * @details + * + * Function : rgSCHUtlHdlCrcFailInd + * This API is invoked to indicate CRC failure to scheduler. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] CmLteTimingInfo timingInfo + * + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlHdlCrcFailInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo timingInfo +) +#else +PUBLIC Void rgSCHUtlHdlCrcFailInd(cell, ue, timingInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo timingInfo; +#endif +{ + TRC2(rgSCHUtlHdlCrcFail); + cell->sc.apis->rgSCHUlCrcFailInd(cell, ue, timingInfo); + RETVOID; +} /* end of rgSCHUtlHdlCrcFailInd */ +#endif /* LTEMAC_SPS */ + + +/** + * @brief This function is a wrapper to call scheduler specific API. + * + * @details + * + * Function: rgSCHUtlDlProcAddToRetx + * Purpose: This function adds a HARQ process to retransmission + * queue. This may be performed when a HARQ ack is + * unsuccessful. + * + * Invoked by: HARQ feedback processing + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchDlHqProc* hqP + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlProcAddToRetx +( +RgSchCellCb *cell, +RgSchDlHqProcCb *hqP +) +#else +PUBLIC Void rgSCHUtlDlProcAddToRetx(cell, hqP) +RgSchCellCb *cell; +RgSchDlHqProcCb *hqP; +#endif +{ + TRC2(rgSCHUtlDlProcAddToRetx); + cell->sc.apis->rgSCHDlProcAddToRetx(cell, hqP); + RETVOID; +} + + +/** + * @brief This function adds a HARQ process TB to transmission + * + * @details + * + * Function: rgSCHUtlDlHqPTbAddToTx + * Purpose: This function a HarqProcess TB to the subframe + * list. + * + * Invoked by: Scheduler + * + * @param[in] RgSubFrm* subFrm + * @param[in] RgDlHqProc* hqP + * @param[in] U8 tbIdx + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlHqPTbAddToTx +( +RgSchDlSf *subFrm, +RgSchDlHqProcCb *hqP, +U8 tbIdx +) +#else +PUBLIC Void rgSCHUtlDlHqPTbAddToTx(subFrm, hqP, tbIdx) +RgSchDlSf *subFrm; +RgSchDlHqProcCb *hqP; +U8 tbIdx; +#endif +{ + RgSchUeCb *ue = NULLP; + RgSchCellCb *cell = hqP->hqE->cell; + /* CA Dev Start */ + /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */ + /* ue->cell will always hold PCell information */ + if (NULLP == hqP->hqPSfLnk.node) + { + if (hqP->hqE->ue) + { + ue = hqP->hqE->ue; + if(NULLP == ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node) + { + ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)ue; + cmLListAdd2Tail(&cell->subFrms[subFrm->dlIdx]->ueLst, + &ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk); + + ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].isPuschHarqRecpPres = FALSE; + + } + + /* Add Hq proc in particular dlIdx List for this UE + This list will be used while processing feedback*/ + hqP->hqPSfLnk.node = (PTR)hqP; + cmLListAdd2Tail(&ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk); +#ifdef CA_DBG + { + extern U32 gSCellSchedCount,gPrimarySchedCount; + if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue,hqP->hqE->cell)) + { + gSCellSchedCount++; + }else + gPrimarySchedCount++; + } +#endif + } + else if (hqP->hqE->msg4Proc == hqP) + { + /* Msg4 will be scheduled on PCELL only hence add directly to subFrm msg4HqpList */ + hqP->hqPSfLnk.node = (PTR)hqP; + cmLListAdd2Tail(&subFrm->msg4HqPLst, &hqP->hqPSfLnk); + } + } + else + { + ue = hqP->hqE->ue; + } + if((ue) && (HQ_TB_WAITING == hqP->tbInfo[tbIdx].state)) + + { + ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt++; + } + /*totalTbCnt will hold the total number of TBs across all harq Proc from all + * cells*/ + + hqP->subFrm = subFrm; + + /* CA Dev End */ + RETVOID; +} + + + +/** + * @brief This function removes a HARQ process TB from transmission + * + * @details + * + * Function: rgSCHUtlDlHqPTbRmvFrmTx + * Purpose: This function removes a HarqProcess TB to the subframe + * list. + * + * Invoked by: Scheduler + * + * @param[in] RgSubFrm* subFrm + * @param[in] RgDlHqProc* hqP + * @param[in] U8 tbIdx + * @param[in] Bool isRepeting + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlHqPTbRmvFrmTx +( +RgSchDlSf *subFrm, +RgSchDlHqProcCb *hqP, +U8 tbIdx, +Bool isRepeting +) +#else +PUBLIC Void rgSCHUtlDlHqPTbRmvFrmTx(subFrm, hqP, tbIdx, isRepeting) +RgSchDlSf *subFrm; +RgSchDlHqProcCb *hqP; +U8 tbIdx; +Bool isRepeting; +#endif +{ + RgSchCellCb *cell = NULLP; + /* Check with TDD */ + if ((isRepeting) && + (hqP->hqE->ue->ackNakRepCb.cfgRepCnt != + hqP->tbInfo[tbIdx].fbkRepCntr)) + { + cmLListDelFrm(&subFrm->ackNakRepQ, + &hqP->tbInfo[tbIdx].anRepLnk[hqP->tbInfo[tbIdx].fbkRepCntr]); + } + else + { + if (NULLP != hqP->hqPSfLnk.node) + { + /* CA dev Start */ + if (hqP->hqE->msg4Proc == hqP) + { + /* Msg4 will be scheduled on PCELL only hence delete directly from subFrm msg4HqpList */ + cmLListDelFrm(&subFrm->msg4HqPLst, &hqP->hqPSfLnk); + } + else + { + cell = hqP->hqE->cell; + /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */ + /* ue->cell will always hold PCell information */ + cmLListDelFrm(&hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk); + if (0 == hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst.count) + { + + cmLListDelFrm(&cell->subFrms[subFrm->dlIdx]->ueLst, + &hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk); + hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)NULLP; + hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt = 0; + } + } + hqP->hqPSfLnk.node = NULLP; + } + hqP->subFrm = NULLP; + } + RETVOID; +} + +#ifdef LTE_ADV +/** + * @brief Handler for accessing the existing SCellCb identified by the key + * SCellId under the CellCb. + * + * @details + * + * Function : rgSchUtlGetCellCb + * + * + * @param[in] *cellCb + * @param[in] ueId + * @return RgSchUeCb* + **/ +#ifdef ANSI +PUBLIC RgSchCellCb* rgSchUtlGetCellCb +( + Inst inst, + U16 cellId +) +#else +PUBLIC RgSchCellCb* rgSchUtlGetCellCb(inst, cellId) + Inst inst; + U16 cellId; +#endif +{ + RgSchCellCb *cellCb = NULLP; + U8 strtCellId; + + TRC2(rgSchUtlGetCellCb); + + strtCellId = rgSchCb[inst].genCfg.startCellId; + cellCb = rgSchCb[inst].cells[cellId - strtCellId]; + + RETVALUE(cellCb); + +} /* rgSchUtlGetCellCb */ + +/** + * @brief Handler for deriving the servCellidx + * + * @details + * + * Function : rgSchUtlGetServCellIdx + * + * + * @param[in] *cellId + * @param[in] RgSchUeCb *ue + * @return U8 servCellIdx + **/ +#ifdef ANSI +PUBLIC U8 rgSchUtlGetServCellIdx +( + Inst inst, + U16 cellId, + RgSchUeCb *ue +) +#else +PUBLIC U8 rgSchUtlGetServCellIdx(inst,cellId,ue) + Inst inst; + U16 cellId; + RgSchUeCb *ue; +#endif +{ + U8 servCellIdx; + U16 strtCellId; + + TRC2(rgSchUtlGetCellCb); + + strtCellId = rgSchCb[inst].genCfg.startCellId; + + servCellIdx = ue->cellIdToCellIdxMap[cellId - strtCellId]; + + RETVALUE(servCellIdx); + +} /* rgSchUtlGetCellCb */ + +/** + * @brief Handler for validating the Cell Id received secondary Cell Addition + * + * @details + * + * Function : rgSchUtlGetCellId + * + * + * @param[in] *cellCb + * @param[in] ueId + * @return RgSchUeCb* + **/ +#ifdef ANSI +PUBLIC S16 rgSchUtlVldtCellId +( + Inst inst, + U16 cellId +) +#else +PUBLIC S16 rgSchUtlVldtCellId(inst, cellId) + Inst inst; + U16 cellId; +#endif +{ + U8 strtCellId; + + TRC2(rgSchUtlVldtCellId); + + strtCellId = rgSchCb[inst].genCfg.startCellId; + if((cellId >= strtCellId) && ((cellId - strtCellId) < CM_LTE_MAX_CELLS)) + { + RETVALUE(ROK); + } + RETVALUE(RFAILED); +} /* rgSchUtlVldtCellId */ + +#endif /* LTE_ADV*/ +/** + * @brief UE reconfiguration for scheduler + * + * @details + * + * Function : rgSCHUtlRgrUeRecfg + * + * This functions updates UE specific scheduler + * information upon UE reconfiguration + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[int] RgrUeRecfg *ueRecfg + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrUeRecfg +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeRecfg *ueRecfg, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlRgrUeRecfg(cell, ue, ueRecfg, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeRecfg *ueRecfg; +RgSchErrInfo *err; +#endif +{ +/* Changes for UE Category Reconfiguration feature addition */ + RgSchCmnUe *ueSch = RG_SCH_CMN_GET_UE(ue, cell); + + TRC2(rgSCHUtlRgrUeRecfg); + + /* Changes for UE Category Reconfiguration feature addition */ + if (ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG) + { + ueSch->cmn.ueCat = ueRecfg->ueCatEnum-1; +#ifdef TFU_UPGRADE + ue->ueCatEnum = ueRecfg->ueCatEnum; +#endif + } + + /* DL MU-MIMO not supported */ + if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) + { + + if (ueRecfg->txMode.pres == PRSNT_NODEF) + { + if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_5) + { + err->errCause = RGSCHERR_SCH_CFG; + RETVALUE(RFAILED); + } +#ifdef LTE_ADV + if(ue->mimoInfo.txMode != ueRecfg->txMode.txModeEnum) + { + /* Decremnt the previos A value for this cell */ + ue->f1bCsAVal -= rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode); + /* Update A value with the new TM Mode */ + ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(ueRecfg->txMode.txModeEnum); + + + RLOG1(L_INFO,"UeReCfg A valie is %d\n",ue->f1bCsAVal); + } +#endif + ue->mimoInfo.txMode = ueRecfg->txMode.txModeEnum; + } + } +#ifdef TFU_UPGRADE + /* [ccpu00123958]-ADD- Check for PUSCH related Reconfig from the bit mask */ + if(ueRecfg->ueRecfgTypes & RGR_UE_PUSCH_RECFG) + { + /* Fix: ccpu00124012 */ + /* TODO:: Need to check if this is + mandatory to be re-configured on UE category re-configuration */ + /* ue->ul.betaHqOffst = ueRecfg->puschDedCfg.bACKIdx; + ue->ul.betaCqiOffst = ueRecfg->puschDedCfg.bCQIIdx; + ue->ul.betaRiOffst = ueRecfg->puschDedCfg.bRIIdx;*/ + } +#endif + if (ueRecfg->ueRecfgTypes & RGR_UE_ULTXANTSEL_RECFG) + { + ue->ul.ulTxAntSel = ueRecfg->ulTxAntSel; + } + if (ueRecfg->ueRecfgTypes & RGR_UE_CDBKSBST_RECFG) + { + ue->mimoInfo.cdbkSbstRstrctn = ueRecfg->ueCodeBookRstRecfg; + } + + /* Commenting here to assign garbage value when it is not set in APP. */ + //ue->accessStratumRls = ueRecfg->accessStratumRls; + RETVALUE(cell->sc.apis->rgSCHRgrUeRecfg(cell, ue, ueRecfg, err)); +} /* rgSCHUtlRgrUeRecfg */ + +/** + * @brief This function deletes a service from scheduler + * + * @details + * + * Function: rgSCHUtlFreeDlLc + * Purpose: This function is made available through a FP for + * making scheduler aware of a service being deleted from UE + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @param[in] RgSchDlLcCb* svc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFreeDlLc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *svc +) +#else +PUBLIC Void rgSCHUtlFreeDlLc(cell, ue, svc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *svc; +#endif +{ + TRC2(rgSCHUtlFreeDlLc); + cell->sc.apis->rgSCHFreeDlLc(cell, ue, svc); + + /* Stack Crash problem for TRACE5 changes. added the return below . */ + RETVOID; + +} + +/** + * @brief UE deletion for scheduler + * + * @details + * + * Function : rgSCHUtlFreeUe + * + * This functions deletes all scheduler information + * pertaining to a UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFreeUe +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHUtlFreeUe(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlFreeUe); +#ifdef LTE_TDD + rgSCHUtlDelUeANFdbkInfo(ue,RGSCH_PCELL_INDEX); +#endif + cell->sc.apis->rgSCHFreeUe(cell, ue); + + /* Stack Crash problem for TRACE5 changes. added the return below . */ + RETVOID; + +} /* rgSCHUtlFreeUe */ + +/** + * @brief This function updates the scheduler with service for a UE + * + * @details + * + * Function: rgSCHUtlDlDedBoUpd + * Purpose: This function should be called whenever there is a + * change BO for a service. + * + * Invoked by: BO and Scheduler + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSchUeCb* ue + * @param[in] RgSchDlLcCb* lc + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDlDedBoUpd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchDlLcCb *lc +) +#else +PUBLIC Void rgSCHUtlDlDedBoUpd(cell, ue, lc) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchDlLcCb *lc; +#endif +{ + TRC2(rgSCHUtlDlDedBoUpd); + cell->sc.apis->rgSCHDlDedBoUpd(cell, ue, lc); + RETVOID; +} +/** + * @brief Record MSG3 allocation into the UE + * + * @details + * + * Function : rgSCHUtlRecMsg3Alloc + * + * This function is invoked to update record msg3 allocation information + * in the UE when UE is detected for RaCb + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] RgSchRaCb *raCb + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlRecMsg3Alloc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchRaCb *raCb +) +#else +PUBLIC Void rgSCHUtlRecMsg3Alloc(cell, ue, raCb) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchRaCb *raCb; +#endif +{ + TRC2(rgSCHUtlRecMsg3Alloc) + cell->sc.apis->rgSCHUlRecMsg3Alloc(cell, ue, raCb); + RETVOID; + +} /* rgSCHRecMsg3Alloc */ + +#ifdef RG_UNUSED +/** + * @brief Update harq process for allocation + * + * @details + * + * Function : rgSCHUtlUpdUlHqProc + * + * This function is invoked when harq process + * control block is now in a new memory location + * thus requiring a pointer/reference update. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUlHqProcCb *curProc + * @param[in] RgSchUlHqProcCb *oldProc + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdUlHqProc +( +RgSchCellCb *cell, +RgSchUlHqProcCb *curProc, +RgSchUlHqProcCb *oldProc +) +#else +PUBLIC S16 rgSCHUtlUpdUlHqProc(cell, curProc, oldProc) +RgSchCellCb *cell; +RgSchUlHqProcCb *curProc; +RgSchUlHqProcCb *oldProc; +#endif +{ + TRC2(rgSCHUtlUpdUlHqProc); + RETVALUE(cell->sc.apis->rgSCHUpdUlHqProc(cell, curProc, oldProc)); +} /* rgSCHUtlUpdUlHqProc */ +#endif +/** + * @brief UL grant for contention resolution + * + * @details + * + * Function : rgSCHUtlContResUlGrant + * + * Add UE to another queue specifically for CRNTI based contention + * resolution + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlContResUlGrant +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlContResUlGrant(cell, ue, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlContResUlGrant); + + + ue->isMsg4PdcchWithCrnti = TRUE; + + RETVALUE(cell->sc.apis->rgSCHContResUlGrant(cell, ue, err)); +} /* rgSCHUtlContResUlGrant */ + +/** + * @brief SR reception handling + * + * @details + * + * Function : rgSCHUtlSrRcvd + * + * - Handles SR reception for UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlSrRcvd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +CmLteTimingInfo frm, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlSrRcvd(cell, ue, frm, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +CmLteTimingInfo frm; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlSrRcvd); + RETVALUE(cell->sc.apis->rgSCHSrRcvd(cell, ue, frm, err)); +} /* rgSCHUtlSrRcvd */ + +/** + * @brief Short BSR update + * + * @details + * + * Function : rgSCHUtlUpdBsrShort + * + * This functions does requisite updates to handle short BSR reporting + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 lcgId + * @param[in] U8 bsr + * @param[out] RgSchErrInfo *err + * @return Void + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUpdBsrShort +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 lcgId, +U8 bsr, +RgSchErrInfo *err +) +#else +PUBLIC Void rgSCHUtlUpdBsrShort(cell, ue, lcgId, bsr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 lcgId; +U8 bsr; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlUpdBsrShort); + cell->sc.apis->rgSCHUpdBsrShort(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err); + RETVOID; +} /* rgSCHUtlUpdBsrShort */ + + +/** + * @brief Truncated BSR update + * + * @details + * + * Function : rgSCHUtlUpdBsrTrunc + * + * This functions does required updates to handle truncated BSR report + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 lcgId + * @param[in] U8 bsr + * @param[out] RgSchErrInfo *err + * @return Void + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUpdBsrTrunc +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 lcgId, +U8 bsr, +RgSchErrInfo *err +) +#else +PUBLIC Void rgSCHUtlUpdBsrTrunc(cell, ue, lcgId, bsr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 lcgId; +U8 bsr; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlUpdBsrTrunc); + cell->sc.apis->rgSCHUpdBsrTrunc(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err); + RETVOID; +} /* rgSCHUtlUpdBsrTrunc */ + + +/** + * @brief Long BSR update + * + * @details + * + * Function : rgSCHUtlUpdBsrLong + * + * - Update BSRs for all configured LCGs + * - Update priority of LCGs if needed + * - Update UE's position within/across uplink scheduling queues + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 bsr0 + * @param[in] U8 bsr1 + * @param[in] U8 bsr2 + * @param[in] U8 bsr3 + * @param[out] RgSchErrInfo *err + * @return Void + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUpdBsrLong +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 bsr0, +U8 bsr1, +U8 bsr2, +U8 bsr3, +RgSchErrInfo *err +) +#else +PUBLIC Void rgSCHUtlUpdBsrLong(cell, ue, bsr0, bsr1, bsr2, bsr3, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 bsr0; +U8 bsr1; +U8 bsr2; +U8 bsr3; +RgSchErrInfo *err; +#endif +{ + U8 bsArr[4]; + TRC2(rgSCHUtlUpdBsrLong); + + bsArr[0] = bsr0; + bsArr[1] = bsr1; + bsArr[2] = bsr2; + bsArr[3] = bsr3; + cell->sc.apis->rgSCHUpdBsrLong(cell, ue, bsArr, err); + RETVOID; +} /* rgSCHUtlUpdBsrLong */ + +/** + * @brief EXT PHR update + * + * @details + * + * Function : rgSCHUtlUpdExtPhr + * + * Updates extended power headroom info for a UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 phr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdExtPhr +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgInfExtPhrCEInfo * extPhr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlUpdExtPhr(cell, ue, extPhr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgInfExtPhrCEInfo * extPhr; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlUpdExtPhr); + RETVALUE(cell->sc.apis->rgSCHUpdExtPhr(cell, ue, extPhr, err)); +} /* rgSCHUtlUpdExtPhr */ + + + +/** + * @brief PHR update + * + * @details + * + * Function : rgSCHUtlUpdPhr + * + * Updates power headroom info for a UE + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 phr + * @param[out] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdPhr +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U8 phr, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlUpdPhr(cell, ue, phr, err) +RgSchCellCb *cell; +RgSchUeCb *ue; +U8 phr; +RgSchErrInfo *err; +#endif +{ + TRC2(rgSCHUtlUpdPhr); + RETVALUE(cell->sc.apis->rgSCHUpdPhr(cell, ue, phr, err)); +} /* rgSCHUtlUpdPhr */ + + +/** + * @brief Indication of UL CQI + * + * @details + * + * Function : rgSCHUtlUlCqiInd + * + * - Updates uplink CQI information for the UE. Computes and + * stores the lowest CQI of CQIs reported in all subbands + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] TfuUlCqiRpt *ulCqiInfo + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlCqiInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +TfuUlCqiRpt *ulCqiInfo +) +#else +PUBLIC Void rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +TfuUlCqiRpt *ulCqiInfo; +#endif +{ + TRC2(rgSCHUtlUlCqiInd); + cell->sc.apis->rgSCHUlCqiInd(cell, ue, ulCqiInfo); + RETVOID; +} /* rgSCHUtlUlCqiInd */ + +/** + * @brief Indication of PUCCH power adjustment + * + * @details + * + * Function : rgSCHUtlPucchDeltaPwrInd + * + * - Updates uplink CQI information for the UE. Computes and + * stores the lowest CQI of CQIs reported in all subbands + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U8 delta + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlPucchDeltaPwrInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +S8 delta +) +#else +PUBLIC Void rgSCHUtlPucchDeltaPwrInd(cell, ue, delta) +RgSchCellCb *cell; +RgSchUeCb *ue; +S8 delta; +#endif +{ + TRC2(rgSCHUtlPucchDeltaPwrInd); + cell->sc.apis->rgSCHPucchDeltaPwrInd(cell, ue, delta); + RETVOID; +} /* rgSCHUtlPucchDeltaPwrInd */ + +/* Start: LTEMAC_2.1_DEV_CFG */ +/** + * @brief Ue Reset Request + * + * @details + * + * Function : rgSCHUtlUeReset + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return S16 + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUeReset +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC Void rgSCHUtlUeReset(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlUeReset); + ue->remBoCnt = 0; + cell->sc.apis->rgSCHUeReset(cell, ue); + RETVOID; +} /* rgSCHUtlUeReset */ +/* End: LTEMAC_2.1_DEV_CFG */ + +/** + * @brief Returns HARQ proc for which data expected now + * + * @details + * + * Function: rgSCHUtlUlHqProcForUe + * Purpose: This function returns the harq process for + * which data is expected in the current subframe. + * It does not validate if the HARQ process + * has an allocation. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteTimingInfo frm + * @param[in] RgSchUeCb *ue + * @param[out] RgSchUlHqProcCb **procRef + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHqProcForUe +( +RgSchCellCb *cell, +CmLteTimingInfo frm, +RgSchUeCb *ue, +RgSchUlHqProcCb **procRef +) +#else +PUBLIC Void rgSCHUtlUlHqProcForUe(cell, frm, ue, procRef) +RgSchCellCb *cell; +CmLteTimingInfo frm; +RgSchUeCb *ue; +RgSchUlHqProcCb **procRef; +#endif +{ + TRC2(rgSCHUtlUlHqProcForUe); + cell->sc.apis->rgSCHUlHqProcForUe(cell, frm, ue, procRef); + + /* Stack Crash problems for TRACE5 changes. added the return below */ + RETVOID; + +} + +/** + * @brief Returns first uplink allocation to send reception + * request to PHY + * + * @details + * + * Function: rgSCHUtlFirstRcptnReq(cell) + * Purpose: This function returns the first uplink allocation + * (or NULLP if there is none) in the subframe + * in which is expected to prepare and send reception + * request to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlFirstRcptnReq +( +RgSchCellCb *cell +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlFirstRcptnReq(cell) +RgSchCellCb *cell; +#endif +{ + TRC2(rgSCHUtlFirstRcptnReq); + RETVALUE(cell->sc.apis->rgSCHFirstRcptnReq(cell)); +} + +/** + * @brief Returns first uplink allocation to send reception + * request to PHY + * + * @details + * + * Function: rgSCHUtlNextRcptnReq(cell) + * Purpose: This function returns the next uplink allocation + * (or NULLP if there is none) in the subframe + * in which is expected to prepare and send reception + * request to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlNextRcptnReq +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlNextRcptnReq(cell, alloc) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlNextRcptnReq); + RETVALUE(cell->sc.apis->rgSCHNextRcptnReq(cell, alloc)); +} + +/** + * @brief Returns first uplink allocation to send HARQ feedback + * request to PHY + * + * @details + * + * Function: rgSCHUtlFirstHqFdbkAlloc + * Purpose: This function returns the first uplink allocation + * (or NULLP if there is none) in the subframe + * in which it is expected to prepare and send HARQ + * feedback to PHY. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @param[in] U8 idx + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc +( +RgSchCellCb *cell, +U8 idx +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc(cell, idx) +RgSchCellCb *cell; +U8 idx; +#endif +{ + TRC2(rgSCHUtlFirstHqFdbkAlloc); + RETVALUE(cell->sc.apis->rgSCHFirstHqFdbkAlloc(cell, idx)); +} + + +/** + * @brief Returns next allocation to send HARQ feedback for + * + * @details + * + * Function: rgSCHUtlNextHqFdbkAlloc(cell) + * Purpose: This function returns the next uplink allocation + * (or NULLP if there is none) in the subframe + * for which HARQ feedback needs to be sent. + * + * Invoked by: TOM + * + * @param[in] RgSchCellCb *cell + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc +( +RgSchCellCb *cell, +RgSchUlAlloc *alloc, +U8 idx +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc(cell, alloc, idx) +RgSchCellCb *cell; +RgSchUlAlloc *alloc; +U8 idx; +#endif +{ + TRC2(rgSCHUtlNextHqFdbkAlloc); + RETVALUE(cell->sc.apis->rgSCHNextHqFdbkAlloc(cell, alloc, idx)); +} + +/*********************************** +***********************************/ +/** + * @brief This API is invoked to send TFU SAP bind request to PHY. + * + * @details + * + * Function : rgSCHUtlTfuBndReq + * + * This API is invoked to send TFU SAP bind request to PHY from scheduler + * isntance. It fills in the Pst structure, spId and suId values and + * invokes bind request primitive at TFU. + * + * @param[in] Inst instId + * @param[in] SuId suId + * @param[in] SpId spId + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlTfuBndReq +( +Inst instId, +SuId suId, +SpId spId +) +#else +PUBLIC S16 rgSCHUtlTfuBndReq(instId, suId, spId) +Inst instId; +SuId suId; +SpId spId; +#endif +{ + S16 ret; + RgSchLowSapCb *tfuSap; + Pst pst; + TRC2(rgSCHUtlTfuBndReq); + + /* Get the lower SAP control block from the layer control block. */ + tfuSap = &(rgSchCb[instId].tfuSap[suId]); + (Void)cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst)); + if((ret = RgLiTfuSchBndReq (&pst, suId, spId)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlTfuBndReq() Call to RgLiTfuBndReq()" + " failed"); + } + RETVALUE(ret); +} /* rgSCHUtlTfuBndReq */ + +/** + * @brief This API is invoked to send TFU SAP unbind request to PHY. + * + * @details + * + * Function : rgSCHUtlTfuUBndReq + * This API is invoked to send TFU SAP unbind request to PHY from Scheduler + * isntance. It fills in the Pst structure and spId value and invokes + * unbind request primitive at TFU. + * + * @param[in] SpId spId + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlTfuUBndReq +( +Inst inst, +RgSchLowSapCfgInfo sapCfg, +Reason reason +) +#else +PUBLIC S16 rgSCHUtlTfuUBndReq(inst, sapCfg, reason) +Inst inst; +RgSchLowSapCfgInfo sapCfg; +Reason reason; +#endif +{ + S16 ret; + Pst pst; + + TRC2(rgSCHUtlTfuUBndReq); + + /* Get the lower SAP control block from the layer control block. */ + cmMemcpy ((U8*)&pst, (U8*)&(sapCfg.sapPst), sizeof(Pst)); + if((ret = RgLiTfuSchUbndReq (&pst, sapCfg.spId, reason)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuUBndReq() Call to" + " RgLiTfuUbndReq() failed"); + } + RETVALUE(ret); + +} /* rgSCHUtlTfuUBndReq */ + +/*********************************************************** + * + * Func : rgSCHUtlResetSfAlloc + * + * Desc : Utility Function to Reset subframe allocation information. + * + * + * Ret : ROK + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlResetSfAlloc +( +RgInfSfAlloc *sfAlloc, +Bool resetCmnLcInfo, +Bool restAlloc +) +#else +PUBLIC S16 rgSCHUtlResetSfAlloc(sfAlloc,resetCmnLcInfo,restAlloc) +RgInfSfAlloc *sfAlloc; +Bool resetCmnLcInfo; +Bool restAlloc; +#endif +{ + TRC2(rgSCHUtlResetSfAlloc); + if(TRUE == restAlloc) + { + if(sfAlloc->ueInfo.numUes) + { + cmMemset((U8 *)sfAlloc->ueInfo.allocInfo,0x00, + (sizeof(RgInfUeAlloc)*sfAlloc->ueInfo.numUes)); + } + sfAlloc->ueInfo.numUes = 0; + sfAlloc->rarInfo.numRaRntis = 0; + sfAlloc->flowCntrlInfo.numUes = 0; + } + if(TRUE == resetCmnLcInfo) + { + sfAlloc->cmnLcInfo.bitMask = 0; + } + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHUtlGetRlsHqAlloc + * + * Desc : Utility Function to Allocate subframe allocation information. + * + * + * Ret : ROK + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetRlsHqAlloc +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlGetRlsHqAlloc(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx = 0; + Inst inst = cell->instIdx; + TRC2(rgSCHUtlGetRlsHqAlloc); + for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) + { + cell->rlsHqArr[idx].cellId = cell->cellId; + + /* Allocating with additional location, to accommodate + TA scheduling along with maximum no of UEs per SF */ + + /* Allocate memory for "scheduled UE" Info */ + if((rgSCHUtlAllocSBuf(inst, + (Data**)&(cell->rlsHqArr[idx].ueHqInfo), + (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " + "UE Alloc"); + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); + +} + +/*********************************************************** + * + * Func : rgSCHUtlPutRlsHqAlloc + * + * Desc : Utility Function to deallocate subframe allocation information. + * + * + * Ret : ROK + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlPutRlsHqAlloc +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlPutRlsHqAlloc(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx = 0; + Inst inst = cell->instIdx; + TRC2(rgSCHUtlPutRlsHqAlloc); + + for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) + { + /* Deallocate memory for "scheduled UE" Info */ + if (cell->rlsHqArr[idx].ueHqInfo != NULLP) + { + /* Freeing with additional location, to accommodate TA + scheduling along with maximum no of UEs per SF */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data **)(&(cell->rlsHqArr[idx].ueHqInfo)), + (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF)); + } + } + + RETVALUE(ROK); + +} + + +/*********************************************************** + * + * Func : rgSCHUtlGetSfAlloc + * + * Desc : Utility Function to Allocate subframe allocation information. + * + * + * Ret : ROK + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetSfAlloc +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlGetSfAlloc(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx; + U8 indx; + Inst inst = cell->instIdx; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + TRC2(rgSCHUtlGetSfAlloc); + +#ifdef LTE_TDD + for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++) +#else + for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) +#endif + { + cell->sfAllocArr[idx].cellId = cell->cellId; + + /* Allocating with additional location, to accommodate + TA scheduling along with maximum no of UEs per SF */ + + /* Allocate memory for "scheduled UE" Info */ + if((rgSCHUtlAllocSBuf(inst, + (Data**)&(cell->sfAllocArr[idx].ueInfo.allocInfo), + (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " + "UE Alloc"); + RETVALUE(RFAILED); + } + + /* Allocate memory for "scheduled RAR" Info */ + if((rgSCHUtlAllocSBuf(inst, + (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo), + (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " + "RARNTI"); + RETVALUE(RFAILED); + } + for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++) + { + if((rgSCHUtlAllocSBuf(inst, + (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo), + (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf)))) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Memory allocation FAILED for " + "RNTI"); + RETVALUE(RFAILED); + } + } + + } + +#ifdef EMTC_ENABLE + rgSCHEmtcUtlGetSfAlloc(cell); +#endif + + RETVALUE(ROK); + +} + +/*********************************************************** + * + * Func : rgSCHUtlPutSfAlloc + * + * Desc : Utility Function to deallocate subframe allocation information. + * + * + * Ret : ROK + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlPutSfAlloc +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlPutSfAlloc(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx; + U8 indx; + Inst inst = cell->instIdx; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + TRC2(rgSCHUtlPutSfAlloc); + +#ifdef LTE_TDD + for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++) +#else + for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++) +#endif + { + if (cell->sfAllocArr[idx].rarInfo.raRntiInfo != NULLP) + { + for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++) + { + if (cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo != NULLP) + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].\ + crntiInfo)), + (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf))); + } + /* Deallocate memory for "scheduled RAR" Info */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo)), + (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF)); + } + /* Deallocate memory for "scheduled UE" Info */ + if (cell->sfAllocArr[idx].ueInfo.allocInfo != NULLP) + { + /* Freeing with additional location, to accommodate TA + scheduling along with maximum no of UEs per SF */ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(inst, + (Data**)(&(cell->sfAllocArr[idx].ueInfo.allocInfo)), + (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF)); + } + } + +#ifdef EMTC_ENABLE + rgSCHEmtcUtlPutSfAlloc(cell); +#endif + RETVALUE(ROK); + +} + +/*********************************************************** + * + * Func : rgSCHUtlAllocSBuf + * + * Desc : Utility Function to Allocate static buffer. + * Memory allocated is assumed contiguous. + * + * + * Ret : ROK + * RFAILED + * + * Notes: Caller doesnt need to raise the alarm in case of memory + * allocation gets failed. + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAllocSBuf +( +Inst inst, /* Instance of the invoking scheduler */ +Data **pData, /* Pointer of the data to be returned */ +Size size /* size */ +) +#else +PUBLIC S16 rgSCHUtlAllocSBuf(inst, pData, size) +Inst inst; /* Instance of the invoking scheduler */ +Data **pData; /* Pointer of the data to be returned */ +Size size; /* size */ +#endif +{ + /* Moving alarm diagnostics to available scope */ + + TRC2(rgSCHUtlAllocSBuf) + + /* Initialize the param to NULLP */ + *pData = NULLP; + + /* May not be necessary for data performance path */ +#ifndef NO_ERRCLS + if (size == 0) + { + RETVALUE(RFAILED); + } +#endif + + /* allocate buffer */ +#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ + MS_BUF_ADD_ALLOC_CALLER(); +#endif /* */ + if (SGetSBuf(rgSchCb[inst].rgSchInit.region, rgSchCb[inst].rgSchInit.pool, + pData, size) != ROK) + { + RgUstaDgn dgn; /* Alarm diagnostics structure */ + dgn.type = LRG_USTA_DGNVAL_MEM; + dgn.u.mem.region = rgSchCb[inst].rgSchInit.region; + dgn.u.mem.pool = rgSchCb[inst].rgSchInit.pool; + /* Send an alarm to Layer Manager */ + rgSCHLmmStaInd(inst, LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL, + LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); + RGSCHLOGERROR(inst, ERRCLS_DEBUG, ERG015, 0, "Unable to Allocate Buffer"); + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Unable to Allocate the Buffer"); + RETVALUE(RFAILED); + } + + + /* zero out the allocated memory */ + cmMemset((U8 *)*pData, 0x00, size); + + RETVALUE(ROK); + +} /* end of rgSCHUtlAllocSBuf */ + + +/* +* +* Fun: rgSCHUtlFreeSBuf +* +* Desc: The argument to rgSCHUtlFreeSBuf() is a pointer to a block +* previously allocated by rgSCHUtlAllocSBuf() and size. It +* deallocates the memory. +* +* Ret: RETVOID +* +* Notes: None +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFreeSBuf +( +Inst inst, /* Instance of the invoking scheduler */ +Data **data, /* pointer to data */ +Size size /* size */ +) +#else +PUBLIC Void rgSCHUtlFreeSBuf(inst, data, size) +Inst inst; /* Instance of the invoking scheduler */ +Data **data; /* pointer to data */ +Size size; /* size */ +#endif +{ + + S16 ret; + + TRC2(rgSCHUtlFreeSBuf) + + if ((data == NULLP) || (*data == NULLP) || (size == 0)) + { + RETVOID; + } + + +#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ + MS_BUF_ADD_CALLER(); +#endif /* */ + /* Deallocate buffer */ + ret = SPutSBuf(rgSchCb[inst].rgSchInit.region, + rgSchCb[inst].rgSchInit.pool, (*data), size); + + if (ret != ROK) + { + RGSCHLOGERROR(inst, ERRCLS_DEBUG, ERG016, (ErrVal) 0, + "rgSCHUtlFreeSBuf failed.\n"); + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHUtlFreeSBuf failed"); + RETVOID; + } + + /* ccpu00117052 - ADD - Assigning the pointer to NULLP */ + *data = NULLP; + + RETVOID; +} /* end of rgSCHUtlFreeSBuf */ + + +#ifdef RGR_SI_SCH +/* +* +* Fun: rgSCHUtlFreeWarningSiSeg +* +* Desc: This is used to deallocate Warning SI Seg. +* +* Ret: RETVOID +* +* Notes: None +* +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFreeWarningSiSeg +( +Region reg, +Pool pool, +CmLListCp *siPduLst +) +#else +PUBLIC Void rgSCHUtlFreeWarningSiSeg(reg, pool, siPduLst) +Region reg; +Pool pool; +CmLListCp *siPduLst; +#endif +{ + CmLList *node; + Buffer *pdu; + + TRC2(rgSCHUtlFreeWarningSiSeg) + + while (siPduLst->first != NULLP) + { + node = siPduLst->first; + pdu = (Buffer *)node->node; + cmLListDelFrm(siPduLst, node); + RGSCH_FREE_MSG(pdu); + SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList)); + node = NULLP; + } + + RETVOID; +} /* end of rgSCHUtlFreeWarningSiSeg */ + + +/* +* +* Fun: rgSCHUtlFreeWarningSiPdu +* +* Desc: This is used to deallocate Warning SI PDU. +* +* Ret: RETVOID +* +* Notes: None +* +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFreeWarningSiPdu +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHUtlFreeWarningSiPdu(cell) +RgSchCellCb *cell; +#endif +{ + CmLList *node; + Buffer *pdu; + RgSchWarningSiInfo *warningSi; + RgSchWarningSiPdu *warningSiPdu; + + TRC2(rgSCHUtlFreeWarningSiPdu) + + warningSi = (RgSchWarningSiInfo *) cell->siCb.\ + siArray[cell->siCb.siCtx.siId-1].si; + /* ccpu00136659: CMAS ETWS design changes */ + CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); + if (node == NULLP) + { + RETVOID; + } + + warningSiPdu = (RgSchWarningSiPdu *)node->node; + pdu = warningSiPdu->pdu; + /* ccpu00136659: CMAS ETWS design changes */ + cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node); + RGSCH_FREE_MSG(pdu); + if(warningSi->warningSiMsg.segLstCp.count == 0) + { + /* ccpu00136659: CMAS ETWS design changes */ + cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP; + rgSCHUtlRgrWarningSiCfgCfm(cell->instIdx, + rgSchCb[cell->instIdx].rgrSap->sapCfg.spId, + cell->siCb.warningSi[warningSi->idx].siId, + warningSi->warningSiMsg.transId, RGR_CFG_CFM_TX_COMPLETE); + } + + RETVOID; + +} /* end of rgSCHUtlFreeWarningSiPdu */ + + +/* +* +* Fun: rgSCHUtlGetWarningSiPdu +* +* Desc: This is used to get Warning SI PDU for Scheduling. +* +* Ret: +* +* Notes: None +* +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC Buffer *rgSCHUtlGetWarningSiPdu +( +RgSchCellCb *cell +) +#else +PUBLIC Buffer *rgSCHUtlGetWarningSiPdu(cell) +RgSchCellCb *cell; +#endif +{ + RgSchWarningSiInfo *warningSi; + RgSchWarningSiPdu *warningSiPdu; + Buffer *pdu; + CmLList *node; + + TRC2(rgSCHUtlGetWarningSiPdu) + + warningSi = (RgSchWarningSiInfo *) cell->siCb. + siArray[cell->siCb.siCtx.siId-1].si; + /* ccpu00136659: CMAS ETWS design changes */ + CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); + if (node != NULLP) + { + warningSiPdu = (RgSchWarningSiPdu *)node->node; + pdu = warningSiPdu->pdu; + RETVALUE(pdu); + } + else + { + RETVALUE(NULLP); + } +} /* rgSCHUtlGetWarningSiPdu */ + + +/* +* +* Fun: rgSCHUtlGetMcsAndNPrb +* +* Desc: This is used to get mcs and nPrb value. +* +* Ret: +* +* Notes: None +* +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetMcsAndNPrb +( +RgSchCellCb *cell, +U8 *nPrb, +U8 *mcs, +MsgLen *msgLen +) +#else +PUBLIC S16 rgSCHUtlGetMcsAndNPrb(cell, nPrb, mcs, msgLen) +RgSchCellCb *cell; +U8 *nPrb; +U8 *mcs; +MsgLen *msgLen; +#endif +{ + RgSchWarningSiInfo *warningSi; + RgSchWarningSiPdu *warningSiPdu; + CmLList *node; + + TRC2(rgSCHUtlGetMcsAndNPrb) + + if(cell->siCb.siCtx.warningSiFlag == FALSE) + { + *mcs = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].mcs; + *nPrb = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].nPrb; + *msgLen = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].msgLen; + } + else + { + warningSi = (RgSchWarningSiInfo *) cell->siCb. + siArray[cell->siCb.siCtx.siId-1].si; + /* ccpu00136659: CMAS ETWS design changes */ + CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node); + if (node == NULLP) + { + RETVALUE(RFAILED); + } + + warningSiPdu = (RgSchWarningSiPdu *)node->node; + *mcs = warningSiPdu->mcs; + *nPrb = warningSiPdu->nPrb; + *msgLen = warningSiPdu->msgLen; + RETVALUE(ROK); + + } + RETVALUE(ROK); +} /* rgSCHUtlGetMcsAndNPrb */ + +/* +* +* Fun: rgSCHUtlCalMacAndPrb +* +* Desc: This is used to Calculate mcs and nPrb value for SIB1 and SIs. +* +* Ret: +* +* Notes: None +* +* File: rg_utl.c +*/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlCalMcsAndNPrb +( +RgSchCellCb *cell, +U8 cfgType, +MsgLen msgLen, +U8 siId +) +#else +PUBLIC S16 rgSCHUtlCalMcsAndNPrb(cell, nPrb, mcs, msgLen) +RgSchCellCb *cell; +U8 cfgType; +MsgLen msgLen; +U8 siId; +#endif +{ + U8 mcs = 0; + U8 nPrb = 0; + + TRC2(rgSCHUtlCalMcsAndNPrb) + + /*Get the nPrb and mcs parametr values */ + if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8)) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "msgLen does " + "not match any valid TB Size"); + RETVALUE(RFAILED); + } + + + if(cfgType == RGR_SI_CFG_TYPE_SIB1 || cfgType == RGR_SI_CFG_TYPE_SIB1_PWS) + { + + if(cell->siCb.crntSiInfo.sib1Info.sib1 == NULLP) + { + cell->siCb.crntSiInfo.sib1Info.mcs = mcs; + cell->siCb.crntSiInfo.sib1Info.nPrb = nPrb; + cell->siCb.crntSiInfo.sib1Info.msgLen = msgLen; + } + else + { + cell->siCb.newSiInfo.sib1Info.mcs = mcs; + cell->siCb.newSiInfo.sib1Info.nPrb= nPrb; + cell->siCb.newSiInfo.sib1Info.msgLen = msgLen; + } + } + + + if(cfgType == RGR_SI_CFG_TYPE_SI) + { + if(cell->siCb.crntSiInfo.siInfo[siId-1].si == NULLP && + !(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD)) + { + cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs; + cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb; + cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen; + } + else + { + cell->siCb.newSiInfo.siInfo[siId-1].mcs = mcs; + cell->siCb.newSiInfo.siInfo[siId-1].nPrb= nPrb; + cell->siCb.newSiInfo.siInfo[siId-1].msgLen = msgLen; + } + } + + if(cfgType == RGR_SI_CFG_TYPE_SIB8_CDMA) + { + cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs; + cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb; + cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen; + } + + RETVALUE(ROK); +} +#endif + +/*********************************************************** + * + * Func : rgSCHUtlFillDgnParams + * + * Desc : Utility Function to Fill Diagonostic params. + * + * Ret : None. + * + * Notes: None. + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlFillDgnParams +( +Inst inst, +RgUstaDgn *dgn, +U8 dgnType +) +#else +PUBLIC Void rgSCHUtlFillDgnParams(inst, dgn, dgnType) +Inst inst; +RgUstaDgn *dgn; +U8 dgnType; +#endif +{ + + TRC2(rgSCHUtlFillDgnParams) + + switch(dgnType) + { + case LRG_USTA_DGNVAL_MEM: + dgn->type = (U8) LRG_USTA_DGNVAL_MEM; + dgn->u.mem.region = rgSchCb[inst].rgSchInit.region; + dgn->u.mem.pool = rgSchCb[inst].rgSchInit.pool; + break; + + default: + break; + } + + RETVOID; +} /* end of rgSCHUtlFillDgnParams */ + +/*********************************************************** + * + * Func : rgSCHUtlGetPstToLyr + * + * Desc : Utility Function to get the pst structure to post a message to MAC + * + * + * Ret : ROK + * RFAILED + * + * Notes: This function should be called while sending a msg from + * scheduler instance to MAC + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlGetPstToLyr +( +Pst *pst, +RgSchCb *schCb, +Inst macInst +) +#else +PUBLIC Void rgSCHUtlGetPstToLyr (pst, schCb, macInst) +Pst *pst; +RgSchCb *schCb; +Inst macInst; +#endif +{ + TRC2(rgSCHUtlGetPstToLyr); + + /* Only the needed params are filled */ + pst->region = schCb->rgSchInit.region; + pst->pool = schCb->rgSchInit.pool; + pst->srcInst = schCb->rgSchInit.inst+SCH_INST_START; + pst->srcProcId = schCb->rgSchInit.procId; + pst->dstProcId = schCb->rgSchInit.procId; + + pst->dstInst = macInst; + pst->dstEnt = ENTRG; + pst->srcEnt = ENTRG; + pst->selector = 0; + pst->prior = PRIOR0; + pst->intfVer = 0; + pst->route = RTESPEC; + + RETVOID; +} /* end of rgSCHUtlGetPstToLyr */ + +/** @brief This function fills in the common lc information to be sent to MAC + * + * @details + * + * Function: rgSCHUtlFillRgInfCmnLcInfo + * @param RgSchDlSf *sf, + * @param RgInfSfAlloc *sfAlloc, + * @param CmLteLcId lcId, + * @param Bool sendInd + * + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFillRgInfCmnLcInfo +( +RgSchDlSf *sf, +RgInfSfAlloc *sfAlloc, +CmLteLcId lcId, +Bool sendInd +) +#else +PUBLIC S16 rgSCHUtlFillRgInfCmnLcInfo(sf, sfAlloc, lcId, sendInd) +RgSchDlSf *sf; +RgInfSfAlloc *sfAlloc; +CmLteLcId lcId; +Bool sendInd; +#endif +{ + TRC2(rgSCHUtlFillRgInfCmnLcInfo); + + if((sf->bch.tbSize)&& + !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCH_INFO)) + { +#ifndef RGR_SI_SCH + sfAlloc->cmnLcInfo.bchInfo.lcId = lcId; +#endif + sfAlloc->cmnLcInfo.bitMask |= RGINF_BCH_INFO; + } + else if((sf->bcch.pdcch != NULLP)&& + !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCCH_INFO)) + { + sfAlloc->cmnLcInfo.bcchInfo.rnti = RGSCH_SI_RNTI; + rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.bcchInfo.dciInfo), + &(sf->bcch.pdcch->dci)); +#ifndef RGR_SI_SCH + sfAlloc->cmnLcInfo.bcchInfo.lcId = lcId; + sfAlloc->cmnLcInfo.bcchInfo.sndStatInd = sendInd; +#endif + sfAlloc->cmnLcInfo.bitMask |= RGINF_BCCH_INFO; + } + else if((sf->pcch.pdcch != NULLP) && + !(sfAlloc->cmnLcInfo.bitMask & RGINF_PCCH_INFO)) + { + sfAlloc->cmnLcInfo.pcchInfo.rnti = RGSCH_P_RNTI; + rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.pcchInfo.dciInfo), + &(sf->pcch.pdcch->dci)); + sfAlloc->cmnLcInfo.pcchInfo.lcId = lcId; + sfAlloc->cmnLcInfo.bitMask |= RGINF_PCCH_INFO; + } + RETVALUE(ROK); +} + +/** @brief This function fills in the RAR information to be sent to MAC + * + * @details + * + * Function: rgSCHUtlFillRgInfRarInfo + * + * @param RgSchCellCb *cell + * @param RgSchDlSf *sf + * @param RgInfSfAlloc *sfAlloc + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFillRgInfRarInfo +( +RgSchDlSf *sf, +RgInfSfAlloc *sfAlloc, +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlFillRgInfRarInfo(sf, sfAlloc, cell) +RgSchDlSf *sf; +RgInfSfAlloc *sfAlloc; +RgSchCellCb *cell; +#endif +{ + U8 idx; + CmLListCp *lnkLst; + CmLList *tmp; + RgSchRaCb *raCb; + RgSchUeCb *ue; + RgInfRaRntiInfo *raRntiAlloc; + U8 noRaRsps; + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); + + TRC2(rgSCHUtlFillRgInfRarInfo); + +#ifdef LTE_TDD + noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC; +#else + noRaRsps = RGSCH_MAX_RA_RSP_ALLOC; +#endif + + for(idx =0; idx < noRaRsps; idx++) + { + if (sf->raRsp[idx].pdcch == NULLP) + { + /* No further raResp Allocations. */ + break; + } + /* Added Dl TB count for RACH Response transmission*/ +#ifdef LTE_L2_MEAS + cell->dlUlTbCnt.tbTransDlTotalCnt++; +#endif + raRntiAlloc = &(sfAlloc->rarInfo.raRntiInfo[idx]); + raRntiAlloc->raRnti = sf->raRsp[idx].raRnti; + raRntiAlloc->schdTbSz = sf->raRsp[idx].tbSz; + raRntiAlloc->numCrnti = 0; + rgSCHUtlFillPdschDciInfo(&(raRntiAlloc->dciInfo), + &(sf->raRsp[idx].pdcch->dci)); + /* RACHO : fill backoff indicator information */ + raRntiAlloc->backOffInd = sf->raRsp[idx].backOffInd; + + /* Fill for contention free UEs*/ + lnkLst = &(sf->raRsp[idx].contFreeUeLst); + CM_LLIST_FIRST_NODE(lnkLst, tmp); + while (tmp) + { + ue = (RgSchUeCb *)tmp->node; + tmp = tmp->next; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = ue->ueId; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = TRUE; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = ue->ul.rarGrnt.rapId; +#ifndef MAC_5GTF_UPDATE + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop = + ue->ul.rarGrnt.hop; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit = + ue->ul.rarGrnt.cqiReqBit; +#endif + /* SHASHAHNK ADD RIV CALC */ + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart = + ue->ul.rarGrnt.rbStart; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb = + ue->ul.rarGrnt.numRb; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc = + ue->ul.rarGrnt.tpc; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt = + ue->ul.rarGrnt.iMcsCrnt; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta = ue->ul.rarGrnt.ta; + raRntiAlloc->numCrnti++; + cmLListDelFrm(lnkLst, &ue->ul.rarGrnt.raRspLnk); + ue->ul.rarGrnt.raRspLnk.node = (PTR)NULLP; + } + /* Fill for contention based UEs*/ + lnkLst = &(sf->raRsp[idx].raRspLst); + + CM_LLIST_FIRST_NODE(lnkLst, tmp); + + while((NULLP != tmp) && ((RgSchRaCb *)tmp->node != NULLP)) + { + raCb = (RgSchRaCb *)tmp->node; + + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = raCb->tmpCrnti; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = FALSE; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = raCb->rapId; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.pres = TRUE; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.val = raCb->ta.val; +#ifndef MAC_5GTF_UPDATE + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop = + raCb->msg3Grnt.hop; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit = FALSE; +#endif + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart = + raCb->msg3Grnt.rbStart; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb = + raCb->msg3Grnt.numRb; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc = + raCb->msg3Grnt.tpc; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt = + raCb->msg3Grnt.iMcsCrnt; + raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.delayBit = + raCb->msg3Grnt.delayBit; + /* For initial attaching UEs Aperiodic CQI need not be triggered */ + raRntiAlloc->numCrnti++; + /* Search the next node */ + CM_LLIST_NEXT_NODE(lnkLst, tmp); + } + } + sfAlloc->rarInfo.numRaRntis = idx; + /* ccpu00132314-ADD-Update the tx power allocation info + TODO-Need to add a check for max tx power per symbol */ + sfAlloc->rarInfo.txPwrOffset = cellDl->rarTxPwrOffset; + + RETVALUE(ROK); +} /* end of rgSCHUtlFillRgInfRarInfo */ + +/** @brief This function fills in the pdsch data related allocation Info + * from the pdcch DCI info. + * subframe + * + * @details + * + * Function: rgSCHUtlFillPdschDciInfo + * + * Processing steps: + * - Depending upon the DCI Format, fill the appropriate fields. + * + * @param [out] TfuPdschDciInfo *pdschDci + * @param [in] TfuDciInfo *pdcchDci + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFillPdschDciInfo +( +TfuPdschDciInfo *pdsch, +TfuDciInfo *pdcchDci +) +#else +PUBLIC S16 rgSCHUtlFillPdschDciInfo(pdsch, pdcchDci) +TfuPdschDciInfo *pdsch; +TfuDciInfo *pdcchDci; +#endif +{ + TRC2(rgSCHUtlFillPdschDciInfo) + +#ifdef EMTC_ENABLE + S16 ret = ROK; +#endif + pdsch->format = pdcchDci->dciFormat; + switch(pdcchDci->dciFormat) + { + case TFU_DCI_FORMAT_1: + pdsch->u.format1AllocInfo = pdcchDci->u.format1Info.allocInfo; + break; + case TFU_DCI_FORMAT_1A: + if (pdcchDci->u.format1aInfo.isPdcchOrder == FALSE) + { + pdsch->u.format1aAllocInfo = pdcchDci->u.format1aInfo.t.pdschInfo.allocInfo; + } + break; + case TFU_DCI_FORMAT_1B: + pdsch->u.format1bAllocInfo = pdcchDci->u.format1bInfo.allocInfo; + break; + case TFU_DCI_FORMAT_1C: + pdsch->u.format1cAllocInfo = pdcchDci->u.format1cInfo; + break; + case TFU_DCI_FORMAT_1D: + pdsch->u.format1dAllocInfo = pdcchDci->u.format1dInfo.allocInfo; + break; + case TFU_DCI_FORMAT_2: + pdsch->u.format2AllocInfo = pdcchDci->u.format2Info.allocInfo; + break; + case TFU_DCI_FORMAT_2A: + pdsch->u.format2AAllocInfo = pdcchDci->u.format2AInfo.allocInfo; + break; +#ifdef RG_5GTF + case TFU_DCI_FORMAT_B1: + pdsch->u.formatB1Info = pdcchDci->u.formatB1Info; + break; + case TFU_DCI_FORMAT_B2: + pdsch->u.formatB2Info = pdcchDci->u.formatB2Info; + break; +#endif + default: +#ifdef EMTC_ENABLE + ret = rgSCHEmtcUtlFillPdschDciInfo(pdsch, pdcchDci); + if(RFAILED == ret) + { + RETVALUE(RFAILED); + } +#else + RETVALUE(RFAILED); +#endif + } + RETVALUE(ROK); +} + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + * @brief This function resets temporary variables in Pool + * @details + * + * Function: rgSchSFRResetPoolVariables + * + * Invoked by: rgSCHSFRUtlTotalPoolInit + * + * @param[in] RgSchCellCb* cell + * @param[in] RgSubFrm* subFrm + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSchDSFRPwrCheck +( + RgSchDlSf *sf, + Bool *isAllUePwrHigh + ) +#else +PRIVATE Void rgSchDSFRPwrCheck(sf, isAllUePwrHigh) + RgSchDlSf *sf; + Bool *isAllUePwrHigh; + +#endif +{ + RgSchSFRPoolInfo *sfrCCPool; + + CmLListCp *l; + CmLList *n; + + TRC2(rgSchDSFRPwrCheck); + + l = &sf->sfrTotalPoolInfo.ccPool; + n = cmLListFirst(l); + while(n) + { + sfrCCPool = (RgSchSFRPoolInfo*)n->node; + if((sfrCCPool->poolstartRB == sfrCCPool->pwrHiCCRange.startRb) && + (sfrCCPool->poolendRB == sfrCCPool->pwrHiCCRange.endRb)) + { + n = cmLListNext(l); + if(n) + { + continue; + } + *isAllUePwrHigh = TRUE; + break; + } + else + break; + } +} +/* LTE_ADV_FLAG_REMOVED_END */ +/*********************************************************** + * + * Func : rgSCHUtlFillRgInfTbInfo + * + * Desc : Utility Function to fill the allocation info of each Tb + * + * + * Ret : RETVOID + * + * + * Notes: This function should be called while sending a msg from + * scheduler instance to MAC + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHUtlFillRgInfTbInfo +( +RgSchDlHqProcCb *hqP, +RgInfUeAlloc *allocInfo, +RgSchCellCb *cell +) +#else +PRIVATE Void rgSCHUtlFillRgInfTbInfo (hqP, allocInfo, cell) +RgSchDlHqProcCb *hqP; +RgInfUeAlloc *allocInfo; +RgSchCellCb *cell; +#endif +{ + RgSchDlSf *sf; + U8 idx; + RgInfUeTbInfo *tbInfo; + U8 tbCnt; + /* LTE_ADV_FLAG_REMOVED_START */ +#ifdef TFU_UPGRADE + PRIVATE U32 tmpCnt = 0; + Bool isAllUePwrHigh = FALSE; +#endif + /* LTE_ADV_FLAG_REMOVED_END */ + RgSchDlLcCb *dlLcCb = NULLP; + U16 rlcHdrEstmt; + U8 lcId; + /* RRM_RBC_X */ +#ifdef LTE_L2_MEAS + U8 prbUsed = 0; +#endif + /* RRM_RBC_Y */ + + CmLteTimingInfo frm; + + /* Get Downlink Subframe */ + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + sf = rgSCHUtlSubFrmGet(cell, frm); + /* Setting of fillCtrlPdu flag + If both P-cell and S-cell are present, + make TRUE for P-cell and FALSE for all s-cells + For all other cases set TRUE */ +#ifdef LTE_ADV + if ((rgSchCb[cell->instIdx].genCfg.forceCntrlSrbBoOnPCel) && + !RG_SCH_CMN_IS_PCELL_HQP(hqP)) + { + allocInfo->fillCtrlPdu = FALSE; + } + else + { + allocInfo->fillCtrlPdu = TRUE; + } +#endif + + allocInfo->tbStrtIdx = -1; + + +#ifdef LTE_ADV + allocInfo->tbReqInfo.sCellHqPId = 0xff; + rgSCHLaaHndlFillRgInfTbInfo(cell, hqP, allocInfo); +#endif + + /*TODO:REEMA: Check and fill the isRetx */ + for(tbCnt = 0; tbCnt < 2; tbCnt++) + { + RgSchUeCb *ue = NULLP; + /*Changed as a result of CR timer*/ + if ((hqP->hqE->ue != NULLP)/* && + ((hqP->tbInfo[tbCnt].lchSchdData[0].lcId != 0) || \ + (hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF))*/) + { + ue = hqP->hqE->ue; + allocInfo->rnti = ue->ueId; + allocInfo->doa = hqP->hqE->ue->mimoInfo.doa; + allocInfo->txMode = (TfuTxMode)(hqP->hqE->ue->mimoInfo.txMode); + allocInfo->puschRptUsd = hqP->hqE->ue->mimoInfo.puschFdbkVld; + allocInfo->puschPmiInfo = hqP->hqE->ue->mimoInfo.puschPmiInfo; + if(hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF) + { + hqP->tbInfo[tbCnt].taSnt = TRUE; + } +#ifdef TFU_UPGRADE + if (RG_SCH_IS_PAPRSNT(ue,hqP->hqE->cell)) + { + /*update pA value */ + allocInfo->pa = (RG_SCH_CMN_GET_PA(ue,hqP->hqE->cell)).val; + } +#endif + + /* LTE_ADV_FLAG_REMOVED_START */ + /* If ABS is enabled, calculate resource used */ + if((0 == tbCnt) && (RGR_ENABLE == ue->cell->lteAdvCb.absCfg.status)) + { + /* For Macro count number resource used in Non-ABS SF */ + if(RGR_ABS_MUTE == ue->cell->lteAdvCb.absCfg.absPatternType) + { + if(RG_SCH_ABS_ENABLED_NONABS_SF == ue->cell->lteAdvCb.absDlSfInfo) + { + ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+= + hqP->tbInfo[tbCnt].dlGrnt.numRb; + } + } + /* For pico count number resource used in ABS SF for ABS UE */ + else if(RGR_ABS_TRANSMIT == ue->cell->lteAdvCb.absCfg.absPatternType) + { + if(RG_SCH_ABS_ENABLED_ABS_SF == ue->cell->lteAdvCb.absDlSfInfo) + { + if(TRUE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe) + { + ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+= + hqP->tbInfo[tbCnt].dlGrnt.numRb; + } + } + } + } + +#ifdef TFU_UPGRADE + /*if SFR is enabled*/ + allocInfo->isEnbSFR = (U8)RG_SCH_CMN_IS_SFR_ENB(ue->cell); /* KW fix for LTE_ADV */ + if((ue->cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) && + (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == FALSE)) + { + rgSchDSFRPwrCheck(sf, &isAllUePwrHigh); + } + if(isAllUePwrHigh) + { + allocInfo->pa = (U8)ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; /* KW fix for LTE_ADV */ + if(tmpCnt++ == 100000) + { + RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, + "DSFR::ll UEs can go HIGH, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId); + tmpCnt = 0; + } + } + else + { + if (allocInfo->isEnbSFR) + { + /*Update pA to Plow if it is cell-centred ,else pA will be pHigh*/ + if (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == TRUE) + { + allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; + if(tmpCnt++ == 100000) + { + RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, + "SFR::UE is CELL EDGE, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId); + tmpCnt = 0; + } + + } + else + { + if(TRUE == ue->lteAdvUeCb.isCCUePHigh) + { + allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; + ue->lteAdvUeCb.isCCUePHigh = FALSE; + } + else + { + allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pLow; + if(tmpCnt++ == 100000) + { + RLOG_ARG2(L_DEBUG,DBG_CELLID,ue->cell->cellId, + "SFR::UE is CELL CENTRE, PLow(%d) for UE(%d)\n",allocInfo->pa, ue->ueId); + tmpCnt = 0; + } + } + } + } + } + /* LTE_ADV_FLAG_REMOVED_END */ +#endif + } + else + { + if (hqP->hqE->raCb) + { +#ifdef TFU_UPGRADE + RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell); +#endif +#ifdef LTEMAC_SPS + allocInfo->pdcchRnti = hqP->hqE->raCb->tmpCrnti; +#endif + allocInfo->rnti = hqP->hqE->raCb->tmpCrnti; +#ifdef TFU_UPGRADE + /*ccpu00132314-ADD-Use a default pA value + for msg4 */ + allocInfo->pa = cellDl->msg4pAVal; +#endif + } + } + /* If TB Is scheduled for this SF */ + if(hqP->tbInfo[tbCnt].state == HQ_TB_WAITING) + { + if (allocInfo->tbStrtIdx == -1){ + allocInfo->tbStrtIdx = tbCnt; +#ifndef LTEMAC_SPS + rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), + &(hqP->pdcch->dci)); +#else + if (hqP->pdcch) + { + rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), + &(hqP->pdcch->dci)); + } + else if ((ue) && (ue->dl.spsOccPdcch.rnti == ue->spsRnti)) + { + rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo), + &(ue->dl.spsOccPdcch.dci)); + } +#endif /* ifndef LTEMAC_SPS */ + } +#ifdef LTEMAC_SPS + if (hqP->pdcch) + { + allocInfo->pdcchRnti = hqP->pdcch->rnti; + } + else if (ue) + { + allocInfo->pdcchRnti = ue->spsRnti; + } +#endif + tbInfo = &(allocInfo->tbInfo[tbCnt]); + allocInfo->nmbOfTBs++; + allocInfo->hqProcId = hqP->procId; + allocInfo->tbInfo[tbCnt].schdTbSz = hqP->tbInfo[tbCnt].tbSz; + + tbInfo->disTb = FALSE; + if(!(hqP->tbInfo[tbCnt].txCntr)) + { +#ifdef LTE_ADV + if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE == + rgSCHLaaSCellEnabled(cell)))) +#endif + { + hqP->tbInfo[tbCnt].txCntr++; + } + for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++) + { + tbInfo->schdDat[idx].lcId =\ + hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; + tbInfo->schdDat[idx].numBytes =\ + hqP->tbInfo[tbCnt].lchSchdData[idx].schdData; + if(hqP->hqE->ue) + { + lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; + if(lcId != 0) + { + dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1]; + if(dlLcCb != NULLP) + { + RG_SCH_CMN_DL_GET_HDR_EST(dlLcCb, rlcHdrEstmt); + /* Update the totalBo with the scheduled bo */ + (hqP->hqE->ue->totalBo <= tbInfo->schdDat[idx].numBytes - rlcHdrEstmt)?\ + (hqP->hqE->ue->totalBo = 0):\ + (hqP->hqE->ue->totalBo -= tbInfo->schdDat[idx].numBytes-rlcHdrEstmt); + + /* RRM_RBC_X */ +#ifdef LTE_L2_MEAS + prbUsed = ((hqP->tbInfo[tbCnt].\ + lchSchdData[idx].schdData * + hqP->tbInfo[tbCnt].dlGrnt.numRb) / + (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz)); + dlLcCb->qciCb->dlPrbCount += prbUsed; + if(dlLcCb->qciCb->qci > 0) + { + RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed); + } +#endif /* RRM_RBC_Y */ + +#ifdef RG_PFS_STATS + //if(!(hqP->hqE->ue->pfsStats.lcStats[lcId-1].isLcCntSet)) + if(tbCnt == 0) + { + U8 idx = 0; + if (hqP->hqE->ue->cell == hqP->hqE->cell) + { + idx = RGSCH_PCELL_INDEX; + } + else + { + idx = RG_SCH_GET_SCELL_INDEX((hqP->hqE->ue), (hqP->hqE->cell)); + } + hqP->hqE->ue->pfsStats.lcStats[lcId-1].ueSchdOcc[idx]++; + hqP->hqE->ue->pfsStats.lcStats[lcId-1].perRefresh[ue->pfsStats.lcStats[lcId-1].lastIdx].lcSchdOcc++; + } +#endif + } + } + } + } + /* Added Dl TB count for SRB/DRB data transmission*/ +#ifdef LTE_L2_MEAS + cell->dlUlTbCnt.tbTransDlTotalCnt++; +#endif + tbInfo->ta.pres = hqP->tbInfo[tbCnt].schdTa.pres; + tbInfo->ta.val = hqP->tbInfo[tbCnt].schdTa.val; +#ifdef LTE_ADV + tbInfo->sCellActCe = hqP->tbInfo[tbCnt].schdSCellActCe; +#endif + tbInfo->numSchLch = hqP->tbInfo[tbCnt].numLch; + if(!(hqP->tbInfo[tbCnt].numLch)) + { + tbInfo->schdDat[tbInfo->numSchLch].numBytes= hqP->tbInfo[tbCnt].tbSz; + /* Fix: If only TA is scheduled, use some dummy LCID */ + if (tbInfo->ta.pres) + tbInfo->schdDat[tbInfo->numSchLch].lcId = RG_TA_LCID; + } + + tbInfo->contResCe = hqP->tbInfo[tbCnt].contResCe; + tbInfo->isReTx = FALSE; + } + else + { +#ifdef LTE_ADV + if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE == + rgSCHLaaSCellEnabled(cell)))) +#endif + { + hqP->tbInfo[tbCnt].txCntr++; + } + tbInfo->isReTx = TRUE; + /* RRM_RBC_X */ + /* As per 36.314, harq retransmission also considered for + * prb utilization calculation*/ + for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++) + { +#ifdef LTE_L2_MEAS + if(hqP->hqE->ue) + { + lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId; + if(lcId != 0) + { + dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1]; + if(dlLcCb != NULLP) + { + prbUsed = ((hqP->tbInfo[tbCnt].\ + lchSchdData[idx].schdData * + hqP->tbInfo[tbCnt].dlGrnt.numRb) / + (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz)); + if(dlLcCb->qciCb->qci > 0) + { + RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed); + } + } + } + } +#endif + } + /* RRM_RBC_Y */ + } + } + } +#ifdef LTE_ADV + rgSCHLaaResetDlHqProcCb(hqP); +#endif + + RETVOID; +} +/*********************************************************** + * + * Func : rgSCHUtlFillRgInfUeInfo + * + * Desc : Utility Function to fill the allocation info of Ue + * : MIMO : Filling 2TB's of each UE + * + * Ret : ROK + * RFAILED + * + * Notes: This function should be called while sending a msg from + * scheduler instance to MAC + * + * File : rg_utl.c + * + **********************************************************/ + /* CA dev Start */ +#ifdef ANSI +PUBLIC Void rgSCHUtlFillRgInfUeInfo +( +RgSchDlSf *sf, +RgSchCellCb *cell, +CmLListCp *dlDrxInactvTmrLst, +CmLListCp *dlInActvLst, +CmLListCp *ulInActvLst +) +#else +PUBLIC Void rgSCHUtlFillRgInfUeInfo (sf,cell, dlDrxInactvTmrLst, dlInActvLst, ulInActvLst) +{ +RgSchDlSf *sf; +RgSchCellCb *cell; +CmLListCp *dlDrxInactvTmrLst; +CmLListCp *dlInActvLst; +CmLListCp *ulInActvLst; +#endif +{ + RgInfSfAlloc *sfAlloc; + CmLListCp *lnkLst; /* lnkLst assignment */ + CmLList *tmp; + CmLList *hqPNode; + RgSchUeCb *ue = NULLP; + RgInfUeInfo *ueInfo = NULLP; + RgInfUeAlloc *ueAlloc = NULLP; + RgSchDlHqProcCb *hqCb = NULLP; + + /* Since Msg4 is sched only on PCELL, use cell arg's sfAllocArr */ + sfAlloc = &(cell->sfAllocArr[cell->crntSfIdx]); + ueInfo = &(sfAlloc->ueInfo); + ueAlloc = sfAlloc->ueInfo.allocInfo; + + lnkLst = &(sf->msg4HqPLst); + CM_LLIST_FIRST_NODE(lnkLst, tmp); + while(NULLP != tmp) + { + printf("5GTF_ERROR MSG4 Consolidation\n"); + hqCb = (RgSchDlHqProcCb *)(tmp->node); + CM_LLIST_NEXT_NODE(lnkLst, tmp); + + rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes], cell); + + ue = hqCb->hqE->ue; + + if(ue != NULLP) + { + if((!(ue->dl.dlInactvMask & RG_HQENT_INACTIVE)) && (ue->isDrxEnabled)) + { + rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes], + dlDrxInactvTmrLst, dlInActvLst, ulInActvLst); + } + } + ueInfo->numUes++; + } + + lnkLst = &(sf->ueLst); + CM_LLIST_FIRST_NODE(lnkLst, tmp); + while(NULLP != tmp) + { +#if defined (TENB_STATS) && defined (RG_5GTF) + cell->tenbStats->sch.dl5gtfPdschCons++; +#endif + ue = (RgSchUeCb *)(tmp->node); + CM_LLIST_NEXT_NODE(lnkLst, tmp); + + hqPNode = ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst.first; + while (hqPNode) + { + hqCb = (RgSchDlHqProcCb *)hqPNode->node; + hqPNode = hqPNode->next; + + sfAlloc = &(hqCb->hqE->cell->sfAllocArr[hqCb->hqE->cell->crntSfIdx]); + ueInfo = &(sfAlloc->ueInfo); + ueAlloc = sfAlloc->ueInfo.allocInfo; + + rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes], + hqCb->hqE->cell); + + if(ue->isDrxEnabled) + { + rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes], + dlDrxInactvTmrLst, dlInActvLst, ulInActvLst); + } + ueInfo->numUes++; + } +#ifdef LTE_ADV + if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE) + { + /*If remaining BO is left then increment the count*/ + if(ue->totalBo > 0) + { + ue->remBoCnt++; + /* Check if trigger for Activation is met or not */ + if(rgSCHIsActvReqd(cell, ue)) + { + ue->remBoCnt = 0; + /*Passing primary cell*/ + rgSCHSCellSelectAndActDeAct(ue->cell, ue, RGR_SCELL_ACT); + } + } + else + { + /*If remaining BO is 0 then reset the count*/ + ue->remBoCnt = 0; + } + } +#endif + } + + RETVOID; +} /* end of rgSCHUtlFillRgInfUeInfo */ + /* CA dev End */ + + +/** @brief This function shall update the scheduler with the CEs and data rcvd + * + * @details + * + * Function: rgSCHUtlUpdSch + * + * Processing steps: + * - Collate the information of all the SDUs received and inform the + * scheduler rgSCHDataRcvd + * - Send Data indication to the higher layer with the dedicated data + * (rgUIMSndDedDatInd) + * - Inform scheduler with any MAC CEs if present. + * + * @param [in] RgCellCb *cellCb + * @param [in] RgUeCb *ueCb + * @param [in] RgMacPdu *pdu + * @param [in] RgSchErrInfo *err + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdSch +( +RgInfSfDatInd *subfrmInfo, +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +RgInfUeDatInd *pdu, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlUpdSch (subfrmInfo, cellCb, ueCb, pdu, err) +RgInfSfDatInd *subfrmInfo; +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +RgInfUeDatInd *pdu; +RgSchErrInfo *err; +#endif +{ + + S16 ret; + TRC2(rgSCHUtlUpdSch); + +#ifdef LTEMAC_SPS + if (RGSCH_UL_SPS_ACT_PRSENT & pdu->ceInfo.bitMask) + { + /* SPS to be activated due to data on SPS LCG ID*/ + rgSCHUtlSpsActInd(cellCb, ueCb, pdu->ceInfo.spsSduSize); + } +#endif + /* TODO : Temp Fix for crash due to UL SDU corruption*/ + if (RGSCH_PHR_CE_PRSNT & pdu->ceInfo.bitMask) + { + /* PHR present */ + RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); + if ((ret = rgSCHUtlUpdPhr(cellCb, ueCb, pdu->ceInfo.ces.phr, err)) != ROK) + RETVALUE(ret); + } + /* Note: Order of indication to Sch now is + * 1st Indicate the DataInd info for each LCG's + * 2nd Update the BSR reports received along with data + * this is to make sure the effBsr is updated to the latest BSR + * received. + */ + cellCb->sc.apis->rgSCHUpdUeDataIndLcg(cellCb, ueCb, pdu); + +#ifndef MAC_5GTF_UPDATE + if (RGSCH_TRUNC_BSR_CE_PRSNT & pdu->ceInfo.bitMask) + { + RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); + /*ccpu00129922 - MOD - Deleted return value + * checking since it returns void*/ + rgSCHUtlUpdBsrTrunc (cellCb, ueCb, + (U8)(pdu->ceInfo.ces.bsr.truncBsr >> 6), + (U8)(pdu->ceInfo.ces.bsr.truncBsr & 0x3F), err); + } + else + { + if (RGSCH_SHORT_BSR_CE_PRSNT & pdu->ceInfo.bitMask) + { + RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); + /*ccpu00129922 - MOD - Deleted return value + checking since it returns void*/ + rgSCHUtlUpdBsrShort (cellCb, ueCb, + (U8)(pdu->ceInfo.ces.bsr.shortBsr >> 6), + (U8)(pdu->ceInfo.ces.bsr.shortBsr & 0x3F), err); + } + else + { + if (RGSCH_LONG_BSR_CE_PRSNT & pdu->ceInfo.bitMask) +#else + if (RGSCH_BSR_CE_PRSNT & pdu->ceInfo.bitMask) +#endif + { + RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime); + /*ccpu00129922 - MOD - Deleted return value + checking since it returns void*/ + rgSCHUtlUpdBsrLong (cellCb, ueCb, + pdu->ceInfo.ces.bsr.longBsr.bs1, + pdu->ceInfo.ces.bsr.longBsr.bs2, + pdu->ceInfo.ces.bsr.longBsr.bs3, + pdu->ceInfo.ces.bsr.longBsr.bs4, + err); + } +#ifndef MAC_5GTF_UPDATE + } + + } +#endif + + RETVALUE(ROK); +} /* end of rgSCHUtlUpdSch */ +#ifdef RGR_V1 +/** + * @brief Handler for Updating Bo received in StaRsp + * + * @details + * + * Function : rgSCHUtlAddUeToCcchSduLst + * + * This function shall be invoked once it receives staRsp on CCCH + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAddUeToCcchSduLst +( +RgSchCellCb *cell, +RgSchUeCb *ueCb +) +#else +PUBLIC S16 rgSCHUtlAddUeToCcchSduLst(cell, ueCb) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +#endif +{ + RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb, cell); + RgSchDlHqProcCb *hqP = (RgSchDlHqProcCb *)ueDl->proc; + TRC2(rgSCHUtlAddUeToCcchSduLst); + + /* Temp Guard: For back to back CCCH SDU BO + * twice. Hence an extra guard. If already added to scheduling + * queue or if scheduled and waiting for HQ FDBK, ignore */ + if ((ueCb->ccchSduLnk.node) || + ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) && + ((hqP != NULLP) && (hqP->hqE->ccchSduProc)))) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unexpected CCCH SDU BO", + ueCb->ueId); + RETVALUE(ROK); + } + + ueCb->ccchSduLnk.node = (PTR)(ueCb); + cmLListAdd2Tail(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk)); + + RETVALUE(ROK); +} +/** + * + * @details + * + * Function : rgSCHUtlUpdtBo + * + * This function shall be invoked once it receives staRsp on CCCH + * + * @param[in] RgSchCellCb *cell + * @param[in] RgRguCmnStaRsp *staRsp + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdtBo +( +RgSchCellCb *cell, +RgInfCmnBoRpt *staRsp +) +#else +PUBLIC S16 rgSCHUtlUpdtBo(cell, staRsp) +RgSchCellCb *cell; +RgInfCmnBoRpt *staRsp; +#endif +{ + RgSchUeCb *ueCb; + TRC2(rgSCHUtlUpdtBo) + + + if ((ueCb = rgSCHDbmGetUeCb(cell, staRsp->u.rnti)) == NULLP) + { + /* Handle Ue fetch failure */ + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid UEID:%d",staRsp->u.rnti); + RETVALUE(RFAILED); + } + /* Update Bo in ueCb */ + ueCb->dlCcchInfo.bo = (U32)(staRsp->bo); +#ifdef EMTC_ENABLE + if(ueCb->isEmtcUe) + { + rgSCHUtlAddUeToEmtcCcchSduLst(cell,ueCb); + } + else +#endif + { + rgSCHUtlAddUeToCcchSduLst(cell, ueCb); + } + + RETVALUE(ROK); +} /* rgSCHUtlUpdtBo */ + +#endif +/** + * + * @details + * Function : rgSCHUtlHndlCcchBoUpdt + * + * This function shall fetch the raCb with the given rnti and ask RAM to + * update BO + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgInfCmnBoRpt *boRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlHndlCcchBoUpdt +( +RgSchCellCb *cell, +RgInfCmnBoRpt *boRpt +) +#else +PUBLIC S16 rgSCHUtlHndlCcchBoUpdt(cell, boRpt) +RgSchCellCb *cell; +RgInfCmnBoRpt *boRpt; +#endif +{ + RgSchRaCb *raCb; + RgSchUeCb *ueCb; + + TRC2(rgSCHUtlHndlCcchBoUpdt); + + if ((raCb = rgSCHDbmGetRaCb(cell, boRpt->u.rnti)) == NULLP) + { +#ifdef RGR_V1 + /* CR timer implementation changes*/ + /*If no raCb, schedule ueCb, ueCb is extracted in rgSCHUtlUpdtBo*/ + RETVALUE(rgSCHUtlUpdtBo(cell, boRpt)); +#else + /* Handle RaCb fetch failure */ + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "Invalid RNTI:%d to fetch raCb",boRpt->u.rnti); + RETVALUE(RFAILED); +#endif + } + +#ifdef RGR_V1 + + /*Fix: If RaCb exists, then MSG4 is not completed yet*/ + /*Check if guard timer has expired, if not CR CE + CCCH SDU will be scheduled*/ + if((raCb->contResTmrLnk.node != NULLP) && \ + (raCb->schdLnk.node == NULLP) && (raCb->dlHqE->msg4Proc == NULLP)) + { +#ifdef EMTC_ENABLE + /*if contention resolution timer left ,Stop the Contention Resolution Guard Timer , + add in toBeSchduled list and update the Bo */ + if(TRUE == raCb->isEmtcRaCb) + { + rgSCHRamEmtcUpdtBo(cell, raCb, boRpt); + } + else +#endif + { + cmLListDelFrm(&cell->contResGrdTmrLst, &(raCb->contResTmrLnk)); + raCb->contResTmrLnk.node=NULLP; + rgSCHRamUpdtBo(cell, raCb, boRpt); + } + } + else + { + /*Fix:Guard timer has expired */ + /*Update the BO in UE CB but dont add it to the scheduling list. + *Should be added to the list after MSG4 completion*/ + if ((ueCb = rgSCHDbmGetUeCb(cell, boRpt->u.rnti)) == NULLP) + { + /* Handle Ue fetch failure */ + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid RNTI:%d",boRpt->u.rnti); + RETVALUE(RFAILED); + } + /* Update Bo in ueCb */ + ueCb->dlCcchInfo.bo = (U32)(boRpt->bo); + } + +#else + rgSCHRamUpdtBo(cell, raCb, boRpt); +#endif + + RETVALUE(ROK); +} /* rgSCHUtlHndlCcchBoUpdt */ + +/** + * @brief Validates BO received for BCCH or PCCH. + * + * @details + * + * Function : rgSCHUtlGetAllwdCchTbSz + * + * This function shall return the tbSz equal to or + * the nearest greater value for a given bo. + * If no such value found return -1. The nPrb value is + * accordingly set. + * + * + * @param[in] U32 bo + * @param[out] U8 *nPrb + * @return S32 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S32 rgSCHUtlGetAllwdCchTbSz +( +U32 bo, +U8 *nPrb, +U8 *mcs +) +#else +PUBLIC S32 rgSCHUtlGetAllwdCchTbSz(bo, nPrb, mcs) +U32 bo; +U8 *nPrb; +U8 *mcs; +#endif +{ + S32 lt; + S32 cn; + S32 rt; + + TRC2(rgSCHUtlGetAllwdCchTbSz); + + for (lt = 0, rt = 43; lt <= rt;) + { + cn = (lt + rt)/2; + if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz == bo) + { + *nPrb = rgSchUtlBcchPcchTbSzTbl[cn].rbIndex; + *mcs = rgSchUtlBcchPcchTbSzTbl[cn].mcs; + RETVALUE(rgSchUtlBcchPcchTbSzTbl[cn].tbSz); + } + else if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz < bo) + lt = cn + 1; + else + rt = cn - 1; + } + if (lt == 44) + { + RETVALUE(RFAILED); + } + *nPrb = rgSchUtlBcchPcchTbSzTbl[lt].rbIndex; + *mcs = rgSchUtlBcchPcchTbSzTbl[lt].mcs; + RETVALUE(rgSchUtlBcchPcchTbSzTbl[lt].tbSz); +} + +/** + * @brief Handler for BO Updt received for BCCH or PCCH. + * + * @details + * + * Function : rgSCHUtlHndlBcchPcchBoUpdt + * + * This function shall store the buffer and time to transmit in lcCb + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgInfCmnBoRpt *boRpt + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlHndlBcchPcchBoUpdt +( +RgSchCellCb *cell, +RgInfCmnBoRpt *boUpdt +) +#else +PUBLIC S16 rgSCHUtlHndlBcchPcchBoUpdt(cell, boUpdt) +RgSchCellCb *cell; +RgInfCmnBoRpt *boUpdt; +#endif +{ + RgSchClcDlLcCb *dlLc; + RgSchClcBoRpt *boRpt; + Inst inst = cell->instIdx; + U8 nPrb=0; + U8 mcs=0; + + TRC2(rgSCHUtlHndlBcchPcchBoUpdt); + + dlLc = rgSCHDbmGetBcchOnBch(cell); + if (dlLc == NULLP) + { + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "No Logical Channel dlLc is NULLP for RNTI:%d LCID:%d",boUpdt->u.rnti,boUpdt->lcId); + RETVALUE(RFAILED); + } + if (boUpdt->lcId != dlLc->lcId) + { + /* Added for dropping paging Message*/ + /*suman*/ + if ((rgSCHChkBoUpdate(cell,boUpdt))== ROK) /* Checking if received BO falls within the window of 5120 subframes*/ + { + if (rgSCHUtlGetAllwdCchTbSz(boUpdt->bo*8, &nPrb, &mcs) + != (boUpdt->bo*8)) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"[%ld]BO: does not match any " + "valid TB Size RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId); + RETVALUE(RFAILED); + } + }/*end of rgSCHChkBoUpdate*/ + else + { + RETVALUE(ROK); + } + } + if ((dlLc = rgSCHDbmGetCmnLcCb(cell, boUpdt->lcId)) == NULLP) + { + /* Handle lcCb fetch failure */ + RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, + "LCID:%d Invalid for RNTI:%d",boUpdt->lcId,boUpdt->u.rnti); + } + + if (((rgSCHUtlAllocSBuf(inst, (Data **)(&boRpt), sizeof(RgSchClcBoRpt))) ==RFAILED) || + (!boRpt)) + { + RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId, "Allocation of common bo %dreport " + "failed RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId); + RETVALUE(RFAILED); + } + + boRpt->bo = boUpdt->bo; + boRpt->mcs = mcs; + boRpt->timeToTx = boUpdt->u.timeToTx; + boRpt->nPrb = nPrb; +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + boRpt->emtcDIReason = boUpdt->emtcDIReason; + boRpt->pnb = boUpdt->pnb; + } +#endif + RG_SCH_ADD_TO_CRNT_TIME(boRpt->timeToTx, + boRpt->maxTimeToTx, cell->siCfg.siWinSize) + if((NULLP != dlLc) && (dlLc->si)) + { + boRpt->retxCnt = cell->siCfg.retxCnt; + } + else + { + boRpt->retxCnt = 0; + } + rgSCHDbmInsCmnLcBoRpt(dlLc, boRpt); + + RETVALUE(ROK); +} /* rgSCHUtlHndlBcchPcchBoUpdt */ + +/** + * @brief API for sending bind confirm from Scheduler instance to RRM + * + * @details + * + * Function: rgSCHUtlRgrBndCfm + * + * This API is invoked to send bind confirm from Scheduler instance to RRM. + * This API fills in Pst structure and SAP Ids and invokes + * bind confirm API towards RRM. + * + * @param[in] SuId suId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrBndCfm +( +Inst instId, +SuId suId, +U8 status +) +#else +PUBLIC S16 rgSCHUtlRgrBndCfm(instId, suId, status) +Inst instId; +SuId suId; +U8 status; +#endif +{ + S16 ret = ROK; + + TRC2(rgSCHUtlRgrBndCfm) + + + ret = RgUiRgrBndCfm(&rgSchCb[instId].rgrSap[suId].sapCfg.sapPst, rgSchCb[instId].rgrSap[suId].sapCfg.suId, status); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrBndCfm: RgUiRgrBndCfm Failed "); + RETVALUE(ret); + } + RETVALUE(ret); +} /* rgSCHUtlRgrBndCfm*/ + +/** + * @brief API for sending bind confirm from Scheduler instance to RRM via RGM + * interface + * + * @details + * + * Function: rgSCHUtlRgmBndCfm + * + * This API is invoked to send bind confirm from Scheduler instance to RRM. + * This API fills in Pst structure and SAP Ids and invokes + * + * @param[in] SuId suId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgmBndCfm +( +Inst instId, +SuId suId, +U8 status +) +#else +PUBLIC S16 rgSCHUtlRgmBndCfm(instId, suId, status) +Inst instId; +SuId suId; +U8 status; +#endif +{ + S16 ret = ROK; + + TRC2(rgSCHUtlRgmBndCfm) + + + ret = RgUiRgmBndCfm(&rgSchCb[instId].rgmSap[suId].sapCfg.sapPst, rgSchCb[instId].rgmSap[suId].sapCfg.suId, status); + if (ret != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgmBndCfm: RgUiRgrBndCfm Failed "); + RETVALUE(ret); + } + RETVALUE(ret); +} /* rgSCHUtlRgmBndCfm*/ + + + +/** + * @brief API for sending configuration confirm from Scheduler to DU APP + * + * @details + * + * Function: schSendCfgCfm + * + * This API is invoked to send configuration confirm from Scheduler to DU + * APP. + * + * @param[in] Pst pst + * @param[in] RgrCfgTransId transId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 schSendCfgCfm +( +Region reg, +Pool pool, +RgrCfgTransId transId, +U8 status +) +#else +PUBLIC S16 schSendCfgCfm(reg, pool, transId, status) +Region reg; +Pool pool; +RgrCfgTransId transId; +U8 status; +#endif +{ + Pst cfmPst; + Inst inst; + + TRC2(schSendCfgCfm) + cmMemset((U8 *)(&cfmPst), 0, sizeof(Pst)); + + cfmPst.srcEnt = (Ent)ENTDUAPP; + cfmPst.srcInst = (Inst) 0; + cfmPst.srcProcId = SFndProcId(); + cfmPst.dstEnt = (Ent)ENTRG; + cfmPst.dstInst = (Inst) 0; + cfmPst.dstProcId = SFndProcId(); + cfmPst.selector = RGR_SEL_LC; + cfmPst.region = reg; + cfmPst.pool = pool; + + if(RgUiRgrCfgCfm(&cfmPst,transId, status) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"schSendCfgCfm: RgUiRgrCfgCfm Failed "); + printf("\nschSendCfgCfm: RgUiRgrCfgCfm Failed "); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} /* schSendCfgCfm*/ +#ifdef RGR_RRM_TICK +/** + * @brief API for sending TTI indication from Scheduler to RRM. + * + * @details + * + * Function: rgSCHUtlRgrTtiInd + * + * This API is invoked to send TTI indication from Scheduler instance to RRM. + * This API fills in Pst structure and RgrTtiIndInfo + * + * @param[in] cell RgSchCellCb + * @param[in] CmLteTimingInfo status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrTtiInd +( +RgSchCellCb *cell, +RgrTtiIndInfo *rgrTti +) +#else +PUBLIC S16 rgSCHUtlRgrTtiInd(cell, rgrTti) +RgSchCellCb *cell; +RgrTtiIndInfo *rgrTti; +#endif +{ + S16 ret = ROK; + RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ +#ifdef L2_L3_SPLIT + extern Bool g_usettitmr; + extern Void mtTmrHdlrPublic(void); +#endif + + TRC2(rgSCHUtlRgrTtiInd) + + + rgrSap = cell->rgrSap; + if (rgrSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHUtlRgrTtiInd() Upper SAP not bound (%d) ", + rgrSap->sapSta.sapState); + RETVALUE(RFAILED); + } + RgUiRgrTtiInd(&(cell->rgrSap->sapCfg.sapPst), + cell->rgrSap->sapCfg.suId, rgrTti); +#ifdef L2_L3_SPLIT + { + g_usettitmr = TRUE; + mtTmrHdlrPublic(); + } +#endif + RETVALUE(ret); +} /* rgSCHUtlRgrTtiInd*/ +#endif +/** @brief This function is called by rgMacSchSfRecpInd. This function invokes the + * scheduler with the information of the received Data and any Control Elements + * if present. + * + * @details + * + * Function: + * + * Processing steps: + * - Retrieves the RaCb with the rnti provided, if it doesnt exist + * return failure. + * - If UE exists then update the Schduler with any MAC CEs if present. + * - Invoke RAM module to do Msg3 related processing rgSCHRamProcMsg3 + * + * @param [in] RgSchCellCb *cellCb + * @param [in] RgSchUeCb *ueCb + * @param [in] CmLteRnti rnti + * @param [in] RgMacPdu *pdu + * @param [in] RgSchErrInfo *err + * @param + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlProcMsg3 +( +RgInfSfDatInd *subfrmInfo, +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +CmLteRnti rnti, +RgInfUeDatInd *pdu, +RgSchErrInfo *err + ) +#else +PUBLIC S16 rgSCHUtlProcMsg3 (subfrmInfo, cellCb, ueCb, rnti, pdu, err) +RgInfSfDatInd *subfrmInfo; +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +CmLteRnti rnti; +RgInfUeDatInd *pdu; +RgSchErrInfo *err; +#endif +{ + S16 ret; + RgSchRaCb *raCb; + + TRC2(rgSCHUtlProcMsg3) + + + /* must have an raCb for this case */ + raCb = rgSCHDbmGetRaCb (cellCb, rnti); + if (raCb == NULLP) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, "RNTI:%d Received MSG3, unable to " + "find raCb",rnti); + RETVALUE(RFAILED); + } + + /* ccpu00130982: Processing CRNTI MAC CE before Short BSR, if any, such that + * effBsr of current case only will be considered in scheduling of ContResLst*/ + ret = rgSCHRamProcMsg3 (cellCb, ueCb, raCb, pdu, err); + if (ret != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Processing failed in the RAM " + "RNTI:%d ",rnti); + RETVALUE(ret); + } + /* if ueCb is present */ + if (ueCb != NULLP) + { + rgSCHUtlUpdSch (subfrmInfo, cellCb, ueCb, pdu, err); + } + + RETVALUE(ROK); +} +#ifdef LTEMAC_SPS +/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the + * scheduler with the information of the received Data. + * + * @details + * + * Function: rgSCHUtlSpsRelInd + * + * Processing steps: + * TODO + * + * @param [in] RgSchCellCb *cellCb + * @param [in] RgSchUeCb *ueCb + * @param [in] Bool *isExplRel + * @param + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlSpsRelInd +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +Bool isExplRel +) +#else +PUBLIC S16 rgSCHUtlSpsRelInd (cellCb, ueCb, isExplRel) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +Bool isExplRel; +#endif +{ + TRC2(rgSCHUtlSpsRelInd); + cellCb->sc.apis->rgSCHUlSpsRelInd(cellCb, ueCb, isExplRel); + RETVALUE(ROK); +} /* end of rgSCHUtlSpsRelInd */ + + +/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the + * scheduler with the information of the received Data. + * + * @details + * + * Function: rgSCHUtlSpsActInd + * + * Processing steps: + * TODO + * + * @param [in] RgSchCellCb *cellCb + * @param [in] RgSchUeCb *ueCb + * @param [in] U16 spsSduSize + * @param + * @return S16 + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlSpsActInd +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +U16 spsSduSize +) +#else +PUBLIC S16 rgSCHUtlSpsActInd (cellCb, ueCb, spsSduSize) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +U16 spsSduSize; +#endif +{ + TRC2(rgSCHUtlSpsActInd); + cellCb->sc.apis->rgSCHUlSpsActInd(cellCb, ueCb, spsSduSize); + RETVALUE(ROK); +} /* end of rgSCHUtlSpsActInd */ + + +#endif /* LTEMAC_SPS */ + +#ifdef RG_PHASE_2 +/** + * @brief This API is invoked to send uplink group power control request to PHY. + * + * @details + * + * Function : rgSCHUtlTfuGrpPwrCntrlReq + * + * This API is invoked to send uplink group power control request to PHY. + * It fills in the Pst structure, spId value and invokes group power + * control request primitive at TFU. + * + * @param[in] TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlTfuGrpPwrCntrlReq +( +Inst inst, +S16 sapId, +TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq +) +#else +PUBLIC S16 rgSCHUtlTfuGrpPwrCntrlReq(inst, sapId, grpPwrCntrlReq) +Inst inst; +S16 sapId; +TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq; +#endif +{ + S16 ret; + RgSchLowSapCb *tfuSap; + Pst pst; + + TRC2(rgSCHUtlTfuGrpPwrCntrlReq); + + /* Get the lower SAP control block from the layer control block. */ + tfuSap = &(rgSchCb[inst].tfuSap[sapId]); + if (tfuSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,grpPwrCntrlReq->cellId, + "rgSCHUtlTfuGrpPwrCntrlReq() Lower SAP not bound (%d) ",tfuSap->sapSta.sapState); + RETVALUE(RFAILED); + } + cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst)); + if((ret = RgLiTfuGrpPwrCntrlReq (&pst, tfuSap->sapCfg.spId, grpPwrCntrlReq)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,grpPwrCntrlReq->cellId, + "rgSCHUtlTfuGrpPwrCntrlReq() Call to RgLiTfuGrpPwrCntrlReq() failed"); + } + RETVALUE(ret); +} /* rgSCHUtlTfuGrpPwrCntrlReq */ +#endif + +/** + * @brief This API is invoked to send Control Info to PHY. + * + * @details + * + * Function : rgSCHUtlTfuCntrlReq + * + * This API is invoked to send Control Info to PHY. It + * fills in the Pst structure, spId value and invokes Cntrl + * request primitive at TFU. + * + * @param[in] TfuCntrlReqInfo *cntrlReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlTfuCntrlReq +( +Inst inst, +S16 sapId, +TfuCntrlReqInfo *cntrlReq +) +#else +PUBLIC S16 rgSCHUtlTfuCntrlReq(inst, sapId, cntrlReq) +Inst inst; +S16 sapId; +TfuCntrlReqInfo *cntrlReq; +#endif +{ + S16 ret; + RgSchLowSapCb *tfuSap; + + TRC2(rgSCHUtlTfuCntrlReq) + + /* Get the lower SAP control block from the layer control block. */ + tfuSap = &(rgSchCb[inst].tfuSap[sapId]); + +#ifndef NO_ERRCLS + if (tfuSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuCntrlReq() Lower SAP not bound (%d) ", + tfuSap->sapSta.sapState); + RGSCH_FREE_MEM(cntrlReq); + RETVALUE(RFAILED); + } +#endif + + /* Using local variable for pst is unnecessary - for optimization */ + if((ret = RgLiTfuCntrlReq(&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, + cntrlReq)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuCntrlReq() Call to RgLiTfuCntrlReq() failed"); + } + RETVALUE(ret); +} /* rgSCHUtlTfuCntrlReq*/ + + +/* FOR ACK NACK REP */ + +/** + * @brief This API is invoked to tell the DL Scheduler to add the UE back into + * its scheduling queues. + * + * @details + * + * Function : rgSCHUtlDlActvtUe + * + * This API is invoked from Measurement gap moduled. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlDlActvtUe +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC S16 rgSCHUtlDlActvtUe(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlDlActvtUe); + cell->sc.apis->rgSCHActvtDlUe(cell, ue); + RETVALUE(ROK); +} + +/** + * @brief This API is invoked to tell the UL Scheduler to add the UE back into + * its scheduling queues. + * + * @details + * + * Function : rgSCHUtlUlActvtUe + * + * This API is invoked from Measurement gap moduled. + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUlActvtUe +( +RgSchCellCb *cell, +RgSchUeCb *ue +) +#else +PUBLIC S16 rgSCHUtlUlActvtUe(cell, ue) +RgSchCellCb *cell; +RgSchUeCb *ue; +#endif +{ + TRC2(rgSCHUtlUlActvtUe); + cell->sc.apis->rgSCHActvtUlUe(cell, ue); + RETVALUE(ROK); +} + +/** + * @brief This API is invoked to send Reception Request Info to PHY. + * + * @details + * + * Function : rgSCHUtlTfuRecpReq + * + * This API is invoked to send Reception Request Info to PHY. It + * fills in the Pst structure, spId value and invokes Reception + * request primitive at TFU. + * + * @param[in] TfuRecpReqInfo *recpReq + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlTfuRecpReq +( +Inst inst, +S16 sapId, +TfuRecpReqInfo *recpReq +) +#else +PUBLIC S16 rgSCHUtlTfuRecpReq(inst, sapId, recpReq) +Inst inst; +S16 sapId; +TfuRecpReqInfo *recpReq; +#endif +{ + S16 ret; + RgSchLowSapCb *tfuSap; + + TRC2(rgSCHUtlTfuRecpReq) + + /* Get the lower SAP control block from the layer control block. */ + tfuSap = &(rgSchCb[inst].tfuSap[sapId]); + +#ifndef NO_ERRCLS + if (tfuSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuRecpReq() Lower SAP not bound (%d) ", + tfuSap->sapSta.sapState); + RGSCH_FREE_MEM(recpReq); + RETVALUE(RFAILED); + } +#endif + + /* Using local variable for pst is unnecessary - for optimization */ + if((ret = RgLiTfuRecpReq(&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, + recpReq)) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"rgSCHUtlTfuRecpReq() Call to RgLiTfuRecpReq() failed"); + } + RETVALUE(ret); +} /* rgSCHUtlTfuRecpReq */ + + /** @brief This function Validates the SAP information received along with the + * primitive from the lower layer. + * + * Function: rgSCHUtlValidateTfuSap + * + * Validates SAP information. + * @param suId The SAP Id + * @return + * -# ROK + * -# RFAILED + */ +#ifdef ANSI +PUBLIC S16 rgSCHUtlValidateTfuSap +( +Inst inst, +SuId suId +) +#else +PUBLIC S16 rgSCHUtlValidateTfuSap(inst, suId) +Inst inst; +SuId suId; +#endif +{ + RgSchLowSapCb *tfuSap; + + TRC2(rgSCHUtlValidateTfuSap) + + if(suId >= rgSchCb[inst].numSaps) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Incorrect SuId"); + RETVALUE(RFAILED); + } + tfuSap = &(rgSchCb[inst].tfuSap[suId]); + + /* First lets check the suId */ + if( suId != tfuSap->sapCfg.suId) + { + RLOG_ARG2(L_ERROR,DBG_INSTID,inst,"Incorrect SuId. Configured (%d) Recieved (%d)", + tfuSap->sapCfg.suId, suId); + RETVALUE(RFAILED); + } + if (tfuSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"Lower SAP not enabled SuId (%d)", + tfuSap->sapCfg.suId); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +} /* end of rgSCHUtlValidateTfuSap */ + +/* +* +* Fun: rgSCHUtlAllocEventMem +* +* Desc: This function allocates event memory +* +* Ret: ROK - on success +* RFAILED - on failure +* +* Notes: None +* +* File: rg_utl.c +* +*/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAllocEventMem +( +Inst inst, +Ptr *memPtr, +Size memSize +) +#else +PUBLIC S16 rgSCHUtlAllocEventMem(inst, memPtr, memSize) +Inst inst; +Ptr *memPtr; +Size memSize; +#endif +{ + Mem sMem; + VOLATILE U32 startTime=0; + + TRC2(rgSCHUtlAllocEventMem) + + sMem.region = rgSchCb[inst].rgSchInit.region; + sMem.pool = rgSchCb[inst].rgSchInit.pool; + +#if (ERRCLASS & ERRCLS_DEBUG) + if (memSize<= 0) + { + RGSCHLOGERROR(inst, ERRCLS_INT_PAR, ERG022, memSize, + "rgAllocEventMem(): memSize invalid\n"); + RETVALUE (RFAILED); + } +#endif /* ERRCLASS & ERRCLS_DEBUG */ + /*starting Task*/ + SStartTask(&startTime, PID_SCHUTL_CMALLCEVT); + +#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ + MS_BUF_ADD_ALLOC_CALLER(); +#endif /* */ +#ifdef TFU_ALLOC_EVENT_NO_INIT + if(ROK != cmAllocEvntNoInit(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr)) +#else + if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr)) +#endif /* */ + { + RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"cmAllocEvnt Failed."); + RETVALUE(RFAILED); + } + /*stoping Task*/ + SStopTask(startTime, PID_SCHUTL_CMALLCEVT); + RETVALUE(ROK); +} /* end of rgSCHUtlAllocEventMem*/ + +/* +* +* Fun: rgGetEventMem +* +* Desc: This function allocates event memory +* +* Ret: ROK - on success +* RFAILED - on failure +* +* Notes: None +* +* File: rg_utl.c +* +*/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetEventMem +( +Ptr *ptr, +Size len, +Ptr memCp +) +#else +PUBLIC S16 rgSCHUtlGetEventMem(ptr, len, memCp) +Ptr *ptr; +Size len; +Ptr memCp; +#endif +{ + S16 ret; + + TRC2(rgSCHUtlGetEventMem) +#ifdef TFU_ALLOC_EVENT_NO_INIT + ret = cmGetMemNoInit(memCp, len, (Ptr *)ptr); +#else + ret = cmGetMem(memCp, len, (Ptr *)ptr); +#endif + RETVALUE(ret); +} /* end of rgSCHUtlGetEventMem*/ + +#ifdef LTE_TDD + + +/** + * @brief Handler to allocate memory for ACK/NACk feedback information + * + * @details + * + * Function : rgSCHUtlAllocUeANFdbkInfo + * + * It allocates memory for the UE related ACK NACK information. + * + * @param[in] RgSchUeCb *ue + * @return S16 + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlAllocUeANFdbkInfo +( +RgSchUeCb *ue, +U8 servCellIdx +) +#else +PUBLIC S16 rgSCHUtlAllocUeANFdbkInfo(ue,servCellIdx) +RgSchUeCb *ue; +U8 servCellIdx; +#endif +{ + U8 idx; + + TRC2(rgSCHUtlAllocUeANFdbkInfo); + + if (rgSCHUtlAllocSBuf(ue->cell->instIdx, + (Data **) &(ue->cellInfo[servCellIdx]->anInfo), sizeof(RgSchTddANInfo) * \ + ue->cell->ackNackFdbkArrSize) != ROK) + { + RETVALUE(RFAILED); + } + + for(idx=0; idx < ue->cell->ackNackFdbkArrSize; idx++) + { + rgSCHUtlInitUeANFdbkInfo(&ue->cellInfo[servCellIdx]->anInfo[idx]); + } + + /* Set it to the first index */ + ue->cellInfo[servCellIdx]->nextFreeANIdx = 0; + RETVALUE(ROK); +} /* rgSCHUtlAllocUeANFdbkInfo */ + +/** + * @brief Handler to release memory for ACK/NACk feedback information + * + * @details + * + * Function : rgSCHUtlDelUeANFdbkInfo + * + * It releases memory for the UE related ACK NACK information. + * + * @param[in] RgSchUeCb *ue + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlDelUeANFdbkInfo +( +RgSchUeCb *ue, +U8 servCellIdx +) +#else +PUBLIC Void rgSCHUtlDelUeANFdbkInfo(ue,servCellIdx) +RgSchUeCb *ue; +U8 servCellIdx; +#endif +{ + TRC2(rgSCHUtlDelUeANFdbkInfo); + + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(ue->cell->instIdx, + (Data **)(&( ue->cellInfo[servCellIdx]->anInfo)), sizeof(RgSchTddANInfo) * \ + ue->cell->ackNackFdbkArrSize); + + RETVOID; +} /* rgSCHUtlDelUeANFdbkInfo */ + +/** + * @brief Handler to initialise UE ACK/NACk feedback information + * + * @details + * + * Function : rgSCHUtlInitUeANFdbkInfo + * + * It initialises UE related ACK NACK information. + * + * @param[in] RgSchTddANInfo *anFdInfo + * @return S16 + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlInitUeANFdbkInfo +( +RgSchTddANInfo *anFdInfo +) +#else +PUBLIC S16 rgSCHUtlInitUeANFdbkInfo(anFdInfo) +RgSchTddANInfo *anFdInfo; +#endif +{ + TRC2(rgSCHUtlInitUeANFdbkInfo); + + anFdInfo->sfn = RGSCH_MAX_SFN+1; /* defensively setting invalid sfn */ + anFdInfo->subframe = 0; + anFdInfo->ulDai = RG_SCH_INVALID_DAI_VAL; + anFdInfo->dlDai = RG_SCH_INVALID_DAI_VAL; + anFdInfo->latestMIdx = RG_SCH_INVALID_M_VAL; + + RETVALUE(ROK); +} /* rgSCHUtlInitUeANFdbkInfo */ + +/** + * @brief Handler to get UE related ACK NACK feedback information + * + * @details + * + * Function : rgSCHUtlGetUeANFdbkInfo + * + * It gets the UE related ACK NACK information based on + * SFN and subframe number. + * + * @param[in] RgSchUeCb *ueCb + * @param[in] CmLteTimingInfo *time + * @return RgSchTddANInfo* + **/ +#ifdef ANSI +PUBLIC RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo +( +RgSchUeCb *ueCb, +CmLteTimingInfo *timeInfo, +U8 servCellIdx +) +#else +PUBLIC RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo(ueCb, timeInfo,servCellIdx) +RgSchUeCb *ueCb; +CmLteTimingInfo *timeInfo; +U8 servCellIdx; +#endif +{ + U8 idx; + + TRC2(rgSCHUtlGetUeANFdbkInfo); + + for (idx = 0; idx < ueCb->cell->ackNackFdbkArrSize; ++idx) + { + if( (timeInfo->sfn == ueCb->cellInfo[servCellIdx]->anInfo[idx].sfn) && + (timeInfo->subframe == ueCb->cellInfo[servCellIdx]->anInfo[idx].subframe)) + { + RETVALUE(&ueCb->cellInfo[servCellIdx]->anInfo[idx]); + } + } + + RETVALUE(NULLP); +} /* rgSCHUtlGetUeANFdbkInfo */ + +/** + * @brief To get downlink subframe index + * + * @details + * + * Function: rgSCHUtlGetDlSfIdx + * Purpose: Gets downlink subframe index based on SFN and subframe no + * + * @param[in] CmLteTimingInfo *timeInfo + * @param[in] RgSchCellCb *cell + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC U8 rgSCHUtlGetDlSfIdx +( +RgSchCellCb *cell, +CmLteTimingInfo *timeInfo +) +#else +PUBLIC U8 rgSCHUtlGetDlSfIdx(cell, timeInfo) +RgSchCellCb *cell; +CmLteTimingInfo *timeInfo; +#endif +{ + U16 idx = 0; + TRC2(rgSCHUtlGetDlSfIdx); + + idx = RGSCH_NUM_SUB_FRAMES - \ + rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]; + idx = ((idx * timeInfo->sfn) + \ + rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][timeInfo->subframe]) - 1; + idx = idx % cell->numDlSubfrms; + + RETVALUE((U8)idx); +} + +/** + * @brief To get the next downlink subframe + * + * @details + * + * Function: rgSCHUtlGetNxtDlSfInfo + * Purpose: Gets next downlink subframe based on current DL subframe + * + * @param[in] CmLteTimingInfo curDlTime + * @param[in] RgSchCellCb *cell + * @param[in] RgSchDlSf *dlSf + * @param[in] RgSchDlSf **nxtDlsf + * @param[in] CmLteTimingInfo *nxtDlTime + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlGetNxtDlSfInfo +( +CmLteTimingInfo curDlTime, +RgSchCellCb *cell, +RgSchDlSf *dlSf, +RgSchDlSf **nxtDlsf, +CmLteTimingInfo *nxtDlTime +) +#else +PUBLIC Void rgSCHUtlGetNxtDlSfInfo(curDlTime, cell, dlSf, nxtDlsf, nxtDlTime) +CmLteTimingInfo curDlTime; +RgSchCellCb *cell; +RgSchDlSf *dlSf; +RgSchDlSf **nxtDlsf; +CmLteTimingInfo *nxtDlTime; +#endif +{ + U16 idx = curDlTime.subframe; + U8 count = 0; + TRC2(rgSCHUtlGetNxtDlSfInfo); + + while(TRUE) + { + do + { + idx = (idx + 1) % RGSCH_NUM_SUB_FRAMES; + count++; + }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] + != RG_SCH_TDD_DL_SUBFRAME); + RG_SCH_ADD_TO_CRNT_TIME(curDlTime, (*nxtDlTime), count); + *nxtDlsf = rgSCHUtlSubFrmGet(cell, *nxtDlTime); + if(dlSf->dlFdbkInfo.subframe != (*nxtDlsf)->dlFdbkInfo.subframe) + { + break; + } + } + RETVOID; +} + +/** + * @brief To get the previous downlink subframe + * + * @details + * + * Function: rgSCHUtlGetPrevDlSfInfo + * Purpose: Gets previous downlink subframe based on current DL subframe + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteTimingInfo curDlTime + * @param[in] CmLteTimingInfo *prevDlTime + * @param[in] U8 *numSubfrm + * @return U8 + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlGetPrevDlSfInfo +( +RgSchCellCb *cell, +CmLteTimingInfo curDlTime, +CmLteTimingInfo *prevDlTime, +U8 *numSubfrm +) +#else +PUBLIC Void rgSCHUtlGetPrevDlSfInfo(cell, curDlTime, prevDlTime, numSubfrm) +RgSchCellCb *cell; +CmLteTimingInfo curDlTime; +CmLteTimingInfo *prevDlTime; +U8 *numSubfrm; +#endif +{ + S16 idx = curDlTime.subframe; + U8 count = 0; + TRC2(rgSCHUtlGetPrevDlSfInfo); + + do + { + idx--; + if(idx < 0) + { + idx = RGSCH_NUM_SUB_FRAMES-1; + } + count++; + }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx] + != RG_SCH_TDD_DL_SUBFRAME); + *numSubfrm = count; + RGSCHDECRFRMCRNTTIME(curDlTime, (*prevDlTime), count); + RETVOID; +} + +#endif +/* Added Holes Management functions for Adaptive Re transmission */ +/******* : START *****/ +/*********************************************************** + * + * Func : rgSCHUtlUlSfInit + * + * Desc : UL subframe init. + * + * Ret : S16 + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUlSfInit +( +RgSchCellCb *cell, +RgSchUlSf *sf, +U8 idx, +U8 maxUePerSf +) +#else +PUBLIC S16 rgSCHUtlUlSfInit(cell, sf, idx, maxUePerSf) +RgSchCellCb *cell; +RgSchUlSf *sf; +U8 idx; +U8 maxUePerSf; +#endif +{ + S16 ret=ROK; + TRC2(rgSCHUtlUlSfInit); + + sf->idx = idx; +#ifdef RG_5GTF + U8 index; +#endif + +#ifdef LTE_TDD + if(cell->ulDlCfgIdx == 0) + { + /* Store the Uplink subframe number corresponding to the idx */ + sf->ulSfIdx = rgSchTddCfg0UlSfTbl[idx%6]; + } +#endif + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->allocDb, + sizeof(RgSchUlAllocDb)); + if (ret != ROK) + { + RETVALUE(ret); + } + ret = rgSCHUtlUlAllocDbInit(cell, sf->allocDb, maxUePerSf); + if (ret != ROK) + { + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), + sizeof(RgSchUlAllocDb)); + RETVALUE(ret); + } + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->holeDb, + sizeof(RgSchUlHoleDb)); + if (ret != ROK) + { + rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), + sizeof(RgSchUlAllocDb)); + RETVALUE(ret); + } + /* Initialize the hole with CFI 1 Pusch Bw Info */ + ret = rgSCHUtlUlHoleDbInit(cell, sf->holeDb, (U8)(maxUePerSf + 2), \ + 0, cell->dynCfiCb.bwInfo[1].numSb); + + if (ret != ROK) + { + rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), + sizeof(RgSchUlAllocDb)); + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)), + sizeof(RgSchUlHoleDb)); + RETVALUE(ret); + } + cmLListInit(&sf->reTxLst); + + /* Fix ccpu00120610*/ + sf->allocCountRef = &sf->allocDb->count; + + /* initialize UL available subbands for current sub-frame */ + sf->availSubbands = cell->dynCfiCb.bwInfo[1].numSb; +#ifdef RG_5GTF + sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti; + sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti; + for(index = 0; index < MAX_5GTF_BEAMS; index++) + { + sf->sfBeamInfo[index].totVrbgAllocated = 0; + sf->sfBeamInfo[index].totVrbgRequired = 0; + sf->sfBeamInfo[index].vrbgStart = 0; + } +#endif + + RETVALUE(ret); +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlSfDeinit + * + * Desc : Deinitialises a subframe + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlSfDeinit +( +RgSchCellCb *cell, +RgSchUlSf *sf +) +#else +PUBLIC Void rgSCHUtlUlSfDeinit(cell, sf) +RgSchCellCb *cell; +RgSchUlSf *sf; +#endif +{ + TRC2(rgSCHUtlUlSfDeinit); + if (sf->allocDb) + { + rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)), + sizeof(RgSchUlAllocDb)); + } + if (sf->holeDb) + { + rgSCHUtlUlHoleDbDeinit(cell, sf->holeDb); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)), + sizeof(RgSchUlHoleDb)); + } + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocDbInit + * + * Desc : Initialise allocation DB + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHUtlUlAllocDbInit +( +RgSchCellCb *cell, +RgSchUlAllocDb *allocDb, +U8 maxAllocs +) +#else +PRIVATE S16 rgSCHUtlUlAllocDbInit(cell, allocDb, maxAllocs) +RgSchCellCb *cell; +RgSchUlAllocDb *allocDb; +U8 maxAllocs; +#endif +{ + S16 ret = rgSCHUtlUlAllocMemInit(cell, &allocDb->mem, maxAllocs); + TRC2(rgSCHUtlUlAllocDbInit); + if (ret != ROK) + { + RETVALUE(ret); + } + allocDb->count = 0; + allocDb->first = NULLP; + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocDbDeinit + * + * Desc : Deinitialises allocation DB + * sent to UE, for a UE with accumulation disabled + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHUtlUlAllocDbDeinit +( +RgSchCellCb *cell, +RgSchUlAllocDb *allocDb +) +#else +PRIVATE Void rgSCHUtlUlAllocDbDeinit(cell, allocDb) +RgSchCellCb *cell; +RgSchUlAllocDb *allocDb; +#endif +{ + TRC2(rgSCHUtlUlAllocDbDeinit); + rgSCHUtlUlAllocMemDeinit(cell, &allocDb->mem); + allocDb->count = 0; + allocDb->first = NULLP; + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleDbInit + * + * Desc : Initialise hole DB + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE S16 rgSCHUtlUlHoleDbInit +( +RgSchCellCb *cell, +RgSchUlHoleDb *holeDb, +U8 maxHoles, +U8 start, +U8 num +) +#else +PRIVATE S16 rgSCHUtlUlHoleDbInit(cell, holeDb, maxHoles, start, num) +RgSchCellCb *cell; +RgSchUlHoleDb *holeDb; +U8 maxHoles; +U8 start; +U8 num; +#endif +{ + S16 ret; + RgSchUlHole *hole = NULLP; + TRC2(rgSCHUtlUlHoleDbInit); + + ret = rgSCHUtlUlHoleMemInit(cell, &holeDb->mem, maxHoles, &hole); + if (ret != ROK) + { + RETVALUE(ret); + } + holeDb->count = 1; + holeDb->first = hole; + hole->start = start; + hole->num = num; + hole->prv = hole->nxt = NULLP; + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleDbDeinit + * + * Desc : Deinitialises hole DB + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE Void rgSCHUtlUlHoleDbDeinit +( +RgSchCellCb *cell, +RgSchUlHoleDb *holeDb +) +#else +PRIVATE Void rgSCHUtlUlHoleDbDeinit(cell, holeDb) +RgSchCellCb *cell; +RgSchUlHoleDb *holeDb; +#endif +{ + TRC2(rgSCHUtlUlHoleDbDeinit); + rgSCHUtlUlHoleMemDeinit(cell, &holeDb->mem); + holeDb->count = 0; + holeDb->first = NULLP; + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocGetHole + * + * Desc : Get allocation from hole + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetHole +( +RgSchUlSf *sf, +U8 numSb, +RgSchUlHole *hole +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetHole(sf, numSb, hole) +RgSchUlSf *sf; +U8 numSb; +RgSchUlHole *hole; +#endif +{ + TRC2(rgSCHUtlUlAllocGetHole); + if (numSb < hole->num) + { + RETVALUE(rgSCHUtlUlAllocGetPartHole(sf, numSb, hole)); + } + else + { + RETVALUE(rgSCHUtlUlAllocGetCompHole(sf, hole)); + } +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocGetCompHole + * + * Desc : Get an allocation corresponding to an entire hole + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole +( +RgSchUlSf *sf, +RgSchUlHole *hole +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole(sf, hole) +RgSchUlSf *sf; +RgSchUlHole *hole; +#endif +{ + RgSchUlAlloc *alloc; + /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */ + /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole + * updated, causing another check for prv */ + RgSchUlAlloc *prv = hole->prvAlloc; + RgSchUlAlloc *nxt = hole->nxtAlloc; + TRC2(rgSCHUtlUlAllocGetCompHole); + + if (prv) + { + if (hole->start == prv->nxtHole->start) + { + prv->nxtHole = NULLP; + } + alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv); + } + else + { + alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb); + } + + RGSCH_NULL_CHECK( 0, alloc); + alloc->prvHole = NULLP; + alloc->nxtHole = NULLP; + + alloc->sbStart = hole->start; + alloc->numSb = hole->num; + + if (nxt) + { + nxt->prvHole = NULLP; + } + + rgSCHUtlUlHoleRls(sf->holeDb, hole); + + /* UL_ALLOC_CHANGES*/ + alloc->allocDbRef = (void*)sf->allocDb; + alloc->holeDbRef = (void*)sf->holeDb; + RETVALUE(alloc); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocGetPartHole + * + * Desc : Get an allocation corresponding to a part of a hole. + * The initial 'numSb' part of the hole shall be taken + * away for this alloc. + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole +( +RgSchUlSf *sf, +U8 numSb, +RgSchUlHole *hole +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole(sf, numSb, hole) +RgSchUlSf *sf; +U8 numSb; +RgSchUlHole *hole; +#endif +{ + RgSchUlAlloc *alloc; + /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */ + /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole + * updated, causing another check for prv */ + RgSchUlAlloc *prv = hole->prvAlloc; + TRC2(rgSCHUtlUlAllocGetPartHole); + + if (prv) + { + if (hole->start == prv->nxtHole->start) + { + prv->nxtHole = NULLP; + } + alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv); + } + else + { + alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb); + } + + RGSCH_NULL_CHECK( 0, alloc); + alloc->prvHole = NULLP; + alloc->nxtHole = hole; + hole->prvAlloc = alloc; + + alloc->sbStart = hole->start; + alloc->numSb = numSb; + hole->start += numSb; + hole->num -= numSb; + + rgSCHUtlUlHoleDecr(sf->holeDb, hole); + + /* UL_ALLOC_CHANGES*/ + alloc->allocDbRef = (void*)sf->allocDb; + alloc->holeDbRef = (void*)sf->holeDb; + + RETVALUE(alloc); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocFirst + * + * Desc : Get first alloc in subframe + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocFirst +( +RgSchUlSf *sf +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocFirst(sf) +RgSchUlSf *sf; +#endif +{ + TRC2(rgSCHUtlUlAllocFirst); + RETVALUE(sf->allocDb->first); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocNxt + * + * Desc : Get next alloc + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocNxt +( +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocNxt(sf, alloc) +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlUlAllocNxt); + UNUSED(sf); + RETVALUE(alloc->nxt); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocGetAdjNxt + * + * Desc : Get alloc which is immediately after the passed one. + * 1. Gets alloc from mem. + * 2. Inserts alloc into list (between prv and + * prv->nxt, prv is not NULLP). + * 3. Increments alloc count. + * Note 1: Holes are not dealt with here. + * Note 2: Assumes prv to be NULL. + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt +( +RgSchUlAllocDb *db, +RgSchUlAlloc *prv +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt(db, prv) +RgSchUlAllocDb *db; +RgSchUlAlloc *prv; +#endif +{ + RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem); + RgSchUlAlloc *nxt = prv->nxt; + TRC2(rgSCHUtlUlAllocGetAdjNxt); + +#if (ERRCLASS & ERRCLS_DEBUG) + if ( alloc == NULLP ) + { + RETVALUE ( NULLP ); + } +#endif + alloc->prv = prv; + alloc->nxt = nxt; + prv->nxt = alloc; + if (nxt) + { + nxt->prv = alloc; + } + + ++db->count; + + RETVALUE(alloc); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocGetFirst + * + * Desc : Get alloc which is to be the first one in the alloc list + * 1. Gets alloc from mem. + * 2. Inserts alloc as first element into list. + * 3. Increments alloc count. + * Note 1: Holes are not dealt with here. + * Note 2: prv to necessarily NULLP. + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetFirst +( +RgSchUlAllocDb *db +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocGetFirst(db) +RgSchUlAllocDb *db; +#endif +{ + RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem); + RgSchUlAlloc *nxt = db->first; + TRC2(rgSCHUtlUlAllocGetFirst); + +#if (ERRCLASS & ERRCLS_DEBUG) + if ( alloc == NULLP ) + { + RETVALUE ( NULLP ); + } +#endif + + alloc->prv = NULLP; + alloc->nxt = nxt; + if (nxt) + { + nxt->prv = alloc; + } + db->first = alloc; + + ++db->count; + + RETVALUE(alloc); +} + +/* UL_ALLOC_ENHANCEMENT */ +/*********************************************************** + * + * Func : rgSCHUtlUlHoleAddAllocation + * + * Desc : On freeing an alloc, add to hole + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleAddAllocation +( +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleAddAllocation(alloc) +RgSchUlAlloc *alloc; +#endif +{ + /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as + * one, if such excessive branching is done (AllocNone, AllocNoPrv etc). + * The excessive branching is meant to utilise the knowledge of whether prv + * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt, + * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as + * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */ + RgSchUlHoleDb *db = alloc->holeDbRef; + RgSchUlHole *prv = alloc->prvHole; + RgSchUlHole *nxt = alloc->nxtHole; + TRC2(rgSCHUtlUlHoleAddAllocation); + + if (prv) + { + if (nxt) + { + rgSCHUtlUlHoleJoin(db, prv, nxt, alloc); + } + else + rgSCHUtlUlHoleExtndRight(db, prv, alloc); + } + else + { + if (nxt) + { + rgSCHUtlUlHoleExtndLeft(db, nxt, alloc); + } + else + rgSCHUtlUlHoleNew(db, alloc); + } + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocRelease + * + * Desc : Releases an uplink allocation, only take alloc ptr + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlAllocRelease +( +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlAllocRelease(alloc) +RgSchUlAlloc *alloc; +#endif +{ + RgSchUlAllocDb *allocDb = alloc->allocDbRef; + RgSchUlAlloc *prv = alloc->prv; + RgSchUlAlloc *nxt = alloc->nxt; + TRC2(rgSCHUtlUlAllocRelease); + + alloc->ue = NULLP; + alloc->raCb = NULLP; + alloc->isAdaptive = FALSE; + + if (prv) + { + prv->nxt = nxt; + if (nxt) /* general case: this allocation lies btw two */ + { + nxt->prv = prv; + } + } + else + { + allocDb->first = nxt; + if (nxt) + { + nxt->prv = NULLP; + } + } + --allocDb->count; + rgSCHUtlUlHoleAddAllocation(alloc); + rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc); + + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocRls + * + * Desc : Releases an uplink allocation + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlAllocRls +( +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlAllocRls(sf, alloc) +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + RgSchUlAllocDb *allocDb = sf->allocDb; + RgSchUlAlloc *prv = alloc->prv; + RgSchUlAlloc *nxt = alloc->nxt; + TRC2(rgSCHUtlUlAllocRls); + + alloc->ue = NULLP; + alloc->raCb = NULLP; + alloc->isAdaptive = FALSE; + + if(allocDb->count) + { + if (prv) + { + prv->nxt = nxt; + if (nxt) /* general case: this allocation lies btw two */ + { + nxt->prv = prv; + } + } + else + { + allocDb->first = nxt; + if (nxt) + { + nxt->prv = NULLP; + } + } + --allocDb->count; + rgSCHUtlUlHoleAddAlloc(sf, alloc); + rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc); + } + else + { + + printf("\nError: allocDb->count is ZERO ====\n"); + } + + //printf("\nallocDb->count:%u\n",allocDb->count); + + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleFirst + * + * Desc : Get first (largest) hole + * + * Ret : RgSchUlHole * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlHole *rgSCHUtlUlHoleFirst +( +RgSchUlSf *sf +) +#else +PUBLIC RgSchUlHole *rgSCHUtlUlHoleFirst(sf) +RgSchUlSf *sf; +#endif +{ + TRC2(rgSCHUtlUlHoleFirst); + RETVALUE(sf->holeDb->first); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleNxt + * + * Desc : Get next largest hole + * + * Ret : RgSchUlHole * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlHole *rgSCHUtlUlHoleNxt +( +RgSchUlSf *sf, +RgSchUlHole *hole +) +#else +PUBLIC RgSchUlHole *rgSCHUtlUlHoleNxt(sf, hole) +RgSchUlSf *sf; +RgSchUlHole *hole; +#endif +{ + TRC2(rgSCHUtlUlHoleNxt); + UNUSED(sf); + RETVALUE(hole->nxt); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleAddAlloc + * + * Desc : On freeing an alloc, add to hole + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleAddAlloc +( +RgSchUlSf *sf, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleAddAlloc(sf, alloc) +RgSchUlSf *sf; +RgSchUlAlloc *alloc; +#endif +{ + /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as + * one, if such excessive branching is done (AllocNone, AllocNoPrv etc). + * The excessive branching is meant to utilise the knowledge of whether prv + * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt, + * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as + * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */ + RgSchUlHoleDb *db = sf->holeDb; + RgSchUlHole *prv = alloc->prvHole; + RgSchUlHole *nxt = alloc->nxtHole; + TRC2(rgSCHUtlUlHoleAddAlloc); + + if (prv) + { + if (nxt) + { + rgSCHUtlUlHoleJoin(db, prv, nxt, alloc); + } + else + rgSCHUtlUlHoleExtndRight(db, prv, alloc); + } + else + { + if (nxt) + { + rgSCHUtlUlHoleExtndLeft(db, nxt, alloc); + } + else + rgSCHUtlUlHoleNew(db, alloc); + } + + /* increment the number of subbands getting freed to total available list */ + sf->availSubbands += alloc->numSb; + + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleJoin + * + * Desc : Join two holes (due to alloc being deleted) + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleJoin +( +RgSchUlHoleDb *db, +RgSchUlHole *prv, +RgSchUlHole *nxt, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleJoin(db, prv, nxt, alloc) +RgSchUlHoleDb *db; +RgSchUlHole *prv; +RgSchUlHole *nxt; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlUlHoleJoin); + prv->num += alloc->numSb + nxt->num; + rgSCHUtlUlHoleRls(db, nxt); + rgSCHUtlUlHoleIncr(db, prv); + rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt); + + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleExtndRight + * + * Desc : Extend hole due to alloc coming 'after' the hole + * being deleted + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleExtndRight +( +RgSchUlHoleDb *db, +RgSchUlHole *prv, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleExtndRight(db, prv, alloc) +RgSchUlHoleDb *db; +RgSchUlHole *prv; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlUlHoleExtndRight); + prv->num += alloc->numSb; + rgSCHUtlUlHoleIncr(db, prv); + rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt); + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleExtndLeft + * + * Desc : Extend hole due to alloc coming 'before' the hole + * being deleted + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleExtndLeft +( +RgSchUlHoleDb *db, +RgSchUlHole *nxt, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleExtndLeft(db, nxt, alloc) +RgSchUlHoleDb *db; +RgSchUlHole *nxt; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlUlHoleExtndLeft); + nxt->num += alloc->numSb; + nxt->start = alloc->sbStart; + rgSCHUtlUlHoleIncr(db, nxt); + rgSCHUtlUlHoleUpdAllocLnks(nxt, alloc->prv, alloc->nxt); + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleNew + * + * Desc : Create new hole due to alloc being deleted + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleNew +( +RgSchUlHoleDb *db, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlHoleNew(db, alloc) +RgSchUlHoleDb *db; +RgSchUlAlloc *alloc; +#endif +{ + RgSchUlHole *hole = rgSCHUtlUlHoleMemGet(&db->mem); +#if (ERRCLASS & ERRCLS_DEBUG) + if ( hole == NULLP ) + { + RETVOID; + } +#endif + TRC2(rgSCHUtlUlHoleNew); + hole->start = alloc->sbStart; + hole->num = alloc->numSb; + ++db->count; + rgSCHUtlUlHoleIns(db, hole); + rgSCHUtlUlHoleUpdAllocLnks(hole, alloc->prv, alloc->nxt); + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleUpdAllocLnks + * + * Desc : Update alloc links in hole + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleUpdAllocLnks +( +RgSchUlHole *hole, +RgSchUlAlloc *prvAlloc, +RgSchUlAlloc *nxtAlloc +) +#else +PUBLIC Void rgSCHUtlUlHoleUpdAllocLnks(hole, prvAlloc, nxtAlloc) +RgSchUlHole *hole; +RgSchUlAlloc *prvAlloc; +RgSchUlAlloc *nxtAlloc; +#endif +{ + TRC2(rgSCHUtlUlHoleUpdAllocLnks); + if (prvAlloc) + { + prvAlloc->nxtHole = hole; + } + if (nxtAlloc) + { + nxtAlloc->prvHole = hole; + } + hole->prvAlloc = prvAlloc; + hole->nxtAlloc = nxtAlloc; + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleIns + * + * Desc : Insert (newly created) hole in sorted list of holes. + * Searches linearly, beginning with the largest hole. + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleIns +( +RgSchUlHoleDb *db, +RgSchUlHole *hole +) +#else +PUBLIC Void rgSCHUtlUlHoleIns(db, hole) +RgSchUlHoleDb *db; +RgSchUlHole *hole; +#endif +{ + RgSchUlHole *cur; + TRC2(rgSCHUtlUlHoleIns); + + if ((cur = db->first) != NULLP) + { + RgSchUlHole *nxt; + if (cur->num < hole->num) + { + /* Add at front */ + hole->nxt = cur; + cur->prv = hole; + db->first = hole; + hole->prv = NULLP; + RETVOID; + } + + for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt) + { + if (nxt->num < hole->num) + { + /* Insert hole: cur <-> hole <-> nxt */ + cur->nxt = hole; + hole->prv = cur; + hole->nxt = nxt; + nxt->prv = hole; + RETVOID; + } + } + + /* Add at end */ + cur->nxt = hole; + hole->prv = cur; + hole->nxt = NULLP; + RETVOID; + } + + /* This is the first hole */ + db->first = hole; + hole->prv = NULLP; /* may not be needed */ + hole->nxt = NULLP; + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleIncr + * + * Desc : hole->num has increeased, reposition in sorted + * list if needed + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleIncr +( +RgSchUlHoleDb *db, +RgSchUlHole *hole +) +#else +PUBLIC Void rgSCHUtlUlHoleIncr(db, hole) +RgSchUlHoleDb *db; +RgSchUlHole *hole; +#endif +{ + RgSchUlHole *cur; + TRC2(rgSCHUtlUlHoleIncr); + + if ((cur = hole->prv) != NULLP) + { + RgSchUlHole *prv; + + if (cur->num > hole->num) + { + RETVOID; + } + + /* Remove hole from current position */ + cur->nxt = hole->nxt; + if (hole->nxt) + { + hole->nxt->prv = cur; + } + + for (prv = cur->prv; prv; cur = prv, prv = prv->prv) + { + if (prv->num > hole->num) + { + /* Insert hole: prv <-> hole <-> cur */ + prv->nxt = hole; + hole->prv = prv; + hole->nxt = cur; + cur->prv = hole; + RETVOID; + } + } + + /* Add at front */ + hole->nxt = cur; + cur->prv = hole; + db->first = hole; + hole->prv = NULLP; + RETVOID; + } + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleDecr + * + * Desc : hole->num has decreeased, reposition in sorted + * list if needed + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleDecr +( +RgSchUlHoleDb *db, +RgSchUlHole *hole +) +#else +PUBLIC Void rgSCHUtlUlHoleDecr(db, hole) +RgSchUlHoleDb *db; +RgSchUlHole *hole; +#endif +{ + RgSchUlHole *cur; + TRC2(rgSCHUtlUlHoleDecr); + + if ((cur = hole->nxt) != NULLP) + { + RgSchUlHole *nxt; + + if (cur->num < hole->num) + { + RETVOID; + } + + /* Remove hole from current position */ + cur->prv = hole->prv; + if (hole->prv) + { + hole->prv->nxt = cur; + } + else /* no prv, so cur to replace hole as first in list */ + { + db->first = cur; + } + + for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt) + { + if (nxt->num < hole->num) + { + /* Insert hole: cur <-> hole <-> nxt */ + cur->nxt = hole; + hole->prv = cur; + hole->nxt = nxt; + nxt->prv = hole; + RETVOID; + } + } + + /* Add at end */ + cur->nxt = hole; + hole->prv = cur; + hole->nxt = NULLP; + RETVOID; + } + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleRls + * + * Desc : Releases hole. + * 1. Decrements hole count. + * 2. Deletes hole from list. + * 3. Frees hole (hole memory release). + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleRls +( +RgSchUlHoleDb *db, +RgSchUlHole *hole +) +#else +PUBLIC Void rgSCHUtlUlHoleRls(db, hole) +RgSchUlHoleDb *db; +RgSchUlHole *hole; +#endif +{ + RgSchUlHole *prv = hole->prv; + RgSchUlHole *nxt = hole->nxt; + TRC2(rgSCHUtlUlHoleRls); + + --db->count; + if (prv) + { + prv->nxt = nxt; + if (nxt) + { + nxt->prv = prv; + } + } + else + { + db->first = nxt; + if (nxt) + { + nxt->prv = NULLP; + } + } + + rgSCHUtlUlHoleMemRls(&db->mem, hole); + RETVOID; +} + + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocMemInit + * + * Desc : Initialises alloc free pool + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUlAllocMemInit +( +RgSchCellCb *cell, +RgSchUlAllocMem *mem, +U8 maxAllocs +) +#else +PUBLIC S16 rgSCHUtlUlAllocMemInit(cell, mem, maxAllocs) +RgSchCellCb *cell; +RgSchUlAllocMem *mem; +U8 maxAllocs; +#endif +{ + S16 ret; + RgSchUlAlloc *allocs; + TRC2(rgSCHUtlUlAllocMemInit); + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&allocs, + maxAllocs * sizeof(*allocs)); + if (ret != ROK) + { + RETVALUE(ret); + } + mem->allocs = allocs; + mem->maxAllocs = maxAllocs; + if (mem->maxAllocs == 1) + { + allocs[0].prv = NULLP; + allocs[0].nxt = NULLP; + } + else + { + U8 i; + allocs[0].prv = NULLP; + allocs[0].nxt = &allocs[1]; + for (i = 1; i < mem->maxAllocs - 1; ++i) + { + allocs[i].prv = &allocs[i-1]; + allocs[i].nxt = &allocs[i+1]; + } + allocs[i].prv = &allocs[i-1]; + allocs[i].nxt = NULLP; + } + mem->firstFree = &allocs[0]; + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocMemDeinit + * + * Desc : Deinitialises alloc free pool + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlAllocMemDeinit +( +RgSchCellCb *cell, +RgSchUlAllocMem *mem +) +#else +PUBLIC Void rgSCHUtlUlAllocMemDeinit(cell, mem) +RgSchCellCb *cell; +RgSchUlAllocMem *mem; +#endif +{ + TRC2(rgSCHUtlUlAllocMemDeinit); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->allocs)), + mem->maxAllocs * sizeof(*mem->allocs)); + mem->maxAllocs = 0; + mem->firstFree = NULLP; + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleMemInit + * + * Desc : Initialises hole free pool. Assumes maxHoles + * to be at least 2. + * + * Ret : S16 (ROK/RFAILED) + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUlHoleMemInit +( +RgSchCellCb *cell, +RgSchUlHoleMem *mem, +U8 maxHoles, +RgSchUlHole **holeRef +) +#else +PUBLIC S16 rgSCHUtlUlHoleMemInit(cell, mem, maxHoles, holeRef) +RgSchCellCb *cell; +RgSchUlHoleMem *mem; +U8 maxHoles; +RgSchUlHole **holeRef; +#endif +{ + S16 ret; + RgSchUlHole *holes; + TRC2(rgSCHUtlUlHoleMemInit); + + ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&holes, + maxHoles * sizeof(*holes)); + if (ret != ROK) + { + RETVALUE(ret); + } + + mem->holes = holes; + mem->maxHoles = maxHoles; + + /* first hole is taken up */ + holes[0].prv = NULLP; /* not needed */ + holes[0].nxt = NULLP; /* not needed */ + *holeRef = &holes[0]; + + if (mem->maxHoles == 2) + { + holes[1].prv = NULLP; /* may not be needed */ + holes[1].nxt = NULLP; /* may not be needed */ + } + else + { + U8 i; + holes[1].prv = NULLP; + holes[0].nxt = &holes[1]; + for (i = 1; i < mem->maxHoles - 1; ++i) + { + holes[i].prv = &holes[i-1]; + holes[i].nxt = &holes[i+1]; + } + holes[i].prv = &holes[i-1]; + holes[i].nxt = NULLP; + } + mem->firstFree = &holes[1]; + + RETVALUE(ROK); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleMemDeinit + * + * Desc : Deinitialises hole free pool + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleMemDeinit +( +RgSchCellCb *cell, +RgSchUlHoleMem *mem +) +#else +PUBLIC Void rgSCHUtlUlHoleMemDeinit(cell, mem) +RgSchCellCb *cell; +RgSchUlHoleMem *mem; +#endif +{ + TRC2(rgSCHUtlUlHoleMemDeinit); + /* ccpu00117052 - MOD - Passing double pointer + for proper NULLP assignment*/ + rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->holes)), + mem->maxHoles * sizeof(*mem->holes)); + mem->maxHoles = 0; + mem->firstFree = NULLP; + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocMemGet + * + * Desc : Gets an 'alloc' from the free pool + * + * Ret : RgSchUlAlloc * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocMemGet +( +RgSchUlAllocMem *mem +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlAllocMemGet(mem) +RgSchUlAllocMem *mem; +#endif +{ + RgSchUlAlloc *alloc; + TRC2(rgSCHUtlUlAllocMemGet); + +#if (ERRCLASS & ERRCLS_DEBUG) + if (mem->firstFree == NULLP) + { + RETVALUE(NULLP); + } +#endif + + alloc = mem->firstFree; + mem->firstFree = alloc->nxt; + alloc->nxt = NULLP; /* probably not needed */ + /* alloc->prv might already be NULLP, in case was needed to set it to NULLP */ + + RETVALUE(alloc); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlAllocMemRls + * + * Desc : Returns an 'alloc' to the free pool + * + * Ret : + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlAllocMemRls +( +RgSchUlAllocMem *mem, +RgSchUlAlloc *alloc +) +#else +PUBLIC Void rgSCHUtlUlAllocMemRls(mem, alloc) +RgSchUlAllocMem *mem; +RgSchUlAlloc *alloc; +#endif +{ + TRC2(rgSCHUtlUlAllocMemRls); + alloc->prv = NULLP; + + alloc->nxt = mem->firstFree; + if (mem->firstFree != NULLP) + { + mem->firstFree->prv = alloc; + } + mem->firstFree = alloc; + RETVOID; +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleMemGet + * + * Desc : Gets a 'hole' from the free pool + * + * Ret : RgSchUlHole * + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC RgSchUlHole *rgSCHUtlUlHoleMemGet +( +RgSchUlHoleMem *mem +) +#else +PUBLIC RgSchUlHole *rgSCHUtlUlHoleMemGet(mem) +RgSchUlHoleMem *mem; +#endif +{ + RgSchUlHole *hole; + TRC2(rgSCHUtlUlHoleMemGet); + +#if (ERRCLASS & ERRCLS_DEBUG) + if (mem->firstFree == NULLP) + { + RETVALUE(NULLP); + } +#endif + + hole = mem->firstFree; + mem->firstFree = hole->nxt; + mem->firstFree->prv = NULLP; /* may not be needed, under error class */ + hole->nxt = NULLP; /* probably not needed */ + /* hole->prv is might already be NULLP, in case was needed to set it to NULLP */ + + RETVALUE(hole); +} + +/*********************************************************** + * + * Func : rgSCHUtlUlHoleMemRls + * + * Desc : Returns a 'hole' to the free pool + * + * Ret : Void + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUlHoleMemRls +( +RgSchUlHoleMem *mem, +RgSchUlHole *hole +) +#else +PUBLIC Void rgSCHUtlUlHoleMemRls(mem, hole) +RgSchUlHoleMem *mem; +RgSchUlHole *hole; +#endif +{ + TRC2(rgSCHUtlUlHoleMemRls); + hole->prv = NULLP; + + hole->nxt = mem->firstFree; + if (mem->firstFree != NULLP) + { + mem->firstFree->prv = hole; + } + mem->firstFree = hole; + RETVOID; +} + +/** + * @brief Get an alloc from the specified position in the BW. + * + * @details + * + * Function : rgSCHUtlUlGetSpfcAlloc + * + * - Return an alloc from the specified position in the BW. + * Note: This function assumes there is always a hole + * Existing which completely has the specified + * allocation. The reason for such an assumption is + * the function's usage as of now guarantees that there + * will always be such hole. And also for efficiency. + * + * @param[in] RgSchUlSf *sf + * @param[in] U8 startSb + * @param[in] U8 numSb + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc +( +RgSchUlSf *sf, +U8 startSb, +U8 numSb +) +#else +PUBLIC RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc(sf, startSb, numSb) +RgSchUlSf *sf; +U8 startSb; +U8 numSb; +#endif +{ + RgSchUlHole *hole, *nxtHole; + RgSchUlAlloc *alloc = NULLP; + TRC2(rgSCHUtlUlGetSpfcAlloc); + + if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP) + { + RETVALUE(NULLP); + } + do + { + nxtHole = rgSCHUtlUlHoleNxt(sf, hole); + if ((startSb >= hole->start) && + (startSb+numSb <= hole->start+hole->num)) + { + if (startSb != hole->start) + { + /* Create a new hole to accomodate Subbands between + * hole start and req alloc start */ + RgSchUlHole *newHole = rgSCHUtlUlHoleMemGet(&(sf->holeDb->mem)); + +#if (ERRCLASS & ERRCLS_DEBUG) + if ( newHole == NULLP ) + { + RETVALUE( NULLP ); + } +#endif + newHole->start = hole->start; + newHole->num = startSb - hole->start; + hole->start = startSb; + /* [ccpu00122847]-MOD- Correctly updating the hole->num */ + hole->num -= newHole->num; + ++(sf->holeDb->count); + rgSCHUtlUlHoleIns(sf->holeDb, newHole); + newHole->prvAlloc = hole->prvAlloc; + if (newHole->prvAlloc) + { + newHole->prvAlloc->nxtHole = newHole; + } + if (numSb == hole->num) + { + alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); + } + else + { + alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); + } + alloc->prvHole = newHole; + newHole->nxtAlloc = alloc; + } + else /* Hole start and req alloc start are same */ + { + if (numSb == hole->num) + { + alloc = rgSCHUtlUlAllocGetCompHole(sf, hole); + } + else + { + alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole); + } + } + break; + } + } while ((hole = nxtHole) != NULLP); + RETVALUE(alloc); +} +#ifdef LTE_L2_MEAS +/** + * @brief Validates the qci values + * + * @details + * + * Function :rgSCHUtlValidateQci + * + * @param[in] RgSchCellCb *cellCb + * @param[in] U8 numQci + * @param[out] U8 *qci + * @return S16 + * ROK + * RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHUtlValidateQci +( +RgSchCellCb *cellCb, +U8 numQci, +U8 *qci +) +#else +PRIVATE S16 rgSCHUtlValidateQci(cellCb, numQci, qci) +RgSchCellCb *cellCb; +U8 numQci; +U8 *qci; +#endif +{ + U8 qciIdx; + U8 qciVal; + + TRC3(rgSCHUtlValidateQci) + + for(qciIdx = 0; qciIdx < numQci; qciIdx++) + { + qciVal = qci[qciIdx]; + if(qciVal == 0 || qciVal > 9) + { + RETVALUE(RFAILED); + } + if(qciVal != cellCb->qciArray[qciVal].qci) + { + RETVALUE(RFAILED); + } + } + + RETVALUE(ROK); +}/* rgSCHUtlValidateQci */ +/** + * @brief Validates the measurement request parameters. + * + * @details + * + * Function :rgSCHUtlValidateMeasReq + * + * @param[in] RgSchCellCb *cellCb + * @param[in] LrgSchMeasReqInfo *schL2MeasInfo + * @param[out] RgSchErrInfo *err + * @return RgSchUlAlloc* + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlValidateMeasReq +( +RgSchCellCb *cellCb, +LrgSchMeasReqInfo *schL2MeasInfo, +RgSchErrInfo *err +) +#else +PUBLIC S16 rgSCHUtlValidateMeasReq(cellCb, schL2MeasInfo, err) +RgSchCellCb *cellCb; +LrgSchMeasReqInfo *schL2MeasInfo; +RgSchErrInfo *err; +#endif +{ + U16 measType; + S16 ret; + + TRC3(rgSCHUtlValidateMeasReq) + + measType = schL2MeasInfo->measType; + + if((measType == 0) || + measType > 2047) + { + err->errType = RGSCHERR_SCH_INVALID_MEAS_TYPE; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + if((schL2MeasInfo->timePrd !=0) && + (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) && + ((schL2MeasInfo->avgPrbQciDl.numQci > LRG_MAX_QCI_PER_REQ)|| + (schL2MeasInfo->avgPrbQciDl.numQci == 0))) + { + err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + if((schL2MeasInfo->timePrd !=0) && + (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) && + (schL2MeasInfo->avgPrbQciUl.numQci > LRG_MAX_QCI_PER_REQ)) + { + err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL) && + ((schL2MeasInfo->nmbActvUeQciDl.numQci > LRG_MAX_QCI_PER_REQ) || + (schL2MeasInfo->nmbActvUeQciDl.sampPrd == 0)|| + ((schL2MeasInfo->timePrd !=0)&& + (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciDl.sampPrd)) || + (schL2MeasInfo->nmbActvUeQciDl.sampPrd > LRG_MAX_SAMP_PRD))) + { + err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL) && + ((schL2MeasInfo->nmbActvUeQciUl.numQci > LRG_MAX_QCI_PER_REQ) || + (schL2MeasInfo->nmbActvUeQciUl.sampPrd == 0)|| + ((schL2MeasInfo->timePrd !=0) && + (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciUl.sampPrd)) || + (schL2MeasInfo->nmbActvUeQciUl.sampPrd > LRG_MAX_SAMP_PRD))) + { + err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + if((schL2MeasInfo->timePrd !=0) && + (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)) + { + RGSCH_ARRAY_BOUND_CHECK(cellCb->instIdx, schL2MeasInfo->avgPrbQciDl.qci, \ + (schL2MeasInfo->avgPrbQciDl.numQci)); + ret = rgSCHUtlValidateQci(cellCb, schL2MeasInfo->avgPrbQciDl.numQci, + schL2MeasInfo->avgPrbQciDl.qci); + if(ret != ROK) + { + err->errType = RGSCHERR_SCH_INVALID_QCI_VAL; + err->errCause = RGSCHERR_SCH_L2MEAS; + RETVALUE(RFAILED); + } + } + RETVALUE(ROK); +}/* rgSCHUtlValidateMeasReq */ +#endif /* LTE_L2_MEAS */ +/******* : END *****/ +#ifdef RGR_SI_SCH +/** + * @brief API for sending SI configuration confirm from Scheduler to RRM + * + * @details + * + * Function: rgSCHUtlRgrSiCfgCfm + * + * This API is invoked to send SI configuration confirm from Scheduler + * to RRM. + * This API fills in Pst structure and SAP Ids and invokes + * config confirm API towards RRM. + * + * @param[in] RgrCfgTransId transId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrSiCfgCfm +( +Inst instId, +SpId spId, +RgrCfgTransId transId, +U8 status +) +#else +PUBLIC S16 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, status) +Inst instId; +SpId spId; +RgrCfgTransId transId; +U8 status; +#endif +{ + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + + TRC2(rgSCHUtlRgrSiCfgCfm) + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + if(RgUiRgrSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst, + rgSchCb[instId].rgrSap[spId].sapCfg.suId, + transId, status) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrSiCfgCfm: " + "RgUiRgrSiCfgCfm Failed "); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHUtlRgrSiCfgCfm */ + + +/** + * @brief API for sending Warning SI configuration confirm from + * Scheduler to RRM + * + * @details + * + * + * This API is invoked to send Warning SI configuration confirm + * from Scheduler to RRM. + * This API fills in Pst structure and SAP Ids and invokes + * config confirm API towards RRM. + * + * @param[in] RgrCfgTransId transId + * @param[in] U8 status + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrWarningSiCfgCfm +( +Inst instId, +SpId spId, +U8 siId, +RgrCfgTransId transId, +U8 status +) +#else +PUBLIC S16 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, siId, transId, status) +Inst instId; +SpId spId; +U8 siId; +RgrCfgTransId transId; +U8 status; +#endif +{ + U8 prntTrans[RGR_CFG_TRANSID_SIZE+1]; + + TRC2(rgSCHUtlRgrWarningSiCfgCfm) + + cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE); + prntTrans[RGR_CFG_TRANSID_SIZE] = '\0'; + + + if(RgUiRgrWarningSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst, + rgSchCb[instId].rgrSap[spId].sapCfg.suId, + transId, siId, status) != ROK) + { + RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"rgSCHUtlRgrSiCfgCfm: " + "RgUiRgrSiCfgCfm Failed "); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* rgSCHUtlRgrWarningSiCfgCfm */ + +/*********************************************************** + * + * Func : rgSCHUtlPutSiInfo + * + * Desc : Utility Function to deallocate SI information + * + * + * RFAILED + * + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC Void rgSCHUtlPutSiInfo +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHUtlPutSiInfo(cell) +RgSchCellCb *cell; +#endif +{ + U8 idx = 0; + U32 sizeOfSiInfo = 0; + TRC2(rgSCHUtlPutSiInfo) + /*Free the buffers in crntSiInfo*/ + RGSCH_FREE_MSG(cell->siCb.crntSiInfo.mib) + RGSCH_FREE_MSG(cell->siCb.crntSiInfo.sib1Info.sib1) + + sizeOfSiInfo = sizeof(cell->siCb.crntSiInfo.siInfo)/sizeof(cell->siCb.crntSiInfo.siInfo[0]); + + for(idx=0; idx < sizeOfSiInfo; idx++) + { + RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si) + } + + /*Free the buffers in newSiInfo */ + RGSCH_FREE_MSG(cell->siCb.newSiInfo.mib) + RGSCH_FREE_MSG(cell->siCb.newSiInfo.sib1Info.sib1) + + sizeOfSiInfo = sizeof(cell->siCb.newSiInfo.siInfo)/sizeof(cell->siCb.newSiInfo.siInfo[0]); + + for(idx=0; idx < sizeOfSiInfo; idx++) + { + RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[idx].si) + } + + RETVOID; +} +#endif /*RGR_SI_SCH */ + + + +/*********************************************************** + * + * Func : rgSCHUtlGetDrxSchdUesInDl + * + * Desc : Utility Function to fill the get the list of + * scheduled UEs. On these UE's, drx-inactivity + * timer will be started/restarted. + * + * Ret : ROK + * RFAILED + * + * Notes: + * + * File : rg_utl.c + * + **********************************************************/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlGetDrxSchdUesInDl +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb, +RgSchDlHqProcCb *dlHq, +RgInfUeAlloc *allocInfo, +CmLListCp *dlDrxInactvTmrLst, +CmLListCp *dlInActvLst, +CmLListCp *ulInActvLst +) +#else +PUBLIC S16 rgSCHUtlGetDrxSchdUesInDl(cellCb, ueCb, dlHq, allocInfo, dlDrxInactvTmrLst, dlInActvLst, ulInActvLst) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +RgSchDlHqProcCb *dlHq; +RgInfUeAlloc *allocInfo; +CmLListCp *dlDrxInactvTmrLst; +CmLListCp *dlInActvLst; +CmLListCp *ulInActvLst; +#endif +{ + Bool isNewTx = FALSE; + U8 idx; + RgSchDrxDlHqProcCb *drxHq; + RgSchDRXCellCb *drxCell = cellCb->drxCb; + RgSchDrxUeCb *drxUe; +#ifdef DEBUGP + Inst inst = cellCb->instIdx; +#endif + U8 cellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)]; + U32 dlInactvMask; + U32 ulInactvMask; + + for(idx = 0; idx < allocInfo->nmbOfTBs; idx++) + { + if(allocInfo->tbInfo[idx].isReTx == FALSE) + { + isNewTx = TRUE; + /* Removing break here, since in 2 TB case if 2nd TB is proceeding with + retx then drxretx timer should be stopped.*/ + } + else + { + /*Stop the DRX retransmission timer as UE scheduled for retx. Here + * we stop the timer and inactivate the UE for both UL and DL. + * This may result in loss of one subframe for UL but this trade + * off is taken to avoid the overhead of maintaining a list of UEs + * to be inactivated in the next subframe.*/ + drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq); + drxUe = RG_SCH_DRX_GET_UE(ueCb); + if(drxHq->reTxIndx != DRX_INVALID) + { + /* This condition should never occur */ + if(drxHq->reTxIndx >= RG_SCH_MAX_DRXQ_SIZE) + { + RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"[%d]UE:DRXUE RETX IDX[%d]" + "is out of bound,dlInactvMask %d,procId %d\n", ueCb->ueId, + drxHq->reTxIndx,ueCb->dl.dlInactvMask, dlHq->procId)); + } + + drxUe->drxDlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId); + drxUe->drxUlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId); + + dlInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId; + ulInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId; + + for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++) + { + dlInactvMask &= drxUe->drxDlInactvMaskPerCell[cellIdx]; + ulInactvMask &= drxUe->drxUlInactvMaskPerCell[cellIdx]; + } + + drxUe->drxDlInactvMask |= dlInactvMask; + drxUe->drxUlInactvMask |= ulInactvMask; + + /* if no other condition is keeping ue active, + * inactivate the Ue + */ + if(!RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe)) + { + /* BUG 2 : HARQ_RTT, changed for consistency */ + ueCb->dl.dlInactvMask |= (RG_DRX_INACTIVE); + + /* Add to DL inactive list */ + cmLListAdd2Tail(dlInActvLst,&(ueCb->dlDrxInactvLnk)); + ueCb->dlDrxInactvLnk.node = (PTR)ueCb; + } + + if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe)) + { + /*BUG 2: HARQ_RTT changed for consistency */ + ueCb->ul.ulInactvMask |= (RG_DRX_INACTIVE); + + cmLListAdd2Tail(ulInActvLst,&(ueCb->ulDrxInactvLnk)); + ueCb->ulDrxInactvLnk.node = (PTR)ueCb; + } + + /* Deleting entry from HARQ RTT queue for the same HARQ proc, + * if exist. This is the special case which can happen iF UL + * scheduling is done later. */ + if(drxHq->rttIndx != DRX_INVALID) + { + cmLListDelFrm (&(cellCb->drxCb->drxQ[drxHq->rttIndx].harqRTTQ), + &(drxHq->harqRTTEnt)); + + drxHq->rttIndx = DRX_INVALID; + } + + cmLListDelFrm (&(drxCell->drxQ[drxHq->reTxIndx].harqRetxQ), + &(drxHq->harqRetxEnt)); + drxHq->reTxIndx = DRX_INVALID; + } + } + } + + if(isNewTx == TRUE) + { + if(ueCb->drxCb->raRcvd == TRUE) + { + ueCb->drxCb->raRcvd = FALSE; + + /* mark the ra bit */ + ueCb->drxCb->drxUlInactvMask |= RG_SCH_DRX_RA_BITMASK; + ueCb->drxCb->drxDlInactvMask |= RG_SCH_DRX_RA_BITMASK; + + }/*if(ra->rcvd) == TRUE */ + + if(ueCb->dlDrxInactvTmrLnk.node == NULLP) + { + cmLListAdd2Tail(dlDrxInactvTmrLst,&(ueCb->dlDrxInactvTmrLnk)); + ueCb->dlDrxInactvTmrLnk.node = (PTR)ueCb; + } + }/*if(isNewTx == TRUE) */ + + RETVALUE(ROK); +}/* rgSCHUtlGetSchdUes*/ + +/* ccpu00117452 - MOD - Changed macro name from + RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */ +#ifdef RGR_CQI_REPT +/** + * @brief This function fills StaInd struct + * + * @details + * + * Function: rgSCHUtlFillSndStaInd + * Purpose: Fills StaInd struct and sends the + * StaInd to RRM + * + * @param[in] RgSchCellCb *cell pointer to Cell Control block + * @param[in] RgSchUeCb *ue pointer to Ue Control block + * @param[in] RgrStaIndInfo *staInfo Sta Ind struct to be filled + * @param[in] U8 numCqiRept NUmber of reports to be filled + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFillSndStaInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrStaIndInfo *staInfo, +U8 numCqiRept +) +#else +PUBLIC S16 rgSCHUtlFillSndStaInd(cell, ue, staInfo, numCqiRept) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrStaIndInfo *staInfo; +U8 numCqiRept; +#endif +{ + U8 idxStart; + + /* Fill StaInd for sending collated Latest N CQI rpeorts */ + /* Find index in the array from where Latest N + reports needs to be fetched. Use this value to index in the array + and copy the reports into staInfo */ + + /* Fill the Cell Id of PCC of the UE */ + staInfo->cellId = ue->cell->cellId; + staInfo->crnti = ue->ueId; + + idxStart = ue->schCqiInfo.cqiCount - numCqiRept; + + cmMemcpy ((U8*)&(staInfo->ueCqiInfo.cqiRept), + (U8*)&(ue->schCqiInfo.cqiRept[idxStart]), + numCqiRept * sizeof(RgrUeCqiRept)); + + staInfo->ueCqiInfo.numCqiRept = numCqiRept; + + ue->schCqiInfo.cqiCount = 0; + + /* Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM */ + if(rgSCHUtlRgrStaInd(cell, staInfo) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Could not send " + "CQI reports for RNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + +}/* End of rgSCHUtlFillSndStaInd */ + + + +/** + * @brief API for sending STA indication from Scheduler to RRM. + * + * @details + * + * Function: rgSCHUtlRgrStaInd + * + * This API is invoked to send STA indication from Scheduler instance to RRM. + * This API fills in Pst structure and RgrStaIndInfo + * and calls the Sta primitive API towards RRM. + * + * @param[in] cell RgSchCellCb + * @param[in] RgrStsIndInfo *rgrSta + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrStaInd +( +RgSchCellCb *cell, +RgrStaIndInfo *rgrSta +) +#else +PUBLIC S16 rgSCHUtlRgrStaInd(cell, rgrSta) +RgSchCellCb *cell; +RgrStaIndInfo *rgrSta; +#endif +{ + S16 ret = ROK; + RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ + + TRC2(rgSCHUtlRgrStaInd) + + + rgrSap = cell->rgrSap; + if (rgrSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHUtlRgrStaInd() Upper SAP not bound (%d) ", + rgrSap->sapSta.sapState); + RETVALUE(RFAILED); + } + RgUiRgrStaInd(&(cell->rgrSap->sapCfg.sapPst), + cell->rgrSap->sapCfg.suId, rgrSta); + RETVALUE(ret); +} /* rgSCHUtlRgrStaInd*/ +#endif /* End of RGR_CQI_REPT */ + +/* Fix : syed HO UE does not have a valid ue->rntiLnk */ +/** + * @brief Indicates MAC to release any rnti context it has. + * + * @details + * Function : rgSCHUtlIndRntiRls2Mac + * This function indicates MAC for this rnti release. + * In case of ueId change it will indicate MAC + * about the new rnti to be updated. + * It will post a release RNTI indication to MAC. + * + * + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteRnti rnti + * @param[in] Bool ueIdChng + * @param[in] CmLteRnti newRnti + * @return Void + * -# ROK + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlIndRntiRls2Mac +( +RgSchCellCb *cell, +CmLteRnti rnti, +Bool ueIdChng, +CmLteRnti newRnti +) +#else +PUBLIC Void rgSCHUtlIndRntiRls2Mac(cell, rnti, ueIdChng, newRnti) +RgSchCellCb *cell; +CmLteRnti rnti; +Bool ueIdChng; +CmLteRnti newRnti; +#endif +{ + Pst pst; + Inst inst = cell->instIdx; + RgInfRlsRnti rntiInfo; + + TRC2(rgSCHUtlIndRntiRls2Mac) + + /* Copy the info to rntiInfo */ + rntiInfo.cellId = cell->cellId; + rntiInfo.rnti = rnti; + /* Fix : syed ueId change as part of reestablishment. + * Now SCH to trigger this. CRG ueRecfg for ueId change + * is dummy */ + rntiInfo.ueIdChng = ueIdChng; + rntiInfo.newRnti = newRnti; +#ifdef LTE_ADV + rntiInfo.isUeSCellDel = FALSE; +#endif + /* Invoke MAC to release the rnti */ + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst); + RgSchMacRlsRnti(&pst, &rntiInfo); + RETVOID; +} + +/* LTE_ADV_FLAG_REMOVED_START */ +/** + * @brief API for sending LOAD INF indication from Scheduler to RRM. + * @details + * + * Function: rgSCHUtlRgrLoadInfInd + * + * This API is invoked to send LOAD INF indication from Scheduler instance to RRM. + * This API fills in Pst structure and RgrLoadInfIndInfo + * and calls the Sta primitive API towards RRM. + * + * @param[in] cell RgSchCellCb + * @param[in] RgrLoadInfIndInfo *rgrLoadInf + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrLoadInfInd +( + RgSchCellCb *cell, + RgrLoadInfIndInfo *rgrLoadInf + ) +#else +PUBLIC S16 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf) + RgSchCellCb *cell; + RgrLoadInfIndInfo *rgrLoadInf; +#endif +{ + S16 ret = ROK; + RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ + + TRC2(rgSCHUtlRgrLoadInfInd) + + + rgrSap = cell->rgrSap; + if (rgrSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHUtlRgrLoadInfInd() Upper SAP not bound (%d) ", + rgrSap->sapSta.sapState); + RETVALUE(RFAILED); + } + RgUiRgrLoadInfInd(&(cell->rgrSap->sapCfg.sapPst), + cell->rgrSap->sapCfg.suId, rgrLoadInf); + RETVALUE(ret); +} /* rgSCHUtlRgrLoadInfInd*/ +/* LTE_ADV_FLAG_REMOVED_END */ + +/* MS_FIX : syed SCH to act as MASTER in maintaining + * rnti related context. Trigger to rnti del/Chng at SCH + * will result in a Indication to MAC to release its + * RNTI context. MAC inturn indicates the context cleared + * indication to SCH, upon which SCH would set this +/** + * @brief API for sending STA indication from Scheduler to RRM. + * + * @details + * + * Function: rgSCHUtlRlsRnti + * + * This API is invoked to indicate MAC to release rnti + * + * @param[in] RgSchCellCb *cellCb + * @param[in] RgSchRntiLnk *rntiLnk, + * @param[in] Bool ueIdChngd, + * @param[in] CmLteRnti newRnti + * @return Void + **/ + +#ifdef ANSI +PUBLIC Void rgSCHUtlRlsRnti +( +RgSchCellCb *cell, +RgSchRntiLnk *rntiLnk, +Bool ueIdChngd, +CmLteRnti newRnti +) +#else +PUBLIC Void rgSCHUtlRlsRnti(cell, rntiLnk, ueIdChngd, newRnti) +RgSchCellCb *cell; +RgSchRntiLnk *rntiLnk; +Bool ueIdChngd; +CmLteRnti newRnti; +#endif +{ + + TRC2(rgSCHUtlRlsRnti) + U8 isLegacy = 0; +#ifdef EMTC_ENABLE + if(cell->emtcEnable) + { + rgSCHEmtcUtlRlsRnti(cell, rntiLnk, &isLegacy); + } +#endif + if(!isLegacy) + { + /*Add to Guard Pool*/ + cmLListAdd2Tail(&cell->rntiDb.rntiGuardPool, &rntiLnk->rntiGrdPoolLnk); + rntiLnk->rntiGrdPoolLnk.node = (PTR)rntiLnk; + } + /* Fix: syed Explicitly Inidcate MAC to release RNTI */ + rgSCHUtlIndRntiRls2Mac(cell, rntiLnk->rnti, ueIdChngd, newRnti); + + RETVOID; +} + + +/** + * @brief This function fills StaInd struct + * + * @details + * + * Function: rgSCHUtlFillSndUeStaInd + * Purpose: Fills StaInd struct and sends the + * StaInd to RRM + * + * @param[in] RgSchCellCb *cell pointer to Cell Control block + * @param[in] RgSchUeCb *ue pointer to Ue Control block + * @param[in] U8 numCqiRept NUmber of reports to be filled + * @return Void + * + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlFillSndUeStaInd +( +RgSchCellCb *cell, +RgSchUeCb *ue, +RgrUeStaIndInfo *ueStaInfo +) +#else +PUBLIC S16 rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInfo) +RgSchCellCb *cell; +RgSchUeCb *ue; +RgrUeStaIndInfo *ueStaInfo; +#endif +{ + + ueStaInfo->cellId = cell->cellId; + ueStaInfo->crnti = ue->ueId; + + /* Call utility function (rgSCHUtlRgrUeStaInd) to send rpts to RRM */ + if(rgSCHUtlRgrUeStaInd(cell, ueStaInfo) != ROK) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Could not send " + "UE Sta reports CRNTI:%d",ue->ueId); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + +}/* End of rgSCHUtlFillSndStaInd */ + + + +/** + * @brief API for sending STA indication from Scheduler to RRM. + * + * @details + * + * Function: rgSCHUtlRgrStaInd + * + * This API is invoked to send STA indication from Scheduler instance to RRM. + * This API fills in Pst structure and RgrStaIndInfo + * and calls the Sta primitive API towards RRM. + * + * @param[in] cell RgSchCellCb + * @param[in] RgrStsIndInfo *rgrSta + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlRgrUeStaInd +( +RgSchCellCb *cell, +RgrUeStaIndInfo *rgrUeSta +) +#else +PUBLIC S16 rgSCHUtlRgrUeStaInd(cell, rgrUeSta) +RgSchCellCb *cell; +RgrUeStaIndInfo *rgrUeSta; +#endif +{ + S16 ret = ROK; + RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */ + + TRC2(rgSCHUtlRgrStaInd) + + + rgrSap = cell->rgrSap; + if (rgrSap->sapSta.sapState != LRG_BND) + { + RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, + "rgSCHUtlRgrUeStaInd() Upper SAP not bound (%d) ", + rgrSap->sapSta.sapState); + RETVALUE(RFAILED); + } + RgUiRgrUeStaInd(&(cell->rgrSap->sapCfg.sapPst), + cell->rgrSap->sapCfg.suId, rgrUeSta); + RETVALUE(ret); +} /* rgSCHUtlRgrStaInd*/ + +/* RRM_RBC_X */ +/** + * @brief function to report DL and UL PRB usage to RRM. + * + * + * Function: rgSCHUtlUpdAvgPrbUsage + * This function sends the PRB usage report to + * RRM with the interval configured by RRM. + * + * @param[in] cell *RgSchCellCb + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlUpdAvgPrbUsage +( +RgSchCellCb *cell +) +#else +PUBLIC S16 rgSCHUtlUpdAvgPrbUsage(cell) +RgSchCellCb *cell; +#endif +{ + CmLteTimingInfo frm; + RgmPrbRprtInd *prbRprtInd; + S16 ret = ROK; + U32 idx; +#ifdef DBG_MAC_RRM_PRB_PRINT + static U32 count = 0; + const U32 reprotForEvery20Sec = 20000/cell->prbUsage.rprtPeriod; + + count++; +#endif + + TRC2(rgSCHUtlUpdAvgPrbUsage); + + frm = cell->crntTime; + RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA); + + U16 numDlSf; + U16 numUlSf; +#ifdef LTE_TDD + + if(cell->prbUsage.rprtPeriod >= RGSCH_NUM_SUB_FRAMES) + { + /* Get the total number of DL and UL subframes within the reporting period*/ + numDlSf = (cell->prbUsage.rprtPeriod * + rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]) + / RGSCH_NUM_SUB_FRAMES; + numUlSf = (cell->prbUsage.rprtPeriod * + rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1]) + / RGSCH_NUM_SUB_FRAMES; + } + else + { + /* Get the total number of DL and UL subframes < 10 ms interval */ + numDlSf = rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][frm.subframe]; + numUlSf = rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][frm.subframe]; + } +#else + numDlSf = cell->prbUsage.rprtPeriod; + numUlSf = cell->prbUsage.rprtPeriod; +#endif + + if(SGetSBuf(cell->rgmSap->sapCfg.sapPst.region, + cell->rgmSap->sapCfg.sapPst.pool, (Data**)&prbRprtInd, + sizeof(RgmPrbRprtInd)) != ROK) + { + RETVALUE(RFAILED); + } + + cmMemset((U8 *) &prbRprtInd->stQciPrbRpts[0], + 0, + (RGM_MAX_QCI_REPORTS * sizeof(RgmPrbRptPerQci))); + + prbRprtInd->bCellId = cell->cellId; + + if(numDlSf > 0) + { + prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_DL; + for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ ) + { + prbRprtInd->stQciPrbRpts[idx].bAvgPrbDlUsage = + RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed*100), + (numDlSf * cell->bwCfg.dlTotalBw)); + prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci; + cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed = 0; + } + } + + if(numUlSf > 0) + { + prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_UL; + for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ ) + { + prbRprtInd->stQciPrbRpts[idx].bAvgPrbUlUsage = + RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed*100), + (numUlSf * cell->ulAvailBw)); + prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci; + cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed = 0; + } + } + +#ifdef DBG_MAC_RRM_PRB_PRINT + if((count % reprotForEvery20Sec) == 0 ) + { + printf("\n===================================================================="); + printf("\nMAC: QCI-1[DL:UL] | QCI-2[DL:UL] | QCI-3[DL:UL] | QCI-4[DL:UL] \n"); + printf("======================================================================\n"); + printf(" [%d: %d]\t | [%d: %d]\t | [%d: %d]\t| [%d: %d]\t\n", + prbRprtInd->stQciPrbRpts[0].bAvgPrbDlUsage, + prbRprtInd->stQciPrbRpts[0].bAvgPrbUlUsage, + prbRprtInd->stQciPrbRpts[1].bAvgPrbDlUsage, + prbRprtInd->stQciPrbRpts[1].bAvgPrbUlUsage, + prbRprtInd->stQciPrbRpts[2].bAvgPrbDlUsage, + prbRprtInd->stQciPrbRpts[2].bAvgPrbUlUsage, + prbRprtInd->stQciPrbRpts[3].bAvgPrbDlUsage, + prbRprtInd->stQciPrbRpts[3].bAvgPrbUlUsage); + } +#endif + RgUiRgmSendPrbRprtInd(&(cell->rgmSap->sapCfg.sapPst), + cell->rgmSap->sapCfg.suId, prbRprtInd); + + + RETVALUE(ret); +} +/* RRM_RBC_Y */ + +/** + * @brief This function resends the Ta in case of + * max retx failure or DTX for the Ta transmitted + * + * @details + * + * Function: rgSCHUtlReTxTa + * Purpose: + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlReTxTa +( +RgSchCellCb *cellCb, +RgSchUeCb *ueCb +) +#else +PUBLIC Void rgSCHUtlReTxTa(cellCb, ueCb) +RgSchCellCb *cellCb; +RgSchUeCb *ueCb; +#endif +{ + TRC2(rgSCHUtlReTxTa) + + /* If TA Timer is running. Stop it */ + if (ueCb->taTmr.tmrEvnt != TMR_NONE) + { + rgSCHTmrStopTmr(cellCb, ueCb->taTmr.tmrEvnt, ueCb); + } + /*[ccpu00121813]-ADD-If maxretx is reached then + * use outstanding TA val for scheduling again */ + if(ueCb->dl.taCb.outStndngTa == TRUE) + { + ueCb->dl.taCb.ta = ueCb->dl.taCb.outStndngTaval; + ueCb->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD; + ueCb->dl.taCb.outStndngTa = FALSE; + + } + /* Fix : syed TA state updation missing */ + ueCb->dl.taCb.state = RGSCH_TA_TOBE_SCHEDULED; + rgSCHUtlDlTARpt(cellCb, ueCb); + + RETVOID; +} + +/* Added function for dropping Paging Message*/ +/** + * @brief Handler for BO Updt received for BCCH or PCCH. + * + * @details + * + * Function : rgSCHChkBoUpdate + * + * This function shall check for BO received falls within the scheduling window or not + * + * + * @param[in] RgSchCellCb *cell + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PRIVATE S16 rgSCHChkBoUpdate +( +RgSchCellCb *cell, +RgInfCmnBoRpt *boUpdt +) +#else +PRIVATE S16 rgSCHChkBoUpdate (cell, boUpdt) +RgSchCellCb *cell; +RgInfCmnBoRpt *boUpdt; +#endif +{ + + U32 crntTimeInSubFrms = 0; + U32 boUpdTimeInSubFrms = 0; + U32 distance = 0; + TRC2(rgSCHChkBoUpdate); + + crntTimeInSubFrms = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + cell->crntTime.subframe + + RG_SCH_CMN_DL_DELTA + 2; /* As bo received will scheduled in next TTI + so incrementing with +1 more */ + boUpdTimeInSubFrms = (boUpdt->u.timeToTx.sfn * RGSCH_NUM_SUB_FRAMES_5G)+ boUpdt->u.timeToTx.subframe; + + + distance = boUpdTimeInSubFrms > crntTimeInSubFrms ? \ + boUpdTimeInSubFrms - crntTimeInSubFrms : \ + (RGSCH_MAX_SUBFRM_5G - crntTimeInSubFrms + boUpdTimeInSubFrms); + + if (distance > RGSCH_PCCHBCCH_WIN) + { + RETVALUE(RFAILED); + } + RETVALUE(ROK); + +}/*rgSCHChkBoUpdate*/ + + +#ifdef LTE_TDD +/** + * @brief Utility function to calculate the UL reTxIdx in TDD cfg0 + * + * @details + * + * Function : rgSchUtlCfg0ReTxIdx + * + * Update the reTxIdx according to the rules mentioned + * in 3GPP TS 36.213 section 8 for TDD Cfg0 + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteTimingInfo phichTime + * @param[in] U8 hqFdbkIdx + * @return U8 + **/ +#ifdef ANSI +PUBLIC U8 rgSchUtlCfg0ReTxIdx +( +RgSchCellCb *cell, +CmLteTimingInfo phichTime, +U8 hqFdbkIdx +) +#else +PUBLIC U8 rgSchUtlCfg0ReTxIdx (cell, phichTime, hqFdbkIdx) +RgSchCellCb *cell; +CmLteTimingInfo phichTime; +U8 hqFdbkIdx; +#endif +{ + U8 reTxIdx = RGSCH_INVALID_INFO; + U8 iPhich = 0; + RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell); + RgSchUlSf *ulSf; + U8 ulSF; /* UL SF in the TDD frame */ + + TRC2(rgSchUtlCfg0ReTxIdx); + + ulSf = &cellUl->ulSfArr[hqFdbkIdx]; + ulSF = ulSf->ulSfIdx; + + /* Check for the UL SF 4 or 9 */ + if(ulSF == 9 || ulSF == 4) + { + iPhich = 1; + } + if(phichTime.subframe == 0 || phichTime.subframe == 5) + { + if(iPhich == 0) + { + /* Retx will happen according to the Pusch k table */ + reTxIdx = cellUl->schdIdx; + } + if(iPhich == 1) + { + /* Retx will happen at n+7 */ + RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7); + /* Fetch the corresponding UL subframe Idx in UL sf array */ + reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell); + } + } + else if(phichTime.subframe == 1 || phichTime.subframe == 6) + { + /* Retx will happen at n+7 */ + RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7); + /* Fetch the corresponding UL subframe Idx in UL sf array */ + reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell); + } + RETVALUE(reTxIdx); +} +#endif + +/** + * @brief Utility function to calculate total num of PRBs required to + * satisfy DL BO for TM1/TM2/TM6/TM7 + * + * @details + * + * Function : rgSchUtlDlCalc1CwPrb + * + * Calculate PRBs required for UE to satisfy BO in DL + * + * Note : Total calculated PRBs will be assigned to *prbReqrd + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *prbReqrd + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSchUtlDlCalc1CwPrb +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 bo, +U32 *prbReqrd +) +#else +PUBLIC Void rgSchUtlDlCalc1CwPrb(cell, ue, bo, prbReqrd) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 bo; +U32 *prbReqrd; +#endif +{ + RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); + U32 eff; + U32 noRes; + U8 iTbs; + U8 cfi = dlCell->currCfi; + + TRC2(rgSchUtlDlCalc1CwPrb); + + iTbs = dlUe->mimoInfo.cwInfo[0].iTbs[0]; + eff = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs]; + + /* Optimization to convert totalBo (which is in-terms of bytes) to bits + * i.e, << 3 and multiply with 1024 i.e, << 10 */ + noRes = ((U64)((bo << 3) << 10)) / (eff); + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); + + RETVOID; +} /* rgSchUtlDlCalc1CwPrb*/ + +/** + * @brief Utility function to calculate total num of PRBs required to + * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO) + * for TM3/TM4 + * + * @details + * + * Function : rgSchUtlDlCalc2CwPrb + * + * Calculate PRBs required for UE to satisfy BO in DL + * + * Note : Total calculated PRBs will be assigned to *prbReqrd + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *prbReqrd + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSchUtlDlCalc2CwPrb +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 bo, +U32 *prbReqrd +) +#else +PUBLIC Void rgSchUtlDlCalc2CwPrb(cell, ue, bo, prbReqrd) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 bo; +U32 *prbReqrd; +#endif +{ + RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell); + RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell); + U32 eff1, eff2; + U32 noRes; + U8 noLyr1, noLyr2; + U8 iTbs1, iTbs2; + U8 cfi = dlCell->currCfi; + + TRC2(rgSchUtlDlCalc2CwPrb); + + if ((dlUe->mimoInfo.forceTD) ||/* Transmit Diversity (TD) */ + (dlUe->mimoInfo.ri < 2))/* 1 layer precoding */ + { + iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[0]; + eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs1]; + + /* Optimization to convert totalBo (which is in-terms of bytes) to bits + * i.e, << 3 and multiply with 1024 i.e, << 10 */ + noRes = ((U64)((bo << 3) << 10)) / (eff1); + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); + } + else + { + noLyr1 = dlUe->mimoInfo.cwInfo[0].noLyr; + noLyr2 = dlUe->mimoInfo.cwInfo[1].noLyr; + iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1]; + iTbs2 = dlUe->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1]; + eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1]; + eff2 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2]; + + /* Optimization to convert totalBo (which is in-terms of bytes) to bits + * i.e, << 3 and multiply with 1024 i.e, << 10 */ + noRes = ((U64)((bo << 3) << 10)) / (eff1 + eff2); + /* Get the number of RBs needed for this transmission */ + /* Number of RBs = No of REs / No of REs per RB */ + *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]); + } + RETVOID; +} /* rgSchUtlDlCalc2CwPrb */ + +/** + * @brief Utility function to calculate total num of PRBs required to + * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO) + * + * @details + * + * Function : rgSchUtlCalcTotalPrbReq + * + * This function calls TM specific routine to calculate PRB + * + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 bo + * @param[out] U32 *prbReqrd + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSchUtlCalcTotalPrbReq +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 bo, +U32 *prbReqrd +) +#else +PUBLIC Void rgSchUtlCalcTotalPrbReq(cell, ue, bo, prbReqrd) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 bo; +U32 *prbReqrd; +#endif +{ + TRC2(rgSchUtlCalcTotalPrbReq); + + /* Call TM specific Prb calculation routine */ + (dlCalcPrbFunc[ue->mimoInfo.txMode - 1])(cell, ue, bo, prbReqrd); + + RETVOID; +} /* rgSchUtlCalcTotalPrbReq */ +#ifdef TFU_UPGRADE +/*********************************************************** + * + * Func : rgSCHUtlFetchPcqiBitSz + * + * + * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity. + * + * Ret : U8 + * ROK - Success + * + * Notes: + * + * File : + * + **********************************************************/ +#ifdef ANSI +PRIVATE U8 rgSCHUtlFetchPcqiBitSz +( + RgSchCellCb *cell, + RgSchUeCb *ueCb, + U8 numTxAnt + ) +#else +PRIVATE U8 rgSCHUtlFetchPcqiBitSz (cell, ueCb, numTxAnt) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +U8 numTxAnt; +#endif +{ + U8 confRepMode; + U8 pcqiSz; + U8 ri; + RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cell); + + TRC3(rgSCHUtlFetchPcqiBitSz); + confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum; + if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) && + (ueCb->mimoInfo.txMode != RGR_UE_TM_4)) + { + ri =1; + } + else + { + ri = cqiCb->perRiVal; + } + switch(confRepMode) + { + case RGR_PRD_CQI_MOD10: + { + pcqiSz = 4; + } + break; + + case RGR_PRD_CQI_MOD11: + { + if(numTxAnt == 2) + { + if (ri ==1) + { + pcqiSz = 6; + } + else + { + pcqiSz = 8; + } + } + else if(numTxAnt == 4) + { + if (ri ==1) + { + pcqiSz = 8; + } + else + { + pcqiSz = 11; + } + } + else + { + /* This is number of antenna case 1. + * This is not applicable for Mode 1-1. + * So setting it to invalid value */ + pcqiSz = 0; + } + } + break; + + case RGR_PRD_CQI_MOD20: + { + if(cqiCb->isWb) + { + pcqiSz = 4; + } + else + { + pcqiSz = 4 + cqiCb->label; + } + } + break; + + case RGR_PRD_CQI_MOD21: + { + if(cqiCb->isWb) + { + if(numTxAnt == 2) + { + if (ri ==1) + { + pcqiSz = 6; + } + else + { + pcqiSz = 8; + } + } + else if(numTxAnt == 4) + { + if (ri ==1) + { + pcqiSz = 8; + } + else + { + pcqiSz = 11; + } + } + else + { + /* This might be number of antenna case 1. + * For mode 2-1 wideband case only antenna port 2 or 4 is supported. + * So setting invalid value.*/ + pcqiSz = 0; + } + } + else + { + if (ri ==1) + { + pcqiSz = 4 + cqiCb->label; + } + else + { + pcqiSz = 7 + cqiCb->label; + } + } + } + break; + + default: + pcqiSz = 0; + break; + } + + RETVALUE(pcqiSz); +} +#endif +/** + * @brief Utility function to returns the number of subbands based on the + * requested bytes. + * + * @details + * + * Function : rgSchUtlGetNumSbs + * + * Calculate the number of PRBs + * Update the subbandRequired based on the nPrbs and subband size + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @param[in] U32 *numSbs + * @return U8 + **/ +#ifdef ANSI +PUBLIC U8 rgSchUtlGetNumSbs +( +RgSchCellCb *cell, +RgSchUeCb *ue, +U32 *numSbs +) +#else +PUBLIC U8 rgSchUtlGetNumSbs (cell, ue, numSbs) +RgSchCellCb *cell; +RgSchUeCb *ue; +U32 *numSbs; +#endif +{ + U32 nPrb; + //Currently hardcoding MAX prb for each UE + nPrb = ue->ue5gtfCb.maxPrb; + (*numSbs) = RGSCH_CEIL(nPrb, MAX_5GTF_VRBG_SIZE); + RETVALUE(ROK); +} + +/** + * @brief Utility function to insert the UE node into UE Lst based on the + * number of subbands allocated for the UE for the current TTI. + * + * @details + * + * Function : rgSchUtlSortInsUeLst + * + * If subbandRequired < Min, then insert at head + * Else If subbandRequired > Max, then insert at tail + * Else, traverse the list and place the node at the appropriate place + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ue + * @return U8 + **/ +#ifdef ANSI +PUBLIC U8 rgSchUtlSortInsUeLst +( +RgSchCellCb *cell, +CmLListCp *ueLst, +CmLList *node, +U8 vrbgRequired +) +#else +PUBLIC U8 rgSchUtlSortInsUeLst (cell, ueLst, node, vrbgRequired) +RgSchCellCb *cell; +CmLListCp *ueLst; +CmLList *node; +U8 vrbgRequired; +#endif +{ + CmLList *ueInLst; + CmLList *firstUeInLst; + CmLList *lastUeInLst; + RgSchUeCb *tempUe; + RgSchCmnUlUe *ueUl; + + //firstUeInLst = cmLListFirst(ueLst); + CM_LLIST_FIRST_NODE(ueLst,firstUeInLst); + if(NULLP == firstUeInLst) + { + /* first node to be added to the list */ + cmLListAdd2Tail(ueLst, node); + } + else + { + /* Sb Required for the UE is less than the first node in the list */ + tempUe = (RgSchUeCb *)(firstUeInLst->node); + ueUl = RG_SCH_CMN_GET_UL_UE(tempUe, cell); + + if(vrbgRequired <= ueUl->vrbgRequired) + { + cmLListInsCrnt(ueLst, (node)); + } + else + { + /* Sb Required for this UE is higher than the UEs in the list */ + lastUeInLst = cmLListLast(ueLst); + tempUe = (RgSchUeCb *)(lastUeInLst->node); + if(vrbgRequired >= ueUl->vrbgRequired) + { + cmLListAdd2Tail(ueLst, (node)); + } + else + { + /* This UE needs to be in the middle. Search and insert the UE */ + ueInLst = cmLListFirst(ueLst); + do + { + tempUe = (RgSchUeCb *)(ueInLst->node); + + if(vrbgRequired <= ueUl->vrbgRequired) + { + cmLListInsCrnt(ueLst, (node)); + break; + } + + ueInLst = cmLListNext(ueLst); + + } while(NULLP != ueInLst && ueInLst != firstUeInLst); + } + } + } + + RETVALUE(ROK); +} + +/** + * @brief Function to Send LCG GBR register to MAC + * + * @details + * + * Function: rgSCHUtlBuildNSendLcgReg + * + * Handler for sending LCG GBR registration + * + * Invoked by: + * SCHD + * + * Processing Steps: + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteRnti crnti + * @param[in] U8 lcgId + * @param[in] Bool isGbr + * @return S16 + * -# ROK + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlBuildNSendLcgReg +( +RgSchCellCb *cell, +CmLteRnti crnti, +U8 lcgId, +Bool isGbr +) +#else +PUBLIC S16 rgSCHUtlBuildNSendLcgReg(cell, crnti, lcgId, isGbr) +RgSchCellCb *cell; +CmLteRnti crnti; +U8 lcgId; +Bool isGbr; +#endif +{ + Pst pst; + RgInfLcgRegReq lcgRegReq; + + TRC3(rgSCHUtlBuildNSendLcgReg); + + cmMemset((U8*)&pst, (U8)0, sizeof(Pst)); + lcgRegReq.isGbr = isGbr; + lcgRegReq.cellId = cell->cellId; + lcgRegReq.crnti = crnti; + lcgRegReq.lcgId = lcgId; + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst); + /* code Coverage portion of the test case */ + RgSchMacLcgReg(&pst, &lcgRegReq); + + RETVALUE(ROK); +} + +#ifdef TFU_UPGRADE +#ifdef LTE_ADV +#ifndef TFU_TDD +/** + * @brief Function to map RGR pucch type to TFU type + * + * @details + * + * Function: rgSchUtlGetFdbkMode + * + * + * Invoked by: + * SCHD + * + * Processing Steps: + * + * @param[in] RgrSchFrmt1b3TypEnum + * @return TfuAckNackMode + * -# ROK + **/ +#ifdef ANSI +PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode +( +RgrSchFrmt1b3TypEnum fdbkType +) +#else +PUBLIC TfuAckNackMode rgSchUtlGetFdbkMode(fdbkType) +RgrSchFrmt1b3TypEnum fdbkType; +#endif +{ + + TfuAckNackMode mode = TFU_UCI_FORMAT_1A_1B; + + TRC2(rgSchUtlGetFdbkMode); + + switch(fdbkType) + { + case RG_SCH_UCI_FORMAT_NON_CA: + case RG_SCH_UCI_FORMAT1A_1B: + { + mode = TFU_UCI_FORMAT_1A_1B; + } + break; + case RG_SCH_UCI_FORMAT1B_CS: + { + mode = TFU_UCI_FORMAT_1B_CS; + } + break; + case RG_SCH_UCI_FORMAT3: + { + mode = TFU_UCI_FORMAT_3; + } + break; + } + RETVALUE(mode); +} +#endif /* TFU_TDD */ +#endif /* LTE_ADV */ +#endif /*TFU_UPGRADE */ + +#ifdef LTE_ADV +/** + * @brief Send Ue SCell delete to SMAC. + * + * @details + * + * Function : rgSCHUtlSndUeSCellDel2Mac + * This function populates the struct RgInfRlsRnti and + * get the pst for SMac and mark field isUeSCellDel to TRUE which + * indicates that it is a Ue SCell delete. + * + * + * + * @param[in] RgSchCellCb *cell + * @param[in] CmLteRnti rnti + * @return Void + * -# ROK + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlSndUeSCellDel2Mac +( +RgSchCellCb *cell, +CmLteRnti rnti +) +#else +PUBLIC Void rgSCHUtlSndUeSCellDel2Mac(cell, rnti) +RgSchCellCb *cell; +CmLteRnti rnti; +#endif +{ + Pst pst; + Inst inst = cell->instIdx; + RgInfRlsRnti rntiInfo; + + TRC2(rgSCHUtlSndUeSCellDel2Mac) + + RGSCHDBGINFONEW(inst,(rgSchPBuf(inst),"RNTI Release IND for UE(%d)\n", rnti)); + /* Copy the info to rntiInfo */ + rntiInfo.cellId = cell->cellId; + rntiInfo.rnti = rnti; + /* Fix : syed ueId change as part of reestablishment. + * Now SCH to trigger this. CRG ueRecfg for ueId change + * is dummy */ + rntiInfo.ueIdChng = FALSE; + rntiInfo.newRnti = rnti; + rntiInfo.isUeSCellDel = TRUE; + /* Invoke MAC to release the rnti */ + rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst); + RgSchMacRlsRnti(&pst, &rntiInfo); + RETVOID; +} + +/** + * @brief Returns max TB supported by a given txMode + * + * @details + * + * Function : rgSCHUtlGetMaxTbSupp + * Max TB supported for TM Modes (1,2,5,6 and 7) is 1 + * and 2 for others + * + * + * @param[in] RgrTxMode txMode + * @return U8 maxTbCount; + * -# ROK + **/ +#ifdef ANSI +PUBLIC U8 rgSCHUtlGetMaxTbSupp +( +RgrTxMode txMode +) +#else +PUBLIC U8 rgSCHUtlGetMaxTbSupp(txMode) +RgrTxMode txMode +#endif +{ + U8 maxTbCount; + + TRC2(rgSCHUtlGetMaxTbSupp); + + /* Primary Cell */ + + switch(txMode) + { + case RGR_UE_TM_1: + case RGR_UE_TM_2: + case RGR_UE_TM_5: + case RGR_UE_TM_6: + case RGR_UE_TM_7: + maxTbCount = 1; + break; + case RGR_UE_TM_3: + case RGR_UE_TM_4: + case RGR_UE_TM_8: + case RGR_UE_TM_9: + maxTbCount = 2; + break; + default: + maxTbCount = 0; + break; + } + + RETVALUE(maxTbCount); +} + +/** + * @brief Send Ue SCell delete to SMAC. + * + * @details + * + * Function : rgSCHTomUtlGetTrigSet + * This function gets the triggerset based on cqiReq + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb ueCb + * @param[in] U8 cqiReq, + * @param[out] U8 *triggerSet + * + * @return Void + * -# ROK + **/ +#ifdef ANSI +PUBLIC Void rgSCHTomUtlGetTrigSet +( + RgSchCellCb *cell, + RgSchUeCb *ueCb, + U8 cqiReq, + U8 *triggerSet + ) +#else +PRIVATE S16 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, triggerSet) + RgSchCellCb *cell; + RgSchUeCb *ueCb; + U8 cqiReq; + U8 *triggerSet; +#endif +{ + RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ueCb); + switch(cqiReq) + { + case RG_SCH_APCQI_SERVING_CC: + { + /* APeriodic CQI request for Current Carrier.*/ + U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)]; + *triggerSet = 1 << (7 - sCellIdx); + break; + } + case RG_SCH_APCQI_1ST_SERVING_CCS_SET: + { + *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet1; + break; + } + case RG_SCH_APCQI_2ND_SERVING_CCS_SET: + { + *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet2; + break; + } + default: + { + /* BUG */ + break; + } + } + RETVOID; +} +#endif +/** + * @brief This function updates the value of UE specific DCI sizes + * + * @details + * + * Function: rgSCHUtlUpdUeDciSize + * Purpose: This function calculates and updates DCI Sizes in bits. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @param[in] RgSchUeCb *ueCb + * @param[in] isCsi2Bit *isCsi2Bit: is 1 bit or 2 bit CSI + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlUpdUeDciSize +( +RgSchCellCb *cell, +RgSchUeCb *ueCb, +Bool isCsi2Bit +) +#else +PUBLIC Void rgSCHUtlUpdUeDciSize(cell, ueCb, isCsi2Bit) +RgSchCellCb *cell; +RgSchUeCb *ueCb; +Bool isCsi2Bit; +#endif +{ + U8 dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0]; + U8 dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0]; + if ((ueCb->accessStratumRls >= RGR_REL_10) && (cell->bwCfg.dlTotalBw >= cell->bwCfg.ulTotalBw)) + { + dci01aCmnSize += 1; /* Resource Allocation Type DCI 0 */ + dci01aDedSize += 1; /* Resource Allocation Type DCI 0 */ + } + if (isCsi2Bit == TRUE) + { + dci01aDedSize += 2; /* 2 bit CSI DCI 0 */ + } + else + { + dci01aDedSize += 1; /* 1 bit CSI DCI 0 */ + } + + /* Common CSI is always 1 bit DCI 0 */ + dci01aCmnSize += 1; /* 1 bit CSI DCI 0 */ + + /* Compare the sizes of DCI 0 with DCI 1A and consider the greater */ + if (dci01aCmnSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) + { + dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; + } + if (dci01aDedSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) + { + dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; + } + + /* Remove the Ambiguous Sizes as mentioned in table Table 5.3.3.1.2-1 Spec 36.212-a80 Sec 5.3.3.1.3 */ + dci01aCmnSize += rgSchDciAmbigSizeTbl[dci01aCmnSize]; + dci01aDedSize += rgSchDciAmbigSizeTbl[dci01aDedSize]; + + ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_0] = dci01aCmnSize; + ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_1A] = dci01aCmnSize; + + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_0] = dci01aDedSize; + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A] = dci01aDedSize; + + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1]; + do { + /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled + * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A + * for scheduling the same serving cell and mapped onto the UE specific search space given by the + * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */ + if (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A]) + { + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += 1; + } + + /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs + * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended + * to format 1 until the payload size of format 1 does not belong to one of the sizes in + * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */ + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1]]; + } while (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A]); + + /* Just copying the value of 2/2A to avoid multiple checks at PDCCH allocations. This values never change.*/ + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2]; + ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A]; + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2]; + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A]; + + /* Spec 36.212-a80 Sec 5.3.3.1.3: except when format 1A assigns downlink resource + * on a secondary cell without an uplink configuration associated with the secondary cell */ + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]]; + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1]; + do { + /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled + * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A + * for scheduling the same serving cell and mapped onto the UE specific search space given by the + * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */ + if (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]) + { + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += 1; + } + + /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs + * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended + * to format 1 until the payload size of format 1 does not belong to one of the sizes in + * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */ + ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1]]; + } while (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]); +#ifdef EMTC_ENABLE + rgSCHEmtcUtlUpdUeDciSize(cell, ueCb); +#endif +} + +/** + * @brief This function initialises the DCI Size table + * + * @details + * + * Function: rgSCHUtlCalcDciSizes + * Purpose: This function calculates and initialises DCI Sizes in bits. + * + * Invoked by: Scheduler + * + * @param[in] RgSchCellCb *cell + * @return Void + * + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlCalcDciSizes +( +RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHUtlCalcDciSizes(cell) +RgSchCellCb *cell; +#endif +{ + U8 dciSize = 0; + U8 dci01aSize = 0; + U32 bits = 0, idx = 0; + + switch(TFU_DCI_FORMAT_0) /* Switch case for the purpose of readability */ + { + case TFU_DCI_FORMAT_0: + { + /* DCI 0: Spec 36.212 Section 5.3.3.1.1 */ + dciSize = 0; + /*-- Calculate resource block assignment bits need to be set + Which is ln(N(N+1)/2) 36.212 5.3.3.1 --*/ + bits = (cell->bwCfg.ulTotalBw * (cell->bwCfg.ulTotalBw + 1) / 2); + while ((bits & 0x8000) == 0) + { + bits <<= 1; + idx++; + } + bits = 16 - idx; + + dciSize = 1 /* DCI 0 bit indicator */ + \ + 1 /* Frequency hoping enable bit field */ + \ + (U8)bits /* For frequency Hopping */ + \ + 5 /* MCS */ + \ + 1 /* NDI */ + \ + 2 /* TPC */ + \ + 3 /* DMRS */ +#ifdef TFU_TDD + + \ + 2 /* UL Index Config 0 or DAI Config 1-6 */ +#endif + ; + + cell->dciSize.baseSize[TFU_DCI_FORMAT_0] = dciSize; + + /* If hoping flag is enabled */ + if (cell->bwCfg.ulTotalBw <= 49) /* Spec 36.213 Table 8.4-1, N UL_hop, if hopping is enabled */ + { + cell->dciSize.dci0HopSize = 1; + } + else + { + cell->dciSize.dci0HopSize = 2; + } + + /* Update common non-CRNTI scrambled DCI 0/1A flag */ + dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0] + 1; /* 1 bit CSI */ + } + case TFU_DCI_FORMAT_1A: + { + /* DCI 1A: Spec 36.212 Section 5.3.3.1.3 */ + dciSize = 0; + idx = 0; + /* Calculate resource block assignment bits need to be set + Which is ln(N(N+1)/2) */ + bits = (cell->bwCfg.dlTotalBw * (cell->bwCfg.dlTotalBw + 1) / 2); + while ((bits & 0x8000) == 0) + { + bits <<= 1; + idx++; + } + bits = 16 - idx; + + dciSize += 1 /* Format 1A */ + \ + 1 /* Local or Distributed */ + \ + (U8)bits /* Resource block Assignment */ + \ + 5 /* MCS */ + +#ifdef TFU_TDD + 4 /* HARQ Proc Id */ + +#else + 3 /* HARQ Proc Id */ + +#endif + 1 /* NDI */ + \ + 2 /* RV */ + \ + 2 /* TPC CMD */ +#ifdef TFU_TDD + + \ + 2 /* DAI */ +#endif + ; + cell->dciSize.baseSize[TFU_DCI_FORMAT_1A] = dciSize; + + /* If the UE is not configured to decode PDCCH with CRC scrambled by the C-RNTI, + * and the number of information bits in format 1A is less than that of format 0, + * zeros shall be appended to format 1A until the payload size equals that of format 0. */ + /* Compare the size with DCI 1A and DCI 0 and consider the greater one */ + if (dci01aSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]) + { + dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A]; + } + /* If the number of information bits in format 1A belongs to one of the sizes in + * Table 5.3.3.1.2-1, one zero bit shall be appended to format 1A. */ + dci01aSize += rgSchDciAmbigSizeTbl[dci01aSize]; + cell->dciSize.size[TFU_DCI_FORMAT_1A] = cell->dciSize.size[TFU_DCI_FORMAT_0] = dci01aSize; + } + case TFU_DCI_FORMAT_1: + { + /* DCI 1: Spec 36.212 Section 5.3.3.1.2 */ + dciSize = 0; + if (cell->bwCfg.dlTotalBw > 10) + { + dciSize = 1; /* Resource Allocation header bit */ + } + + /* Resouce allocation bits Type 0 and Type 1 */ + bits = (cell->bwCfg.dlTotalBw/cell->rbgSize); + if ((cell->bwCfg.dlTotalBw % cell->rbgSize) != 0) + { + bits++; + } + + dciSize += (U8)bits /* Resource Allocation bits */ + \ + 5 /* MCS */ + +#ifdef TFU_TDD + 4 /* HARQ TDD */ + +#else + 3 /* HARQ FDD */ + +#endif + 1 /* NDI */ + \ + 2 /* Redunancy Version */ + \ + 2 /* TPC Cmd */ +#ifdef TFU_TDD + + \ + 2 /* DAI */ +#endif + ; + + + cell->dciSize.baseSize[TFU_DCI_FORMAT_1] = dciSize; + + cell->dciSize.size[TFU_DCI_FORMAT_1] = dciSize; + + do { + /* If the UE is not configured to decode PDCCH with CRC + * scrambled by the C-RNTI and the number of information bits in format 1 + * is equal to that for format 0/1A, one bit of value zero shall be appended + * to format 1. */ + if (dci01aSize == cell->dciSize.size[TFU_DCI_FORMAT_1]) + { + cell->dciSize.size[TFU_DCI_FORMAT_1] += 1; + } + + /* If the number of information bits in format 1 belongs to one of the sizes in + * Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended to format 1 until + * the payload size of format 1 does not belong to one of the sizes in Table 5.3.3.1.2-1 + * and is not equal to that of format 0/1A mapped onto the same search space. */ + cell->dciSize.size[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_1]]; + } while (cell->dciSize.size[TFU_DCI_FORMAT_1] == dci01aSize); + } + case TFU_DCI_FORMAT_2: + { + /* DCI 2: Spec 36.212 Section 5.3.3.1.5 */ + dciSize = 0; + if (cell->bwCfg.dlTotalBw > 10) + { + dciSize = 1; /* Resource Allocation bit */ + } + + dciSize += (U8)bits /* Resource Allocation bits */ + \ + 2 /* TPC */ + +#ifdef TFU_TDD + 2 /* DAI */ + \ + 4 /* HARQ */ + +#else + 3 /* HARQ */ + +#endif + 1 /* CW Swap Flag */ + \ + 5 /* MCS for TB1 */+ \ + 1 /* NDI for TB1 */+ \ + 2 /* RV for TB1 */ + \ + 5 /* MCS for TB2 */+ \ + 1 /* NDI for TB2 */+ \ + 2 /* RV for TB2 */; + if (cell->numTxAntPorts == 2) + { + dciSize += 3; + } + else if (cell->numTxAntPorts == 4) + { + dciSize += 6; + } + cell->dciSize.size[TFU_DCI_FORMAT_2] = dciSize; + cell->dciSize.size[TFU_DCI_FORMAT_2] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2]]; + } + case TFU_DCI_FORMAT_2A: + { + /* DCI 2A: Spec 36.212 Section 5.3.3.1.5A */ + dciSize = 0; + if (cell->bwCfg.dlTotalBw > 10) + { + dciSize = 1; /* Resource Allocation bit */ + } + + dciSize += (U8)bits /* Resource Allocation bits */ + \ + 2 /* TPC */ + +#ifdef TFU_TDD + 2 /* DAI */ + \ + 4 /* HARQ */ + +#else + 3 /* HARQ */ + +#endif + 1 /* CW Swap Flag */ + \ + 5 /* MCS for TB1 */+ \ + 1 /* NDI for TB1 */+ \ + 2 /* RV for TB1 */ + \ + 5 /* MCS for TB2 */+ \ + 1 /* NDI for TB2 */+ \ + 2 /* RV for TB2 */; + if (cell->numTxAntPorts == 4) + { + dciSize += 2; + } + cell->dciSize.size[TFU_DCI_FORMAT_2A] = dciSize; + cell->dciSize.size[TFU_DCI_FORMAT_2A] += \ + rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2A]]; /* Spec 39.212 Table 5.3.3.1.2-1 */ + } + case TFU_DCI_FORMAT_3: + { + /* DCI 3: Spec 36.212 Section 5.3.3.1.6 */ + cell->dciSize.size[TFU_DCI_FORMAT_3] = cell->dciSize.size[TFU_DCI_FORMAT_1A] / 2; + if (cell->dciSize.size[TFU_DCI_FORMAT_3] % 2) + { + cell->dciSize.size[TFU_DCI_FORMAT_3]++; + } + } + case TFU_DCI_FORMAT_3A: + { + /* DCI 3A: Spec 36.212 Section 5.3.3.1.7 */ + cell->dciSize.size[TFU_DCI_FORMAT_3A] = cell->dciSize.size[TFU_DCI_FORMAT_1A]; + } +#ifdef EMTC_ENABLE + case TFU_DCI_FORMAT_6_0A: + { + rgSCHEmtcGetDciFrmt60ASize(cell); + } + case TFU_DCI_FORMAT_6_1A: + { + rgSCHEmtcGetDciFrmt61ASize(cell); + } +#endif + default: + { + /* DCI format not supported */ + break; + } + } +} + +/** + * @brief Handler for the CPU OvrLd related state adjustment. + * + * @details + * + * Function : rgSCHUtlCpuOvrLdAdjItbsCap + * + * Processing Steps: + * - Record dl/ulTpts + * - Adjust maxItbs to acheive target throughputs + * + * @param[in] RgSchCellCb *cell + * @return Void + **/ +#ifdef ANSI +PUBLIC Void rgSCHUtlCpuOvrLdAdjItbsCap +( + RgSchCellCb *cell +) +#else +PUBLIC Void rgSCHUtlCpuOvrLdAdjItbsCap(cell) + RgSchCellCb *cell +#endif +{ + U32 tptDelta; + + TRC3(rgSCHUtlCpuOvrLdAdjItbsCap) + + if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_DL_TPT_UP | + RGR_CPU_OVRLD_DL_TPT_DOWN)) + { + /* Regulate DL Tpt for CPU overload */ + if (cell->measurements.dlTpt > cell->cpuOvrLdCntrl.tgtDlTpt) + { + tptDelta = cell->measurements.dlTpt - cell->cpuOvrLdCntrl.tgtDlTpt; + /* Upto 0.5% drift in measured vs target tpt is ignored */ + if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5) + { + cell->thresholds.maxDlItbs = RGSCH_MAX((cell->thresholds.maxDlItbs-1), 1); + } + } + else + { + tptDelta = cell->cpuOvrLdCntrl.tgtDlTpt - cell->measurements.dlTpt; + /* Upto 0.5% drift in measured vs target tpt is ignored */ + if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5) + { + cell->thresholds.maxDlItbs = RGSCH_MIN((cell->thresholds.maxDlItbs+1), RG_SCH_DL_MAX_ITBS); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("\n DL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.dlTpt, cell->cpuOvrLdCntrl.tgtDlTpt, + cell->thresholds.maxDlItbs); +#endif + } + + if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_UL_TPT_UP | + RGR_CPU_OVRLD_UL_TPT_DOWN)) + { + /* Regualte DL Tpt for CPU overload */ + if (cell->measurements.ulTpt > cell->cpuOvrLdCntrl.tgtUlTpt) + { + tptDelta = cell->measurements.ulTpt - cell->cpuOvrLdCntrl.tgtUlTpt; + /* Upto 1% drift in measured vs target tpt is ignored */ + if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10) + { + cell->thresholds.maxUlItbs = RGSCH_MAX((cell->thresholds.maxUlItbs-1), 1); + } + } + else + { + tptDelta = cell->cpuOvrLdCntrl.tgtUlTpt - cell->measurements.ulTpt; + /* Upto 1% drift in measured vs target tpt is ignored */ + if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10) + { + cell->thresholds.maxUlItbs = RGSCH_MIN((cell->thresholds.maxUlItbs+1), RG_SCH_UL_MAX_ITBS); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("\n UL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.ulTpt, cell->cpuOvrLdCntrl.tgtUlTpt, + cell->thresholds.maxUlItbs); +#endif + } + + RETVOID; +} +/** + * @brief Handler for the num UE per TTI based CPU OvrLd instr updating + * + * @details + * + * Function : rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr + * + * Processing Steps: + * - Validate the config params. + * - Update numUEperTTi CPU OL related information. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] U8 cnrtCpuOvrLdIns + * @return Void + **/ +#ifdef ANSI +PRIVATE Void rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr +( + RgSchCellCb *cell, + U8 crntCpuOvrLdIns +) +#else +PRIVATE S16 rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(cell, crntCpuOvrLdIns) + RgSchCellCb *cell; + U8 crntCpuOvrLdIns; +#endif +{ + RgSchCpuOvrLdCntrlCb *cpuInstr = &(cell->cpuOvrLdCntrl); + RgSchCmnCell *cellSch; + U8 maxUeNewDlTxPerTti; + U8 maxUeNewUlTxPerTti; + U8 tmpSubFrame = 0; +#ifdef CPU_OL_DBG_PRINTS + U8 idx = 0; +#endif + U8 maxDlDecCnt; + U8 maxUlDecCnt; + + cellSch = RG_SCH_CMN_GET_CELL(cell); + + maxUeNewDlTxPerTti = cellSch->dl.maxUeNewTxPerTti; + maxUeNewUlTxPerTti = cellSch->ul.maxUeNewTxPerTti; + + /* Calculate Maximum Decremen */ + maxDlDecCnt = (10*(maxUeNewDlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED); + maxUlDecCnt = (10*(maxUeNewUlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED); + + /* Check for DL CPU Commands */ + if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_DEC_NUM_UE_PER_TTI ) + { + /* Decrement till 90% of maxUeNewDlTxPerTti */ + if ( cpuInstr->dlNxtIndxDecNumUeTti < maxDlDecCnt ) + { + tmpSubFrame = (cpuInstr->dlNxtIndxDecNumUeTti) % 10; + cpuInstr->dlNxtIndxDecNumUeTti++; + if ( cpuInstr->maxUeNewTxPerTti[tmpSubFrame] > 1 ) + { + cpuInstr->maxUeNewTxPerTti[tmpSubFrame]--; + } + else + { +#ifdef CPU_OL_DBG_PRINTS + printf("CPU_OL_TTI__ERROR\n"); +#endif + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti); +#endif + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", + cpuInstr->dlNxtIndxDecNumUeTti); + } + else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_INC_NUM_UE_PER_TTI ) + { + if ( cpuInstr->dlNxtIndxDecNumUeTti > 0) + { + cpuInstr->dlNxtIndxDecNumUeTti--; + tmpSubFrame = (cpuInstr->dlNxtIndxDecNumUeTti) % 10; + if ( cpuInstr->maxUeNewTxPerTti[tmpSubFrame] < maxUeNewDlTxPerTti ) + { + cpuInstr->maxUeNewTxPerTti[tmpSubFrame]++; + } + else + { +#ifdef CPU_OL_DBG_PRINTS + printf("CPU_OL_TTI__ERROR\n"); +#endif + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti); +#endif + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", + cpuInstr->dlNxtIndxDecNumUeTti); + } + /* Check for UL CPU commands */ + if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_DEC_NUM_UE_PER_TTI ) + { + /* Decrement till 90% of maxUeNewDlTxPerTti */ + if ( cpuInstr->ulNxtIndxDecNumUeTti < maxUlDecCnt ) + { + tmpSubFrame = (cpuInstr->ulNxtIndxDecNumUeTti) % 10; + cpuInstr->ulNxtIndxDecNumUeTti++; + if ( cpuInstr->maxUeNewRxPerTti[tmpSubFrame] > 1 ) + { + cpuInstr->maxUeNewRxPerTti[tmpSubFrame]--; + } + else + { +#ifdef CPU_OL_DBG_PRINTS + printf("CPU_OL_TTI__ERROR\n"); +#endif + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti); +#endif + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", + cpuInstr->dlNxtIndxDecNumUeTti); + } + else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_INC_NUM_UE_PER_TTI ) + { + if ( cpuInstr->ulNxtIndxDecNumUeTti > 0) + { + cpuInstr->ulNxtIndxDecNumUeTti--; + tmpSubFrame = (cpuInstr->ulNxtIndxDecNumUeTti) % 10; + if ( cpuInstr->maxUeNewRxPerTti[tmpSubFrame] < maxUeNewUlTxPerTti ) + { + cpuInstr->maxUeNewRxPerTti[tmpSubFrame]++; + } + else + { +#ifdef CPU_OL_DBG_PRINTS + printf("CPU_OL_TTI__ERROR\n"); +#endif + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Invalid CPU OL"); + } + } +#ifdef CPU_OL_DBG_PRINTS + printf("ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti); +#endif + RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"dlNxtIndxDecNumUeTti = %d", + cpuInstr->dlNxtIndxDecNumUeTti); + } +#ifdef CPU_OL_DBG_PRINTS + /* TODO: Debug Information - Shall be moved under CPU_OL_DBG_PRINTS */ + printf("maxUeNewDlTxPerTti = %d, maxUeNewUlTxPerTti = %d\n", maxUeNewDlTxPerTti, maxUeNewUlTxPerTti); + printf("DL Sf numUePerTti:"); + for ( idx = 0; idx < 10 ; idx ++ ) + { + printf(" %d", cpuInstr->maxUeNewTxPerTti[idx]); + } + printf("\nUL Sf numUePerTti:"); + for ( idx = 0; idx < 10 ; idx ++ ) + { + printf(" %d", cpuInstr->maxUeNewRxPerTti[idx]); + } + printf("\n"); +#endif + + RETVOID; +} /* rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr */ + +/** + * @brief Handler for the CPU OvrLd related cell Recfg. + * + * @details + * + * Function : rgSCHUtlResetCpuOvrLdState + * + * Processing Steps: + * - Validate the config params. + * - Update CPU OL related state information. + * - If successful, return ROK else RFAILED. + * + * @param[in] RgSchCellCb *cell + * @param[in] U8 cnrtCpuOvrLdIns + * @return S16 + * -# ROK + * -# RFAILED + **/ +#ifdef ANSI +PUBLIC S16 rgSCHUtlResetCpuOvrLdState +( + RgSchCellCb *cell, + U8 crntCpuOvrLdIns +) +#else +PUBLIC S16 rgSCHUtlResetCpuOvrLdState(cell, crntCpuOvrLdIns) + RgSchCellCb *cell; + U8 crntCpuOvrLdIns; +#endif +{ + U8 crntDlCpuOL=0; + U8 crntUlCpuOL=0; + RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch); + U8 idx; + + TRC3(rgSCHUtlResetCpuOvrLdState) + +#ifdef CPU_OL_DBG_PRINTS + printf("\n CPU OVR LD Ins Rcvd = %d\n", (int)crntCpuOvrLdIns); +#endif + RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"CPU OVR LD Ins Rcvd"); + + if ( RGR_CPU_OVRLD_RESET == crntCpuOvrLdIns ) + { + /* The CPU OL instruction received with RESET (0), hence reset it */ +#ifdef CPU_OL_DBG_PRINTS + printf("rgSCHUtlResetCpuOvrLdState: RESET CPU OL instr\n"); +#endif + RLOG_ARG0(L_INFO,DBG_CELLID,cell->cellId,"RESET CPU OVR LD"); + cell->cpuOvrLdCntrl.cpuOvrLdIns = 0; + /* Reset the max UL and DL itbs to 26 */ + cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS; + cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS; + /* Reset the num UE per TTI intructions */ + cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0; + cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0; + for ( idx = 0; idx < 10; idx++ ) + { + cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] = + schCmnCell->dl.maxUeNewTxPerTti; + cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] = + schCmnCell->ul.maxUeNewTxPerTti; + } + + RETVALUE(ROK); + } + /* Check and Update numUEPer TTI based CPU overload instruction before + * going for TP based CPU OL + * TTI based intrcuctions shall be > 0xF */ + if ( crntCpuOvrLdIns > 0xF ) + { + rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(cell, crntCpuOvrLdIns); + /* If need to have both TP and numUePerTti instrcution together in + * one command then dont return from here */ + RETVALUE(ROK); + } + + crntDlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_UP) +\ + (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_DOWN); + if ((crntDlCpuOL) && (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_UP) && + (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_DOWN)) + { + /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ + RETVALUE(RFAILED); + } + crntUlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_UP) +\ + (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_DOWN); + if ((crntUlCpuOL) && (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_UP) && + (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_DOWN)) + { + /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ + RETVALUE(RFAILED); + } + if ((crntDlCpuOL == 0) && (crntUlCpuOL == 0)) + { + /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */ + RETVALUE(RFAILED); + } + + cell->cpuOvrLdCntrl.cpuOvrLdIns = crntCpuOvrLdIns; + + if (crntUlCpuOL) + { + if (crntUlCpuOL == RGR_CPU_OVRLD_UL_TPT_DOWN) + { + cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt - \ + (cell->measurements.ulTpt * 3 )/100; + } + else + { + cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt + \ + (cell->measurements.ulTpt * 2 )/100; + } + RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,"CPU OVR LD UL Reset to " + "%d, %lu, %lu", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt,cell->measurements.ulTpt); +#ifdef CPU_OL_DBG_PRINTS + printf("\n CPU OVR LD UL Reset to= %d, %lu, %lu\n", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt, + cell->measurements.ulTpt); +#endif + } + + if (crntDlCpuOL) + { + if (crntDlCpuOL == RGR_CPU_OVRLD_DL_TPT_DOWN) + { + cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt - \ + (cell->measurements.dlTpt * 1 )/100; + } + else + { + cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt + \ + (cell->measurements.dlTpt * 1 )/100; + } + RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,"CPU OVR LD DL Reset to " + "%d, %lu, %lu", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt,cell->measurements.dlTpt); + +#ifdef CPU_OL_DBG_PRINTS + printf("\n CPU OVR LD DL Reset to= %d, %lu, %lu\n", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt, + cell->measurements.dlTpt); +#endif + } + rgSCHUtlCpuOvrLdAdjItbsCap(cell); + RETVALUE(ROK); +} +#ifdef EMTC_ENABLE +PUBLIC S16 rgSCHUtlAddToResLst +( + CmLListCp *cp, + RgSchIotRes *iotRes + ) +{ + cmLListAdd2Tail(cp, &iotRes->resLnk); + iotRes->resLnk.node = (PTR)iotRes; + RETVALUE(ROK); +} +PUBLIC S16 rgSCHUtlDelFrmResLst +( +RgSchUeCb *ue, +RgSchIotRes *iotRes +) +{ + CmLListCp *cp = NULLP; + RgSchEmtcUeInfo *emtcUe = NULLP; + emtcUe = RG_GET_EMTC_UE_CB(ue); + if(iotRes->resType == RG_SCH_EMTC_PUCCH_RES) + { + cp = &emtcUe->ulResLst; + }else if(iotRes->resType == RG_SCH_EMTC_PDSCH_RES) + { + cp = &emtcUe->dlResLst; + }else + { + RLOG0(L_INFO, "*****restype mismatch"); + } + if(cp != NULLP ) + { + if(cp->count == 0) + { + RLOG0(L_INFO,"****error count*****\n"); + RETVALUE(ROK); + } + } + cmLListDelFrm(cp, &iotRes->resLnk); + iotRes->resLnk.node = NULLP; + RETVALUE(ROK); +} +#endif +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_sch_utl_clist.c b/src/5gnrsch/rg_sch_utl_clist.c similarity index 100% rename from src/5gnrmac/rg_sch_utl_clist.c rename to src/5gnrsch/rg_sch_utl_clist.c diff --git a/src/LICENSES.txt b/src/LICENSES.txt deleted file mode 100644 index a9db3d030..000000000 --- a/src/LICENSES.txt +++ /dev/null @@ -1,31 +0,0 @@ -LICENSES.txt - - -Unless otherwise specified, all software contained herein is licensed -under the Apache License, Version 2.0 (the "Software License"); -you may not use this software except in compliance with the Software -License. You may obtain a copy of the Software License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the Software License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the Software License for the specific language governing permissions -and limitations under the Software License. - - - -Unless otherwise specified, all documentation contained herein is licensed -under the Creative Commons License, Attribution 4.0 Intl. (the -"Documentation License"); you may not use this documentation except in -compliance with the Documentation License. You may obtain a copy of the -Documentation License at - -https://creativecommons.org/licenses/by/4.0/ - -Unless required by applicable law or agreed to in writing, documentation -distributed under the Documentation License is distributed on an "AS IS" -BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -implied. See the Documentation License for the specific language governing -permissions and limitations under the Documentation License. diff --git a/src/README b/src/README deleted file mode 100644 index 1ec374403..000000000 --- a/src/README +++ /dev/null @@ -1,36 +0,0 @@ -Directory Structure : - -1. 5gnr_opensource/build/ : contains files required to compile the code - a. common : contains individual module's makefile - b. config : contains SSI memory configuration - c. odu : contains main makefile to generate an executable binary - -2. 5gnr_opensource/src/ : contains layer specific source code - a. 5gnrmac : MAC source code - b. 5gnrrlc : RLC source code - c. cm : common, environment and interface files - d. cu_stub : Stub code for CU - e. du_app : DU application and F1 code - f. mt : wrapper functions over OS - g. phy_stub : Stub code for Physical layer - h. rlog : logging module - - -Pre-requisite for Compilation : -1. Linux 32-bit/64-bit machine -2. GCC version 4.6.3 and above - -How to Compile: -1. cd 5gnr_opensource/build/odu -2. To clean and compile: - a. DU : make clean_all odu MACHINE=BIT64 TEXT_LOG=YES MODE=FDD - b. CU : make clean_cu cu_stub MACHINE=BIT64 TEXT_LOG=YES MODE=FDD - -How to execute: -1. DU : - a. cd 5gnr_opensource/build/odu/bin/odu - b. ./odu -f ../config/ssi_mem -2. CU : - a. cd 5gnr_opensource/build/odu/bin/cu_stub - b. ./cu_stub -f ../config/ssi_mem - diff --git a/src/build/common/asn.mak b/src/build/common/asn.mak deleted file mode 100755 index 07b5b81b4..000000000 --- a/src/build/common/asn.mak +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for ASN - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/du_app/F1AP/asn -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - - -lib: $(LIB_DIR)/libasn.a -include $(COM_BUILD_DIR)/compile.mak - - - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libasn.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libasn.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning ASN$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libasn.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/src/build/common/cm.mak b/src/build/common/cm.mak deleted file mode 100755 index 18e66068f..000000000 --- a/src/build/common/cm.mak +++ /dev/null @@ -1,90 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -#-------------------------------------------------------------# -#Makefile for product cm - script generated. -#Only the $(CCcmFLAGS) may be modified. -#-------------------------------------------------------------# -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_GREEN) -SRC_DIR=$(ROOT_DIR)/src/cm - -EG_DIR=$(ROOT_DIR)/src/egtpu -SZ_DIR=$(ROOT_DIR)/src/s1ap -CZ_DIR=$(ROOT_DIR)/src/x2ap - -# TODO - The dependency between layers and CM files should be removed # -I_OPTS+=-I$(EG_DIR) -I$(SZ_DIR) -I$(CZ_DIR) - -#-------------------------------------------------------------# -#User macros (to be modified) -#-------------------------------------------------------------# -#CCrmFLAGS=-DLRM_LWLC -DRMU_LWLC -URMU_NPLC -DRGM_LWLC -DLWLCSMRMMILRM -DLCSMRMMILRM -DSM -DRM_INTF -#CCnlFlags=-DLWLCSMSONILNL -DNLU_LWLC -DLCSMSONILNL -DNLU_TC -DTCSMSONILNL -DNL -#CCcmFLAGS=-DSS_MT_TMR -DSS_FLOAT -DRGR_V1 -DLSZV1 -DVE_SB_SCTP $(CCrmFLAGS) -#CCsmFLAGS=-DHI -DSB -DEG -DWR -DKW -DKW_PDCP -DPJ -DSZ -DYS -DRG -DNH -UVE_SM_LOG_TO_FILE -DRGR_SI_SCH -DTA_NEW -DSI_NEW -DCZ $(CCrmFLAGS) $(CCnlFlags) - -#-------------------------------------------------------------# -# Define all the layers that are part of this binary so that # -# their coupling requirements get defined from envopt.h. # -#-------------------------------------------------------------# -# TODO -DRM has conflict with some cm_atm files. It is temp- # -# orarily removed from this list. # -MOD_FLAGS=-DNH -DWR -DNX -DSZ -DCZ -DSB -DHI -DEG -DSM -DNL -DSM -DRG -DKW -DYS -#This module does not support binary logging so disable it -TEXT_LOG=YES - -#-------------------------------------------------------------# -# Source file list. This needs to be explicitly built as CM -# directory contains files for both CPUL and CPUH. -#-------------------------------------------------------------# -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_SRCS:=$(filter-out %cm_ss.c, $(C_SRCS)) -C_SRCS:=$(filter-out %egt_util.c, $(C_SRCS)) -C_SRCS:=$(filter-out %lve.c, $(C_SRCS)) -C_SRCS:=$(filter-out %cm_atm.c, $(C_SRCS)) -C_SRCS:=$(filter-out %_ptsp.c, $(C_SRCS)) -C_SRCS:=$(filter-out %_se_tst.c, $(C_SRCS)) -ifeq ($(PLTFRM),XEON) -C_SRCS:=$(filter-out %mem_wl.c, $(C_SRCS)) -else -C_SRCS:=$(filter-out %mem.c, $(C_SRCS)) -endif - -C_OBJS_WO_LOG=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) - - -lib: $(LIB_DIR)/libcm.a - -include $(COM_BUILD_DIR)/compile.mak - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libcm.a:$(C_OBJS_WO_LOG) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libcm.a $(C_OBJS) -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning CPUH CM$(REVERT_COLOR)" - @echo -e "$(COLOR_RED) $(REVERT_COLOR)" - $(Q)\rm -f $(LIB_DIR)/libcm.a $(C_OBJS_WO_LOG) - - diff --git a/src/build/common/compile.mak b/src/build/common/compile.mak deleted file mode 100644 index 219923183..000000000 --- a/src/build/common/compile.mak +++ /dev/null @@ -1,142 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -#/********************************************************************16** -# -# Name: gNodeB Sample Application -# -# Type: make file -# -# Desc: Compile, assemble and link product software for -# various configurations. Further comments are -# embedded in the file. -# -# This file supports a variety of environments and -# build targets. The default build target will be the -# portable target for the Linu 2.4.x with GNU C(gcc) -# -# Env: Linux 2.4.x with GNU C (gcc) -# -# File: compile.mak -# -#********************************************************************21*/ -#======================================================================= - -STOPTS=-DENB - -Q= -S= -# Check for verbose build -ifneq ($(V),1) - Q:=@ - S:=-s -endif -export Q -export S - -#-DSSINT2 -DSS_TICKS_SEC=100 -# MTSS defines -SS_FLAGS=-DSS -DSS_MT -DSUNOS -DSS_LINUX -UCONRD -UNOFILESYS -USS_DEBG_MEM_CORRUP_LEVEL1 \ - -DSS_TICKS_SEC=100 -USSI_DEBUG_LEVEL1 -USS_LICENSE_CHECK -DANSI -D_GNU_SOURCE\ - -D_REENTRANT -D__EXTENSIONS__ -DDEBUGNOEXIT - -# Flags to be used if text logging is enabled -TEXT_LOGGING = -DRLOG_ENABLE_TEXT_LOGGING -DRLOG_DEBUG_MODE - -ifeq ($(INSTRUMENTATION), YES) -INSTRUMENTATION_FLAGS = -DSS_MEM_CORRUPTION_DETECTION -endif - -# Flags pertaining to the functionality of TeNB are included here -TENB_FLAGS=-DLTERRC_REL9 -DEGTP_U_REL_9 -UMAC_SCH_STATS -USCH_STATS \ - -DTENB_TTI_PERF -DAES -DLTE_RRC_DISSECTOR -DRSYS_WIRESHARK - -ifneq ($(PLTFRM), PAL) -TENB_FLAGS += -DIPV6_SUPPORTED -endif - -ifeq ($(RADIO_CLUSTER), YES) -TENB_FLAGS += -DRADIO_CLUSTER -endif -# Flags that define the broad level functioning of the binary -ENV_FLAGS=-DNO_ERRCLS -DNOERRCHK -DDEBUGP - -RVW_FLAGS=-DCM_PASN_DBG -DLTEMAC_MIMO -DWR_UL_PWR \ - -DREVIEW -DNL - -# Flags that can be removed when everything works. These flags are not included -# in the compilation at the moment. -DEL_FLAGS=-DSS_WL_REGION=1 -DVE_PERF_MEAS -UVE_SUPPORT_RLC_UM_MODE -ULTE_LNX_AFFINITY \ - -DKW_BG_DL_PROC -DKW_BG_UL_PROC -DWR_SB_SCTP -DPHY_ERROR_LOGGING -DWR_DETECT_RLF \ - -USS_MEM_CORRUPTION_DETECTION -DL2_LOGGING_ENABLED -DLTEMAC_DRX -UUSE_PURE \ - -DLTE_MULTIUE -DCMKV2 -DYS_ENB_CFG -DTA_NEW -DTENB_DISABLE_DL_ZBC - -ALL_FLAGS=$(SS_FLAGS) $(CMN_FLAGS) $(ENV_FLAGS) $(RVW_FLAGS) $(TENB_FLAGS) $(LNXENV) - -# compiler options: -#C_OPTS+=-g -O3 -pipe -pedantic -Wall -Werror -Wno-comment -Wshadow -C_OPTS+=-g -pipe -Wall -Wno-comment -Wshadow \ - -Wcast-qual -fno-strict-aliasing -fsigned-char --std=c99 - -COPTS_WO_PEDANTIC=-g -O3 -pipe -Wall -Werror -Wno-comment -Wshadow \ - -Wcast-qual -fno-strict-aliasing -fsigned-char --std=c99 - -COPTS_WO_WERROR=-g -O3 -pipe -pedantic -Wall -Wno-comment -Wshadow \ - -Wcast-qual -fno-strict-aliasing -fsigned-char --std=c99 - -xCPP_OPTS+=-g -pipe -pedantic -Wall -Werror -Wno-comment -Wshadow \ - -Wcast-qual -fno-strict-aliasing -fsigned-char -lstdc++ - -# Include path settings -I_OPTS+=-I$(SRC_DIR) -I$(ROOT_DIR)/src/cm -I$(ROOT_DIR)/src/mt -I$(ROOT_DIR)/src/rlog -I_OPTS+=$(PLTFRM_INCLUDES) -.SUFFIXES:.c .o - -$(C_OBJS):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(C_OPTS) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(C_WO_WERR_OBJS):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(COPTS_WO_WERROR) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(C_WO_PED_OBJS):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(COPTS_WO_PEDANTIC) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(CPP_OBJS):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(CPP_OPTS) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(C_OBJS_WO_LOG):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(C_OPTS) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(C_WO_PED_OBJS_WO_LOG):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(COPTS_WO_PEDANTIC) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - -$(CPP_OBJS_WO_LOG):$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(HDR_FILES) - @echo -e "Compiling $(COLOR_RED) $< $(REVERT_COLOR)" - $(Q)$(CC) -c -o $@ $(CPP_OPTS) $(I_OPTS) $(ALL_FLAGS) $(TEXT_LOGGING) $(MOD_FLAGS) \ - $(PLTFRM_FLAGS) $< - diff --git a/src/build/common/cu_stub.mak b/src/build/common/cu_stub.mak deleted file mode 100755 index 673b8753c..000000000 --- a/src/build/common/cu_stub.mak +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for CU STUB - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/cu_stub/ -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) - - -lib: $(LIB_DIR)/libcu.a -include $(COM_BUILD_DIR)/compile.mak - -I_OPTS+=-I$(ROOT_DIR)/src/mt -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn - -PLTFRM_FLAGS+=-DCU_STUB - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libcu.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libcu.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning CU STUB$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libcu.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/src/build/common/du_app.mak b/src/build/common/du_app.mak deleted file mode 100755 index 3b835ab29..000000000 --- a/src/build/common/du_app.mak +++ /dev/null @@ -1,61 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for DU APP - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/du_app/ -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lkw*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) - - -lib: $(LIB_DIR)/libduapp.a -include $(COM_BUILD_DIR)/compile.mak - -I_OPTS+=-I$(ROOT_DIR)/src/mt -I_OPTS+=-I$(SRC_DIR)/F1AP -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn - - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libduapp.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libduapp.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning DU APP$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libduapp.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/src/build/common/env.mak b/src/build/common/env.mak deleted file mode 100644 index 700ed6076..000000000 --- a/src/build/common/env.mak +++ /dev/null @@ -1,82 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -#*********************************************************************17*/ -# -# Name: gNodeB Sample Application -# -# Type: make file -# -# Desc: Compile, assemble and link product software for -# various configurations. Further comments are -# embedded in the file. -# -# This file supports a variety of environments and -# build targets. The default build target will be the -# portable target for the Linu 2.4.x with GNU C(gcc) -# -# Env: Linux 2.4.x with GNU C (gcc) -# -# File: env.mak -# -#********************************************************************21*/ -#======================================================================= - -STOPTS=-DENB - -Q= -S= -# Check for verbose build -ifneq ($(V),1) - Q:=@ - S:=-s -endif -export Q -export S - -# With the assumption that the make command is run from the directory -# where the makefile is located, PWD fetches the build directory and -# all other directories are generated using the build directory. -BUILD_DIR=$(PWD) -ROOT_DIR_SCRIPTS =$(patsubst %/build/scripts,%,$(BUILD_DIR)) -COM_BUILD_DIR=$(BUILD_DIR)/../common -ROOT_DIR=$(patsubst %/build/odu,%,$(BUILD_DIR)) -export BUILD_DIR -export COM_BUILD_DIR -export ROOT_DIR - -# Path where the .o files or the directories with .o files are located -OBJ_ROOT =$(BUILD_DIR)/obj -export OBJ_ROOT -# Path where the binary logging related files are generated -LOG_ROOT =$(BUILD_DIR)/logdb -export LOG_ROOT -# Path where the libraries are created -LIB_ROOT =$(BUILD_DIR)/lib -export LIB_ROOT -# Path for the common files that are used across multiple layers -CM_DIR =$(ROOT_DIR)/src/cm -export CM_DIR -# Path where the final binaries are created -BIN_DIR =$(BUILD_DIR)/bin -export BIN_DIR -# Path where the libraries are packaged and these are used when not built from source -EXT_LIB_DIR =$(ROOT_DIR)/lib -export EXT_LIB_DIR - -CMENBE2EOPTS += $(RLOG_OPTS_TEXT) - -L_OPTS = -lrt -lm -lpthread -lpcap -lstdc++ -L $(LIB_ROOT) diff --git a/src/build/common/f1ap.mak b/src/build/common/f1ap.mak deleted file mode 100755 index d45122114..000000000 --- a/src/build/common/f1ap.mak +++ /dev/null @@ -1,62 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for DU APP - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/du_app/F1AP -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lkw*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) - - -lib: $(LIB_DIR)/libf1ap.a -include $(COM_BUILD_DIR)/compile.mak - -I_OPTS+=-I$(ROOT_DIR)/src/mt -I_OPTS+=-I$(ROOT_DIR)/src/du_app -I_OPTS+=-I$(ROOT_DIR)/src/cu_stub -I_OPTS+=-I$(ROOT_DIR)/src/du_app/F1AP/asn - - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libf1ap.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libf1ap.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning F1AP$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libf1ap.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/src/build/common/kw.mak b/src/build/common/kw.mak deleted file mode 100644 index cb44684ce..000000000 --- a/src/build/common/kw.mak +++ /dev/null @@ -1,54 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -##-------------------------------------------------------------# -##Makefile for product ib - script generated. -#Only the $(CCib) may be modified. -#-------------------------------------------------------------# -include ../common/rsys_fancy.mak -include ../common/env.mak - -SRC_DIR=$(ROOT_DIR)/src/5gnrrlc - -#Prepare source file list -C_SRCS=$(wildcard $(SRC_DIR)/*.c) - -#prepare the list of object files and RLOG related files -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) - -#-------------------------------------------------------------# -#User macros (to be modified) -#-------------------------------------------------------------# -MOD_FLAGS=-DRG -DYS -DKW -DLCRGU -DLCKWULUDX -DLCUDX -DLWLCKWULUDX -UPJ - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# - -lib: $(LIB_DIR)/libkw.a -include $(COM_BUILD_DIR)/compile.mak - -$(LIB_DIR)/libkw.a:$(C_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libkw.a $(C_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning RLC$(REVERT_COLOR)" - $(Q)\rm -f $(LIB_DIR)/libkw.a $(C_OBJS) - diff --git a/src/build/common/mt.mak b/src/build/common/mt.mak deleted file mode 100755 index f22a83e39..000000000 --- a/src/build/common/mt.mak +++ /dev/null @@ -1,257 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -# -##-------------------------------------------------------------# -#Makefile for product mt - script generated. -#Only the $(CCmtFLAGS) may be modified. -#-------------------------------------------------------------# -include ../common/rsys_fancy.mak -include ../common/env.mak - -#-------------------------------------------------------------# -#User macros (to be modified) -#-------------------------------------------------------------# - -CCmtFLAGS=-DSS_MT_TMR -USS_LOGGER_SUPPORT -DEGTP_U#<---Insert mt specific defines here - -#-------------------------------------------------------------# -#File/Obj macros -#-------------------------------------------------------------# -SRC_DIR=$(ROOT_DIR)/src/mt - -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_SRCS:=$(filter-out %ss_acc.c,$(C_SRCS)) -C_SRCS:=$(filter-out %mt_tst.c,$(C_SRCS)) -C_SRCS:=$(filter-out %sol.c, $(C_SRCS)) -C_SRCS:=$(filter-out %diag.c, $(C_SRCS)) -C_SRCS:=$(filter-out %mtsp.c, $(C_SRCS)) -C_SRCS:=$(filter-out %tskent.c, $(C_SRCS)) - -ifeq ($(PLTFRM),PAL) -C_SRCS:=$(filter-out %4gmx.c, $(C_SRCS)) -endif -ifneq ($(BOARD), T33H) -C_SRCS:=$(filter-out %t33.c, $(C_SRCS)) -endif - -C_OBJS_WO_LOG=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -I_OPTS+=-isystem $(BSPPATH)/usr/include/brcm -I_OPTS+=-I$(SRC_DIR)/security - - -#mtSRCS= \ -# $(IN_DIR)/mt_id.c\ -# $(IN_DIR)/mt_ss.c\ -# $(IN_DIR)/ss_gen.c\ -# $(IN_DIR)/ss_id.c\ -# $(IN_DIR)/ss_mem.c\ -# $(IN_DIR)/ss_msg.c\ -# $(IN_DIR)/ss_pack.c\ -# $(IN_DIR)/ss_queue.c\ -# $(IN_DIR)/ss_strm.c\ -# $(IN_DIR)/ss_task.c\ -# $(IN_DIR)/ss_drvr.c\ -# $(IN_DIR)/ss_timer.c\ -# $(IN_DIR)/ss_diag.c -#ifeq (${BLDENV},lnx_e2e_ms) -# mtSRCS+=$(IN_DIR)/mt_4gmx.c -#else -#ifeq (${BLDENV},lnx_ms_withoutdiag) -# mtSRCS+=$(IN_DIR)/mt_4gmx.c -#endif -#endif -#ifeq ($(BLDENV),lnx_e2e_bc) -# mtSRCS+=$(IN_DIR)/bc_cpu_overload.c -# mtSRCS+=$(IN_DIR)/bc_icpu_snd.c -# mtSRCS+=$(IN_DIR)/bc_icpu_rcv.c -# mtSRCS+=$(IN_DIR)/bc_cpu_init.c -# mtSRCS+=$(IN_DIR)/rb_log.c -# mtSRCS+=$(IN_DIR)/ss_rbuf.c -# mtSRCS+=$(IN_DIR)/bc_free_mgr.c -# mtSRCS+=$(IN_DIR)/bc_batch_mgr.c -#else -# mtSRCS+=$(IN_DIR)/bc_cpu_overload.c -# mtSRCS+=$(IN_DIR)/bc_icpu_snd.c -# mtSRCS+=$(IN_DIR)/bc_icpu_rcv.c -# mtSRCS+=$(IN_DIR)/bc_cpu_init.c -# mtSRCS+=$(IN_DIR)/rb_log.c -# mtSRCS+=$(IN_DIR)/ss_rbuf.c -# mtSRCS+=$(IN_DIR)/bc_free_mgr.c -# mtSRCS+=$(IN_DIR)/bc_batch_mgr.c -#endif -# -#mtOBJS= \ -# $(OUT_DIR)/mt_id.$(OBJ)\ -# $(OUT_DIR)/mt_ss.$(OBJ)\ -# $(OUT_DIR)/ss_gen.$(OBJ)\ -# $(OUT_DIR)/ss_id.$(OBJ)\ -# $(OUT_DIR)/ss_mem.$(OBJ)\ -# $(OUT_DIR)/ss_msg.$(OBJ)\ -# $(OUT_DIR)/ss_pack.$(OBJ)\ -# $(OUT_DIR)/ss_queue.$(OBJ)\ -# $(OUT_DIR)/ss_strm.$(OBJ)\ -# $(OUT_DIR)/ss_task.$(OBJ)\ -# $(OUT_DIR)/ss_drvr.$(OBJ)\ -# $(OUT_DIR)/ss_timer.$(OBJ)\ -# $(OUT_DIR)/ss_diag.$(OBJ) -#ifeq (${BLDENV},lnx_e2e_ms) -# mtOBJS+=$(OUT_DIR)/mt_4gmx.$(OBJ) -#else -#ifeq (${BLDENV},lnx_ms_withoutdiag) -# mtOBJS+=$(OUT_DIR)/mt_4gmx.$(OBJ) -#endif -#endif -#ifeq ($(BLDENV),lnx_e2e_bc) -# mtOBJS+=$(OUT_DIR)/bc_cpu_overload.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_icpu_snd.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_icpu_rcv.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_cpu_init.$(OBJ) -# mtOBJS+=$(OUT_DIR)/rb_log.$(OBJ) -# mtOBJS+=$(OUT_DIR)/ss_rbuf.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_free_mgr.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_batch_mgr.$(OBJ) -#else -# mtOBJS+=$(OUT_DIR)/bc_cpu_overload.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_icpu_snd.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_icpu_rcv.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_cpu_init.$(OBJ) -# mtOBJS+=$(OUT_DIR)/rb_log.$(OBJ) -# mtOBJS+=$(OUT_DIR)/ss_rbuf.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_free_mgr.$(OBJ) -# mtOBJS+=$(OUT_DIR)/bc_batch_mgr.$(OBJ) -#endif - -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(SRC_DIR)/*.[hx]) -HDR_FILES+=$(wildcard $(SRC_DIR)/*.[hx]) - -#ifeq ($(BLDENV),lnx_e2e_bc) -# MT_INC+=$(IN_DIR)/bc_icpu.h -# MT_INC+=$(IN_DIR)/bc_cpu_init.h -# MT_INC+=$(IN_DIR)/rb_log.x -# MT_INC+=$(IN_DIR)/rb_log.h -# MT_INC+=$(IN_DIR)/bc_cpu_overload.h -#else -# MT_INC+=$(IN_DIR)/bc_icpu.h -# MT_INC+=$(IN_DIR)/bc_cpu_init.h -# MT_INC+=$(IN_DIR)/rb_log.x -# MT_INC+=$(IN_DIR)/rb_log.h -# MT_INC+=$(IN_DIR)/bc_cpu_overload.h -#endif - -#ALL_INC=$(MT_INC) $(CM_INC) - -#-------------------------------------------------------------# -#Compiler macros -#-------------------------------------------------------------# -#Compiler macros -#-------------------------------------------------------------# -#$(OUT_DIR)/mt_id.$(OBJ): $(IN_DIR)/mt_id.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/mt_id.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/mt_id.c -#$(OUT_DIR)/mt_ss.$(OBJ): $(IN_DIR)/mt_ss.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/mt_ss.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/mt_ss.c -#ifeq (${BLDENV},lnx_e2e_ms) -#$(OUT_DIR)/mt_4gmx.$(OBJ): $(IN_DIR)/mt_4gmx.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/mt_4gmx.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/mt_4gmx.c -#else -#ifeq (${BLDENV},lnx_ms_withoutdiag) -#$(OUT_DIR)/mt_4gmx.$(OBJ): $(IN_DIR)/mt_4gmx.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/mt_4gmx.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/mt_4gmx.c -#endif -#endif -# -#ifeq ($(BLDENV),lnx_e2e_bc) -#$(OUT_DIR)/bc_cpu_overload.$(OBJ): $(IN_DIR)/bc_cpu_overload.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_cpu_overload.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_cpu_overload.c -#$(OUT_DIR)/bc_icpu_snd.$(OBJ): $(IN_DIR)/bc_icpu_snd.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_icpu_snd.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_icpu_snd.c -#$(OUT_DIR)/bc_icpu_rcv.$(OBJ): $(IN_DIR)/bc_icpu_rcv.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_icpu_rcv.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_icpu_rcv.c -#$(OUT_DIR)/bc_cpu_init.$(OBJ): $(IN_DIR)/bc_cpu_init.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_cpu_init.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_cpu_init.c -#$(OUT_DIR)/rb_log.$(OBJ): $(IN_DIR)/rb_log.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/rb_log.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/rb_log.c -#$(OUT_DIR)/ss_rbuf.$(OBJ): $(IN_DIR)/ss_rbuf.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_rbuf.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_rbuf.c -#$(OUT_DIR)/bc_free_mgr.$(OBJ): $(IN_DIR)/bc_free_mgr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_free_mgr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_free_mgr.c -#$(OUT_DIR)/bc_batch_mgr.$(OBJ): $(IN_DIR)/bc_batch_mgr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_batch_mgr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_batch_mgr.c -#else -#$(OUT_DIR)/bc_cpu_overload.$(OBJ): $(IN_DIR)/bc_cpu_overload.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_cpu_overload.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_cpu_overload.c -#$(OUT_DIR)/bc_icpu_snd.$(OBJ): $(IN_DIR)/bc_icpu_snd.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_icpu_snd.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_icpu_snd.c -#$(OUT_DIR)/bc_icpu_rcv.$(OBJ): $(IN_DIR)/bc_icpu_rcv.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_icpu_rcv.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_icpu_rcv.c -#$(OUT_DIR)/bc_cpu_init.$(OBJ): $(IN_DIR)/bc_cpu_init.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_cpu_init.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_cpu_init.c -#$(OUT_DIR)/rb_log.$(OBJ): $(IN_DIR)/rb_log.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/rb_log.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/rb_log.c -#$(OUT_DIR)/ss_rbuf.$(OBJ): $(IN_DIR)/ss_rbuf.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_rbuf.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_rbuf.c -#$(OUT_DIR)/bc_free_mgr.$(OBJ): $(IN_DIR)/bc_free_mgr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_free_mgr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_free_mgr.c -#$(OUT_DIR)/bc_batch_mgr.$(OBJ): $(IN_DIR)/bc_batch_mgr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/bc_batch_mgr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/bc_batch_mgr.c -#endif -#$(OUT_DIR)/ss_drvr.$(OBJ): $(IN_DIR)/ss_drvr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_drvr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_drvr.c -#$(OUT_DIR)/ss_gen.$(OBJ): $(IN_DIR)/ss_gen.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_gen.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_gen.c -#$(OUT_DIR)/ss_id.$(OBJ): $(IN_DIR)/ss_id.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_id.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_id.c -#$(OUT_DIR)/ss_mem.$(OBJ): $(IN_DIR)/ss_mem.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_mem.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_mem.c -#$(OUT_DIR)/ss_msg.$(OBJ): $(IN_DIR)/ss_msg.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_msg.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_msg.c -#$(OUT_DIR)/ss_pack.$(OBJ): $(IN_DIR)/ss_pack.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_pack.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_pack.c -#$(OUT_DIR)/ss_queue.$(OBJ): $(IN_DIR)/ss_queue.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_queue.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_queue.c -#$(OUT_DIR)/ss_rtr.$(OBJ): $(IN_DIR)/ss_rtr.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_rtr.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_rtr.c -#$(OUT_DIR)/ss_strm.$(OBJ): $(IN_DIR)/ss_strm.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_strm.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_strm.c -##$(OUT_DIR)/ss_task.$(OBJ): $(IN_DIR)/ss_task.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_task.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_task.c -#$(OUT_DIR)/ss_timer.$(OBJ): $(IN_DIR)/ss_timer.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_timer.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_timer.c -#$(OUT_DIR)/ss_diag.$(OBJ): $(IN_DIR)/ss_diag.c $(ALL_INC) -# $(CC) -c -o $(OUT_DIR)/ss_diag.o $(COPTS) $(IOPTS) $(POPTS) $(CCmtFLAGS) $(IN_DIR)/ss_diag.c -# - -lib:$(LIB_DIR)/libmt.a - -include $(COM_BUILD_DIR)/compile.mak - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libmt.a:$(C_OBJS_WO_LOG) - $(Q)ar -cr $(LIB_DIR)/libmt.a $(C_OBJS_WO_LOG) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaning SSI from $(OBJ_DIR)$(REVERT_COLOR)" - $(Q)\rm -f $(LIB_DIR)/libmt.a $(C_OBJS_WO_LOG) - - diff --git a/src/build/common/phy_stub.mak b/src/build/common/phy_stub.mak deleted file mode 100755 index 0f56cc549..000000000 --- a/src/build/common/phy_stub.mak +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# This is makefile for PHY Stub - -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_RED) - -SRC_DIR=$(ROOT_DIR)/src/phy_stub/ -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) -LOG_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i,$(C_SRCS)) -BAK_FILES=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.bak,$(C_SRCS)) -DB_FILES =$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.i.db,$(C_SRCS)) - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/rg*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) - - -lib: $(LIB_DIR)/libphystub.a -include $(COM_BUILD_DIR)/compile.mak - -I_OPTS+=-I$(ROOT_DIR)/src/mt - - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/libphystub.a:$(C_OBJS) $(C_WO_PED_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/libphystub.a $(C_OBJS) $(C_WO_PED_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo $(OAM_ENABLE) - @echo -e "$(COLOR_RED)Cleaning PHY stub$(REVERT_COLOR)" - @echo $(SRC_DIR) $(CM_DIR) - $(Q)\rm -f $(LIB_DIR)/libphystub.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES) - diff --git a/src/build/common/rg.mak b/src/build/common/rg.mak deleted file mode 100644 index 4d0094cd7..000000000 --- a/src/build/common/rg.mak +++ /dev/null @@ -1,71 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -##-------------------------------------------------------------# -#Makefile for product RG - script generated. -#-------------------------------------------------------------# -include ../common/rsys_fancy.mak -include ../common/env.mak -COLOR=$(COLOR_GREEN) - -SRC_DIR=$(ROOT_DIR)/src/5gnrmac - -# prepare the list of common header files -HDR_FILES+=$(wildcard $(CM_DIR)/env*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/gen*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/ssi*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/cm*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/crg.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/rgr.[hx]) -HDR_FILES+=$(wildcard $(CM_DIR)/rgm.[hx]) - -# Add the product specific header files -HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) - -#prepare the list of source files -C_SRCS=$(wildcard $(SRC_DIR)/*.c) -C_SRCS:=$(filter-out $(SRC_DIR)/rg_sch%, $(C_SRCS)) - -#prepare the list of object files and RLOG related files -C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) - -#-------------------------------------------------------------# -#User macros (to be modified) -#-------------------------------------------------------------# -# Including RG_PHASE2_SCHED for supporting more than one schedulers -# supported by mac -# TODO: make it define for LTEMAC_MIMO and remove it from envopt.h -MOD_FLAGS=-DRGM_LC -DRGM_LWLC -USM -URG_DEBUG -DxRG_PHASE2_SCHED -DxRGR_V1 \ - -DRG_UL_DELTA=2 -ULTEMAC_DLUE_TMGOPTMZ -UTENB_SPLIT_ARCH -DRG -ULTEMAC_MIMO - -lib:$(LIB_DIR)/librg.a -include $(COM_BUILD_DIR)/compile.mak - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/librg.a:$(C_OBJS) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)ar -cr $(LIB_DIR)/librg.a $(C_OBJS) - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Cleaing MAC$(REVERT_COLOR)" - $(Q)\rm -f $(LIB_DIR)/librg.a $(C_OBJS) - diff --git a/src/build/common/rl.mak b/src/build/common/rl.mak deleted file mode 100755 index 1212f6ce1..000000000 --- a/src/build/common/rl.mak +++ /dev/null @@ -1,80 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -# -include ../common/rsys_fancy.mak -COLOR=$(COLOR_GREEN) - -#-------------------------------------------------------------# -#Makefile for RL -#-------------------------------------------------------------# -MOD_FLAGS=-UUSE_RLOG_DATA_TYPES - -SRC_DIR=$(ROOT_DIR)/src/rlog -CM_DIR =$(ROOT_DIR)/src/cm - -# Product sources------------------------------------------------------- -C_SRCS=$(SRC_DIR)/rl_rlog.c $(SRC_DIR)/rl_common.c $(SRC_DIR)/rl_platform.c $(SRC_DIR)/rl_soc.c -rlPOSTPROCSRCS=$(SRC_DIR)/rl_common.c $(SRC_DIR)/rl_postproc.cpp - -# Product includes ------------------------------------------------------- -HDR_FILES=$(SRC_DIR)/rl_common.h $(SRC_DIR)/rl_rlog.h $(SRC_DIR)/rl_interface.h \ - $(SRC_DIR)/rl_platform.h -HDR_FILES+=$(wildcard $(CM_DIR)/*.) - -# Object files ------------------------------------ -C_OBJS_WO_LOG=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS)) - -#-------------------------------------------------------------# -#Makefile for RL -#-------------------------------------------------------------# -rlPOSTPROCOPTS=-DSS_LINUX -DUSE_RLOG_DATA_TYPES - -#-------------------------------------------------------------# -#-------------------------------------------------------------# -#Compiler macros -#-------------------------------------------------------------# -#$(OBJ_DIR)/rl_rlog.$(OBJ):$(rlSRCS) -# @echo -e "Compiling $(COLOR) $< $(REVERT_COLOR)..." -# $(Q) $(CC) -c $(COPTS) $(IOPTS) $(POPTS) $(IN_DIR)/rl_rlog.$(SRC) -rdynamic -o $(OBJ_DIR)/rl_rlog.$(OBJ) -#$(OBJ_DIR)/rl_common.$(OBJ):$(rlSRCS) -# @echo -e "Compiling $(COLOR) $< $(REVERT_COLOR)..." -# $(Q) $(CC) -c $(COPTS) $(IOPTS) $(POPTS) $(IN_DIR)/rl_common.$(SRC) -o $(OBJ_DIR)/rl_common.$(OBJ) -#$(OBJ_DIR)/rl_platform.$(OBJ):$(rlSRCS) -# @echo -e "Compiling $(COLOR) $< $(REVERT_COLOR)..." -# $(Q) $(CC) -c $(COPTS) $(IOPTS) $(POPTS) $(IN_DIR)/rl_platform.$(SRC) -o $(OBJ_DIR)/rl_platform.$(OBJ) - -lib:$(LIB_DIR)/librl.a - -include $(COM_BUILD_DIR)/compile.mak - -#-------------------------------------------------------------# -#Linker macros -#-------------------------------------------------------------# -$(LIB_DIR)/librl.a:$(C_OBJS_WO_LOG) - @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)" - $(Q)$(AR) -cr $(OBJ_DIR)/librl.a $(C_OBJS) - @echo -e "$(COLOR)Building the binary logging post processor$(REVERT_COLOR)" - $(Q)g++ $(rlPOSTPROCOPTS) $(rlPOSTPROCSRCS) -o $(OBJ_DIR)/rlogapp - -#-------------------------------------------------------------# -#Clean macros -#-------------------------------------------------------------# -clean: - @echo -e "$(COLOR_RED)Clearing binary logging$(REVERT_COLOR)" - $(Q)rm -f $(LIB_DIR)/librl.a $(C_OBJS_WO_LOG) - - - diff --git a/src/build/common/rlog.pl b/src/build/common/rlog.pl deleted file mode 100755 index a3643c8fd..000000000 --- a/src/build/common/rlog.pl +++ /dev/null @@ -1,244 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -#!/usr/bin/perl -w -#use strict; -use POSIX; -use Time::HiRes qw(usleep); -local $| = 1; - -#if($ARGV[1] eq "INTEL") { -# if ($#ARGV == 3 ) { -# print "Make DB Script ERROR: More than two arument is passed to script\n"; -# exit; -# } -#} else { -# if ($#ARGV == 4 ) { -# print "Make DB Script ERROR: More than two arument is passed to script\n"; -# exit; -# } -#} -########################################################### -# Reading File name and creating DB file name. -# my $OrgFileName = $ARGV[0]; # Copied File name in to a varible. -# my @spltname = split('/', $OrgFileName); -my $numelem = $#spltname; -my $fileName = $spltname[$numelem]; - -#variable declaration. -my @arryOfLogId = 0; -my $moduleId = 0; -my $fileId = 0; -my $moduleName = 0; -my $lineNum = 0; -my $test = 0; -my $printString = 0; -my @varibles = 0; -my $logLvl = 0; -my $splArgName = 0; -my $splArgVal = 0; -my $tokenID = 0; -my $hexTokenID = 0; -my $CStart = 0; -my $CPattern = 0; -my $CVarible = 0; -my $CString = 0; -my $CEnd = 0; -my $NewVarible = 0; -my $delimit = '%8ld'; -#my $isModuleNameFound = 0; -my $greatestTokenID = 0; -my $DBFILE; -my $tmpfile; -my $tmpfile1; -my $dbentry; - -########################################################### -# Declare the subroutines -sub trim($); -sub ltrim($); -sub rtrim($); -sub findDup; - -# Perl trim function to remove whitespace from the start and end of the string -sub trim($) { - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - return $string; -} - -# Left trim function to remove leading whitespace -sub ltrim($) { - my $string = shift; - $string =~ s/^\s+//; - return $string; -} - -# Right trim function to remove trailing whitespace -sub rtrim($) { - my $string = shift; - $string =~ s/\s+$//; - return $string; -} - -my $prj = $ARGV[0]; -my $tmp = $ARGV[0]; -my @dbFilesDir = ($ARGV[2]); - -# Process the file and generate the log DB for the file -#print "Arguments passed are ", @ARGV, "\n"; -#print "Calling process of the file with argument ", $ARGV[1], "\n"; -parse_preproc_file($ARGV[1]); - -sub parse_preproc_file { - my $OrgFileName = shift; - #print "File passed is ", $OrgFileName, "\n"; - chomp($OrgFileName); - my $generatedb = 0; - my $dbFileName = sprintf("%s%s", $OrgFileName,".db"); - my $logNum = 0; - - my $isModuleIdFound = 0; - my $isFileIdFound = 0; - my $isModuleNameFound = 0; - $logNum = 0; - $fileId = 0; - - # Opening source.i file and DB file - # print "FILE:$OrgFileName\n"; - `cp -f $OrgFileName $OrgFileName.bak`; - if($tmp eq "INTEL") { - #print "Removing # for INTEL"; - system("sed -i '/^#/d' $OrgFileName"); - } elsif($tmp eq "XEON"){ - #print "Remove # for XEON"; - system("sed -i '/stdlib\-bsearch.h/s/^#//g' $OrgFileName"); - system("sed -i '/^#/d' $OrgFileName"); - system("sed -i '/stdlib\-bsearch.h/s/^/#/g' $OrgFileName"); - }else { - #print "Don't Remove # for BRCM"; - #system("sed -i '/^#/d' $OrgFileName"); - } - - open FILE, "<$OrgFileName" or die $!; - open my $OUTPFILE, '>', "$OrgFileName.tmp" or die "Can't write new file: $!"; - my $fromFound =0; - - while() { - if (( $_ =~ /logLev[0-4EHS]/ ) && ( $_ !~ /}[;]*/) && ( $_ !~ /R_LOG_LEVEL/)) { - $fromFound = 1; - $concatStr=$_; - chomp($concatStr); - next; - } - - if( ($_ =~ /}[;]*/) && ($fromFound == 1) ) { - $concatStr =~ s/(.*)(logLev[E0-4HS]) +(.*)/$1$2$3/g; - print $OUTPFILE $concatStr; - print $OUTPFILE $_; - $fromFound = 0; - next; - } - - if ($fromFound == 1) { - chomp($_); - $concatStr = $concatStr.$_; - } else { - #print $OUTPFILE "/* AARTI4*/"; - $_ =~ s/(.*)(logLev[E0-4HS]) +(.*)/$1$2$3/g; - print $OUTPFILE $_; - } - } - close(FILE); - close($OUTPFILE); - `mv -f $OrgFileName.tmp $OrgFileName`; - - open(INFILE, "< $OrgFileName") || die("Make DB Script ERROR: Cannot open file $OrgFileName for parse"); - open $tmpfile, "> $OrgFileName.tmp.i" || die("Data Base ERROR: Cannot Create temporary file"); - open ($dbfile, '>' , "$OrgFileName.tmp.db") || die("Data Base ERROR: Cannot create the file $dbFileName"); - ########################################################## - # Read each line and create the DB entries - while () { - if (($isModuleIdFound != 1) || ($isFileIdFound != 1) || ($isModuleNameFound !=1)) { - if (/(\s*.*)RLOG_MODULE_ID(\s*.*)=(\s*.*);/) { - $moduleId = $3; - $isModuleIdFound = 1; - } - - if (/(\s*.*)RLOG_FILE_ID(\s*.*)=(\s*.*);/) { - $fileId = $3; - $isFileIdFound = 1; - #print "FILE $OrgFileName FILE ID $fileId [$1] [$2] [$3]\n"; - } - if (/(\s*.*)*RLOG_MODULE_NAME(\s*.*)=(\s*.*);/) { - $moduleName = $3; - $moduleName = substr($moduleName,1); - $moduleName = substr($moduleName, 0, -1); - $isModuleNameFound = 1; - } - - print $tmpfile $_; - } elsif (/(\s*.*)(logLev[E0-4HS]\()(\s*.*\,)(\s*\".*\")(\s*.*)/) { - $CStart = $1; - $CPattern = $2; - $CVarible = $3; - $CString = $4; - $CEnd = $5; - - if( $3 =~ m/_LOGID/ ) { - my $fmtStr = $CString; - @variables = split(/,/, $CVarible); - my $arrSize = $#variables; - my $line = $variables[$arrSize]; - my $file = $variables[$arrSize-1]; - - if ($fileId < 0x3FF) { - $tokenID = ($fileId << 16)|(++$logNum); - $hexTokenID = sprintf("0x%x", $tokenID); - } else { print "SOME ERROR MODID:$moduleId FILEID:$fileId\n"; - return 1; - } - - $CVarible =~ s/_LOGID/$hexTokenID/; - - print $tmpfile "$CStart$CPattern$CVarible$CString$CEnd\n"; - print $dbfile "$tokenID;$line;$moduleName;$file;$fmtStr\n"; - $generatedb = 1; - } - } else { - print $tmpfile $_; - } - $lineNum = $lineNum + 1; - } - - ########################################################################## - #Close all files and create final output file - close(INFILE); - close ($tmpfile); - close ($dbfile); - - #close ($DBFILE); - #if( $generatedb eq 1) { - `cp -f $OrgFileName.tmp.i $OrgFileName`; - `mv -f $OrgFileName.tmp.db $dbFileName`; - `dos2unix -q $OrgFileName`; - `dos2unix -q $dbFileName`; - `rm -f $OrgFileName.tmp.i` - #} else { - # 'rm -f tmp.i'; - #} -} diff --git a/src/build/common/rsys_fancy.mak b/src/build/common/rsys_fancy.mak deleted file mode 100644 index 8eb3a835c..000000000 --- a/src/build/common/rsys_fancy.mak +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -#********************************************************************20** -# -# Name: RSYS FANCY MAKE OUTOUT -# -# Type: Makefile -# -# Desc: To control fancy features in the build process -# -# -# File: rsys_fancy.mak -# -#********************************************************************21*/ - -#----------------------------------------------------------------------- -# FANCY STUFF... you can play around with this if you want to -COLOR_RED=\e[31m\e[1m -COLOR_GREEN=\e[32m\e[1m -COLOR_YELLOW=\e[33m\e[1m -COLOR_BLUE=\e[34m\e[1m -COLOR_MAG=\e[35m\e[1m -COLOR_CYAN=\e[36m\e[1m -REVERT_COLOR=\e[m - -#----------------------------------------------------------------------- -# DO NOT EDIT THIS SECTION -ifeq ($(VERBOSE),YES) -export QUIET= -MK_QUIET= -else -export QUIET=@ -MK_QUIET=-s # Make works in quite mode -endif - diff --git a/src/build/config/ssi_mem b/src/build/config/ssi_mem deleted file mode 100755 index 56bcd46e1..000000000 --- a/src/build/config/ssi_mem +++ /dev/null @@ -1,75 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# Max number of Regions -5 -# Number of Buckets and Pools -4 4 -# Bucket Idx and Block Size -0 256 -1 1280 -2 2048 -3 8196 -# Region Idx -0 -# Bucket Idx and Number of blocks -0 10000 -1 500 -2 500 -3 500 -# Heap size -8194304U - -# Region Idx -1 -# Bucket Idx and Number of blocks -0 75000 -1 15000 -2 500 -3 1600 -# Heap size -1004800U - -# Region Idx -2 -# Bucket Idx and Number of blocks -0 65000 -1 8000 -2 600 -3 900 -# Heap size -6097512U - -# Region Idx -3 -# Bucket Idx and Number of blocks -0 75000 -1 15000 -2 500 -3 1600 -# Heap size -1004800U - -# Region Idx -4 -# Bucket Idx and Number of blocks -0 75000 -1 15000 -2 500 -3 1600 -# Heap size -1004800U - diff --git a/src/build/odu/makefile b/src/build/odu/makefile deleted file mode 100644 index 410c3babc..000000000 --- a/src/build/odu/makefile +++ /dev/null @@ -1,213 +0,0 @@ -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ - -# Master makefile - -# Identify the location our software which is used by rest -# of the build scripts - -include ../common/rsys_fancy.mak -include ../common/env.mak - -RULE=$(COLOR_RED) -OPTS=$(COLOR_GREEN) -NORM=$(REVERT_COLOR) - -# For improved speed -CPUINFO=`cat /proc/cpuinfo | grep processor| wc -l` -ifeq ($(CPUINFO), 1) - NUM_PARALLEL=1 -else - NUM_PARALLEL=$(shell echo $(CPUINFO) - 1 |bc) -endif - -ifeq ($(FAST), 1) - NUM_PARALLEL=$(shell echo $(CPUINFO) + 2 |bc) -endif - -PARALLEL_COMP=-j $(NUM_PARALLEL) - -# Different options to CPUH and CPUL builds -# # Other apsects of tool chain set here -# # These should be made available appropriately to the builds -ifeq ($(MACHINE),BIT64) -CC =gcc -m64 -CC_STRIP =strip --strip-all -CC_LINKER =gcc -m64 -CCPP =g++ -m64 -CCPP_LINKER =g++ -m64 -else -CC =gcc -m32 -CC_STRIP =strip --strip-all -CC_LINKER =gcc -m32 -CCPP =g++ -m32 -CCPP_LINKER =g++ -m32 -endif - -CC1= $(CC) -CCPP1= $(CCPP) - -ifeq ($(MODE),TDD) -CNM_ENABLE = YES -else -CNM_ENABLE=NO -endif - -#----------------------------------------------------------------------- -# macro for output file name and makefile name -# - -PLTFRM_FLAGS= -UMSPD -DODU - -ifeq ($(MODE),TDD) - PLTFRM_FLAGS += -DMODE=TDD -endif -ifeq ($(CA_ENABLE),YES) - PLTFRM_FLAGS += -DCA_ENABLE=YES -endif - -# The include options get merged with the options needed by -# # the called makefiles and hence we export these to make them -# # available to them. -BUILD=i686-linux - -# The called makefiles depend on these macros and these need to be exported -export PLTFRM -export PLTFRM_FLAGS -export BUILD -export I_OPTS - -# Add to the linker options the platform specific components -#L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp -L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp - -# Export some of the flags expected from the command line. -# # These macros are made available for the makefiles called from this makefile -export BOARD -export MACHINE -export MODE -export OAM_ENABLE -export CNM_ENABLE -export TEXT_LOG -export CA_ENABLE - -help: - @echo -e "******************************************************************" - @echo -e "BUILD COMMAND DESCRIPTION " - @echo -e "------------------------------------------------------------------" - @echo -e "$(RULE)odu - Builds all components of ODU$(NORM)" - @echo -e "$(RULE)cu_stub - Builds all CU Stub$(NORM)" - @echo -e "$(RULE)clean_odu - clean up ODU$(NORM)" - @echo -e "$(RULE)clean_cu - clean up CU Stub$(NORM)" - @echo -e "$(RULE)clean_all - cleanup everything$(NORM)" - @echo -e "$(OPTS) options: $(NORM)" - @echo -e "$(OPTS) MACHINE=BIT64/BIT32 - Default is BIT32$(NORM)" - @echo -e "$(OPTS) MODE=TDD - If not specified, MODE=FDD$(NORM)" - @echo -e "******************************************************************" - -prepare_dirs: - $(Q)echo -e "Preparing directories for build..." - $(Q)mkdir -p $(BUILD_DIR)/obj/odu - $(Q)mkdir -p $(LIB_ROOT)/odu - $(Q)mkdir -p $(ROOT_DIR)/libs/ - $(Q)mkdir -p $(BIN_DIR)/odu - $(Q)mkdir -p $(BIN_DIR)/config - $(Q)mkdir -p $(ROOT_DIR)/bin - $(Q)echo -e "Directories are successfully prepared" - -prepare_cu_dirs: - $(Q)echo -e "Preparing directories for build..." - $(Q)mkdir -p $(BUILD_DIR)/obj/cu_stub - $(Q)mkdir -p $(LIB_ROOT)/cu_stub - $(Q)mkdir -p $(BIN_DIR)/cu_stub - $(Q)echo -e "Directories are successfully prepared" - -du: - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rg.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - -link_du: du - $(Q)$(CC1) -g -o $(OBJ_ROOT)/odu/odu -Wl,-R../lib/:. $(OBJ_ROOT)/odu/*.o\ - $(L_OPTS) -L$(LIB_ROOT)/odu -L$(ROOT_DIR)/libs/odu - -clean_odu: - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rg.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)' - $(Q)rm -rf $(OBJ_ROOT)/odu/* - $(Q)rm -rf $(LIB_ROOT)/odu/* - $(Q)rm -rf $(BIN_DIR)/odu/* - $(Q)rm -rf $(ROOT_DIR)/bin/odu - $(Q)echo -e "***** ODU CLEAN COMPLETE *****" - -clean_all: clean_odu clean_cu - $(Q)rm -rf $(OBJ_ROOT) - $(Q)rm -rf $(LIB_ROOT) - $(Q)rm -rf $(LOG_ROOT) - $(Q)rm -rf $(BIN_DIR) - $(Q)rm -rf $(ROOT_DIR)/bin - $(Q)rm -rf $(ROOT_DIR)/libs - -cu: - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - -clean_cu: - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)' - $(Q)rm -rf $(OBJ_ROOT)/cu_stub/* - $(Q)rm -rf $(LIB_ROOT)/cu_stub/* - $(Q)rm -rf $(BIN_DIR)/cu_stub/* - $(Q)rm -rf $(ROOT_DIR)/bin/cu_stub - $(Q)echo -e "***** CU STUB CLEAN COMPLETE *****" - -link_cu: - $(Q)$(CC1) -g -o $(OBJ_ROOT)/cu_stub/cu_stub -Wl,-R../lib/:. $(OBJ_ROOT)/cu_stub/*.o\ - $(L_OPTS) -L$(LIB_ROOT)/cu_stub -L$(ROOT_DIR)/libs/cu_stub - $(Q)cp -f ./obj/cu_stub/cu_stub ./bin/cu_stub - $(Q)cp -rf ./bin/cu_stub $(ROOT_DIR)/bin/ - $(Q)echo -e "***** CU STUB BUILD COMPLETE *****" - -copy_build: link_du - $(Q)cp -f ./obj/odu/odu ./bin/odu - $(Q)cp -f ../config/ssi_mem ./bin/config - $(Q)cp -rf ./bin/odu $(ROOT_DIR)/bin/ - $(Q)cp -rf ./bin/config $(ROOT_DIR)/bin/ - $(Q)cp -f ./lib/odu/*.a $(ROOT_DIR)/libs/ - $(Q)echo -e "***** BUILD COMPLETE *****" - -odu: prepare_dirs copy_build - -cu_stub: prepare_cu_dirs cu link_cu - diff --git a/src/cm/cm_inet.c b/src/cm/cm_inet.c index 3dd19aba6..7f2142c8b 100644 --- a/src/cm/cm_inet.c +++ b/src/cm/cm_inet.c @@ -1917,7 +1917,7 @@ U16 port; /* port number */ /* cm_inet_c_001.main_64: New variable used as an argument for sctp_connectx */ #ifdef SCTP_CONNECTX_NEW - U32 assocId = 0; + U32 assocId = 0; #endif U32 addresses_array_size = 0; U32 idx4 = 0; @@ -2193,8 +2193,7 @@ U16 port; /* port number */ { RETVALUE(RFAILED); } -/* HLAL */ -#if 0 + #ifdef IPV6_SUPPORTED if((ipv6_array_size > 0) && (ipv6_array_size <= (CM_INET_NUM_NET_ADDR * \ sizeof(struct sockaddr_in)))) @@ -2206,7 +2205,7 @@ U16 port; /* port number */ RETVALUE(RFAILED); } #endif /* IPV6_SUPPORTED */ -#endif + /* cm_inet_c_001.main_64: Support for new definition of sctp_connectx */ #ifndef SCTP_CONNECTX_NEW ret = sctp_connectx(sockFd->fd, (struct sockaddr*)address_array, cnt); diff --git a/src/cm/cm_mem.c b/src/cm/cm_mem.c index 41a6843f5..cfb865c49 100755 --- a/src/cm/cm_mem.c +++ b/src/cm/cm_mem.c @@ -5343,12 +5343,6 @@ U16 bktIdx; ptrHdr->reqSz = reqSz; ptrHdr->allocSz = allocSz; ptrHdr->bktIdx = bktIdx; -#if 0 - for(btrIdx = 0; btrIdx < BRDCM_MEM_LEAK_BTRACE; btrIdx++) - { - // ptrHdr->backTrace[btrIdx] = __builtin_return_address(btrIdx); - } -#endif cmHashListInsert(®Cb->brdcmSsiLstCp, (PTR)ptrHdr, (U8 *)&(ptrHdr), sizeof(PTR)); #else @@ -5987,50 +5981,6 @@ Void *arg; RETVALUE(0); } /* cmLeakCallBack */ -#if 0 -/* -* -* Fun: backtrace -* -* Desc: Initializes the memory leak detection module -* -* -* Ret: RETVOID -* -* Notes: This function initializes the memory leak detection module. -* -* -* File: cm_mem.c -* -*/ -#ifdef ANSI -PUBLIC S32 backtrace -( -Void **buffer, -S32 count -) -#else -PUBLIC S32 backtrace(buffer, count) -Void **buffer; -S32 count; -#endif -{ - TRC3(backtrace); - - Backtrace_t bt; - ucontext_t u; - - bt.bt_buffer = buffer; - bt.bt_maxcount = count; - bt.bt_actcount = 0; - - if (getcontext(&u) < 0) - RETVALUE(0); - (Void) walkcontext(&u, cmLeakCallBack, &bt); - RETVALUE(bt.bt_actcount); - -} /* backtrace */ -#endif #endif /* SS_MEM_LEAK_SOL */ #endif /* SS_MEM_LEAK_STS */ diff --git a/src/cm/cm_mem_wl.c b/src/cm/cm_mem_wl.c index fc3183107..e15e5223c 100755 --- a/src/cm/cm_mem_wl.c +++ b/src/cm/cm_mem_wl.c @@ -284,73 +284,6 @@ PRIVATE S16 cmHeapFree ARGS((CmMmHeapCb *heapCb, Data *ptr, Size size)); #endif PRIVATE S16 cmCtl ARGS((Void *regionCb, Event event, SMemCtl *memCtl)); PRIVATE Void cmMmHeapInit ARGS((Data *memAddr, CmMmHeapCb *heapCb, Size size)); -#if 0 -#ifdef SS_HISTOGRAM_SUPPORT -#ifdef SSI_DEBUG_LEVEL1 -PRIVATE S16 cmAlloc ARGS((Void *regionCb, Size *size, U32 flags, Data **ptr, - U32 memType, U32 line, U8 *fileName, U8 entId, Bool hstReg)); -PRIVATE S16 cmHeapAlloc ARGS((CmMmHeapCb *heapCb, Data **ptr, Size *size, U32 memType, U32 line, U8 *fileName, U8 entId, Bool hstReg)); -/*cm_mem_c_001.main_20-added new functionto allocate memory from new region*/ -#else -PRIVATE S16 cmHeapAlloc ARGS((CmMmHeapCb *heapCb, Data **ptr, Size *size, - U32 line, U8 *fileName, U8 entId, Bool hstReg)); -PRIVATE S16 cmAlloc ARGS((Void *regionCb, Size *size, U32 flags, Data **ptr, - U32 line, U8 *fileName, U8 entId, Bool hstReg)); -#endif /* SSI_DEBUG_LEVEL1 */ - -PRIVATE S16 cmFree ARGS((Void *regionCb, Data *ptr, Size size, U32 line, - U8 *fileName, U8 entId, Bool hstReg)); - -PRIVATE S16 cmHeapFree ARGS((CmMmHeapCb *heapCb, Data *ptr, Size size, - U32 line, U8 *fileName, U8 entId, Bool hstReg)); -#else /* no histogram support */ -/* cm_mem_c_001.main_12 - prototype is changed to accept memType(static/dynamic) */ -#ifdef SSI_DEBUG_LEVEL1 -PRIVATE S16 cmHeapAlloc ARGS((CmMmHeapCb *heapCb, Data **ptr, Size *size, U32 memType)); -#else -PRIVATE S16 cmHeapAlloc ARGS((CmMmHeapCb *heapCb, Data **ptr, Size *size)); -#endif /* SSI_DEBUG_LEVEL1 */ -PRIVATE S16 cmHeapFree ARGS((CmMmHeapCb *heapCb, Data *ptr, Size size)); -/* cm_mem_c_001.main_15 :Additions */ -#ifdef SSI_DEBUG_LEVEL1 -PRIVATE S16 cmAlloc ARGS((Void *regionCb, Size *size, U32 flags, Data **ptr, U32 memType)); -#else -PRIVATE S16 cmAlloc ARGS((Void *regionCb, Size *size, U32 flags, Data **ptr)); -#endif /* SSI_DEBUG_LEVEL1 */ -PRIVATE S16 cmFree ARGS((Void *regionCb, Data *ptr, Size size)); -#endif /* SS_HISTOGRAM_SUPPORT */ - -/*cm_mem_c_001.main_23 Removed support of SSI_DEBUG_LEVEL1 and SS_HISTOGRAM_SUPPORT for SS_FAP*/ -#ifdef SS_FAP -PRIVATE S16 cmAllocWL ARGS((Void *regionCb, Size *size, U32 flags, Data **ptr)); -PRIVATE S16 cmFreeWL ARGS((Void *regionCb, Data *ptr, Size size)); -#endif - - -PRIVATE Void cmMmBktInit ARGS((Data **memAddr, CmMmRegCb *regCb, - CmMmRegCfg *cfg, U16 bktIdx, U16 *lstMapIdx)); - -/* cm_mem_c_001.main_12 - addition of protoypes for sanity check and hash list functions */ -#ifdef SSI_DEBUG_LEVEL1 -PRIVATE S16 cmMmBktSanityChk ARGS((CmMmBkt *bkt)); -PRIVATE S16 cmMmHeapSanityChk ARGS((CmMmHeapCb *heapCb)); -PRIVATE S16 cmMmHashFunc ARGS((CmMmHashListCp *hashListCp, U32 key, U16 *idx )); -PRIVATE S16 cmMmHashListInit ARGS((CmMmHashListCp *hashListCp, U16 nmbBins, - Region region, Pool pool)); -PRIVATE S16 cmMmHashListDeinit ARGS((CmMmHashListCp *hashListCp, Region region, Pool pool)); -PRIVATE S16 cmMmHashListInsert ARGS((CmMmHashListCp *hashListCp, U32 key)); -#endif /* SSI_DEBUG_LEVEL1 */ -/* cm_mem_c_001.main_15 : Addtions */ -#ifdef SS_HISTOGRAM_SUPPORT -PRIVATE S16 cmHstGrmAllocInsert ARGS((CmHstGrmHashListCp *hashListCp, U32 blkSz, U32 *reqSz, U32 line, U8 *fileName, U8 entId)); -PRIVATE S16 cmHstGrmFreeInsert ARGS((CmHstGrmHashListCp* hashListCp, U32 blkSz, U32 line, U8 *fileName, U8 entId)); -PRIVATE S16 cmHstGrmHashListInit ARGS((CmHstGrmHashListCp *hashListCp)); -PRIVATE S16 cmHstGrmHashListDeInit ARGS((CmHstGrmHashListCp *hashListCp)); -PRIVATE S16 cmHstGrmGetHashIdxAndKey ARGS((U8 *fileName, U32 line, U32 *binIdx, U32 *key)); -PRIVATE S16 cmHstGrmFindEntry ARGS((CmHstGrmHashListCp *hashListCp, U32 key, U32 *binIdx, CmMemEntries **entry)); -PRIVATE S16 cmHstGrmFillEntry ARGS((CmMemEntries *entry, U32 key, U32 line, U8 *fileName, U8 entId)); -#endif /* SS_HISTOGRAM_SUPPORT */ -#endif /* cm_mem_c_001.main_22: Fixing warnings on GCC compiler */ #ifdef __cplusplus @@ -402,9 +335,6 @@ PRIVATE Txt dbgPrntBuf[200]; /* print buffer */ U32 num_times = 0; EXTERN pthread_t tmpRegTidMap[20]; -#if 0 -EXTERN pthread_t tmpMainTid; -#endif extern Bool g_usettitmr; PUBLIC void DumpLayersDebugInformation() { @@ -433,7 +363,7 @@ PUBLIC void DumpLayersDebugInformation() #else //DumpPDCPDlDebugInformation(); //DumpPDCPUlDebugInformation(); -#ifdef CU_STUB +#ifndef ODU_TEST_STUB DumpRLCDlDebugInformation(); DumpRLCUlDebugInformation(); #endif @@ -861,121 +791,6 @@ CmMmRegCfg *cfg; RETVALUE(ROK); } /* end of cmMmRegInit*/ -#if 0 -/* -* -* Fun: ssPutDynBufSet -* -* Desc: Puts the set of dynamic buffers into the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: -* -* File: cm_mem_wl.c -* -*/ -#ifdef ANSI -PUBLIC S16 ssPutDynBufSet -( -U8 bktIdx, -CmMmBktLstCb *bktLstCb -) -#else -PUBLIC S16 ssPutDynBufSet(bktIdx, bktLstCb) -U8 bktIdx; -CmMmBktLstCb *bktLstCb; -#endif -{ - CmMmGlobRegCb *globReg; - CmMmDynBktCb *bktCb; - - TRC1(ssPutDynBufSet); - - globReg = &osCp.globRegCb; - - if(bktIdx > CMM_MAX_BKT_ENT) - { - RETVALUE(RFAILED); - } - - bktCb = &(globReg->bktTbl[bktIdx]); - - /* Lock the global region first */ - SLock(&(globReg->regLock)); - - cmLListAdd2Tail(&(bktCb->listBktSet), bktLstCb); - - SUnlock(&(globReg->regLock)); - - RETVALUE(ROK); -} - -/* -* -* Fun: ssGetDynBufSet -* -* Desc: Gets the set of dynamic buffers into the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: -* -* File: cm_mem_wl.c -* -*/ -#ifdef ANSI -PUBLIC S16 ssGetDynBufSet -( -U8 bktIdx, -CmMmBktLstCb **bktLstCb -) -#else -PUBLIC S16 ssGetDynBufSet(bktIdx, bktLstCb) -U8 bktIdx; -CmMmBktLstCb **bktLstCb; -#endif -{ - CmMmGlobRegCb *globReg; - CmMmDynBktCb *bktCb; - CmLList *lstNode; - - TRC1(ssGetDynBufSet); - - globReg = &osCp.globRegCb; - - if(bktIdx > CMM_MAX_BKT_ENT) - { - RETVALUE(RFAILED); - } - - *bktLstCb = NULLP; - bktCb = &(globReg->bktTbl[bktIdx]); - - /* Lock the global region first */ - SLock(&(globReg->regLock)); - - lstNode = cmLListFirst(&(bktCb->listBktSet)); - - if(lstNode == NULLP) - { - SUnlock(&(globReg->regLock)); - RETVALUE(RFAILED); - } - - cmLListDelFrm(&(bktCb->listBktSet), lstNode); - SUnlock(&(globReg->regLock)); - - *bktLstCb = (CmMmBktLstCb *)lstNode->node; - - RETVALUE(ROK); -} -#endif - /* * @@ -1377,11 +1192,6 @@ Size size; /* Size of the block */ #endif /*TL_Free(regCb->iccHdl, ptr);*/ -#if 0 - if(a < 10) - printf("FREE -ICC Addr Before PA2VA %x After PA2VA %x\n", memPtr, ptr); - a++; -#endif RETVALUE(ROK); } /* end of cmIccFree */ @@ -1435,12 +1245,6 @@ CmMmDynRegCb *regCb; #ifdef T2200_2GB_DDR_CHANGES sprintf(regIccStr, "RxID=%d", (regCb->region + 1)); #else -#if 0 - sprintf(regIccStr, "RxID=%d", (regCb->region + 1)); -#else - //snprintf(regIccStr, sizeof(regIccStr), "QueueSize=%u RxID=%u", 1024, (regCb->region + 1)); - - // snprintf(regIccStr, sizeof(regIccStr), "QueueSize=%u RxID=%u", 2048, (regCb->region + 1)); #ifdef L2_L3_SPLIT if(clusterMode == RADIO_CLUSTER_MODE) { @@ -1465,7 +1269,6 @@ CmMmDynRegCb *regCb; sprintf (regIccStr, "queuesize=%d rxid=%d", 512, (regCb->region) + 1); #endif #endif -#endif #endif printf(" %s \n",regIccStr); regCb->iccHdl = TL_Open(regIccStr, 0); @@ -1593,22 +1396,6 @@ CmMmDynRegCb *regCb; } /* Initialize the bucket structure */ -#if 0 - regCb->bktTbl[bktIdx].numAlloc = 0; - regCb->bktTbl[bktIdx].maxAlloc = 0; - - /* Update the total bucket size */ - regCb->bktSize += (regCb->bktTbl[bktIdx].size * regCb->bktTbl[bktIdx].numBkt); - - regCb->bktTbl[bktIdx].bktFailCnt = 0; - regCb->bktTbl[bktIdx].bktNoFitCnt = 0; - - if(regCb->bktMaxBlkSize < regCb->bktTbl[bktIdx].size) - { - regCb->bktMaxBlkSize = regCb->bktTbl[bktIdx].size; - } -#endif - for(idx = 0; idx < numBkts; idx++) { regCb->bktTbl[idx].crntMemBlkSetElem = NULLP; @@ -1623,7 +1410,6 @@ CmMmDynRegCb *regCb; /* Call SRegRegion to register the memory region with SSI */ cmMemset((U8*)®Info, 0, sizeof(regInfo)); -#if 1 if((SS_MAX_REGS - 1) == regCb->region) { regInfo.alloc = cmDynAllocWithLock; @@ -1634,26 +1420,9 @@ CmMmDynRegCb *regCb; } } else -#endif { -#if 0 - static dynLockCreated; - regInfo.alloc = cmDynAllocWithLock; - regInfo.free = cmDynFreeWithLock; - if ( dynLockCreated == 0) - { - if((SInitLock((&dynAllocFreeLock), SS_LOCK_MUTEX)) != ROK) - { - printf("Failed to initialize the lock region lock\n"); - } - dynLockCreated = 1; - } -#endif - -#if 1 regInfo.alloc = cmDynAlloc; regInfo.free = cmDynFree; -#endif } regInfo.regCb = regCb; @@ -1857,12 +1626,6 @@ CmMmDynBktCb *bkt; /* Bucket list control block */ bkt->crntMemBlkSetElem = memBlkSetElem; } -#if 0 - if(memBlkSetElem->nextBktPtr == NULLP) - { - ssGetDynMemBlkSet(bucketIndex, memBlkSetElem); - } -#endif /* If we have reached the threshold value, get the next set of buckets from * the global region and place it */ if(memBlkSetElem->numFreeBlks < bkt->blkSetAcquireThreshold) @@ -2013,10 +1776,6 @@ CmMmDynBktCb *bkt; /* Bucket list control block */ */ ssPutDynMemBlkSet(bucketIndex, nextMemBlkSetElem, (bkt->bucketSetSize - memBlkSetElem->numFreeBlks - 1)); -#if 0 - nextMemBlkSetElem->numFreeBlks = 0; - nextMemBlkSetElem->nextBktPtr = NULLP; -#endif } } @@ -2337,11 +2096,6 @@ Data **ptr; /* Reference to pointer for which need to be allocate */ #ifdef SS_MEM_WL_DEBUG prvAllocPtr[regCb->region] = *ptr; -#if 0 - if(regCb->region == 6) - printf("cmDynAlloc: PTR = %x\n", *ptr); - **ptr = (U32) ((bktIdx << 4) | 0x0f); -#endif **ptr = (U8) bktIdx; *(*ptr+1) = 0xde; @@ -2360,9 +2114,6 @@ Data **ptr; /* Reference to pointer for which need to be allocate */ btInfo->btInfo[btIdx].btSize = backtrace(btInfo->btInfo[btIdx].btArr, NUM_BT_TRACES); } gettimeofday(&(btInfo->btInfo[btIdx].timeStamp), NULLP); -#if 0 - cmInsertAllocPtrToList(regCb, (PTR)*ptr); -#endif btIdx++; btIdx &= (NUM_FREE_BUFFERS - 1); @@ -2768,10 +2519,6 @@ Data **ptr; /*printf("cmAlloc: bktIdx %u overused %u numAlloc %u\n", bktIdx, g_overused[bktIdx], bkt->numAlloc); */ } } -#if 0 - if(bkt->numAlloc < 100) - printf("cmAlloc: Allocated PTR = %x size = %d\n", *ptr, *size); -#endif /* cm_mem_c_001.main_12 - addition for header manipulation */ #ifdef SSI_DEBUG_LEVEL1 @@ -3064,44 +2811,6 @@ U32 idx; CmBtInfo *btInfo; U8 regIdx; -#if 0 - for(regIdx = 0; regIdx < 8; regIdx++) - { - btInfo = & regBtInfo[regIdx]; - btIdx = btInfo->btInfoIdx; - - for (tmpCnt = 0; tmpCnt < NUM_FREE_BUFFERS; tmpCnt++) - { -#if 0 - if ((btInfo->btInfo[btIdx].ptr >= ptr) && - (btInfo->btInfo[btIdx].ptr + 128 ) >= ptr) - -#endif - if(btInfo->btInfo[btIdx].btSize != 0) - { - U32 i; - char **strings; - strings = backtrace_symbols( btInfo->btInfo[btIdx].btArr,btInfo->btInfo[btIdx].btSize); - printf("*** Last Free Region = %d PTR %x Timestamp sec = (%ld) usec = (%ld) ***\n", idx, ptr, btInfo->btInfo[btIdx].timeStamp.tv_sec, btInfo->btInfo[btIdx].timeStamp.tv_usec); - for (i=0; i < btInfo->btInfo[btIdx].btSize; i++) - { - printf("%s\n", strings[i]); - } - printf("*******************************************************\n"); - - free(strings); - } - - btIdx--; - if (btIdx == 0) - { - btIdx = NUM_FREE_BUFFERS - 1; - } - } - } -#endif - - /* for(regIdx = 0; regIdx < 8; regIdx++) { */ idx = 2; @@ -3337,9 +3046,6 @@ Size size; /* Size of the block */ { btInfo->btInfo[btIdx].btSize = backtrace(btInfo->btInfo[btIdx].btArr, NUM_BT_TRACES); } -#if 0 - cmRemoveAllocPtrFromList(regCb, (ptr + sizeof(U32))); -#endif gettimeofday(&(btInfo->btInfo[btIdx].timeStamp), NULLP); btIdx++; @@ -3705,31 +3411,10 @@ Size size; bkt->nextBlk = ptrHdr; #else /* MS_REMOVE */ -#if 0 - /* sriky: For debugging double deallocation */ - cmMemset(ptr, 0, 50); -#endif *((CmMmEntry **)ptr) = bkt->next; bkt->next = (CmMmEntry *)ptr; #endif /* SSI_DEBUG_LEVEL1 */ -#if 0 - if(bkt->numAlloc <= 0 || bkt->numAlloc > 12000) - { - void *array[10]; - size_t tmpsize, i; - char **strings; - - printf("\n cmFree: Freed pointer = %x and backtrace:\n", ptr); - printf("****************************************\n"); - tmpsize = backtrace(array, 10); - strings = backtrace_symbols(array, tmpsize); - for(i = 0; i < tmpsize; i++) - printf("%s\n", strings[i]); - printf("****************************************\n"); - free(strings); - } -#endif /* * Decrement the statistics variable of number of memory block * allocated @@ -4041,14 +3726,6 @@ Size size; /* * Check if the memory block was allocated from the bucket pool. */ -#if 0 - if(ptr < regCb->regInfo.start) - { - Buffer *tmpbuf = NULLP; - tmpbuf->b_cont = NULLP; - } -#endif - #ifdef MSPD_T2K_TRACK_BUG size += 4; #endif @@ -4101,32 +3778,6 @@ Size size; */ bkt->numAlloc--; -#if 0 - if ((regCb->region == 2) && (bkt->numAlloc < 50)) - { - CmBtInfo *btInfo; - U32 btIdx; - btInfo = &allocBtInfo[regCb->region]; - btIdx = btInfo->btInfoIdx; - btInfo->btInfo[btIdx].ptr = (PTR) *ptr; - { - btInfo->btInfo[btIdx].btSize = backtrace(btInfo->btInfo[btIdx].btArr, NUM_BT_TRACES); - } -#if 0 - gettimeofday(&(btInfo->btInfo[btIdx].timeStamp), NULLP); - cmInsertAllocPtrToList(regCb, (PTR)*ptr); -#endif - - btIdx++; - btIdx &= (NUM_FREE_BUFFERS - 1); - - btInfo->btInfo[btIdx].ptr = (PTR)0; - btInfo->btInfo[btIdx].btSize = 0; - cmMemset(btInfo->btInfo[regCb->mapTbl[idx].bktIdx].btArr, 0, sizeof (btInfo->btInfo[regCb->mapTbl[idx].bktIdx].btArr)); - btInfo->btInfoIdx = btIdx; - } -#endif - RETVALUE(ROK); } @@ -4291,131 +3942,6 @@ SMemCtl *memCtl; } /* end of cmCtl */ -#if 0 -/* -* -* Fun: cmMmBktInit -* -* Desc: Initialize the bucket and the map table. -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: This function is called by the cmMmRegInit. -* -* File: cm_mem_wl.c -* -*/ -#ifdef ANSI -PRIVATE Void cmMmBktInit -( -Data **memAddr, -CmMmRegCb *regCb, -CmMmRegCfg *cfg, -U16 bktIdx, -U16 *lstMapIdx -) -#else -PRIVATE Void cmMmBktInit (memAddr, regCb, cfg, bktIdx, lstMapIdx) -Data **memAddr; -CmMmRegCb *regCb; -CmMmRegCfg *cfg; -U16 bktIdx; -U16 *lstMapIdx; -#endif -{ - U32 cnt; - U16 idx; - U32 numBlks; - Size size; - Data **next; - U16 blkSetRelThreshold; - CmMmBktLstCb *bktLstCb; - - TRC2(cmMmBktInit); - - - size = cfg->bktCfg[bktIdx].size; - numBlks = cfg->bktCfg[bktIdx].numBlks; - - regCb->bktTbl[bktIdx].blkSetRelThreshold = cfg->bktCfg[bktIdx].blkSetRelThreshold; - regCb->bktTbl[bktIdx].blkSetAcquireThreshold = cfg->bktCfg[bktIdx].blkSetAcquireThreshold; - blkSetRelThreshold = cfg->bktCfg[bktIdx].blkSetRelThreshold; - - /* Initialize the bucket linked list */ - cmLListInit(®Cb->bktTbl[bktIdx].listBktSet); - - /* Reset the next pointer */ - regCb->bktTbl[bktIdx].next = NULLP; - - /* Initialize the link list of the memory block */ - next = &(regCb->bktTbl[bktIdx].next); - for (cnt = 0; cnt < numBlks; cnt++) - { - *next = *memAddr; - next = (CmMmEntry **)(*memAddr); - *memAddr = (*memAddr) + size; - - /* Maintain the list Cb */ - if((cnt != 0) && (!(cnt % blkSetRelThreshold))) - { - bktLstCb = calloc(1, sizeof(CmMmBktLstCb)); - bktLstCb->nextBktPtr = regCb->bktTbl[bktIdx].next; - bktLstCb->numBkt = blkSetRelThreshold; - cmLListAdd2Tail((®Cb->bktTbl[bktIdx].listBktSet), (&bktLstCb->memSetNode)); - next = &(regCb->bktTbl[bktIdx].next); - regCb->numBkts++; - } - } - *next = NULLP; - - bktLstCb = cmLListFirst((®Cb->bktTbl[bktIdx].listBktSet)); - regCb->bktTbl[bktIdx].next = bktLstCb->nextBktPtr; - cmLListDelFrm((®Cb->bktTbl[bktIdx].listBktSet), bktLstCb); - free(bktLstCb); - - /* Initialize the Map entry */ - idx = size / cfg->bktQnSize; - - /* - * Check if the size is multiple of quantum size. If not we need to initialize - * one more map table entry. - */ - if(size % cfg->bktQnSize) - { - idx++; - } - - while ( *lstMapIdx < idx) - { - regCb->mapTbl[*lstMapIdx].bktIdx = bktIdx; - -#if (ERRCLASS & ERRCLS_DEBUG) - regCb->mapTbl[*lstMapIdx].numReq = 0; - regCb->mapTbl[*lstMapIdx].numFailure = 0; -#endif - - (*lstMapIdx)++; - } - - /* Initialize the bucket structure */ - regCb->bktTbl[bktIdx].size = size; - regCb->bktTbl[bktIdx].numBlks = numBlks; - regCb->bktTbl[bktIdx].numAlloc = 0; - regCb->bktTbl[bktIdx].maxAlloc = 0; - - /* Update the total bucket size */ - regCb->bktSize += (size * numBlks); - - regCb->bktTbl[bktIdx].bktFailCnt = 0; - regCb->bktTbl[bktIdx].bktNoFitCnt = 0; - - RETVOID; -} /* end of cmMmBktInit */ -#endif - - /* * * Fun: cmMmHeapInit @@ -6950,29 +6476,6 @@ CmMemEntries **entry; T2kMeamLeakInfo gMemLeakInfo[T2K_MEM_LEAK_INFO_TABLE_SIZE]; U32 getT2kMemLeakIndex(U32 address) { -#if 0 - /* - 1 2 3 4 5 6 7 - - XOR 7 with 3 and remove 7 - XOR 1 with 5 and remove 1 - */ - - address -= T2K_MEM_LEAK_START_ADDR; - - U8 Nib7 = address & 0x0000000f; - U8 Nib1 = (address & 0x0f000000) >>24; - U8 Nib3 = (address & 0x000f0000) >> 16; - U8 Nib5 = (address & 0x00000f00) >> 8; - - /* store 8 ^ 3 in 8Nib */ - Nib7 = Nib7 ^ Nib3; - /* store 1 ^ 6 in 6Nib */ - Nib5 = Nib5 ^ Nib1; - - return(((address & 0x000fff00) | (Nib7 << 20) | (Nib5 << 4)) >> 4); - -#endif return ((address - T2K_MEM_LEAK_START_ADDR) >> 8); } @@ -7014,32 +6517,6 @@ void InsertToT2kMemLeakInfo(U32 address, U32 size, U32 lineNo, char* fileName) gMemLeakInfo[idx].address, gMemLeakInfo[idx].fileName, gMemLeakInfo[idx].lineNo, gMemLeakInfo[idx].size, gMemLeakInfo[idx].age, (t2kMemAllocTick-gMemLeakInfo[idx].age)); -#if 0 - /* Try inserting into some other location */ - int i; - int lastIndex = idx + 1; - Bool inserted = FALSE; - for(i = 2; lastIndex < T2K_MEM_LEAK_INFO_TABLE_SIZE && i < 30; i++) - { - if(gMemLeakInfo[lastIndex].address == 0) - { - gMemLeakInfo[lastIndex].address = address; - gMemLeakInfo[lastIndex].size = size; - gMemLeakInfo[lastIndex].lineNo = lineNo; - gMemLeakInfo[lastIndex].fileName = fileName; - gMemLeakInfo[lastIndex].age = (++t2kMemAllocTick) >> 14; /*For every 16384 memory block allocations,Alloc Tick is incremented by 1*/ - inserted = TRUE; - break; - } - lastIndex = idx + (i * i * i); - } -#if 1 - if(!inserted) - { - printf("Something is wrong, trying to insert %x idx = %d no free i = %d\n",address, idx, i); - } -#endif -#endif } } @@ -7082,32 +6559,6 @@ void RemoveFromT2kMemLeakInfo(U32 address, char *file, U32 line) printf("Previous File:%s, Previous Line:%ld\n", gMemLeakInfo[idx].prevRemFileName, gMemLeakInfo[idx].prevRemLineNo); } -#if 0 - /* Try removing from some other location where it might have been stored*/ - int i; - int lastIndex = idx + 1; - Bool removed = FALSE; - for(i = 2; lastIndex < T2K_MEM_LEAK_INFO_TABLE_SIZE && i < 30; i++) - { - if(gMemLeakInfo[lastIndex].address == address) - { - gMemLeakInfo[lastIndex].address = 0; - gMemLeakInfo[lastIndex].size = 0; - gMemLeakInfo[lastIndex].lineNo = 0; - gMemLeakInfo[lastIndex].fileName = 0; - gMemLeakInfo[lastIndex].age = 0; /*For every 16384 memory block allocations,Alloc Tick is incremented by 1*/ - removed = TRUE; - break; - } - lastIndex = idx + (i*i*i); - } -#if 1 - if(!removed) - { - printf("Something is wrong, trying to remove %x idx = %d lastIndex = %d FreeCalled from File=%s, line=%d\n",address, idx, lastIndex,file,line); - } -#endif -#endif } } @@ -7419,196 +6870,6 @@ Region reg; } #endif #endif /* SS_LOCKLESS_MEMORY */ -#if 0 -T2kMeamLeakInfo gMemLeakInfo[T2K_MEM_LEAK_INFO_TABLE_SIZE]; -U32 getT2kMemLeakIndex(U32 address) -{ -#if 0 - /* - 1 2 3 4 5 6 7 - - XOR 7 with 3 and remove 7 - XOR 1 with 5 and remove 1 - */ - - address -= T2K_MEM_LEAK_START_ADDR; - - U8 Nib7 = address & 0x0000000f; - U8 Nib1 = (address & 0x0f000000) >>24; - U8 Nib3 = (address & 0x000f0000) >> 16; - U8 Nib5 = (address & 0x00000f00) >> 8; - - /* store 8 ^ 3 in 8Nib */ - Nib7 = Nib7 ^ Nib3; - /* store 1 ^ 6 in 6Nib */ - Nib5 = Nib5 ^ Nib1; - - return(((address & 0x000fff00) | (Nib7 << 20) | (Nib5 << 4)) >> 4); - -#endif - return ((address - T2K_MEM_LEAK_START_ADDR) >> 8); -} - -static U32 t2kMemAllocTick; -static U32 smallTick; - -void InsertToT2kMemLeakInfo(U32 address, U32 size, U32 lineNo, char* fileName) -{ - U32 index = getT2kMemLeakIndex(address); - - if(((U32)(address - T2K_MEM_LEAK_START_ADDR) & 0xff) !=0) - { - printf("address in InsertToT2kMemLeakInfo is %x size = %d file is %s line is %d \n", address, size, fileName, lineNo); - } - - if(gMemLeakInfo[index].address == 0) - { - gMemLeakInfo[index].address = address; - gMemLeakInfo[index].size = size; - gMemLeakInfo[index].lineNo = lineNo; - gMemLeakInfo[index].fileName = fileName; - gMemLeakInfo[index].age = t2kMemAllocTick; - gMemLeakInfo[index].prevRemLineNo = 0; - gMemLeakInfo[index].prevRemFileName = '\0'; - - if(smallTick++ == 4096) - { - smallTick = 0; - gMemLeakInfo[index].age = (++t2kMemAllocTick); - } - } - else - { - printf("Something is wrong, trying to insert %x index = %d file is %s line is %d \n",address, index, fileName, lineNo); - printf("Address present :%x, from File:%s, Line:%d, Size:%d, Age:%d", - gMemLeakInfo[index].address, gMemLeakInfo[index].fileName, - gMemLeakInfo[index].lineNo, gMemLeakInfo[index].size, - gMemLeakInfo[index].age); -#if 0 - /* Try inserting into some other location */ - int i; - int lastIndex = index + 1; - Bool inserted = FALSE; - for(i = 2; lastIndex < T2K_MEM_LEAK_INFO_TABLE_SIZE && i < 30; i++) - { - if(gMemLeakInfo[lastIndex].address == 0) - { - gMemLeakInfo[lastIndex].address = address; - gMemLeakInfo[lastIndex].size = size; - gMemLeakInfo[lastIndex].lineNo = lineNo; - gMemLeakInfo[lastIndex].fileName = fileName; - gMemLeakInfo[lastIndex].age = (++t2kMemAllocTick) >> 14; /*For every 16384 memory block allocations,Alloc Tick is incremented by 1*/ - inserted = TRUE; - break; - } - lastIndex = index + (i * i * i); - } -#if 1 - if(!inserted) - { - printf("Something is wrong, trying to insert %x index = %d no free i = %d\n",address, index, i); - } -#endif -#endif - } -} - - -void RemoveFromT2kMemLeakInfo(U32 address, char *file, U32 line) -{ - U32 index = getT2kMemLeakIndex(address); - - if(index >= T2K_MEM_LEAK_INFO_TABLE_SIZE) - { - printf("Index out of range = %d address is %x file = %s line = %d. We are going to crash!!!\n", - index, - address, - file, - line); - } - if(gMemLeakInfo[index].address == address) - { - gMemLeakInfo[index].address = 0; - gMemLeakInfo[index].age = 0; - gMemLeakInfo[index].prevRemLineNo = gMemLeakInfo[index].lineNo; - gMemLeakInfo[index].prevRemFileName = gMemLeakInfo[index].fileName; - - /*printf("Something is wrong, Trying to double free Address = %x, Index = %d \n",address,index);*/ - } - else - { - printf("Something is wrong, trying to remove %x index = %d from File=%s, line=%d address present is %x\n",address, index, file,line, - gMemLeakInfo[index].address); - if(gMemLeakInfo[index].prevRemFileName != NULLP) - { - printf("Previous File:%s, Previous Line:%d\n", - gMemLeakInfo[index].prevRemFileName, gMemLeakInfo[index].prevRemLineNo); - } -#if 0 - /* Try removing from some other location where it might have been stored*/ - int i; - int lastIndex = index + 1; - Bool removed = FALSE; - for(i = 2; lastIndex < T2K_MEM_LEAK_INFO_TABLE_SIZE && i < 30; i++) - { - if(gMemLeakInfo[lastIndex].address == address) - { - gMemLeakInfo[lastIndex].address = 0; - gMemLeakInfo[lastIndex].size = 0; - gMemLeakInfo[lastIndex].lineNo = 0; - gMemLeakInfo[lastIndex].fileName = 0; - gMemLeakInfo[lastIndex].age = 0; /*For every 16384 memory block allocations,Alloc Tick is incremented by 1*/ - removed = TRUE; - break; - } - lastIndex = index + (i*i*i); - } -#if 1 - if(!removed) - { - printf("Something is wrong, trying to remove %x index = %d lastIndex = %d FreeCalled from File=%s, line=%d\n",address, index, lastIndex,file,line); - } -#endif -#endif - } -} - -void DumpT2kMemLeakInfoToFile() -{ - int i; - - FILE *fp = fopen("memLeakInfo.txt","wb"); - - if(fp == NULL) - { - printf("Could not open file for dumping mem leak info\n"); - return; - } - - for(i = 0; i< T2K_MEM_LEAK_INFO_TABLE_SIZE; i++) - { - if(gMemLeakInfo[i].address != 0) - { - char* onlyFileName = rindex(gMemLeakInfo[i].fileName,'/'); - if(onlyFileName == NULL) - { - onlyFileName = gMemLeakInfo[i].fileName; - } - - fprintf(fp, "%p s=%d a=%d l=%d f=%s\n",gMemLeakInfo[i].address, - gMemLeakInfo[i].size, - gMemLeakInfo[i].age, - gMemLeakInfo[i].lineNo, - onlyFileName); - } - } - - fprintf(fp,"Current t2kMemAllocTick = %d\n",t2kMemAllocTick); - - fclose(fp); -} -#endif - /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/cm_mem_wl.x b/src/cm/cm_mem_wl.x index 6d42a4d2d..91bfb80a4 100755 --- a/src/cm/cm_mem_wl.x +++ b/src/cm/cm_mem_wl.x @@ -75,20 +75,6 @@ struct cmMmBlkSetElement used for the allocation */ }; -#if 0 -/* This structre is used for the storing the bucket set information in the - * system task region. At present the number of array is used for two. - * The array is indexed using the crntBktNodeIdx value during allocation - * or deallocation */ -struct cmMmDynMemElem -{ - U32 numBkt; /* Number of buckets avilable in the current - set */ - CmMmEntry *nextBktPtr; /* Address of the first bucket which will be - used for the allocation */ -}; -#endif - /* The following structure is used for the storing the buckets/pools * this will be present for each bucket which is configured and * will contains the all the information about the bucket. This @@ -512,21 +498,6 @@ EXTERN S16 ssGetDynMemBlkSet ARGS((U8 bktIdx, CmMmBlkSetElement *dynMemSetElem, #endif #ifdef T2K_MEM_LEAK_DBG -#if 0 -typedef struct _t2kMemLeakInfo -{ - U32 address; /* 0 means it is free */ - U32 size; /* size of the block */ - U32 age; /* in ticks, when it was allocated */ - U32 lineNo; /* lineNo in the file from where allocation was done */ - char* fileName; /* from where allocation was done */ - U32 prevRemLineNo; /* lineNo in the file from where allocation was done */ - char* prevRemFileName; /* from where allocation was done */ - U32 lastDelLineNum; /* lineNo in the file from where allocation was done */ - char* lastDelFileName; /* from where allocation was done */ - -}T2kMeamLeakInfo; -#endif #endif #endif diff --git a/src/cm/ctf.c b/src/cm/ctf.c index 78f1946a9..2922e6e62 100755 --- a/src/cm/ctf.c +++ b/src/cm/ctf.c @@ -727,19 +727,6 @@ CtfKdfReqInfo* kdfReqInfo; } } else if (pst->selector == CTF_SEL_LWLC) { - #if 0 - if (cmPkPtr((PTR)cfgReqInfo, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - /* ctf_c_001.main_3 Compilation warning fix with g++ */ - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - (Txt*)&__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ECTF018, (ErrVal)0, (Txt*)&"Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CtfCfgReqInfo)); - SPutMsg(mBuf); - RETVALUE(RFAILED); - } - #endif } if (cmPkCtfCfgTransId(&transId, mBuf) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) diff --git a/src/cm/du_log.h b/src/cm/du_log.h new file mode 100644 index 000000000..e2a4c165c --- /dev/null +++ b/src/cm/du_log.h @@ -0,0 +1,32 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains system logging functionality for DU */ + +#ifndef __DU_LOGS_H__ +#define __DU_LOGS_H__ + +#include + +/*MACROS*/ +#define DU_LOG(...) ({\ + printf(__VA_ARGS__);\ + syslog(LOG_DEBUG,__VA_ARGS__);\ + }) +#endif + diff --git a/src/cm/envopt.h b/src/cm/envopt.h index ec5c37f69..c1ff5da14 100755 --- a/src/cm/envopt.h +++ b/src/cm/envopt.h @@ -689,7 +689,7 @@ #define RG 1 /* Product options */ -#define RG_PHASE2_SCHED 1 +//#define RG_PHASE2_SCHED 1 #undef RG_DEBUG #undef TTI_PROC #undef PROC_DL diff --git a/src/cm/kwu.c b/src/cm/kwu.c index d9c6408e6..7bbe95211 100755 --- a/src/cm/kwu.c +++ b/src/cm/kwu.c @@ -519,16 +519,6 @@ Buffer * mBuf; #else cmPkKwuDatIndInfo( (datInd), mBuf); #endif /* ERRCLASS & ERRCLS_ADD_RES */ -#if 0 - /*Commenting out the below block as no Memory Allocation happens - * in Protocol. This code will be removed once testing is done */ - if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, - sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY) != ROK) - { - SPutMsg(mBuf); - RETVALUE(RFAILED); - } -#endif } break; default: @@ -715,14 +705,6 @@ KwuDiscSduInfo* discSdu; #else cmPkKwuDiscSduInfo( (discSdu), mBuf); #endif /* ERRCLASS & ERRCLS_ADD_RES */ -#if 0 - if (SPutSBuf(pst->region, pst->pool, (Data *)discSdu, - sizeof(KwuDiscSduInfo)) != ROK) - { - SPutMsg(mBuf); - RETVALUE(RFAILED); - } -#endif break; } } @@ -1301,22 +1283,6 @@ Buffer *mBuf; break; case KWU_SEL_LC: { -#if 0 - /*This will be removed once the testing is done on all platforms */ - if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datReq,\ - sizeof(KwuDatReqInfo),SS_SHARABLE_MEMORY)) != ROK) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - /*MBUF_FIXX*/ - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)EKWU026, (ErrVal)0, "SGetMsg() failed"); - -#endif /* ERRCLASS & ERRCLS_ADD_RES */ - RETVALUE(ret1); - } - -#endif /* Allocate the memory statically as there is no free * in RLC */ datReq = &datReqTmp; diff --git a/src/cm/lcl.h b/src/cm/lcl.h index f9223c52f..3e1e9fa67 100644 --- a/src/cm/lcl.h +++ b/src/cm/lcl.h @@ -21,7 +21,7 @@ #define __LCL_H__ #define NUM_NUMEROLOGY 5 /* Number of numerology */ -#define MAX_TDD_PERIODICITY 5 +#define MAXIMUM_TDD_PERIODICITY 5 #define MAX_SYMB_PER_SLOT 14 typedef enum @@ -143,7 +143,7 @@ typedef struct tddCfg { Bool pres; DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */ - SlotConfig slotCfg[MAX_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; + SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; }TDDCfg; typedef struct clCellCfg diff --git a/src/cm/legtp.c b/src/cm/legtp.c new file mode 100644 index 000000000..a1ba6b1fb --- /dev/null +++ b/src/cm/legtp.c @@ -0,0 +1,536 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains DU APP and EGTP interface functions */ + +#include "du_egtp.h" +#include "legtp.h" + +/******************************************************************* + * + * @brief Packs EGTP confirm status + * + * @details + * + * Function : cmPkEgtpCfmStatus + * + * Functionality: + * Packs EGTP confirm status + * + * @params[in] Confirm status + * Message buffer + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) +{ + SPkU16(cfm.status, mBuf); + SPkU16(cfm.reason, mBuf); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks EGTP confirm status + * + * @details + * + * Function : cmUnpkEgtpCfmStatus + * + * Functionality: + * Packs EGTP confirm status + * + * @params[in] Confirm status + * Message buffer + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) +{ + SUnpkU16(&(cfm->reason), mBuf); + SUnpkU16(&(cfm->status), mBuf); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Packs EGTP configuration + * + * @details + * + * Function : cmPkEgtpCfgReq + * + * Functionality: + * Packs EGTP configuration + * + * @params[in] Post structure + * EGTP configuration + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + if(egtpCfg.localIp.ipV4Pres) + { + SPkU32(egtpCfg.localIp.ipV4Addr, mBuf); + } + cmPkBool(egtpCfg.localIp.ipV4Pres, mBuf); + SPkU16(egtpCfg.localPort, mBuf); + + if(egtpCfg.destIp.ipV4Pres) + { + SPkU32(egtpCfg.destIp.ipV4Addr, mBuf); + } + cmPkBool(egtpCfg.destIp.ipV4Pres, mBuf); + SPkU16(egtpCfg.destPort, mBuf); + + SPkU32(egtpCfg.minTunnelId, mBuf); + SPkU32(egtpCfg.maxTunnelId, mBuf); + + SPstTsk(pst, mBuf); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks EGTP configuration + * + * @details + * + * Function : cmUnpkEgtpCfgReq + * + * Functionality: + * Unpacks EGTP configuration + * + * @params[in] Configuration Request handler + * Post structure + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) +{ + EgtpConfig egtpCfg; + + cmMemset((U8 *)&egtpCfg, 0, sizeof(EgtpConfig)); + + SUnpkU32(&(egtpCfg.maxTunnelId), mBuf); + SUnpkU32(&(egtpCfg.minTunnelId), mBuf); + + SUnpkU16(&(egtpCfg.destPort), mBuf); + cmUnpkBool(&(egtpCfg.destIp.ipV4Pres), mBuf); + if(egtpCfg.destIp.ipV4Pres) + { + SUnpkU32(&(egtpCfg.destIp.ipV4Addr), mBuf); + } + + SUnpkU16(&(egtpCfg.localPort), mBuf); + cmUnpkBool(&(egtpCfg.localIp.ipV4Pres), mBuf); + if(egtpCfg.localIp.ipV4Pres) + { + SUnpkU32(&(egtpCfg.localIp.ipV4Addr), mBuf); + } + + SPutMsg(mBuf); + + RETVALUE((*func)(pst, egtpCfg)); +} + + +/******************************************************************* + * + * @brief Packs EGTP configuration results + * + * @details + * + * Function : cmPkEgtpCfgCfm + * + * Functionality: + * Packs EGTP configuration result + * + * @params[in] Post structure + * Status confirm + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nEGTP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + cmPkEgtpCfmStatus(cfm, mBuf); + SPstTsk(pst, mBuf); + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks EGTP configuration results + * + * @details + * + * Function : cmUnpkEgtpCfgCfm + * + * Functionality: + * Unpacks EGTP configuration result + * + * @params[in] Config Cfm Hanlder + * Message buffer + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) +{ + CmStatus cfm; + + cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); + cmUnpkEgtpCfmStatus(&cfm, mBuf); + + RETVALUE((*func)(cfm)); +} + +/******************************************************************* + * + * @brief Packs EGTP server open request + * + * @details + * + * Function : cmPkEgtpSrvOpenReq + * + * Functionality: + * Packs EGTP server open request + * + * @params[in] Post structure + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +S16 cmPkEgtpSrvOpenReq(Pst *pst) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + SPstTsk(pst, mBuf); + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks EGTP server open req + * + * @details + * + * Function : cmUnpkEgtpSrvOpenReq + * + * Functionality: + * Unpacks EGTP server open req + * + * @params[in] Hanlder function pointer + * Message buffer + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) +{ + RETVALUE((*func)(pst)); +} + + +/******************************************************************* + * + * @brief Packs EGTP server open confirm + * + * @details + * + * Function : cmPkEgtpSrvOpenCfm + * + * Functionality: + * Packs EGTP server open confirm + * + * @params[in] Post structure + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nEGTP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + cmPkEgtpCfmStatus(cfm, mBuf); + SPstTsk(pst, mBuf); + RETVALUE(ROK); + +} + +/******************************************************************* + * + * @brief Unpacks EGTP server open confirm + * + * @details + * + * Function : cmUnpkEgtpSrvOpenCfm + * + * Functionality: + * Unpacks EGTP server open confirm + * + * @params[in] Hanlder function pointer + * Message buffer + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) +{ + CmStatus cfm; + + cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); + cmUnpkEgtpCfmStatus(&cfm, mBuf); + + RETVALUE((*func)(cfm)); +} + +/******************************************************************* + * + * @brief Packs EGTP tunnel management request + * + * @details + * + * Function : cmPkEgtpTnlMgmtReq + * + * Functionality: + * Packs EGTP tunnel management request + * + * @params[in] Post structure + * Tunnel action + * Local tunnel endpoint id + * Remote tunnel endpoint id + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + SPkU8(tnlEvt.action, mBuf); + SPkU32(tnlEvt.lclTeid, mBuf); + SPkU32(tnlEvt.remTeid, mBuf); + + SPstTsk(pst, mBuf); + RETVALUE(ROK); +} + + +/******************************************************************* + * + * @brief Unpacks EGTP tunnel management request + * + * @details + * + * Function : cmUnpkEgtpTnlMgmtReq + * + * Functionality: + * Unpacks EGTP tunnel management request + * + * @params[in] Hanlder function pointer + * Post structure + * Message buffer + * @return ROK - success + * RFAILED - failure + * + * *******************************************************************/ +S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) +{ + EgtpTnlEvt tnlEvt; + + cmMemset((U8 *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); + + SUnpkU32(&(tnlEvt.remTeid), mBuf); + SUnpkU32(&(tnlEvt.lclTeid), mBuf); + SUnpkU8(&(tnlEvt.action), mBuf); + + RETVALUE((* func)(pst, tnlEvt)); + +} + +/******************************************************************* + * + * @brief Packs EGTP tunnel management confirm + * + * @details + * + * Function : cmPkEgtpTnlMgmtCfm + * + * Functionality: + * Packs EGTP tunnel management cfm + * + * @params[in] Post structure + * Tunnel Event structure + * + * @return ROK - success + * RFAILED - failure + * + ********************************************************************/ + +S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nEGTP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + SPkU8(tnlEvt.action, mBuf); + SPkU32(tnlEvt.lclTeid, mBuf); + SPkU32(tnlEvt.remTeid, mBuf); + + cmPkEgtpCfmStatus(tnlEvt.cfmStatus, mBuf); + + SPstTsk(pst, mBuf); + RETVALUE(ROK); + +} + +/******************************************************************* + * + * @brief Unpacks EGTP tunnel management confirm + * + * @details + * + * Function : cmUnpkEgtpTnlMgmtCfm + * + * Functionality: + * Unpacks EGTP tunnel management confirm + * + * @params[in] Hanlder function pointer + * Post structure + * Message buffer + * @return ROK - success + * RFAILED - failure + * + * *******************************************************************/ +S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) +{ + EgtpTnlEvt tnlEvt; + + cmMemset((U8 *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); + + cmUnpkEgtpCfmStatus(&(tnlEvt.cfmStatus), mBuf); + SUnpkU32(&(tnlEvt.remTeid), mBuf); + SUnpkU32(&(tnlEvt.lclTeid), mBuf); + SUnpkU8(&(tnlEvt.action), mBuf); + + RETVALUE((* func)(tnlEvt)); + +} + +/******************************************************************* + * + * @brief Packs TTI indication and sends to EGTP + * + * @details + * + * Function : cmPkEgtpTTIInd + * + * Functionality: + * Packs TTI indication and sends tp EGTP + * + * @params[in] Post structure + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +S16 cmPkEgtpTTIInd(Pst *pst) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + SPstTsk(pst, mBuf); + RETVALUE(ROK); + +} + +/******************************************************************* + * + * @brief Unpacks TTI indication + * + * @details + * + * Function : cmUnpkEgtpTTIInd + * + * Functionality: + * Unpacks TTI indication + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * +******************************************************************/ +S16 cmUnpkEgtpTTIInd(EgtpTTIInd func, Pst *pst, Buffer *mBuf) +{ + RETVALUE((*func)()); +} diff --git a/src/cm/legtp.h b/src/cm/legtp.h new file mode 100644 index 000000000..f77b401d5 --- /dev/null +++ b/src/cm/legtp.h @@ -0,0 +1,114 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* Defines API exchanged between DU_APP and EGTP */ +#ifndef __LEGTP_H___ +#define __LEGTP_H___ + +#include "gen.h" + +#include "gen.x" + +#define EGTP_TNL_MGMT_ADD 1 +#define EGTP_TNL_MGMT_MOD 2 +#define EGTP_TNL_MGMT_DEL 3 + +typedef enum egtpMsgType +{ + EGTP_MSG_INVALID, + EGTPU_MSG_ECHO_REQ, + EGTPU_MSG_ECHO_RSP, + EGTPU_MSG_ERROR_IND = 26, + EGTPU_MSG_SUPP_EXT_HDR_NTF = 31, + EGTPU_MSG_END_MARKER = 254, + EGTPU_MSG_GPDU, + EGTP_MSG_MAX +}EgtpMsgType; + +typedef struct egtpIpAddr +{ + Bool ipV4Pres; + U32 ipV4Addr; +}EgtpIpAddr; + +typedef struct egtpConfig +{ + EgtpIpAddr localIp; + U16 localPort; + EgtpIpAddr destIp; + U16 destPort; + U32 minTunnelId; + U32 maxTunnelId; +}EgtpConfig; + +typedef struct egtpTnlEvt +{ + U8 action; + U32 lclTeid; + U32 remTeid; + CmStatus cfmStatus; +}EgtpTnlEvt; + +/*Extension Header */ +typedef struct egtpExtHdr +{ + TknU16 udpPort; /**< UDP Port */ + TknU16 pdcpNmb; /**< PDCP Number */ +}EgtpExtHdr; + +/*Structure for MsgHdr */ +typedef struct egtpMsgHdr +{ + TknU8 nPdu; /**< N-PDU Number */ + TknU32 seqNum; /**< Sequence Number */ + EgtpExtHdr extHdr; /**< Extension headers present flag */ + U32 teId; /**< Tunnel Endpoint Id */ + U8 msgType; /**< eGTP-U Message Type */ +}EgtpMsgHdr; + +typedef struct egtpMsg +{ + EgtpMsgHdr msgHdr; + Buffer *msg; +}EgtpMsg; + +typedef S16 (*EgtpCfgReq) ARGS((Pst *pst, EgtpConfig egtpCfg)); +typedef S16 (*EgtpCfgCfm) ARGS((CmStatus cfm)); +typedef S16 (*EgtpInitReq) ARGS((Buffer *mBuf)); +typedef S16 (*EgtpSrvOpenReq) ARGS(()); +typedef S16 (*EgtpSrvOpenCfm) ARGS((CmStatus cfm)); +typedef S16 (*EgtpTnlMgmtReq) ARGS((Pst *pst, EgtpTnlEvt tnlEvt)); +typedef S16 (*EgtpTnlMgmtCfm) ARGS((EgtpTnlEvt tnlEvt)); +typedef S16 (*EgtpTTIInd) ARGS(()); + +S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg); +S16 cmUnpkEgtpCfgReq(EgtpCfgReq func , Pst *pst, Buffer *mBuf); +S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm); +S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf); +S16 cmPkEgtpSrvOpenReq(Pst *pst); +S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf); +S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm); +S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf); +S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); +S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf); +S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt); +S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf); +S16 cmPkEgtpTTIInd(Pst *pst); +S16 cmUnpkEgtpTTIInd(EgtpTTIInd func, Pst *pst, Buffer *mBuf); + +#endif diff --git a/src/cm/lphy_stub.h b/src/cm/lphy_stub.h new file mode 100644 index 000000000..25f69f8dd --- /dev/null +++ b/src/cm/lphy_stub.h @@ -0,0 +1,13 @@ +#include "stdio.h" +#include "envopt.h" /* Environment options */ +#include "envdep.h" /* Environment dependent */ +#include "envind.h" /* Environment independent */ + +#include "gen.h" /* General */ +#include "ssi.h" /* System services */ + +#include "gen.x" /* General */ +#include "ssi.x" /* System services */ + +void duStartTtiThread(); +S16 duSendEgtpTTIInd(); diff --git a/src/cm/lrg.c b/src/cm/lrg.c index 08ad06247..658c32540 100755 --- a/src/cm/lrg.c +++ b/src/cm/lrg.c @@ -194,7 +194,7 @@ RgMngmt * cfg; RETVALUE(RFAILED); } if (pst->selector == LRG_SEL_LC) { - if (cmPkRgMngmt(pst, cfg, EVTLRGSCHCFGREQ, mBuf) != ROK) { + if (cmPkRgMngmt(pst, cfg, EVTMACSCHGENCFGREQ, mBuf) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, @@ -205,7 +205,6 @@ RgMngmt * cfg; } } - pst->event = (Event) EVTLRGSCHCFGREQ; RETVALUE(SPstTsk(pst,mBuf)); } @@ -242,7 +241,7 @@ Buffer *mBuf; TRC3(cmUnpkLrgSchCfgReq) - if (cmUnpkRgMngmt(pst, &cfg, EVTLRGSCHCFGREQ, mBuf) != ROK) { + if (cmUnpkRgMngmt(pst, &cfg, EVTMACSCHGENCFGREQ, mBuf) != ROK) { SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, @@ -391,7 +390,7 @@ RgMngmt * cfg; RETVALUE(RFAILED); } if (pst->selector == LRG_SEL_LC) { - if (cmPkRgMngmt(pst, cfg, EVTLRGSCHCFGCFM, mBuf) != ROK) { + if (cmPkRgMngmt(pst, cfg, EVTMACSCHGENCFGCFM, mBuf) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, @@ -402,7 +401,7 @@ RgMngmt * cfg; } } - pst->event = (Event) EVTLRGSCHCFGCFM; + pst->event = (Event) EVTMACSCHGENCFGCFM; RETVALUE(SPstTsk(pst,mBuf)); } @@ -438,7 +437,7 @@ Buffer *mBuf; TRC3(cmUnpkLrgSchCfgCfm) - if (cmUnpkRgMngmt(pst, &cfg, EVTLRGSCHCFGCFM, mBuf) != ROK) { + if (cmUnpkRgMngmt(pst, &cfg, EVTMACSCHGENCFGCFM, mBuf) != ROK) { SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, @@ -3571,8 +3570,8 @@ Buffer *mBuf; if(cmPkRgCfg(¶m->t.cfg, param->hdr.elmId.elmnt, mBuf) != ROK) RETVALUE(RFAILED); break; - case EVTLRGSCHCFGREQ: - case EVTLRGSCHCFGCFM: + case EVTMACSCHGENCFGREQ: + case EVTMACSCHGENCFGCFM: if(cmPkRgCfg(¶m->t.cfg, param->hdr.elmId.elmnt, mBuf) != ROK) RETVALUE(RFAILED); break; @@ -3625,8 +3624,8 @@ Buffer *mBuf; switch(eventType) { case EVTLRGCFGREQ: case EVTLRGCFGCFM: - case EVTLRGSCHCFGREQ: - case EVTLRGSCHCFGCFM: + case EVTMACSCHGENCFGREQ: + case EVTMACSCHGENCFGCFM: if(cmUnpkRgCfg(¶m->t.cfg, param->hdr.elmId.elmnt, mBuf) != ROK) RETVALUE(RFAILED); break; diff --git a/src/cm/lrg.h b/src/cm/lrg.h index 0428a0f9d..44d512d0b 100755 --- a/src/cm/lrg.h +++ b/src/cm/lrg.h @@ -35,14 +35,14 @@ #define EVTLRGCFGCFM 1 /* Config Confirm */ #define EVTLRGCNTRLREQ 2 /* Control Request */ #define EVTLRGCNTRLCFM 3 /* Control Confirm */ -#define EVTLRGSTSREQ 4 /* Statistics Request */ +#define EVTLRGSTSREQ 44 /* Statistics Request */ #define EVTLRGSTSCFM 5 /* Statistics Confirm */ #define EVTLRGSSTAREQ 6 /* Solicited Status Request */ #define EVTLRGSSTACFM 7 /* Solicited Status Confirm */ #define EVTLRGUSTAIND 8 /* Unsolicite Status Indication */ #define EVTLRGTRCIND 9 /* Trace Indication */ -#define EVTLRGSCHCFGREQ 10 /* Scheduler Configuration */ -#define EVTLRGSCHCFGCFM 11 /* Scheduler Config Confirm */ +#define EVTMACSCHGENCFGREQ 10 /* Scheduler Configuration */ +#define EVTMACSCHGENCFGCFM 11 /* Scheduler Config Confirm */ #define EVTLRGSCHSTAIND 12 /* Scheduler Configuration */ #define EVTLRGSCHCNTRLREQ 13 /* Scheduler Configuration */ #define EVTLRGSCHCNTRLCFM 14 /* Scheduler Config Confirm */ diff --git a/src/cm/lrg.x b/src/cm/lrg.x index b1fce636a..6480fcd8d 100755 --- a/src/cm/lrg.x +++ b/src/cm/lrg.x @@ -647,6 +647,16 @@ typedef S16 (*LrgSchL2MeasStopCfm) ARGS(( */ EXTERN S16 RgMiLrgCfgReq ARGS((Pst *pst, RgMngmt *cfg)); + /** @brief This primitive carries the Configuration Request + * for Scheduler sent from the DU APP to MAC. + * @details This primitive is used by MAC to sned the configuration + * to scheduler + * @param pst Pointer to the post structure. + * @param cfm pointer to RgMngmt + * @return ROK/RFAILED + */ +EXTERN S16 MacSchGenCfgReq ARGS((Pst *pst, RgMngmt *cfg)); + /** @brief This primitive carries the Confirmation for a Configuration Request * sent from the layer manager to MAC. * @details This primitive is used by MAC to inform Layer manager about the @@ -669,7 +679,7 @@ EXTERN S16 RgMiLrgCfgCfm ARGS((Pst *pst, RgMngmt *cfm)); * @param cfg pointer to RgMngmt * @return ROK/RFAILED */ -EXTERN S16 RgMiLrgSchCfgReq ARGS((Pst *pst, RgMngmt *cfg)); +EXTERN S16 HandleSchGenCfgReq ARGS((Pst *pst, RgMngmt *cfg)); /** @brief This primitive carries the Confirmation for a Configuration Request * sent from the layer manager to Scheduler. diff --git a/src/cm/lsctp.c b/src/cm/lsctp.c new file mode 100644 index 000000000..f96c2b26a --- /dev/null +++ b/src/cm/lsctp.c @@ -0,0 +1,180 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains DU APP and SCTP interface functions */ + +#include "du_sctp.h" + +/******************************************************************* + * + * @brief Packs SCTP configuration + * + * @details + * + * Function : cmPkSctpAssocReq + * + * Functionality: + * Packs SCTP configuration + * + * @params[in] Notification + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 cmPkSctpAssocReq(Pst *pst, F1SctpParams sctpCfgParam) +{ + Buffer *mBuf; + + if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + if(sctpCfgParam.duIpAddr.ipV4Pres) + { + SPkU32(sctpCfgParam.duIpAddr.ipV4Addr, mBuf); + } + cmPkBool(sctpCfgParam.duIpAddr.ipV4Pres, mBuf); + SPkU16(sctpCfgParam.duPort, mBuf); + + if(sctpCfgParam.cuIpAddr.ipV4Pres) + { + SPkU32(sctpCfgParam.cuIpAddr.ipV4Addr, mBuf); + } + cmPkBool(sctpCfgParam.cuIpAddr.ipV4Pres, mBuf); + SPkU16(sctpCfgParam.cuPort, mBuf); + + SPstTsk(pst, mBuf); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks SCTP configuration + * + * @details + * + * Function : cmUnpkSctpAssocReq + * + * Functionality: + * Unpacks SCTP configuration + * + * @params[in] Notification + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 cmUnpkSctpAssocReq(Buffer *mBuf) +{ + cmMemset((U8*)&sctpCfg, 0, sizeof(F1SctpParams)); + + SUnpkU16(&(sctpCfg.cuPort), mBuf); + cmUnpkBool(&(sctpCfg.cuIpAddr.ipV4Pres), mBuf); + if(sctpCfg.cuIpAddr.ipV4Pres) + { + SUnpkU32(&(sctpCfg.cuIpAddr.ipV4Addr), mBuf); + } + + SUnpkU16(&(sctpCfg.duPort), mBuf); + cmUnpkBool(&(sctpCfg.duIpAddr.ipV4Pres), mBuf); + if(sctpCfg.duIpAddr.ipV4Pres) + { + SUnpkU32(&(sctpCfg.duIpAddr.ipV4Addr), mBuf); + } + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Packs SCTP notification + * + * @details + * + * Function : cmPkSctpNtfy + * + * Functionality: + * Packs SCTP notification + * + * @params[in] Notification + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) +{ + Buffer *mBuf; + + if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK) + { + printf("\nSCTP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + if(ntfy->header.nType == CM_INET_SCTP_ASSOC_CHANGE) + { + SPkU16(ntfy->u.assocChange.state, mBuf); + } + SPkU16(ntfy->header.nType, mBuf); + + if (SPstTsk(pst, mBuf) != ROK) + { + printf("\nSCTP : SPstTsk failed while sending SCTP notification"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Unpacks SCTP notification + * + * @details + * + * Function : cmUnpkSctpNtfy + * + * Functionality: + * Unpacks SCTP notification + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf) +{ + CmInetSctpNotification ntfy; + cmMemset((U8*)&ntfy, 0, sizeof(CmInetSctpNotification)); + + SUnpkU16(&(ntfy.header.nType), mBuf); + if(ntfy.header.nType == CM_INET_SCTP_ASSOC_CHANGE) + { + SUnpkU16(&(ntfy.u.assocChange.state), mBuf); + } + + RETVALUE((*func)(mBuf, &ntfy)); +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/cm/lsctp.h b/src/cm/lsctp.h new file mode 100644 index 000000000..fd434c378 --- /dev/null +++ b/src/cm/lsctp.h @@ -0,0 +1,28 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* Defines API exchanged between DU_APP and SCTP */ +#ifndef __LSCTP_H___ +#define __LSCTP_H___ + +extern S16 cmPkSctpAssocReq(Pst *pst, F1SctpParams sctpCfgParam); +extern S16 cmUnpkSctpAssocReq(Buffer *mBuf); +extern S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy); +extern S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf); + +#endif diff --git a/src/cm/rgm.c b/src/cm/rgm.c index 4e9e42d81..a86cd0deb 100755 --- a/src/cm/rgm.c +++ b/src/cm/rgm.c @@ -213,55 +213,6 @@ Reason reason; RETVALUE(SPstTsk(pst,mBuf)); } -#if 0 - -/** -* @brief Request from RRM to MAC to Unbind the interface saps -* -* @details -* -* Function : cmUnpkLwLcRgmUbndReq -* -* @param[in] Pst* pst -* @param[in] SpId spId -* @param[in] Reason reason -* @return S16 -* -# ROK -**/ -#ifdef ANSI -PUBLIC S16 cmUnpkLwLcRgmUbndReq -( -RgmUbndReq func, -Pst *pst, -Buffer *mBuf -) -#else -PUBLIC S16 cmUnpkLwLcRgmUbndReq(func, pst, mBuf) -RgmUbndReq func; -Pst *pst; -Buffer *mBuf; -#endif -{ - SpId spId; - Reason reason; - - TRC3(cmUnpkLwLcRgmUbndReq) - - if (SUnpkS16(&spId, mBuf) != ROK) - { - SPutMsg(mBuf); - RETVALUE(RFAILED); - } - if (SUnpkS16(&reason, mBuf) != ROK) - { - SPutMsg(mBuf); - RETVALUE(RFAILED); - } - SPutMsg(mBuf); - RETVALUE((*func)(pst, spId, reason)); -} -#endif - /** * @brief Confirmation from MAC to RRM for the bind/Unbind * request for the interface saps diff --git a/src/cm/rgr.c b/src/cm/rgr.c index b288a0c3e..d1bc9468f 100755 --- a/src/cm/rgr.c +++ b/src/cm/rgr.c @@ -431,8 +431,8 @@ Buffer *mBuf; * Func : cmPkRgrCfgReq * * -* Desc : Configuration Request from RRM to MAC for - * configuring Cell/Ue/Lc +* Desc : Configuration Request from DU_APP to MAC for +* configuring Cell/Ue/Lc * * * Ret : S16 @@ -446,14 +446,12 @@ Buffer *mBuf; PUBLIC S16 cmPkRgrCfgReq ( Pst* pst, -SpId spId, RgrCfgTransId transId, RgrCfgReqInfo * cfgReqInfo ) #else -PUBLIC S16 cmPkRgrCfgReq(pst, spId, transId, cfgReqInfo) +PUBLIC S16 cmPkRgrCfgReq(pst, transId, cfgReqInfo) Pst* pst; -SpId spId; RgrCfgTransId transId; RgrCfgReqInfo * cfgReqInfo; #endif @@ -490,6 +488,7 @@ RgrCfgReqInfo * cfgReqInfo; SPutMsg(mBuf); RETVALUE(RFAILED); } +#if 0 if (SPkS16(spId, mBuf) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, @@ -500,6 +499,7 @@ RgrCfgReqInfo * cfgReqInfo; SPutMsg(mBuf); RETVALUE(RFAILED); } +#endif if (SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(RgrCfgReqInfo)) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, @@ -510,7 +510,7 @@ RgrCfgReqInfo * cfgReqInfo; RETVALUE(RFAILED); } - pst->event = (Event) EVTRGRCFGREQ; + pst->event = (Event) EVTMACSCHCFGREQ; RETVALUE(SPstTsk(pst,mBuf)); } @@ -545,12 +545,11 @@ Pst *pst; Buffer *mBuf; #endif { - SpId spId; RgrCfgTransId transId; RgrCfgReqInfo *cfgReqInfo; TRC3(cmUnpkRgrCfgReq) - +#if 0 if (SUnpkS16(&spId, mBuf) != ROK) { SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_ADD_RES) @@ -560,6 +559,8 @@ Buffer *mBuf; #endif RETVALUE(RFAILED); } +#endif + if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) { SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_ADD_RES) @@ -591,7 +592,7 @@ Buffer *mBuf; RETVALUE(RFAILED); } SPutMsg(mBuf); - RETVALUE((*func)(pst, spId, transId, cfgReqInfo)); + RETVALUE((*func)(pst, transId, cfgReqInfo)); } /* rgr_c_001.main_3: Added TTI indication from MAC to RGR user */ @@ -820,14 +821,12 @@ Buffer *mBuf; PUBLIC S16 cmPkRgrCfgCfm ( Pst* pst, -SuId suId, RgrCfgTransId transId, U8 status ) #else -PUBLIC S16 cmPkRgrCfgCfm(pst, suId, transId, status) +PUBLIC S16 cmPkRgrCfgCfm(pst, transId, status) Pst* pst; -SuId suId; RgrCfgTransId transId; U8 status; #endif @@ -861,16 +860,7 @@ U8 status; SPutMsg(mBuf); RETVALUE(RFAILED); } - if (SPkS16(suId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGR034, (ErrVal)0, "Packing failed"); -#endif - SPutMsg(mBuf); - RETVALUE(RFAILED); - } - pst->event = (Event) EVTRGRCFGCFM; + pst->event = (Event) EVTMACSCHCFGCFM; RETVALUE(SPstTsk(pst,mBuf)); } @@ -904,21 +894,11 @@ Pst *pst; Buffer *mBuf; #endif { - SuId suId; RgrCfgTransId transId; U8 status; TRC3(cmUnpkRgrCfgCfm) - if (SUnpkS16(&suId, mBuf) != ROK) { - SPutMsg(mBuf); -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGR035, (ErrVal)0, "Packing failed"); -#endif - RETVALUE(RFAILED); - } if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) { SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_ADD_RES) @@ -938,7 +918,7 @@ Buffer *mBuf; RETVALUE(RFAILED); } SPutMsg(mBuf); - RETVALUE((*func)(pst, suId, transId, status)); + RETVALUE((*func)(pst, transId, status)); } /* rgr_c_001.main_4: ADD-Added for SI Enhancement. */ @@ -3687,9 +3667,6 @@ Buffer *mBuf { CMCHKPK(SPkU32, param->dynConfig[(U8)idx], mBuf); -#if 0 - printf("\npk dyn:%u\n",param->dynConfig[(U8)idx]); -#endif } CMCHKPK(SPkU8, param->uePerGrp, mBuf); CMCHKPK(SPkU8, param->ueGrpPerTti, mBuf); @@ -3697,13 +3674,6 @@ Buffer *mBuf CMCHKPK(SPkU8, param->numOfCC, mBuf); CMCHKPK(SPkU8, param->bwPerCC, mBuf); CMCHKPK(SPkU8, param->cfi, mBuf); -#if 0 - printf("\npk uePerGrp%:%u\n",param->uePerGrp); - printf("\npk ueGrpPerTti:%u\n",param->ueGrpPerTti); - printf("\npk num of UEs:%u\n",param->numUes); - printf("\npk Num of CC:%u\n",param->numOfCC); - printf("\npk bw per cc:%u\n",param->bwPerCC); -#endif RETVALUE(ROK); } @@ -3721,20 +3691,10 @@ Buffer *mBuf CMCHKUNPK(SUnpkU8, ¶m->numUes, mBuf); CMCHKUNPK(SUnpkU8, ¶m->ueGrpPerTti, mBuf); CMCHKUNPK(SUnpkU8, ¶m->uePerGrp, mBuf); -#if 0 - printf("\nunpk uePerGrp:%u\n",param->uePerGrp); - printf("\nunpk ueGrpPerTti:%u\n",param->ueGrpPerTti); - printf("\nunpk num of ues:%u\n",param->numUes); - printf("\nunpk num of cc:%u\n",param->numOfCC); - printf("\nunpk bw per cc:%u\n",param->bwPerCC); -#endif for (idx = 0; idx < MAX_5GTF_SUBFRAME_INFO ; ++idx) { CMCHKUNPK(SUnpkU32, ¶m->dynConfig[(U8)idx], mBuf); -#if 0 - printf("\nunpk dyn:%u\n",param->dynConfig[(U8)idx]); -#endif } RETVALUE(ROK); } @@ -4201,9 +4161,9 @@ PUBLIC S16 cmUnpkRgrCellLteAdvancedFeatureCfg(param, mBuf) /*********************************************************** * -* Func : cmPkRgrSchedEnbCfg +* Func : cmPkMacSchedGnbCfg * -* Desc : SCH ENB Configurations +* Desc : SCH GNB Configurations * * Ret : S16 * @@ -4213,53 +4173,34 @@ PUBLIC S16 cmUnpkRgrCellLteAdvancedFeatureCfg(param, mBuf) * **********************************************************/ #ifdef ANSI -PUBLIC S16 cmPkRgrSchedEnbCfg +PUBLIC S16 cmPkMacSchedGnbCfg ( -RgrSchedEnbCfg *param, +MacSchedGnbCfg *param, Buffer *mBuf ) #else -PUBLIC S16 cmPkRgrSchedEnbCfg(param, mBuf) +PUBLIC S16 cmPkMacSchedGnbCfg(param, mBuf) RgrSchedEnbCfg *param; Buffer *mBuf; #endif { + TRC3(cmPkMacSchedGnbCfg) - //S32 i; - TRC3(cmPkRgrSchedEnbCfg) - -#ifdef RG_5GTF - CMCHKPK(SPkU8, param->isDynTddEnbld, mBuf); -#endif - CMCHKPK(SPkU32, param->accsMode, mBuf); - switch(param->ulSchdType) - { - case RGR_SCH_TYPE_PFS: - CMCHKPK(cmPkRgrEnbPfs, ¶m->ulSchInfo.ulPfs, mBuf); - break; - default : - break; - } - CMCHKPK(SPkU8, param->ulSchdType, mBuf); - switch(param->dlSchdType) - { - case RGR_SCH_TYPE_PFS: - CMCHKPK(cmPkRgrEnbPfs, ¶m->dlSchInfo.dlPfs, mBuf); - break; - default : - break; - } + CMCHKPK(SPkU8, param->maxDlUePerTti, mBuf); + CMCHKPK(SPkU8, param->maxUlUePerTti, mBuf); + CMCHKPK(SPkU8, param->numCells, mBuf); CMCHKPK(SPkU8, param->dlSchdType, mBuf); + CMCHKPK(SPkU8, param->ulSchdType, mBuf); CMCHKPK(SPkU8, param->numTxAntPorts, mBuf); RETVALUE(ROK); } /* cmPkRgrSchedEnbCfg */ /*********************************************************** * -* Func : cmUnpkRgrSchedEnbCfg +* Func : cmUnpkMacSchedGnbCfg * * -* Desc : SCH Enodeb Configuration to SCH +* Desc : SCH Gnodeb Configuration to SCH * * * Ret : S16 @@ -4270,48 +4211,28 @@ Buffer *mBuf; * **********************************************************/ #ifdef ANSI -PUBLIC S16 cmUnpkRgrSchedEnbCfg +PUBLIC S16 cmUnpkMacSchedGnbCfg ( -RgrSchedEnbCfg *param, +MacSchedGnbCfg *param, Buffer *mBuf ) #else -PUBLIC S16 cmUnpkRgrSchedEnbCfg(param, mBuf) -RgrSchedEnbCfg *param; +PUBLIC S16 cmUnpkMacSchedGnbCfg(param, mBuf) +MacSchedGnbCfg *param; Buffer *mBuf; #endif { - //S32 i; - U32 tmpEnum; - TRC3(cmUnpkRgrSchedEnbCfg) + TRC3(cmUnpkMacSchedGnbCfg) CMCHKUNPK(SUnpkU8, ¶m->numTxAntPorts, mBuf); - CMCHKUNPK(SUnpkU8, ¶m->dlSchdType, mBuf); - switch(param->dlSchdType) - { - case RGR_SCH_TYPE_PFS: - CMCHKUNPK(cmUnpkRgrEnbPfs, ¶m->dlSchInfo.dlPfs, mBuf); - break; - default : - break; - } CMCHKUNPK(SUnpkU8, ¶m->ulSchdType, mBuf); - switch(param->ulSchdType) - { - case RGR_SCH_TYPE_PFS: - CMCHKUNPK(cmUnpkRgrEnbPfs, ¶m->ulSchInfo.ulPfs, mBuf); - break; - default : - break; - } - CMCHKUNPK(SUnpkU32, (U32 *)&tmpEnum, mBuf); - param->accsMode = (RgrCellAccsMode) tmpEnum; -#ifdef RG_5GTF - CMCHKUNPK(SUnpkU8, ¶m->isDynTddEnbld, mBuf); -#endif + CMCHKUNPK(SUnpkU8, ¶m->dlSchdType, mBuf); + CMCHKUNPK(SUnpkU8, ¶m->numCells, mBuf); + CMCHKUNPK(SUnpkU8, ¶m->maxUlUePerTti, mBuf); + CMCHKUNPK(SUnpkU8, ¶m->maxDlUePerTti, mBuf); RETVALUE(ROK); -} /* cmUnpkRgrSchedEnbCfg */ +} /* cmUnpkMacSchedGnbCfg */ /*********************************************************** @@ -6889,9 +6810,6 @@ PUBLIC S16 cmUnpkRgr5gtfUeCfg CMCHKUNPK(SUnpkU8, ¶m->numCC, mBuf); CMCHKUNPK(SUnpkU8, ¶m->mcs, mBuf); CMCHKUNPK(SUnpkU8, ¶m->maxPrb, mBuf); -#if 0 - printf("\nunpk %u,%u,%u,%u,%u\n",param->grpId,param->BeamId,param->numCC,param->mcs,param->maxPrb); -#endif RETVALUE(ROK); } @@ -6906,9 +6824,6 @@ PUBLIC S16 cmPkRgr5gtfUeCfg CMCHKPK(SPkU8, param->numCC, mBuf); CMCHKPK(SPkU8, param->BeamId, mBuf); CMCHKPK(SPkU8, param->grpId, mBuf); -#if 0 - printf("\npk %u,%u,%u,%u,%u\n",param->grpId,param->BeamId,param->numCC,param->mcs,param->maxPrb); -#endif RETVALUE(ROK); } #endif @@ -7742,8 +7657,8 @@ Buffer *mBuf; case RGR_CELL_CFG: CMCHKPK(cmPkRgrCellCfg, ¶m->u.cellCfg, mBuf); break; - case RGR_ENB_CFG: - CMCHKPK(cmPkRgrSchedEnbCfg, ¶m->u.schedEnbCfg, mBuf); + case MAC_GNB_CFG: + CMCHKPK(cmPkMacSchedGnbCfg, ¶m->u.schedGnbCfg, mBuf); break; default : RETVALUE(RFAILED); @@ -7786,8 +7701,8 @@ Buffer *mBuf; CMCHKUNPK(SUnpkU8, ¶m->cfgType, mBuf); switch(param->cfgType) { - case RGR_ENB_CFG: - CMCHKUNPK(cmUnpkRgrSchedEnbCfg, ¶m->u.schedEnbCfg, mBuf); + case MAC_GNB_CFG: + CMCHKUNPK(cmUnpkMacSchedGnbCfg, ¶m->u.schedGnbCfg, mBuf); break; case RGR_CELL_CFG: CMCHKUNPK(cmUnpkRgrCellCfg, ¶m->u.cellCfg, mBuf); @@ -9225,7 +9140,7 @@ Buffer *mBuf; case RGR_RECONFIG: CMCHKPK(cmPkRgrRecfg, ¶m->u.recfgInfo, mBuf); break; - case RGR_CONFIG: + case SCH_CONFIG: CMCHKPK(cmPkRgrCfg, ¶m->u.cfgInfo, mBuf); break; #ifdef LTE_ADV @@ -9276,7 +9191,7 @@ Buffer *mBuf; CMCHKUNPK(SUnpkU8, ¶m->action, mBuf); switch(param->action) { - case RGR_CONFIG: + case SCH_CONFIG: CMCHKUNPK(cmUnpkRgrCfg, ¶m->u.cfgInfo, mBuf); break; case RGR_RECONFIG: @@ -11372,9 +11287,6 @@ Buffer *mBuf; #endif { S8 idx; -#if 0 - Ptr ptr; -#endif /* dsfr_pal_fixes ** 21-March-2013 ** SKS */ TknStrOSXL *tknStr; @@ -11392,9 +11304,6 @@ Buffer *mBuf; } else { -#if 0 - ptr =(Ptr)param; -#endif /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** Start */ tknStr = ¶m->u.rntpInfo; diff --git a/src/cm/rgr.h b/src/cm/rgr.h index fe416f43f..65ebf9a80 100755 --- a/src/cm/rgr.h +++ b/src/cm/rgr.h @@ -54,7 +54,7 @@ #endif /* LTE_L2_MEAS*/ /* Configuration/Reconfiguration MACROs*/ -#define RGR_CONFIG 1 /*!< Macro for Configuration Request*/ +#define SCH_CONFIG 1 /*!< Macro for Configuration Request*/ #define RGR_RECONFIG 2 /*!< Macro for Reconfiguration Request*/ #define RGR_DELETE 3 /*!< Macro for Delete Request*/ #define RGR_RESET 4 /*!< Macro for Reset Request*/ @@ -70,7 +70,7 @@ #define RGR_LCH_CFG 3 /*!< Macro for Logical Channel Configuration Type */ #define RGR_LCG_CFG 4 /*!< Macro for Logical Group Configuration Type */ #define RGR_SCELL_UE_CFG 5 /*!< MACRO for Scell release */ -#define RGR_ENB_CFG 6 /*!< MACRO for ENB Scheduler Configuration Type */ +#define MAC_GNB_CFG 6 /*!< MACRO for ENB Scheduler Configuration Type */ /* Cell-wide reconfiguration MACROs */ #define RGR_CELL_DL_CMNRATE_RECFG (1<<0) /*!< Macro for Downlink Common Coderate Reconfiguration */ @@ -250,11 +250,11 @@ #define RGR_CFG_CFM_TX_COMPLETE 0x01 /*!< Negative confirmation: configuration failed */ /* Event corresponding to each primitive at this interface */ -#define EVTRGRBNDREQ 1 /*!< Bind Request */ -#define EVTRGRBNDCFM 2 /*!< Bind Confirm */ -#define EVTRGRUBNDREQ 3 /*!< Unbind Request */ -#define EVTRGRCFGREQ 4 /*!< Configuration Request */ -#define EVTRGRCFGCFM 5 /*!< Configuration Confirm */ +#define EVTRGRBNDREQ 1 /*!< Bind Request */ +#define EVTRGRBNDCFM 2 /*!< Bind Confirm */ +#define EVTRGRUBNDREQ 3 /*!< Unbind Request */ +#define EVTMACSCHCFGREQ 4 /*!< Configuration Request */ +#define EVTMACSCHCFGCFM 5 /*!< Configuration Confirm */ /* rgr_h_001.main_2: Added TTI indication from MAC to RGR user */ /** @name RGR_RRM_TICK */ /** @{ */ diff --git a/src/cm/rgr.x b/src/cm/rgr.x index 7987f8c6a..2eba088ba 100755 --- a/src/cm/rgr.x +++ b/src/cm/rgr.x @@ -830,6 +830,22 @@ typedef struct rgrCellCntrlCmdCfg } RgrCellCntrlCmdCfg; +/** + * @brief + * eNB level Scheduler Configurations + * along with other PFS config Parameters + */ +typedef struct macSchedGnbCfg +{ + U8 numTxAntPorts; /*!< Number of Tx antenna ports */ + U8 ulSchdType; /*!< Indicates which UL scheduler to use, range + * is 0..(number of schedulers - 1) */ + U8 dlSchdType; /*!< Indicates which DL scheduler to use, range + * is 0..(number of schedulers - 1) */ + U8 numCells; /*!< Max number of cells */ + U8 maxUlUePerTti; /*!< Max number of UE in UL per TTI */ + U8 maxDlUePerTti; /*!< Max number of UE in DL per TTI */ +}MacSchedGnbCfg; /** * @brief * eNB level Scheduler Configurations @@ -1049,10 +1065,113 @@ typedef struct rgr5gtfCellCfg }Rgr5gtfCellCfg; #endif +/** @brief This enum defines dl ul transmission periodicity as per spec 38.331 + * servingCellConfigCommon */ +typedef enum rgrDlUlTxPrdcty +{ + RGR_DLULTXPRDCTY_MS0DOT5 = 0, /*! 10000, + representing -6 dB to 4 dB in 0.001 + dB steps */ + U16 pcchTxPwrOffset; /*!< Tx Pwr Offset for PCCH tx. + Offset to the reference signal + power. Value: 0 -> 10000, + representing -6 dB to 4 dB in 0.001 + dB steps */ + U16 rarTxPwrOffset; /*!< Tx Pwr Offset for RAR tx. + Offset to the reference signal + power. Value: 0 -> 10000, + representing -6 dB to 4 dB in 0.001 + dB steps */ + U8 nrMu; /*! 6Ghz)*/ + RgrType0PdcchCSSCfg type0PdcchCSSCfg; /*!< Type 0 CSS Config params */ + RgrFreqInfoDlCfg freqInfoDlCfg; /*!< DL Frequency information + config */ + RgrSulCellCfg sulCellCfg; /*!< SUL Cell config */ + RgrUlCfgCmn ulCmnCfg; /*!< initial UL Bwp and Ul freq + information */ +#endif + Bool initDlBwpPres; /*!< intial common + DL BWP is present or not */ + RgrBwpDlCmn initDlBwp; /*!snList[idx], mBuf); - } - CMCHKPK(cmPkLteLcId, param->lChId, mBuf); - - RETVALUE(ROK); -} - -/** -* @brief Unpacking function for RguLchMapInfo -* -* @details -* -* Function : cmUnpkRguLchMapInfo -* -* @param[out] RguLchMapInfo *param -* @param[in] Buffer *mBuf -* @return Void -**/ -#ifdef ANSI -PRIVATE S16 cmUnpkRguLchMapInfo -( -RguLchMapInfo *param, -Buffer *mBuf -) -#else -PRIVATE S16 cmUnpkRguLchMapInfo(param, mBuf) -RguLchMapInfo *param; -Buffer *mBuf; -#endif -{ - U8 idx; - - TRC3(cmUnpkRguLchMapInfo) - - CMCHKUNPK(cmUnpkLteLcId, ¶m->lChId, mBuf); - for(idx = RGU_MAX_LC; idx > 0; idx--) - { - CMCHKUNPK(SUnpkU16, ¶m->snList[idx - 1], mBuf); - } - - RETVALUE(ROK); -} -#endif /** * @brief Harq Status Indication from MAC to RLC @@ -2034,44 +1961,6 @@ RguHarqStatusInd *harqStatusInd; } -#if 0 -/** -* @brief Unpacking function for RguSnMapInfo -* -* @details -* -* Function : cmUnpkRguSnMapInfo -* -* @param[out] RguSnMapInfo *param -* @param[in] Buffer *mBuf -* @return Void -**/ -#ifdef ANSI -PRIVATE S16 cmUnpkRguSnMapInfo -( -RguSnMapInfo *param, -Buffer *mBuf -) -#else -PRIVATE S16 cmUnpkRguSnMapInfo(param, mBuf) -RguSnMapInfo *param; -Buffer *mBuf; -#endif -{ - U8 idx; - - TRC3(cmUnpkRguSnMapInfo) - - CMCHKUNPK(SUnpkU32, ¶m->tbId, mBuf); - CMCHKUNPK(SUnpkU8, ¶m->numLch, mBuf); - for(idx = param->numLch; idx > 0; idx--) - { - CMCHKUNPK(cmUnpkRguLchMapInfo, ¶m->lchMap[idx - 1], mBuf); - } - RETVALUE(ROK); -} -#endif - /** * @brief Harq Status Indication from MAC to RLC * diff --git a/src/cm/ssi.h b/src/cm/ssi.h index f4a53cda4..06255d4c6 100755 --- a/src/cm/ssi.h +++ b/src/cm/ssi.h @@ -1400,6 +1400,7 @@ #define ENTDUAPP 0xeb /* ORAN DU APP */ #define ENTSCTP 0xec /* ORAN SCTP */ #define ENTF1AP 0xed /* ORAN F1AP */ +#define ENTEGTP 0xee /* ORAN EGTP */ #endif //ORAN /* un-configured procId */ #ifdef SS_MULTIPLE_PROCS diff --git a/src/du_app/F1AP/asn/ANY.c b/src/codec_utils/F1AP/ANY.c similarity index 100% rename from src/du_app/F1AP/asn/ANY.c rename to src/codec_utils/F1AP/ANY.c diff --git a/src/du_app/F1AP/asn/ANY.h b/src/codec_utils/F1AP/ANY.h similarity index 100% rename from src/du_app/F1AP/asn/ANY.h rename to src/codec_utils/F1AP/ANY.h diff --git a/src/du_app/F1AP/asn/AllocationAndRetentionPriority.c b/src/codec_utils/F1AP/AllocationAndRetentionPriority.c similarity index 100% rename from src/du_app/F1AP/asn/AllocationAndRetentionPriority.c rename to src/codec_utils/F1AP/AllocationAndRetentionPriority.c diff --git a/src/du_app/F1AP/asn/AllocationAndRetentionPriority.h b/src/codec_utils/F1AP/AllocationAndRetentionPriority.h similarity index 100% rename from src/du_app/F1AP/asn/AllocationAndRetentionPriority.h rename to src/codec_utils/F1AP/AllocationAndRetentionPriority.h diff --git a/src/du_app/F1AP/asn/Associated-SCell-Item.c b/src/codec_utils/F1AP/Associated-SCell-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Associated-SCell-Item.c rename to src/codec_utils/F1AP/Associated-SCell-Item.c diff --git a/src/du_app/F1AP/asn/Associated-SCell-Item.h b/src/codec_utils/F1AP/Associated-SCell-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Associated-SCell-Item.h rename to src/codec_utils/F1AP/Associated-SCell-Item.h diff --git a/src/du_app/F1AP/asn/Associated-SCell-List.c b/src/codec_utils/F1AP/Associated-SCell-List.c similarity index 100% rename from src/du_app/F1AP/asn/Associated-SCell-List.c rename to src/codec_utils/F1AP/Associated-SCell-List.c diff --git a/src/du_app/F1AP/asn/Associated-SCell-List.h b/src/codec_utils/F1AP/Associated-SCell-List.h similarity index 100% rename from src/du_app/F1AP/asn/Associated-SCell-List.h rename to src/codec_utils/F1AP/Associated-SCell-List.h diff --git a/src/du_app/F1AP/asn/AvailablePLMNList-Item.c b/src/codec_utils/F1AP/AvailablePLMNList-Item.c similarity index 100% rename from src/du_app/F1AP/asn/AvailablePLMNList-Item.c rename to src/codec_utils/F1AP/AvailablePLMNList-Item.c diff --git a/src/du_app/F1AP/asn/AvailablePLMNList-Item.h b/src/codec_utils/F1AP/AvailablePLMNList-Item.h similarity index 100% rename from src/du_app/F1AP/asn/AvailablePLMNList-Item.h rename to src/codec_utils/F1AP/AvailablePLMNList-Item.h diff --git a/src/du_app/F1AP/asn/AvailablePLMNList.c b/src/codec_utils/F1AP/AvailablePLMNList.c similarity index 100% rename from src/du_app/F1AP/asn/AvailablePLMNList.c rename to src/codec_utils/F1AP/AvailablePLMNList.c diff --git a/src/du_app/F1AP/asn/AvailablePLMNList.h b/src/codec_utils/F1AP/AvailablePLMNList.h similarity index 100% rename from src/du_app/F1AP/asn/AvailablePLMNList.h rename to src/codec_utils/F1AP/AvailablePLMNList.h diff --git a/src/du_app/F1AP/asn/AveragingWindow.c b/src/codec_utils/F1AP/AveragingWindow.c similarity index 100% rename from src/du_app/F1AP/asn/AveragingWindow.c rename to src/codec_utils/F1AP/AveragingWindow.c diff --git a/src/du_app/F1AP/asn/AveragingWindow.h b/src/codec_utils/F1AP/AveragingWindow.h similarity index 100% rename from src/du_app/F1AP/asn/AveragingWindow.h rename to src/codec_utils/F1AP/AveragingWindow.h diff --git a/src/du_app/F1AP/asn/BearerTypeChange.c b/src/codec_utils/F1AP/BearerTypeChange.c similarity index 100% rename from src/du_app/F1AP/asn/BearerTypeChange.c rename to src/codec_utils/F1AP/BearerTypeChange.c diff --git a/src/du_app/F1AP/asn/BearerTypeChange.h b/src/codec_utils/F1AP/BearerTypeChange.h similarity index 100% rename from src/du_app/F1AP/asn/BearerTypeChange.h rename to src/codec_utils/F1AP/BearerTypeChange.h diff --git a/src/du_app/F1AP/asn/BitRate.c b/src/codec_utils/F1AP/BitRate.c similarity index 100% rename from src/du_app/F1AP/asn/BitRate.c rename to src/codec_utils/F1AP/BitRate.c diff --git a/src/du_app/F1AP/asn/BitRate.h b/src/codec_utils/F1AP/BitRate.h similarity index 100% rename from src/du_app/F1AP/asn/BitRate.h rename to src/codec_utils/F1AP/BitRate.h diff --git a/src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-Item.c b/src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-Item.c rename to src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-Item.c diff --git a/src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-Item.h b/src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-Item.h rename to src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-Item.h diff --git a/src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-List.c b/src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-List.c similarity index 100% rename from src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-List.c rename to src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-List.c diff --git a/src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-List.h b/src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-List.h similarity index 100% rename from src/du_app/F1AP/asn/Broadcast-To-Be-Cancelled-List.h rename to src/codec_utils/F1AP/Broadcast-To-Be-Cancelled-List.h diff --git a/src/du_app/F1AP/asn/C-RNTI.c b/src/codec_utils/F1AP/C-RNTI.c similarity index 100% rename from src/du_app/F1AP/asn/C-RNTI.c rename to src/codec_utils/F1AP/C-RNTI.c diff --git a/src/du_app/F1AP/asn/C-RNTI.h b/src/codec_utils/F1AP/C-RNTI.h similarity index 100% rename from src/du_app/F1AP/asn/C-RNTI.h rename to src/codec_utils/F1AP/C-RNTI.h diff --git a/src/du_app/F1AP/asn/CG-ConfigInfo.c b/src/codec_utils/F1AP/CG-ConfigInfo.c similarity index 100% rename from src/du_app/F1AP/asn/CG-ConfigInfo.c rename to src/codec_utils/F1AP/CG-ConfigInfo.c diff --git a/src/du_app/F1AP/asn/CG-ConfigInfo.h b/src/codec_utils/F1AP/CG-ConfigInfo.h similarity index 100% rename from src/du_app/F1AP/asn/CG-ConfigInfo.h rename to src/codec_utils/F1AP/CG-ConfigInfo.h diff --git a/src/du_app/F1AP/asn/CNUEPagingIdentity.c b/src/codec_utils/F1AP/CNUEPagingIdentity.c similarity index 100% rename from src/du_app/F1AP/asn/CNUEPagingIdentity.c rename to src/codec_utils/F1AP/CNUEPagingIdentity.c diff --git a/src/du_app/F1AP/asn/CNUEPagingIdentity.h b/src/codec_utils/F1AP/CNUEPagingIdentity.h similarity index 100% rename from src/du_app/F1AP/asn/CNUEPagingIdentity.h rename to src/codec_utils/F1AP/CNUEPagingIdentity.h diff --git a/src/du_app/F1AP/asn/CP-TransportLayerAddress.c b/src/codec_utils/F1AP/CP-TransportLayerAddress.c similarity index 100% rename from src/du_app/F1AP/asn/CP-TransportLayerAddress.c rename to src/codec_utils/F1AP/CP-TransportLayerAddress.c diff --git a/src/du_app/F1AP/asn/CP-TransportLayerAddress.h b/src/codec_utils/F1AP/CP-TransportLayerAddress.h similarity index 100% rename from src/du_app/F1AP/asn/CP-TransportLayerAddress.h rename to src/codec_utils/F1AP/CP-TransportLayerAddress.h diff --git a/src/du_app/F1AP/asn/CUtoDURRCInformation.c b/src/codec_utils/F1AP/CUtoDURRCInformation.c similarity index 100% rename from src/du_app/F1AP/asn/CUtoDURRCInformation.c rename to src/codec_utils/F1AP/CUtoDURRCInformation.c diff --git a/src/du_app/F1AP/asn/CUtoDURRCInformation.h b/src/codec_utils/F1AP/CUtoDURRCInformation.h similarity index 100% rename from src/du_app/F1AP/asn/CUtoDURRCInformation.h rename to src/codec_utils/F1AP/CUtoDURRCInformation.h diff --git a/src/du_app/F1AP/asn/Cancel-all-Warning-Messages-Indicator.c b/src/codec_utils/F1AP/Cancel-all-Warning-Messages-Indicator.c similarity index 100% rename from src/du_app/F1AP/asn/Cancel-all-Warning-Messages-Indicator.c rename to src/codec_utils/F1AP/Cancel-all-Warning-Messages-Indicator.c diff --git a/src/du_app/F1AP/asn/Cancel-all-Warning-Messages-Indicator.h b/src/codec_utils/F1AP/Cancel-all-Warning-Messages-Indicator.h similarity index 100% rename from src/du_app/F1AP/asn/Cancel-all-Warning-Messages-Indicator.h rename to src/codec_utils/F1AP/Cancel-all-Warning-Messages-Indicator.h diff --git a/src/du_app/F1AP/asn/Candidate-SpCell-Item.c b/src/codec_utils/F1AP/Candidate-SpCell-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Candidate-SpCell-Item.c rename to src/codec_utils/F1AP/Candidate-SpCell-Item.c diff --git a/src/du_app/F1AP/asn/Candidate-SpCell-Item.h b/src/codec_utils/F1AP/Candidate-SpCell-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Candidate-SpCell-Item.h rename to src/codec_utils/F1AP/Candidate-SpCell-Item.h diff --git a/src/du_app/F1AP/asn/Candidate-SpCell-List.c b/src/codec_utils/F1AP/Candidate-SpCell-List.c similarity index 100% rename from src/du_app/F1AP/asn/Candidate-SpCell-List.c rename to src/codec_utils/F1AP/Candidate-SpCell-List.c diff --git a/src/du_app/F1AP/asn/Candidate-SpCell-List.h b/src/codec_utils/F1AP/Candidate-SpCell-List.h similarity index 100% rename from src/du_app/F1AP/asn/Candidate-SpCell-List.h rename to src/codec_utils/F1AP/Candidate-SpCell-List.h diff --git a/src/du_app/F1AP/asn/Cause.c b/src/codec_utils/F1AP/Cause.c similarity index 100% rename from src/du_app/F1AP/asn/Cause.c rename to src/codec_utils/F1AP/Cause.c diff --git a/src/du_app/F1AP/asn/Cause.h b/src/codec_utils/F1AP/Cause.h similarity index 100% rename from src/du_app/F1AP/asn/Cause.h rename to src/codec_utils/F1AP/Cause.h diff --git a/src/du_app/F1AP/asn/CauseMisc.c b/src/codec_utils/F1AP/CauseMisc.c similarity index 100% rename from src/du_app/F1AP/asn/CauseMisc.c rename to src/codec_utils/F1AP/CauseMisc.c diff --git a/src/du_app/F1AP/asn/CauseMisc.h b/src/codec_utils/F1AP/CauseMisc.h similarity index 100% rename from src/du_app/F1AP/asn/CauseMisc.h rename to src/codec_utils/F1AP/CauseMisc.h diff --git a/src/du_app/F1AP/asn/CauseProtocol.c b/src/codec_utils/F1AP/CauseProtocol.c similarity index 100% rename from src/du_app/F1AP/asn/CauseProtocol.c rename to src/codec_utils/F1AP/CauseProtocol.c diff --git a/src/du_app/F1AP/asn/CauseProtocol.h b/src/codec_utils/F1AP/CauseProtocol.h similarity index 100% rename from src/du_app/F1AP/asn/CauseProtocol.h rename to src/codec_utils/F1AP/CauseProtocol.h diff --git a/src/du_app/F1AP/asn/CauseRadioNetwork.c b/src/codec_utils/F1AP/CauseRadioNetwork.c similarity index 100% rename from src/du_app/F1AP/asn/CauseRadioNetwork.c rename to src/codec_utils/F1AP/CauseRadioNetwork.c diff --git a/src/du_app/F1AP/asn/CauseRadioNetwork.h b/src/codec_utils/F1AP/CauseRadioNetwork.h similarity index 100% rename from src/du_app/F1AP/asn/CauseRadioNetwork.h rename to src/codec_utils/F1AP/CauseRadioNetwork.h diff --git a/src/du_app/F1AP/asn/CauseTransport.c b/src/codec_utils/F1AP/CauseTransport.c similarity index 100% rename from src/du_app/F1AP/asn/CauseTransport.c rename to src/codec_utils/F1AP/CauseTransport.c diff --git a/src/du_app/F1AP/asn/CauseTransport.h b/src/codec_utils/F1AP/CauseTransport.h similarity index 100% rename from src/du_app/F1AP/asn/CauseTransport.h rename to src/codec_utils/F1AP/CauseTransport.h diff --git a/src/du_app/F1AP/asn/Cell-Direction.c b/src/codec_utils/F1AP/Cell-Direction.c similarity index 100% rename from src/du_app/F1AP/asn/Cell-Direction.c rename to src/codec_utils/F1AP/Cell-Direction.c diff --git a/src/du_app/F1AP/asn/Cell-Direction.h b/src/codec_utils/F1AP/Cell-Direction.h similarity index 100% rename from src/du_app/F1AP/asn/Cell-Direction.h rename to src/codec_utils/F1AP/Cell-Direction.h diff --git a/src/du_app/F1AP/asn/CellBarred.c b/src/codec_utils/F1AP/CellBarred.c similarity index 100% rename from src/du_app/F1AP/asn/CellBarred.c rename to src/codec_utils/F1AP/CellBarred.c diff --git a/src/du_app/F1AP/asn/CellBarred.h b/src/codec_utils/F1AP/CellBarred.h similarity index 100% rename from src/du_app/F1AP/asn/CellBarred.h rename to src/codec_utils/F1AP/CellBarred.h diff --git a/src/du_app/F1AP/asn/CellGroupConfig.c b/src/codec_utils/F1AP/CellGroupConfig.c similarity index 100% rename from src/du_app/F1AP/asn/CellGroupConfig.c rename to src/codec_utils/F1AP/CellGroupConfig.c diff --git a/src/du_app/F1AP/asn/CellGroupConfig.h b/src/codec_utils/F1AP/CellGroupConfig.h similarity index 100% rename from src/du_app/F1AP/asn/CellGroupConfig.h rename to src/codec_utils/F1AP/CellGroupConfig.h diff --git a/src/du_app/F1AP/asn/CellULConfigured.c b/src/codec_utils/F1AP/CellULConfigured.c similarity index 100% rename from src/du_app/F1AP/asn/CellULConfigured.c rename to src/codec_utils/F1AP/CellULConfigured.c diff --git a/src/du_app/F1AP/asn/CellULConfigured.h b/src/codec_utils/F1AP/CellULConfigured.h similarity index 100% rename from src/du_app/F1AP/asn/CellULConfigured.h rename to src/codec_utils/F1AP/CellULConfigured.h diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-Item.c b/src/codec_utils/F1AP/Cells-Broadcast-Cancelled-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-Item.c rename to src/codec_utils/F1AP/Cells-Broadcast-Cancelled-Item.c diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-Item.h b/src/codec_utils/F1AP/Cells-Broadcast-Cancelled-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-Item.h rename to src/codec_utils/F1AP/Cells-Broadcast-Cancelled-Item.h diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-List.c b/src/codec_utils/F1AP/Cells-Broadcast-Cancelled-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-List.c rename to src/codec_utils/F1AP/Cells-Broadcast-Cancelled-List.c diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-List.h b/src/codec_utils/F1AP/Cells-Broadcast-Cancelled-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Cancelled-List.h rename to src/codec_utils/F1AP/Cells-Broadcast-Cancelled-List.h diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Completed-Item.c b/src/codec_utils/F1AP/Cells-Broadcast-Completed-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Completed-Item.c rename to src/codec_utils/F1AP/Cells-Broadcast-Completed-Item.c diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Completed-Item.h b/src/codec_utils/F1AP/Cells-Broadcast-Completed-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Completed-Item.h rename to src/codec_utils/F1AP/Cells-Broadcast-Completed-Item.h diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Completed-List.c b/src/codec_utils/F1AP/Cells-Broadcast-Completed-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Completed-List.c rename to src/codec_utils/F1AP/Cells-Broadcast-Completed-List.c diff --git a/src/du_app/F1AP/asn/Cells-Broadcast-Completed-List.h b/src/codec_utils/F1AP/Cells-Broadcast-Completed-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Broadcast-Completed-List.h rename to src/codec_utils/F1AP/Cells-Broadcast-Completed-List.h diff --git a/src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List-Item.c b/src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List-Item.c rename to src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List-Item.c diff --git a/src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List-Item.h b/src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List-Item.h rename to src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List-Item.h diff --git a/src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List.c b/src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List.c rename to src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List.c diff --git a/src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List.h b/src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Failed-to-be-Activated-List.h rename to src/codec_utils/F1AP/Cells-Failed-to-be-Activated-List.h diff --git a/src/du_app/F1AP/asn/Cells-Status-Item.c b/src/codec_utils/F1AP/Cells-Status-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Status-Item.c rename to src/codec_utils/F1AP/Cells-Status-Item.c diff --git a/src/du_app/F1AP/asn/Cells-Status-Item.h b/src/codec_utils/F1AP/Cells-Status-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Status-Item.h rename to src/codec_utils/F1AP/Cells-Status-Item.h diff --git a/src/du_app/F1AP/asn/Cells-Status-List.c b/src/codec_utils/F1AP/Cells-Status-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-Status-List.c rename to src/codec_utils/F1AP/Cells-Status-List.c diff --git a/src/du_app/F1AP/asn/Cells-Status-List.h b/src/codec_utils/F1AP/Cells-Status-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-Status-List.h rename to src/codec_utils/F1AP/Cells-Status-List.h diff --git a/src/du_app/F1AP/asn/Cells-To-Be-Broadcast-Item.c b/src/codec_utils/F1AP/Cells-To-Be-Broadcast-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-To-Be-Broadcast-Item.c rename to src/codec_utils/F1AP/Cells-To-Be-Broadcast-Item.c diff --git a/src/du_app/F1AP/asn/Cells-To-Be-Broadcast-Item.h b/src/codec_utils/F1AP/Cells-To-Be-Broadcast-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-To-Be-Broadcast-Item.h rename to src/codec_utils/F1AP/Cells-To-Be-Broadcast-Item.h diff --git a/src/du_app/F1AP/asn/Cells-To-Be-Broadcast-List.c b/src/codec_utils/F1AP/Cells-To-Be-Broadcast-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-To-Be-Broadcast-List.c rename to src/codec_utils/F1AP/Cells-To-Be-Broadcast-List.c diff --git a/src/du_app/F1AP/asn/Cells-To-Be-Broadcast-List.h b/src/codec_utils/F1AP/Cells-To-Be-Broadcast-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-To-Be-Broadcast-List.h rename to src/codec_utils/F1AP/Cells-To-Be-Broadcast-List.h diff --git a/src/du_app/F1AP/asn/Cells-to-be-Activated-List-Item.c b/src/codec_utils/F1AP/Cells-to-be-Activated-List-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Activated-List-Item.c rename to src/codec_utils/F1AP/Cells-to-be-Activated-List-Item.c diff --git a/src/du_app/F1AP/asn/Cells-to-be-Activated-List-Item.h b/src/codec_utils/F1AP/Cells-to-be-Activated-List-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Activated-List-Item.h rename to src/codec_utils/F1AP/Cells-to-be-Activated-List-Item.h diff --git a/src/du_app/F1AP/asn/Cells-to-be-Activated-List.c b/src/codec_utils/F1AP/Cells-to-be-Activated-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Activated-List.c rename to src/codec_utils/F1AP/Cells-to-be-Activated-List.c diff --git a/src/codec_utils/F1AP/Cells-to-be-Activated-List.h b/src/codec_utils/F1AP/Cells-to-be-Activated-List.h new file mode 100755 index 000000000..3ef80d584 --- /dev/null +++ b/src/codec_utils/F1AP/Cells-to-be-Activated-List.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Cells_to_be_Activated_List_H_ +#define _Cells_to_be_Activated_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* Cells-to-be-Activated-List */ +typedef struct Cells_to_be_Activated_List { + A_SEQUENCE_OF(struct Cells_to_be_Activated_List_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Cells_to_be_Activated_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Cells_to_be_Activated_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _Cells_to_be_Activated_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/Cells-to-be-Barred-Item.c b/src/codec_utils/F1AP/Cells-to-be-Barred-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Barred-Item.c rename to src/codec_utils/F1AP/Cells-to-be-Barred-Item.c diff --git a/src/du_app/F1AP/asn/Cells-to-be-Barred-Item.h b/src/codec_utils/F1AP/Cells-to-be-Barred-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Barred-Item.h rename to src/codec_utils/F1AP/Cells-to-be-Barred-Item.h diff --git a/src/du_app/F1AP/asn/Cells-to-be-Barred-List.c b/src/codec_utils/F1AP/Cells-to-be-Barred-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Barred-List.c rename to src/codec_utils/F1AP/Cells-to-be-Barred-List.c diff --git a/src/du_app/F1AP/asn/Cells-to-be-Barred-List.h b/src/codec_utils/F1AP/Cells-to-be-Barred-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Barred-List.h rename to src/codec_utils/F1AP/Cells-to-be-Barred-List.h diff --git a/src/du_app/F1AP/asn/Cells-to-be-Deactivated-List-Item.c b/src/codec_utils/F1AP/Cells-to-be-Deactivated-List-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Deactivated-List-Item.c rename to src/codec_utils/F1AP/Cells-to-be-Deactivated-List-Item.c diff --git a/src/du_app/F1AP/asn/Cells-to-be-Deactivated-List-Item.h b/src/codec_utils/F1AP/Cells-to-be-Deactivated-List-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Deactivated-List-Item.h rename to src/codec_utils/F1AP/Cells-to-be-Deactivated-List-Item.h diff --git a/src/du_app/F1AP/asn/Cells-to-be-Deactivated-List.c b/src/codec_utils/F1AP/Cells-to-be-Deactivated-List.c similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Deactivated-List.c rename to src/codec_utils/F1AP/Cells-to-be-Deactivated-List.c diff --git a/src/du_app/F1AP/asn/Cells-to-be-Deactivated-List.h b/src/codec_utils/F1AP/Cells-to-be-Deactivated-List.h similarity index 100% rename from src/du_app/F1AP/asn/Cells-to-be-Deactivated-List.h rename to src/codec_utils/F1AP/Cells-to-be-Deactivated-List.h diff --git a/src/du_app/F1AP/asn/Configured-EPS-TAC.c b/src/codec_utils/F1AP/Configured-EPS-TAC.c similarity index 100% rename from src/du_app/F1AP/asn/Configured-EPS-TAC.c rename to src/codec_utils/F1AP/Configured-EPS-TAC.c diff --git a/src/du_app/F1AP/asn/Configured-EPS-TAC.h b/src/codec_utils/F1AP/Configured-EPS-TAC.h similarity index 100% rename from src/du_app/F1AP/asn/Configured-EPS-TAC.h rename to src/codec_utils/F1AP/Configured-EPS-TAC.h diff --git a/src/du_app/F1AP/asn/Criticality.c b/src/codec_utils/F1AP/Criticality.c similarity index 100% rename from src/du_app/F1AP/asn/Criticality.c rename to src/codec_utils/F1AP/Criticality.c diff --git a/src/du_app/F1AP/asn/Criticality.h b/src/codec_utils/F1AP/Criticality.h similarity index 100% rename from src/du_app/F1AP/asn/Criticality.h rename to src/codec_utils/F1AP/Criticality.h diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics-IE-Item.c b/src/codec_utils/F1AP/CriticalityDiagnostics-IE-Item.c similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics-IE-Item.c rename to src/codec_utils/F1AP/CriticalityDiagnostics-IE-Item.c diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics-IE-Item.h b/src/codec_utils/F1AP/CriticalityDiagnostics-IE-Item.h similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics-IE-Item.h rename to src/codec_utils/F1AP/CriticalityDiagnostics-IE-Item.h diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics-IE-List.c b/src/codec_utils/F1AP/CriticalityDiagnostics-IE-List.c similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics-IE-List.c rename to src/codec_utils/F1AP/CriticalityDiagnostics-IE-List.c diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics-IE-List.h b/src/codec_utils/F1AP/CriticalityDiagnostics-IE-List.h similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics-IE-List.h rename to src/codec_utils/F1AP/CriticalityDiagnostics-IE-List.h diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics.c b/src/codec_utils/F1AP/CriticalityDiagnostics.c similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics.c rename to src/codec_utils/F1AP/CriticalityDiagnostics.c diff --git a/src/du_app/F1AP/asn/CriticalityDiagnostics.h b/src/codec_utils/F1AP/CriticalityDiagnostics.h similarity index 100% rename from src/du_app/F1AP/asn/CriticalityDiagnostics.h rename to src/codec_utils/F1AP/CriticalityDiagnostics.h diff --git a/src/du_app/F1AP/asn/DCBasedDuplicationConfigured.c b/src/codec_utils/F1AP/DCBasedDuplicationConfigured.c similarity index 100% rename from src/du_app/F1AP/asn/DCBasedDuplicationConfigured.c rename to src/codec_utils/F1AP/DCBasedDuplicationConfigured.c diff --git a/src/du_app/F1AP/asn/DCBasedDuplicationConfigured.h b/src/codec_utils/F1AP/DCBasedDuplicationConfigured.h similarity index 100% rename from src/du_app/F1AP/asn/DCBasedDuplicationConfigured.h rename to src/codec_utils/F1AP/DCBasedDuplicationConfigured.h diff --git a/src/du_app/F1AP/asn/DLRRCMessageTransfer.c b/src/codec_utils/F1AP/DLRRCMessageTransfer.c similarity index 100% rename from src/du_app/F1AP/asn/DLRRCMessageTransfer.c rename to src/codec_utils/F1AP/DLRRCMessageTransfer.c diff --git a/src/du_app/F1AP/asn/DLRRCMessageTransfer.h b/src/codec_utils/F1AP/DLRRCMessageTransfer.h similarity index 100% rename from src/du_app/F1AP/asn/DLRRCMessageTransfer.h rename to src/codec_utils/F1AP/DLRRCMessageTransfer.h diff --git a/src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-Item.c b/src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-Item.c rename to src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-Item.h b/src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-Item.h rename to src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-List.c b/src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-List.c rename to src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-List.c diff --git a/src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-List.h b/src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-List.h similarity index 100% rename from src/du_app/F1AP/asn/DLUPTNLInformation-ToBeSetup-List.h rename to src/codec_utils/F1AP/DLUPTNLInformation-ToBeSetup-List.h diff --git a/src/du_app/F1AP/asn/DRB-Activity-Item.c b/src/codec_utils/F1AP/DRB-Activity-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity-Item.c rename to src/codec_utils/F1AP/DRB-Activity-Item.c diff --git a/src/du_app/F1AP/asn/DRB-Activity-Item.h b/src/codec_utils/F1AP/DRB-Activity-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity-Item.h rename to src/codec_utils/F1AP/DRB-Activity-Item.h diff --git a/src/du_app/F1AP/asn/DRB-Activity-List.c b/src/codec_utils/F1AP/DRB-Activity-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity-List.c rename to src/codec_utils/F1AP/DRB-Activity-List.c diff --git a/src/du_app/F1AP/asn/DRB-Activity-List.h b/src/codec_utils/F1AP/DRB-Activity-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity-List.h rename to src/codec_utils/F1AP/DRB-Activity-List.h diff --git a/src/du_app/F1AP/asn/DRB-Activity.c b/src/codec_utils/F1AP/DRB-Activity.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity.c rename to src/codec_utils/F1AP/DRB-Activity.c diff --git a/src/du_app/F1AP/asn/DRB-Activity.h b/src/codec_utils/F1AP/DRB-Activity.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Activity.h rename to src/codec_utils/F1AP/DRB-Activity.h diff --git a/src/du_app/F1AP/asn/DRB-Information.c b/src/codec_utils/F1AP/DRB-Information.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Information.c rename to src/codec_utils/F1AP/DRB-Information.c diff --git a/src/du_app/F1AP/asn/DRB-Information.h b/src/codec_utils/F1AP/DRB-Information.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Information.h rename to src/codec_utils/F1AP/DRB-Information.h diff --git a/src/du_app/F1AP/asn/DRB-Notify-Item.c b/src/codec_utils/F1AP/DRB-Notify-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Notify-Item.c rename to src/codec_utils/F1AP/DRB-Notify-Item.c diff --git a/src/du_app/F1AP/asn/DRB-Notify-Item.h b/src/codec_utils/F1AP/DRB-Notify-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Notify-Item.h rename to src/codec_utils/F1AP/DRB-Notify-Item.h diff --git a/src/du_app/F1AP/asn/DRB-Notify-List.c b/src/codec_utils/F1AP/DRB-Notify-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRB-Notify-List.c rename to src/codec_utils/F1AP/DRB-Notify-List.c diff --git a/src/du_app/F1AP/asn/DRB-Notify-List.h b/src/codec_utils/F1AP/DRB-Notify-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRB-Notify-List.h rename to src/codec_utils/F1AP/DRB-Notify-List.h diff --git a/src/du_app/F1AP/asn/DRBID.c b/src/codec_utils/F1AP/DRBID.c similarity index 100% rename from src/du_app/F1AP/asn/DRBID.c rename to src/codec_utils/F1AP/DRBID.c diff --git a/src/du_app/F1AP/asn/DRBID.h b/src/codec_utils/F1AP/DRBID.h similarity index 100% rename from src/du_app/F1AP/asn/DRBID.h rename to src/codec_utils/F1AP/DRBID.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeModified-Item.c b/src/codec_utils/F1AP/DRBs-FailedToBeModified-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeModified-Item.c rename to src/codec_utils/F1AP/DRBs-FailedToBeModified-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeModified-Item.h b/src/codec_utils/F1AP/DRBs-FailedToBeModified-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeModified-Item.h rename to src/codec_utils/F1AP/DRBs-FailedToBeModified-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeModified-List.c b/src/codec_utils/F1AP/DRBs-FailedToBeModified-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeModified-List.c rename to src/codec_utils/F1AP/DRBs-FailedToBeModified-List.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeModified-List.h b/src/codec_utils/F1AP/DRBs-FailedToBeModified-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeModified-List.h rename to src/codec_utils/F1AP/DRBs-FailedToBeModified-List.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetup-Item.c b/src/codec_utils/F1AP/DRBs-FailedToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetup-Item.c rename to src/codec_utils/F1AP/DRBs-FailedToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetup-Item.h b/src/codec_utils/F1AP/DRBs-FailedToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetup-Item.h rename to src/codec_utils/F1AP/DRBs-FailedToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetup-List.c b/src/codec_utils/F1AP/DRBs-FailedToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetup-List.c rename to src/codec_utils/F1AP/DRBs-FailedToBeSetup-List.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetup-List.h b/src/codec_utils/F1AP/DRBs-FailedToBeSetup-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetup-List.h rename to src/codec_utils/F1AP/DRBs-FailedToBeSetup-List.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-Item.c b/src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-Item.c rename to src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-Item.h b/src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-Item.h rename to src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-List.c b/src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-List.c rename to src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-List.c diff --git a/src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-List.h b/src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-FailedToBeSetupMod-List.h rename to src/codec_utils/F1AP/DRBs-FailedToBeSetupMod-List.h diff --git a/src/du_app/F1AP/asn/DRBs-Modified-Item.c b/src/codec_utils/F1AP/DRBs-Modified-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Modified-Item.c rename to src/codec_utils/F1AP/DRBs-Modified-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-Modified-Item.h b/src/codec_utils/F1AP/DRBs-Modified-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Modified-Item.h rename to src/codec_utils/F1AP/DRBs-Modified-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-Modified-List.c b/src/codec_utils/F1AP/DRBs-Modified-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Modified-List.c rename to src/codec_utils/F1AP/DRBs-Modified-List.c diff --git a/src/du_app/F1AP/asn/DRBs-Modified-List.h b/src/codec_utils/F1AP/DRBs-Modified-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Modified-List.h rename to src/codec_utils/F1AP/DRBs-Modified-List.h diff --git a/src/du_app/F1AP/asn/DRBs-ModifiedConf-Item.c b/src/codec_utils/F1AP/DRBs-ModifiedConf-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ModifiedConf-Item.c rename to src/codec_utils/F1AP/DRBs-ModifiedConf-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-ModifiedConf-Item.h b/src/codec_utils/F1AP/DRBs-ModifiedConf-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ModifiedConf-Item.h rename to src/codec_utils/F1AP/DRBs-ModifiedConf-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-ModifiedConf-List.c b/src/codec_utils/F1AP/DRBs-ModifiedConf-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ModifiedConf-List.c rename to src/codec_utils/F1AP/DRBs-ModifiedConf-List.c diff --git a/src/du_app/F1AP/asn/DRBs-ModifiedConf-List.h b/src/codec_utils/F1AP/DRBs-ModifiedConf-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ModifiedConf-List.h rename to src/codec_utils/F1AP/DRBs-ModifiedConf-List.h diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeModified-Item.c b/src/codec_utils/F1AP/DRBs-Required-ToBeModified-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeModified-Item.c rename to src/codec_utils/F1AP/DRBs-Required-ToBeModified-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeModified-Item.h b/src/codec_utils/F1AP/DRBs-Required-ToBeModified-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeModified-Item.h rename to src/codec_utils/F1AP/DRBs-Required-ToBeModified-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeModified-List.c b/src/codec_utils/F1AP/DRBs-Required-ToBeModified-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeModified-List.c rename to src/codec_utils/F1AP/DRBs-Required-ToBeModified-List.c diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeModified-List.h b/src/codec_utils/F1AP/DRBs-Required-ToBeModified-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeModified-List.h rename to src/codec_utils/F1AP/DRBs-Required-ToBeModified-List.h diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-Item.c b/src/codec_utils/F1AP/DRBs-Required-ToBeReleased-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-Item.c rename to src/codec_utils/F1AP/DRBs-Required-ToBeReleased-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-Item.h b/src/codec_utils/F1AP/DRBs-Required-ToBeReleased-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-Item.h rename to src/codec_utils/F1AP/DRBs-Required-ToBeReleased-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-List.c b/src/codec_utils/F1AP/DRBs-Required-ToBeReleased-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-List.c rename to src/codec_utils/F1AP/DRBs-Required-ToBeReleased-List.c diff --git a/src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-List.h b/src/codec_utils/F1AP/DRBs-Required-ToBeReleased-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Required-ToBeReleased-List.h rename to src/codec_utils/F1AP/DRBs-Required-ToBeReleased-List.h diff --git a/src/du_app/F1AP/asn/DRBs-Setup-Item.c b/src/codec_utils/F1AP/DRBs-Setup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Setup-Item.c rename to src/codec_utils/F1AP/DRBs-Setup-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-Setup-Item.h b/src/codec_utils/F1AP/DRBs-Setup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Setup-Item.h rename to src/codec_utils/F1AP/DRBs-Setup-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-Setup-List.c b/src/codec_utils/F1AP/DRBs-Setup-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Setup-List.c rename to src/codec_utils/F1AP/DRBs-Setup-List.c diff --git a/src/du_app/F1AP/asn/DRBs-Setup-List.h b/src/codec_utils/F1AP/DRBs-Setup-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-Setup-List.h rename to src/codec_utils/F1AP/DRBs-Setup-List.h diff --git a/src/du_app/F1AP/asn/DRBs-SetupMod-Item.c b/src/codec_utils/F1AP/DRBs-SetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-SetupMod-Item.c rename to src/codec_utils/F1AP/DRBs-SetupMod-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-SetupMod-Item.h b/src/codec_utils/F1AP/DRBs-SetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-SetupMod-Item.h rename to src/codec_utils/F1AP/DRBs-SetupMod-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-SetupMod-List.c b/src/codec_utils/F1AP/DRBs-SetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-SetupMod-List.c rename to src/codec_utils/F1AP/DRBs-SetupMod-List.c diff --git a/src/du_app/F1AP/asn/DRBs-SetupMod-List.h b/src/codec_utils/F1AP/DRBs-SetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-SetupMod-List.h rename to src/codec_utils/F1AP/DRBs-SetupMod-List.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeModified-Item.c b/src/codec_utils/F1AP/DRBs-ToBeModified-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeModified-Item.c rename to src/codec_utils/F1AP/DRBs-ToBeModified-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeModified-Item.h b/src/codec_utils/F1AP/DRBs-ToBeModified-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeModified-Item.h rename to src/codec_utils/F1AP/DRBs-ToBeModified-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeModified-List.c b/src/codec_utils/F1AP/DRBs-ToBeModified-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeModified-List.c rename to src/codec_utils/F1AP/DRBs-ToBeModified-List.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeModified-List.h b/src/codec_utils/F1AP/DRBs-ToBeModified-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeModified-List.h rename to src/codec_utils/F1AP/DRBs-ToBeModified-List.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeReleased-Item.c b/src/codec_utils/F1AP/DRBs-ToBeReleased-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeReleased-Item.c rename to src/codec_utils/F1AP/DRBs-ToBeReleased-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeReleased-Item.h b/src/codec_utils/F1AP/DRBs-ToBeReleased-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeReleased-Item.h rename to src/codec_utils/F1AP/DRBs-ToBeReleased-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeReleased-List.c b/src/codec_utils/F1AP/DRBs-ToBeReleased-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeReleased-List.c rename to src/codec_utils/F1AP/DRBs-ToBeReleased-List.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeReleased-List.h b/src/codec_utils/F1AP/DRBs-ToBeReleased-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeReleased-List.h rename to src/codec_utils/F1AP/DRBs-ToBeReleased-List.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetup-Item.c b/src/codec_utils/F1AP/DRBs-ToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetup-Item.c rename to src/codec_utils/F1AP/DRBs-ToBeSetup-Item.c diff --git a/src/codec_utils/F1AP/DRBs-ToBeSetup-Item.h b/src/codec_utils/F1AP/DRBs-ToBeSetup-Item.h new file mode 100755 index 000000000..0a4959122 --- /dev/null +++ b/src/codec_utils/F1AP/DRBs-ToBeSetup-Item.h @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _DRBs_ToBeSetup_Item_H_ +#define _DRBs_ToBeSetup_Item_H_ + + +#include + +/* Including external dependencies */ +#include "DRBID.h" +#include "QoSInformation.h" +#include "ULUPTNLInformation-ToBeSetup-List.h" +#include "RLCMode.h" +#include "DuplicationActivation.h" +#include +#include "ULConfiguration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ULConfiguration; +struct ProtocolExtensionContainer; + +/* DRBs-ToBeSetup-Item */ +typedef struct DRBs_ToBeSetup_Item { + DRBID_t dRBID; + QoSInformation_t qoSInformation; + ULUPTNLInformation_ToBeSetup_List_t uLUPTNLInformation_ToBeSetup_List; + RLCMode_t rLCMode; + struct ULConfiguration *uLConfiguration; /* OPTIONAL */ + DuplicationActivation_t *duplicationActivation; /* OPTIONAL */ + struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} DRBs_ToBeSetup_Item_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DRBs_ToBeSetup_Item; + +#ifdef __cplusplus +} +#endif + +#endif /* _DRBs_ToBeSetup_Item_H_ */ +#include diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetup-List.c b/src/codec_utils/F1AP/DRBs-ToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetup-List.c rename to src/codec_utils/F1AP/DRBs-ToBeSetup-List.c diff --git a/src/codec_utils/F1AP/DRBs-ToBeSetup-List.h b/src/codec_utils/F1AP/DRBs-ToBeSetup-List.h new file mode 100755 index 000000000..11fc32ee2 --- /dev/null +++ b/src/codec_utils/F1AP/DRBs-ToBeSetup-List.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _DRBs_ToBeSetup_List_H_ +#define _DRBs_ToBeSetup_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* DRBs-ToBeSetup-List */ +typedef struct DRBs_ToBeSetup_List { + A_SEQUENCE_OF(struct DRBs_ToBeSetup_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} DRBs_ToBeSetup_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DRBs_ToBeSetup_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _DRBs_ToBeSetup_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetupMod-Item.c b/src/codec_utils/F1AP/DRBs-ToBeSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetupMod-Item.c rename to src/codec_utils/F1AP/DRBs-ToBeSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetupMod-Item.h b/src/codec_utils/F1AP/DRBs-ToBeSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetupMod-Item.h rename to src/codec_utils/F1AP/DRBs-ToBeSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetupMod-List.c b/src/codec_utils/F1AP/DRBs-ToBeSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetupMod-List.c rename to src/codec_utils/F1AP/DRBs-ToBeSetupMod-List.c diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetupMod-List.h b/src/codec_utils/F1AP/DRBs-ToBeSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/DRBs-ToBeSetupMod-List.h rename to src/codec_utils/F1AP/DRBs-ToBeSetupMod-List.h diff --git a/src/du_app/F1AP/asn/DRX-Config.c b/src/codec_utils/F1AP/DRX-Config.c similarity index 100% rename from src/du_app/F1AP/asn/DRX-Config.c rename to src/codec_utils/F1AP/DRX-Config.c diff --git a/src/du_app/F1AP/asn/DRX-Config.h b/src/codec_utils/F1AP/DRX-Config.h similarity index 100% rename from src/du_app/F1AP/asn/DRX-Config.h rename to src/codec_utils/F1AP/DRX-Config.h diff --git a/src/du_app/F1AP/asn/DRX-LongCycleStartOffset.c b/src/codec_utils/F1AP/DRX-LongCycleStartOffset.c similarity index 100% rename from src/du_app/F1AP/asn/DRX-LongCycleStartOffset.c rename to src/codec_utils/F1AP/DRX-LongCycleStartOffset.c diff --git a/src/du_app/F1AP/asn/DRX-LongCycleStartOffset.h b/src/codec_utils/F1AP/DRX-LongCycleStartOffset.h similarity index 100% rename from src/du_app/F1AP/asn/DRX-LongCycleStartOffset.h rename to src/codec_utils/F1AP/DRX-LongCycleStartOffset.h diff --git a/src/du_app/F1AP/asn/DRXConfigurationIndicator.c b/src/codec_utils/F1AP/DRXConfigurationIndicator.c similarity index 100% rename from src/du_app/F1AP/asn/DRXConfigurationIndicator.c rename to src/codec_utils/F1AP/DRXConfigurationIndicator.c diff --git a/src/du_app/F1AP/asn/DRXConfigurationIndicator.h b/src/codec_utils/F1AP/DRXConfigurationIndicator.h similarity index 100% rename from src/du_app/F1AP/asn/DRXConfigurationIndicator.h rename to src/codec_utils/F1AP/DRXConfigurationIndicator.h diff --git a/src/du_app/F1AP/asn/DRXCycle.c b/src/codec_utils/F1AP/DRXCycle.c similarity index 100% rename from src/du_app/F1AP/asn/DRXCycle.c rename to src/codec_utils/F1AP/DRXCycle.c diff --git a/src/du_app/F1AP/asn/DRXCycle.h b/src/codec_utils/F1AP/DRXCycle.h similarity index 100% rename from src/du_app/F1AP/asn/DRXCycle.h rename to src/codec_utils/F1AP/DRXCycle.h diff --git a/src/du_app/F1AP/asn/DUtoCURRCContainer.c b/src/codec_utils/F1AP/DUtoCURRCContainer.c similarity index 100% rename from src/du_app/F1AP/asn/DUtoCURRCContainer.c rename to src/codec_utils/F1AP/DUtoCURRCContainer.c diff --git a/src/du_app/F1AP/asn/DUtoCURRCContainer.h b/src/codec_utils/F1AP/DUtoCURRCContainer.h similarity index 100% rename from src/du_app/F1AP/asn/DUtoCURRCContainer.h rename to src/codec_utils/F1AP/DUtoCURRCContainer.h diff --git a/src/du_app/F1AP/asn/DUtoCURRCInformation.c b/src/codec_utils/F1AP/DUtoCURRCInformation.c similarity index 100% rename from src/du_app/F1AP/asn/DUtoCURRCInformation.c rename to src/codec_utils/F1AP/DUtoCURRCInformation.c diff --git a/src/du_app/F1AP/asn/DUtoCURRCInformation.h b/src/codec_utils/F1AP/DUtoCURRCInformation.h similarity index 100% rename from src/du_app/F1AP/asn/DUtoCURRCInformation.h rename to src/codec_utils/F1AP/DUtoCURRCInformation.h diff --git a/src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-Item.c b/src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-Item.c rename to src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-Item.c diff --git a/src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-Item.h b/src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-Item.h rename to src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-Item.h diff --git a/src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-List.c b/src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-List.c similarity index 100% rename from src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-List.c rename to src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-List.c diff --git a/src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-List.h b/src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-List.h similarity index 100% rename from src/du_app/F1AP/asn/Dedicated-SIDelivery-NeededUE-List.h rename to src/codec_utils/F1AP/Dedicated-SIDelivery-NeededUE-List.h diff --git a/src/du_app/F1AP/asn/DuplicationActivation.c b/src/codec_utils/F1AP/DuplicationActivation.c similarity index 100% rename from src/du_app/F1AP/asn/DuplicationActivation.c rename to src/codec_utils/F1AP/DuplicationActivation.c diff --git a/src/du_app/F1AP/asn/DuplicationActivation.h b/src/codec_utils/F1AP/DuplicationActivation.h similarity index 100% rename from src/du_app/F1AP/asn/DuplicationActivation.h rename to src/codec_utils/F1AP/DuplicationActivation.h diff --git a/src/du_app/F1AP/asn/DuplicationIndication.c b/src/codec_utils/F1AP/DuplicationIndication.c similarity index 100% rename from src/du_app/F1AP/asn/DuplicationIndication.c rename to src/codec_utils/F1AP/DuplicationIndication.c diff --git a/src/du_app/F1AP/asn/DuplicationIndication.h b/src/codec_utils/F1AP/DuplicationIndication.h similarity index 100% rename from src/du_app/F1AP/asn/DuplicationIndication.h rename to src/codec_utils/F1AP/DuplicationIndication.h diff --git a/src/du_app/F1AP/asn/Dynamic5QIDescriptor.c b/src/codec_utils/F1AP/Dynamic5QIDescriptor.c similarity index 100% rename from src/du_app/F1AP/asn/Dynamic5QIDescriptor.c rename to src/codec_utils/F1AP/Dynamic5QIDescriptor.c diff --git a/src/du_app/F1AP/asn/Dynamic5QIDescriptor.h b/src/codec_utils/F1AP/Dynamic5QIDescriptor.h similarity index 100% rename from src/du_app/F1AP/asn/Dynamic5QIDescriptor.h rename to src/codec_utils/F1AP/Dynamic5QIDescriptor.h diff --git a/src/du_app/F1AP/asn/EUTRA-Cell-ID.c b/src/codec_utils/F1AP/EUTRA-Cell-ID.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Cell-ID.c rename to src/codec_utils/F1AP/EUTRA-Cell-ID.c diff --git a/src/du_app/F1AP/asn/EUTRA-Cell-ID.h b/src/codec_utils/F1AP/EUTRA-Cell-ID.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Cell-ID.h rename to src/codec_utils/F1AP/EUTRA-Cell-ID.h diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-FDD-Info.c b/src/codec_utils/F1AP/EUTRA-Coex-FDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-FDD-Info.c rename to src/codec_utils/F1AP/EUTRA-Coex-FDD-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-FDD-Info.h b/src/codec_utils/F1AP/EUTRA-Coex-FDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-FDD-Info.h rename to src/codec_utils/F1AP/EUTRA-Coex-FDD-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-Mode-Info.c b/src/codec_utils/F1AP/EUTRA-Coex-Mode-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-Mode-Info.c rename to src/codec_utils/F1AP/EUTRA-Coex-Mode-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-Mode-Info.h b/src/codec_utils/F1AP/EUTRA-Coex-Mode-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-Mode-Info.h rename to src/codec_utils/F1AP/EUTRA-Coex-Mode-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-TDD-Info.c b/src/codec_utils/F1AP/EUTRA-Coex-TDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-TDD-Info.c rename to src/codec_utils/F1AP/EUTRA-Coex-TDD-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-Coex-TDD-Info.h b/src/codec_utils/F1AP/EUTRA-Coex-TDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Coex-TDD-Info.h rename to src/codec_utils/F1AP/EUTRA-Coex-TDD-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-CyclicPrefixDL.c b/src/codec_utils/F1AP/EUTRA-CyclicPrefixDL.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-CyclicPrefixDL.c rename to src/codec_utils/F1AP/EUTRA-CyclicPrefixDL.c diff --git a/src/du_app/F1AP/asn/EUTRA-CyclicPrefixDL.h b/src/codec_utils/F1AP/EUTRA-CyclicPrefixDL.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-CyclicPrefixDL.h rename to src/codec_utils/F1AP/EUTRA-CyclicPrefixDL.h diff --git a/src/du_app/F1AP/asn/EUTRA-CyclicPrefixUL.c b/src/codec_utils/F1AP/EUTRA-CyclicPrefixUL.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-CyclicPrefixUL.c rename to src/codec_utils/F1AP/EUTRA-CyclicPrefixUL.c diff --git a/src/du_app/F1AP/asn/EUTRA-CyclicPrefixUL.h b/src/codec_utils/F1AP/EUTRA-CyclicPrefixUL.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-CyclicPrefixUL.h rename to src/codec_utils/F1AP/EUTRA-CyclicPrefixUL.h diff --git a/src/du_app/F1AP/asn/EUTRA-FDD-Info.c b/src/codec_utils/F1AP/EUTRA-FDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-FDD-Info.c rename to src/codec_utils/F1AP/EUTRA-FDD-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-FDD-Info.h b/src/codec_utils/F1AP/EUTRA-FDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-FDD-Info.h rename to src/codec_utils/F1AP/EUTRA-FDD-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-Mode-Info.c b/src/codec_utils/F1AP/EUTRA-Mode-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Mode-Info.c rename to src/codec_utils/F1AP/EUTRA-Mode-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-Mode-Info.h b/src/codec_utils/F1AP/EUTRA-Mode-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Mode-Info.h rename to src/codec_utils/F1AP/EUTRA-Mode-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReq-Container.c b/src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReq-Container.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReq-Container.c rename to src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReq-Container.c diff --git a/src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReq-Container.h b/src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReq-Container.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReq-Container.h rename to src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReq-Container.h diff --git a/src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReqAck-Container.c b/src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReqAck-Container.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReqAck-Container.c rename to src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReqAck-Container.c diff --git a/src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReqAck-Container.h b/src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReqAck-Container.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-NR-CellResourceCoordinationReqAck-Container.h rename to src/codec_utils/F1AP/EUTRA-NR-CellResourceCoordinationReqAck-Container.h diff --git a/src/du_app/F1AP/asn/EUTRA-PRACH-Configuration.c b/src/codec_utils/F1AP/EUTRA-PRACH-Configuration.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-PRACH-Configuration.c rename to src/codec_utils/F1AP/EUTRA-PRACH-Configuration.c diff --git a/src/du_app/F1AP/asn/EUTRA-PRACH-Configuration.h b/src/codec_utils/F1AP/EUTRA-PRACH-Configuration.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-PRACH-Configuration.h rename to src/codec_utils/F1AP/EUTRA-PRACH-Configuration.h diff --git a/src/du_app/F1AP/asn/EUTRA-SpecialSubframe-Info.c b/src/codec_utils/F1AP/EUTRA-SpecialSubframe-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SpecialSubframe-Info.c rename to src/codec_utils/F1AP/EUTRA-SpecialSubframe-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-SpecialSubframe-Info.h b/src/codec_utils/F1AP/EUTRA-SpecialSubframe-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SpecialSubframe-Info.h rename to src/codec_utils/F1AP/EUTRA-SpecialSubframe-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-SpecialSubframePatterns.c b/src/codec_utils/F1AP/EUTRA-SpecialSubframePatterns.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SpecialSubframePatterns.c rename to src/codec_utils/F1AP/EUTRA-SpecialSubframePatterns.c diff --git a/src/du_app/F1AP/asn/EUTRA-SpecialSubframePatterns.h b/src/codec_utils/F1AP/EUTRA-SpecialSubframePatterns.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SpecialSubframePatterns.h rename to src/codec_utils/F1AP/EUTRA-SpecialSubframePatterns.h diff --git a/src/du_app/F1AP/asn/EUTRA-SubframeAssignment.c b/src/codec_utils/F1AP/EUTRA-SubframeAssignment.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SubframeAssignment.c rename to src/codec_utils/F1AP/EUTRA-SubframeAssignment.c diff --git a/src/du_app/F1AP/asn/EUTRA-SubframeAssignment.h b/src/codec_utils/F1AP/EUTRA-SubframeAssignment.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-SubframeAssignment.h rename to src/codec_utils/F1AP/EUTRA-SubframeAssignment.h diff --git a/src/du_app/F1AP/asn/EUTRA-TDD-Info.c b/src/codec_utils/F1AP/EUTRA-TDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-TDD-Info.c rename to src/codec_utils/F1AP/EUTRA-TDD-Info.c diff --git a/src/du_app/F1AP/asn/EUTRA-TDD-Info.h b/src/codec_utils/F1AP/EUTRA-TDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-TDD-Info.h rename to src/codec_utils/F1AP/EUTRA-TDD-Info.h diff --git a/src/du_app/F1AP/asn/EUTRA-Transmission-Bandwidth.c b/src/codec_utils/F1AP/EUTRA-Transmission-Bandwidth.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Transmission-Bandwidth.c rename to src/codec_utils/F1AP/EUTRA-Transmission-Bandwidth.c diff --git a/src/du_app/F1AP/asn/EUTRA-Transmission-Bandwidth.h b/src/codec_utils/F1AP/EUTRA-Transmission-Bandwidth.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRA-Transmission-Bandwidth.h rename to src/codec_utils/F1AP/EUTRA-Transmission-Bandwidth.h diff --git a/src/du_app/F1AP/asn/EUTRACells-List-item.c b/src/codec_utils/F1AP/EUTRACells-List-item.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRACells-List-item.c rename to src/codec_utils/F1AP/EUTRACells-List-item.c diff --git a/src/du_app/F1AP/asn/EUTRACells-List-item.h b/src/codec_utils/F1AP/EUTRACells-List-item.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRACells-List-item.h rename to src/codec_utils/F1AP/EUTRACells-List-item.h diff --git a/src/du_app/F1AP/asn/EUTRACells-List.c b/src/codec_utils/F1AP/EUTRACells-List.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRACells-List.c rename to src/codec_utils/F1AP/EUTRACells-List.c diff --git a/src/du_app/F1AP/asn/EUTRACells-List.h b/src/codec_utils/F1AP/EUTRACells-List.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRACells-List.h rename to src/codec_utils/F1AP/EUTRACells-List.h diff --git a/src/du_app/F1AP/asn/EUTRANQoS.c b/src/codec_utils/F1AP/EUTRANQoS.c similarity index 100% rename from src/du_app/F1AP/asn/EUTRANQoS.c rename to src/codec_utils/F1AP/EUTRANQoS.c diff --git a/src/du_app/F1AP/asn/EUTRANQoS.h b/src/codec_utils/F1AP/EUTRANQoS.h similarity index 100% rename from src/du_app/F1AP/asn/EUTRANQoS.h rename to src/codec_utils/F1AP/EUTRANQoS.h diff --git a/src/du_app/F1AP/asn/Endpoint-IP-address-and-port.c b/src/codec_utils/F1AP/Endpoint-IP-address-and-port.c similarity index 100% rename from src/du_app/F1AP/asn/Endpoint-IP-address-and-port.c rename to src/codec_utils/F1AP/Endpoint-IP-address-and-port.c diff --git a/src/du_app/F1AP/asn/Endpoint-IP-address-and-port.h b/src/codec_utils/F1AP/Endpoint-IP-address-and-port.h similarity index 100% rename from src/du_app/F1AP/asn/Endpoint-IP-address-and-port.h rename to src/codec_utils/F1AP/Endpoint-IP-address-and-port.h diff --git a/src/du_app/F1AP/asn/ErrorIndication.c b/src/codec_utils/F1AP/ErrorIndication.c similarity index 100% rename from src/du_app/F1AP/asn/ErrorIndication.c rename to src/codec_utils/F1AP/ErrorIndication.c diff --git a/src/du_app/F1AP/asn/ErrorIndication.h b/src/codec_utils/F1AP/ErrorIndication.h similarity index 100% rename from src/du_app/F1AP/asn/ErrorIndication.h rename to src/codec_utils/F1AP/ErrorIndication.h diff --git a/src/du_app/F1AP/asn/ExecuteDuplication.c b/src/codec_utils/F1AP/ExecuteDuplication.c similarity index 100% rename from src/du_app/F1AP/asn/ExecuteDuplication.c rename to src/codec_utils/F1AP/ExecuteDuplication.c diff --git a/src/du_app/F1AP/asn/ExecuteDuplication.h b/src/codec_utils/F1AP/ExecuteDuplication.h similarity index 100% rename from src/du_app/F1AP/asn/ExecuteDuplication.h rename to src/codec_utils/F1AP/ExecuteDuplication.h diff --git a/src/du_app/F1AP/asn/ExtendedAvailablePLMN-Item.c b/src/codec_utils/F1AP/ExtendedAvailablePLMN-Item.c similarity index 100% rename from src/du_app/F1AP/asn/ExtendedAvailablePLMN-Item.c rename to src/codec_utils/F1AP/ExtendedAvailablePLMN-Item.c diff --git a/src/du_app/F1AP/asn/ExtendedAvailablePLMN-Item.h b/src/codec_utils/F1AP/ExtendedAvailablePLMN-Item.h similarity index 100% rename from src/du_app/F1AP/asn/ExtendedAvailablePLMN-Item.h rename to src/codec_utils/F1AP/ExtendedAvailablePLMN-Item.h diff --git a/src/du_app/F1AP/asn/ExtendedAvailablePLMN-List.c b/src/codec_utils/F1AP/ExtendedAvailablePLMN-List.c similarity index 100% rename from src/du_app/F1AP/asn/ExtendedAvailablePLMN-List.c rename to src/codec_utils/F1AP/ExtendedAvailablePLMN-List.c diff --git a/src/du_app/F1AP/asn/ExtendedAvailablePLMN-List.h b/src/codec_utils/F1AP/ExtendedAvailablePLMN-List.h similarity index 100% rename from src/du_app/F1AP/asn/ExtendedAvailablePLMN-List.h rename to src/codec_utils/F1AP/ExtendedAvailablePLMN-List.h diff --git a/src/du_app/F1AP/asn/ExtendedEARFCN.c b/src/codec_utils/F1AP/ExtendedEARFCN.c similarity index 100% rename from src/du_app/F1AP/asn/ExtendedEARFCN.c rename to src/codec_utils/F1AP/ExtendedEARFCN.c diff --git a/src/du_app/F1AP/asn/ExtendedEARFCN.h b/src/codec_utils/F1AP/ExtendedEARFCN.h similarity index 100% rename from src/du_app/F1AP/asn/ExtendedEARFCN.h rename to src/codec_utils/F1AP/ExtendedEARFCN.h diff --git a/src/du_app/F1AP/asn/ExtendedServedPLMNs-Item.c b/src/codec_utils/F1AP/ExtendedServedPLMNs-Item.c similarity index 100% rename from src/du_app/F1AP/asn/ExtendedServedPLMNs-Item.c rename to src/codec_utils/F1AP/ExtendedServedPLMNs-Item.c diff --git a/src/du_app/F1AP/asn/ExtendedServedPLMNs-Item.h b/src/codec_utils/F1AP/ExtendedServedPLMNs-Item.h similarity index 100% rename from src/du_app/F1AP/asn/ExtendedServedPLMNs-Item.h rename to src/codec_utils/F1AP/ExtendedServedPLMNs-Item.h diff --git a/src/du_app/F1AP/asn/ExtendedServedPLMNs-List.c b/src/codec_utils/F1AP/ExtendedServedPLMNs-List.c similarity index 100% rename from src/du_app/F1AP/asn/ExtendedServedPLMNs-List.c rename to src/codec_utils/F1AP/ExtendedServedPLMNs-List.c diff --git a/src/du_app/F1AP/asn/ExtendedServedPLMNs-List.h b/src/codec_utils/F1AP/ExtendedServedPLMNs-List.h similarity index 100% rename from src/du_app/F1AP/asn/ExtendedServedPLMNs-List.h rename to src/codec_utils/F1AP/ExtendedServedPLMNs-List.h diff --git a/src/du_app/F1AP/asn/F1AP-PDU.c b/src/codec_utils/F1AP/F1AP-PDU.c similarity index 100% rename from src/du_app/F1AP/asn/F1AP-PDU.c rename to src/codec_utils/F1AP/F1AP-PDU.c diff --git a/src/du_app/F1AP/asn/F1AP-PDU.h b/src/codec_utils/F1AP/F1AP-PDU.h similarity index 100% rename from src/du_app/F1AP/asn/F1AP-PDU.h rename to src/codec_utils/F1AP/F1AP-PDU.h diff --git a/src/du_app/F1AP/asn/F1SetupFailure.c b/src/codec_utils/F1AP/F1SetupFailure.c similarity index 100% rename from src/du_app/F1AP/asn/F1SetupFailure.c rename to src/codec_utils/F1AP/F1SetupFailure.c diff --git a/src/du_app/F1AP/asn/F1SetupFailure.h b/src/codec_utils/F1AP/F1SetupFailure.h similarity index 100% rename from src/du_app/F1AP/asn/F1SetupFailure.h rename to src/codec_utils/F1AP/F1SetupFailure.h diff --git a/src/du_app/F1AP/asn/F1SetupRequest.c b/src/codec_utils/F1AP/F1SetupRequest.c similarity index 100% rename from src/du_app/F1AP/asn/F1SetupRequest.c rename to src/codec_utils/F1AP/F1SetupRequest.c diff --git a/src/du_app/F1AP/asn/F1SetupRequest.h b/src/codec_utils/F1AP/F1SetupRequest.h similarity index 100% rename from src/du_app/F1AP/asn/F1SetupRequest.h rename to src/codec_utils/F1AP/F1SetupRequest.h diff --git a/src/du_app/F1AP/asn/F1SetupResponse.c b/src/codec_utils/F1AP/F1SetupResponse.c similarity index 100% rename from src/du_app/F1AP/asn/F1SetupResponse.c rename to src/codec_utils/F1AP/F1SetupResponse.c diff --git a/src/du_app/F1AP/asn/F1SetupResponse.h b/src/codec_utils/F1AP/F1SetupResponse.h similarity index 100% rename from src/du_app/F1AP/asn/F1SetupResponse.h rename to src/codec_utils/F1AP/F1SetupResponse.h diff --git a/src/du_app/F1AP/asn/FDD-Info.c b/src/codec_utils/F1AP/FDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/FDD-Info.c rename to src/codec_utils/F1AP/FDD-Info.c diff --git a/src/du_app/F1AP/asn/FDD-Info.h b/src/codec_utils/F1AP/FDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/FDD-Info.h rename to src/codec_utils/F1AP/FDD-Info.h diff --git a/src/du_app/F1AP/asn/FiveGS-TAC.c b/src/codec_utils/F1AP/FiveGS-TAC.c similarity index 100% rename from src/du_app/F1AP/asn/FiveGS-TAC.c rename to src/codec_utils/F1AP/FiveGS-TAC.c diff --git a/src/du_app/F1AP/asn/FiveGS-TAC.h b/src/codec_utils/F1AP/FiveGS-TAC.h similarity index 100% rename from src/du_app/F1AP/asn/FiveGS-TAC.h rename to src/codec_utils/F1AP/FiveGS-TAC.h diff --git a/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-Item.c b/src/codec_utils/F1AP/Flows-Mapped-To-DRB-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Flows-Mapped-To-DRB-Item.c rename to src/codec_utils/F1AP/Flows-Mapped-To-DRB-Item.c diff --git a/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-Item.h b/src/codec_utils/F1AP/Flows-Mapped-To-DRB-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Flows-Mapped-To-DRB-Item.h rename to src/codec_utils/F1AP/Flows-Mapped-To-DRB-Item.h diff --git a/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-List.c b/src/codec_utils/F1AP/Flows-Mapped-To-DRB-List.c similarity index 100% rename from src/du_app/F1AP/asn/Flows-Mapped-To-DRB-List.c rename to src/codec_utils/F1AP/Flows-Mapped-To-DRB-List.c diff --git a/src/codec_utils/F1AP/Flows-Mapped-To-DRB-List.h b/src/codec_utils/F1AP/Flows-Mapped-To-DRB-List.h new file mode 100755 index 000000000..1dd38b656 --- /dev/null +++ b/src/codec_utils/F1AP/Flows-Mapped-To-DRB-List.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Flows_Mapped_To_DRB_List_H_ +#define _Flows_Mapped_To_DRB_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include "Flows-Mapped-To-DRB-Item.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Flows_Mapped_To_DRB_Item; + +/* Flows-Mapped-To-DRB-List */ +typedef struct Flows_Mapped_To_DRB_List { + A_SEQUENCE_OF(struct Flows_Mapped_To_DRB_Item) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Flows_Mapped_To_DRB_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Flows_Mapped_To_DRB_List; +extern asn_SET_OF_specifics_t asn_SPC_Flows_Mapped_To_DRB_List_specs_1; +extern asn_TYPE_member_t asn_MBR_Flows_Mapped_To_DRB_List_1[1]; +extern asn_per_constraints_t asn_PER_type_Flows_Mapped_To_DRB_List_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _Flows_Mapped_To_DRB_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/FreqBandNrItem.c b/src/codec_utils/F1AP/FreqBandNrItem.c similarity index 100% rename from src/du_app/F1AP/asn/FreqBandNrItem.c rename to src/codec_utils/F1AP/FreqBandNrItem.c diff --git a/src/du_app/F1AP/asn/FreqBandNrItem.h b/src/codec_utils/F1AP/FreqBandNrItem.h similarity index 100% rename from src/du_app/F1AP/asn/FreqBandNrItem.h rename to src/codec_utils/F1AP/FreqBandNrItem.h diff --git a/src/du_app/F1AP/asn/FullConfiguration.c b/src/codec_utils/F1AP/FullConfiguration.c similarity index 100% rename from src/du_app/F1AP/asn/FullConfiguration.c rename to src/codec_utils/F1AP/FullConfiguration.c diff --git a/src/du_app/F1AP/asn/FullConfiguration.h b/src/codec_utils/F1AP/FullConfiguration.h similarity index 100% rename from src/du_app/F1AP/asn/FullConfiguration.h rename to src/codec_utils/F1AP/FullConfiguration.h diff --git a/src/du_app/F1AP/asn/GBR-QoSFlowInformation.c b/src/codec_utils/F1AP/GBR-QoSFlowInformation.c similarity index 100% rename from src/du_app/F1AP/asn/GBR-QoSFlowInformation.c rename to src/codec_utils/F1AP/GBR-QoSFlowInformation.c diff --git a/src/du_app/F1AP/asn/GBR-QoSFlowInformation.h b/src/codec_utils/F1AP/GBR-QoSFlowInformation.h similarity index 100% rename from src/du_app/F1AP/asn/GBR-QoSFlowInformation.h rename to src/codec_utils/F1AP/GBR-QoSFlowInformation.h diff --git a/src/du_app/F1AP/asn/GBR-QosInformation.c b/src/codec_utils/F1AP/GBR-QosInformation.c similarity index 100% rename from src/du_app/F1AP/asn/GBR-QosInformation.c rename to src/codec_utils/F1AP/GBR-QosInformation.c diff --git a/src/du_app/F1AP/asn/GBR-QosInformation.h b/src/codec_utils/F1AP/GBR-QosInformation.h similarity index 100% rename from src/du_app/F1AP/asn/GBR-QosInformation.h rename to src/codec_utils/F1AP/GBR-QosInformation.h diff --git a/src/du_app/F1AP/asn/GNB-CU-Name.c b/src/codec_utils/F1AP/GNB-CU-Name.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-Name.c rename to src/codec_utils/F1AP/GNB-CU-Name.c diff --git a/src/du_app/F1AP/asn/GNB-CU-Name.h b/src/codec_utils/F1AP/GNB-CU-Name.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-Name.h rename to src/codec_utils/F1AP/GNB-CU-Name.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-Item.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-Item.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-Item.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-Item.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-Item.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-Item.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-List.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-List.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-List.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-List.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-List.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Failed-To-Setup-List.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Failed-To-Setup-List.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-Item.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-Item.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-Item.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-Item.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-Item.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-Item.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-List.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-List.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-List.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-List.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-List.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-Setup-List.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-Setup-List.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-Item.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-Item.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-Item.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-Item.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-Item.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-Item.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-List.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-List.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-List.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-List.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-List.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Add-List.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Add-List.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-Item.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-Item.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-Item.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-Item.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-Item.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-Item.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-List.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-List.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-List.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-List.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-List.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Remove-List.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Remove-List.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-Item.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-Item.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-Item.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-Item.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-Item.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-Item.h diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-List.c b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-List.c rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-List.c diff --git a/src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-List.h b/src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-List.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-TNL-Association-To-Update-List.h rename to src/codec_utils/F1AP/GNB-CU-TNL-Association-To-Update-List.h diff --git a/src/du_app/F1AP/asn/GNB-CU-UE-F1AP-ID.c b/src/codec_utils/F1AP/GNB-CU-UE-F1AP-ID.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-UE-F1AP-ID.c rename to src/codec_utils/F1AP/GNB-CU-UE-F1AP-ID.c diff --git a/src/du_app/F1AP/asn/GNB-CU-UE-F1AP-ID.h b/src/codec_utils/F1AP/GNB-CU-UE-F1AP-ID.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CU-UE-F1AP-ID.h rename to src/codec_utils/F1AP/GNB-CU-UE-F1AP-ID.h diff --git a/src/du_app/F1AP/asn/GNB-CUSystemInformation.c b/src/codec_utils/F1AP/GNB-CUSystemInformation.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-CUSystemInformation.c rename to src/codec_utils/F1AP/GNB-CUSystemInformation.c diff --git a/src/du_app/F1AP/asn/GNB-CUSystemInformation.h b/src/codec_utils/F1AP/GNB-CUSystemInformation.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-CUSystemInformation.h rename to src/codec_utils/F1AP/GNB-CUSystemInformation.h diff --git a/src/du_app/F1AP/asn/GNB-DU-ID.c b/src/codec_utils/F1AP/GNB-DU-ID.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-ID.c rename to src/codec_utils/F1AP/GNB-DU-ID.c diff --git a/src/du_app/F1AP/asn/GNB-DU-ID.h b/src/codec_utils/F1AP/GNB-DU-ID.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-ID.h rename to src/codec_utils/F1AP/GNB-DU-ID.h diff --git a/src/du_app/F1AP/asn/GNB-DU-Name.c b/src/codec_utils/F1AP/GNB-DU-Name.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-Name.c rename to src/codec_utils/F1AP/GNB-DU-Name.c diff --git a/src/du_app/F1AP/asn/GNB-DU-Name.h b/src/codec_utils/F1AP/GNB-DU-Name.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-Name.h rename to src/codec_utils/F1AP/GNB-DU-Name.h diff --git a/src/du_app/F1AP/asn/GNB-DU-Served-Cells-Item.c b/src/codec_utils/F1AP/GNB-DU-Served-Cells-Item.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-Served-Cells-Item.c rename to src/codec_utils/F1AP/GNB-DU-Served-Cells-Item.c diff --git a/src/du_app/F1AP/asn/GNB-DU-Served-Cells-Item.h b/src/codec_utils/F1AP/GNB-DU-Served-Cells-Item.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-Served-Cells-Item.h rename to src/codec_utils/F1AP/GNB-DU-Served-Cells-Item.h diff --git a/src/du_app/F1AP/asn/GNB-DU-Served-Cells-List.c b/src/codec_utils/F1AP/GNB-DU-Served-Cells-List.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-Served-Cells-List.c rename to src/codec_utils/F1AP/GNB-DU-Served-Cells-List.c diff --git a/src/codec_utils/F1AP/GNB-DU-Served-Cells-List.h b/src/codec_utils/F1AP/GNB-DU-Served-Cells-List.h new file mode 100644 index 000000000..3bb349c03 --- /dev/null +++ b/src/codec_utils/F1AP/GNB-DU-Served-Cells-List.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _GNB_DU_Served_Cells_List_H_ +#define _GNB_DU_Served_Cells_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* GNB-DU-Served-Cells-List */ +typedef struct GNB_DU_Served_Cells_List { + A_SEQUENCE_OF(struct GNB_DU_Served_Cells_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GNB_DU_Served_Cells_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GNB_DU_Served_Cells_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _GNB_DU_Served_Cells_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/GNB-DU-System-Information.c b/src/codec_utils/F1AP/GNB-DU-System-Information.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-System-Information.c rename to src/codec_utils/F1AP/GNB-DU-System-Information.c diff --git a/src/du_app/F1AP/asn/GNB-DU-System-Information.h b/src/codec_utils/F1AP/GNB-DU-System-Information.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-System-Information.h rename to src/codec_utils/F1AP/GNB-DU-System-Information.h diff --git a/src/du_app/F1AP/asn/GNB-DU-UE-F1AP-ID.c b/src/codec_utils/F1AP/GNB-DU-UE-F1AP-ID.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-UE-F1AP-ID.c rename to src/codec_utils/F1AP/GNB-DU-UE-F1AP-ID.c diff --git a/src/du_app/F1AP/asn/GNB-DU-UE-F1AP-ID.h b/src/codec_utils/F1AP/GNB-DU-UE-F1AP-ID.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DU-UE-F1AP-ID.h rename to src/codec_utils/F1AP/GNB-DU-UE-F1AP-ID.h diff --git a/src/du_app/F1AP/asn/GNB-DUConfigurationQuery.c b/src/codec_utils/F1AP/GNB-DUConfigurationQuery.c similarity index 100% rename from src/du_app/F1AP/asn/GNB-DUConfigurationQuery.c rename to src/codec_utils/F1AP/GNB-DUConfigurationQuery.c diff --git a/src/du_app/F1AP/asn/GNB-DUConfigurationQuery.h b/src/codec_utils/F1AP/GNB-DUConfigurationQuery.h similarity index 100% rename from src/du_app/F1AP/asn/GNB-DUConfigurationQuery.h rename to src/codec_utils/F1AP/GNB-DUConfigurationQuery.h diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdate.c b/src/codec_utils/F1AP/GNBCUConfigurationUpdate.c similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdate.c rename to src/codec_utils/F1AP/GNBCUConfigurationUpdate.c diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdate.h b/src/codec_utils/F1AP/GNBCUConfigurationUpdate.h similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdate.h rename to src/codec_utils/F1AP/GNBCUConfigurationUpdate.h diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdateAcknowledge.c b/src/codec_utils/F1AP/GNBCUConfigurationUpdateAcknowledge.c similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdateAcknowledge.c rename to src/codec_utils/F1AP/GNBCUConfigurationUpdateAcknowledge.c diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdateAcknowledge.h b/src/codec_utils/F1AP/GNBCUConfigurationUpdateAcknowledge.h similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdateAcknowledge.h rename to src/codec_utils/F1AP/GNBCUConfigurationUpdateAcknowledge.h diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdateFailure.c b/src/codec_utils/F1AP/GNBCUConfigurationUpdateFailure.c similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdateFailure.c rename to src/codec_utils/F1AP/GNBCUConfigurationUpdateFailure.c diff --git a/src/du_app/F1AP/asn/GNBCUConfigurationUpdateFailure.h b/src/codec_utils/F1AP/GNBCUConfigurationUpdateFailure.h similarity index 100% rename from src/du_app/F1AP/asn/GNBCUConfigurationUpdateFailure.h rename to src/codec_utils/F1AP/GNBCUConfigurationUpdateFailure.h diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdate.c b/src/codec_utils/F1AP/GNBDUConfigurationUpdate.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdate.c rename to src/codec_utils/F1AP/GNBDUConfigurationUpdate.c diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdate.h b/src/codec_utils/F1AP/GNBDUConfigurationUpdate.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdate.h rename to src/codec_utils/F1AP/GNBDUConfigurationUpdate.h diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdateAcknowledge.c b/src/codec_utils/F1AP/GNBDUConfigurationUpdateAcknowledge.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdateAcknowledge.c rename to src/codec_utils/F1AP/GNBDUConfigurationUpdateAcknowledge.c diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdateAcknowledge.h b/src/codec_utils/F1AP/GNBDUConfigurationUpdateAcknowledge.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdateAcknowledge.h rename to src/codec_utils/F1AP/GNBDUConfigurationUpdateAcknowledge.h diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdateFailure.c b/src/codec_utils/F1AP/GNBDUConfigurationUpdateFailure.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdateFailure.c rename to src/codec_utils/F1AP/GNBDUConfigurationUpdateFailure.c diff --git a/src/du_app/F1AP/asn/GNBDUConfigurationUpdateFailure.h b/src/codec_utils/F1AP/GNBDUConfigurationUpdateFailure.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUConfigurationUpdateFailure.h rename to src/codec_utils/F1AP/GNBDUConfigurationUpdateFailure.h diff --git a/src/du_app/F1AP/asn/GNBDUOverloadInformation.c b/src/codec_utils/F1AP/GNBDUOverloadInformation.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUOverloadInformation.c rename to src/codec_utils/F1AP/GNBDUOverloadInformation.c diff --git a/src/du_app/F1AP/asn/GNBDUOverloadInformation.h b/src/codec_utils/F1AP/GNBDUOverloadInformation.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUOverloadInformation.h rename to src/codec_utils/F1AP/GNBDUOverloadInformation.h diff --git a/src/du_app/F1AP/asn/GNBDUResourceCoordinationRequest.c b/src/codec_utils/F1AP/GNBDUResourceCoordinationRequest.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUResourceCoordinationRequest.c rename to src/codec_utils/F1AP/GNBDUResourceCoordinationRequest.c diff --git a/src/du_app/F1AP/asn/GNBDUResourceCoordinationRequest.h b/src/codec_utils/F1AP/GNBDUResourceCoordinationRequest.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUResourceCoordinationRequest.h rename to src/codec_utils/F1AP/GNBDUResourceCoordinationRequest.h diff --git a/src/du_app/F1AP/asn/GNBDUResourceCoordinationResponse.c b/src/codec_utils/F1AP/GNBDUResourceCoordinationResponse.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUResourceCoordinationResponse.c rename to src/codec_utils/F1AP/GNBDUResourceCoordinationResponse.c diff --git a/src/du_app/F1AP/asn/GNBDUResourceCoordinationResponse.h b/src/codec_utils/F1AP/GNBDUResourceCoordinationResponse.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUResourceCoordinationResponse.h rename to src/codec_utils/F1AP/GNBDUResourceCoordinationResponse.h diff --git a/src/du_app/F1AP/asn/GNBDUStatusIndication.c b/src/codec_utils/F1AP/GNBDUStatusIndication.c similarity index 100% rename from src/du_app/F1AP/asn/GNBDUStatusIndication.c rename to src/codec_utils/F1AP/GNBDUStatusIndication.c diff --git a/src/du_app/F1AP/asn/GNBDUStatusIndication.h b/src/codec_utils/F1AP/GNBDUStatusIndication.h similarity index 100% rename from src/du_app/F1AP/asn/GNBDUStatusIndication.h rename to src/codec_utils/F1AP/GNBDUStatusIndication.h diff --git a/src/du_app/F1AP/asn/GTP-TEID.c b/src/codec_utils/F1AP/GTP-TEID.c similarity index 100% rename from src/du_app/F1AP/asn/GTP-TEID.c rename to src/codec_utils/F1AP/GTP-TEID.c diff --git a/src/du_app/F1AP/asn/GTP-TEID.h b/src/codec_utils/F1AP/GTP-TEID.h similarity index 100% rename from src/du_app/F1AP/asn/GTP-TEID.h rename to src/codec_utils/F1AP/GTP-TEID.h diff --git a/src/du_app/F1AP/asn/GTPTunnel.c b/src/codec_utils/F1AP/GTPTunnel.c similarity index 100% rename from src/du_app/F1AP/asn/GTPTunnel.c rename to src/codec_utils/F1AP/GTPTunnel.c diff --git a/src/du_app/F1AP/asn/GTPTunnel.h b/src/codec_utils/F1AP/GTPTunnel.h similarity index 100% rename from src/du_app/F1AP/asn/GTPTunnel.h rename to src/codec_utils/F1AP/GTPTunnel.h diff --git a/src/du_app/F1AP/asn/HandoverPreparationInformation.c b/src/codec_utils/F1AP/HandoverPreparationInformation.c similarity index 100% rename from src/du_app/F1AP/asn/HandoverPreparationInformation.c rename to src/codec_utils/F1AP/HandoverPreparationInformation.c diff --git a/src/du_app/F1AP/asn/HandoverPreparationInformation.h b/src/codec_utils/F1AP/HandoverPreparationInformation.h similarity index 100% rename from src/du_app/F1AP/asn/HandoverPreparationInformation.h rename to src/codec_utils/F1AP/HandoverPreparationInformation.h diff --git a/src/du_app/F1AP/asn/IgnoreResourceCoordinationContainer.c b/src/codec_utils/F1AP/IgnoreResourceCoordinationContainer.c similarity index 100% rename from src/du_app/F1AP/asn/IgnoreResourceCoordinationContainer.c rename to src/codec_utils/F1AP/IgnoreResourceCoordinationContainer.c diff --git a/src/du_app/F1AP/asn/IgnoreResourceCoordinationContainer.h b/src/codec_utils/F1AP/IgnoreResourceCoordinationContainer.h similarity index 100% rename from src/du_app/F1AP/asn/IgnoreResourceCoordinationContainer.h rename to src/codec_utils/F1AP/IgnoreResourceCoordinationContainer.h diff --git a/src/du_app/F1AP/asn/InactivityMonitoringRequest.c b/src/codec_utils/F1AP/InactivityMonitoringRequest.c similarity index 100% rename from src/du_app/F1AP/asn/InactivityMonitoringRequest.c rename to src/codec_utils/F1AP/InactivityMonitoringRequest.c diff --git a/src/du_app/F1AP/asn/InactivityMonitoringRequest.h b/src/codec_utils/F1AP/InactivityMonitoringRequest.h similarity index 100% rename from src/du_app/F1AP/asn/InactivityMonitoringRequest.h rename to src/codec_utils/F1AP/InactivityMonitoringRequest.h diff --git a/src/du_app/F1AP/asn/InactivityMonitoringResponse.c b/src/codec_utils/F1AP/InactivityMonitoringResponse.c similarity index 100% rename from src/du_app/F1AP/asn/InactivityMonitoringResponse.c rename to src/codec_utils/F1AP/InactivityMonitoringResponse.c diff --git a/src/du_app/F1AP/asn/InactivityMonitoringResponse.h b/src/codec_utils/F1AP/InactivityMonitoringResponse.h similarity index 100% rename from src/du_app/F1AP/asn/InactivityMonitoringResponse.h rename to src/codec_utils/F1AP/InactivityMonitoringResponse.h diff --git a/src/du_app/F1AP/asn/InitialULRRCMessageTransfer.c b/src/codec_utils/F1AP/InitialULRRCMessageTransfer.c similarity index 100% rename from src/du_app/F1AP/asn/InitialULRRCMessageTransfer.c rename to src/codec_utils/F1AP/InitialULRRCMessageTransfer.c diff --git a/src/du_app/F1AP/asn/InitialULRRCMessageTransfer.h b/src/codec_utils/F1AP/InitialULRRCMessageTransfer.h similarity index 100% rename from src/du_app/F1AP/asn/InitialULRRCMessageTransfer.h rename to src/codec_utils/F1AP/InitialULRRCMessageTransfer.h diff --git a/src/du_app/F1AP/asn/InitiatingMessage.c b/src/codec_utils/F1AP/InitiatingMessage.c similarity index 100% rename from src/du_app/F1AP/asn/InitiatingMessage.c rename to src/codec_utils/F1AP/InitiatingMessage.c diff --git a/src/du_app/F1AP/asn/InitiatingMessage.h b/src/codec_utils/F1AP/InitiatingMessage.h similarity index 100% rename from src/du_app/F1AP/asn/InitiatingMessage.h rename to src/codec_utils/F1AP/InitiatingMessage.h diff --git a/src/du_app/F1AP/asn/LCID.c b/src/codec_utils/F1AP/LCID.c similarity index 100% rename from src/du_app/F1AP/asn/LCID.c rename to src/codec_utils/F1AP/LCID.c diff --git a/src/du_app/F1AP/asn/LCID.h b/src/codec_utils/F1AP/LCID.h similarity index 100% rename from src/du_app/F1AP/asn/LCID.h rename to src/codec_utils/F1AP/LCID.h diff --git a/src/du_app/F1AP/asn/Latest-RRC-Version-Enhanced.c b/src/codec_utils/F1AP/Latest-RRC-Version-Enhanced.c similarity index 100% rename from src/du_app/F1AP/asn/Latest-RRC-Version-Enhanced.c rename to src/codec_utils/F1AP/Latest-RRC-Version-Enhanced.c diff --git a/src/du_app/F1AP/asn/Latest-RRC-Version-Enhanced.h b/src/codec_utils/F1AP/Latest-RRC-Version-Enhanced.h similarity index 100% rename from src/du_app/F1AP/asn/Latest-RRC-Version-Enhanced.h rename to src/codec_utils/F1AP/Latest-RRC-Version-Enhanced.h diff --git a/src/du_app/F1AP/asn/LongDRXCycleLength.c b/src/codec_utils/F1AP/LongDRXCycleLength.c similarity index 100% rename from src/du_app/F1AP/asn/LongDRXCycleLength.c rename to src/codec_utils/F1AP/LongDRXCycleLength.c diff --git a/src/du_app/F1AP/asn/LongDRXCycleLength.h b/src/codec_utils/F1AP/LongDRXCycleLength.h similarity index 100% rename from src/du_app/F1AP/asn/LongDRXCycleLength.h rename to src/codec_utils/F1AP/LongDRXCycleLength.h diff --git a/src/du_app/F1AP/asn/MIB-message.c b/src/codec_utils/F1AP/MIB-message.c similarity index 100% rename from src/du_app/F1AP/asn/MIB-message.c rename to src/codec_utils/F1AP/MIB-message.c diff --git a/src/du_app/F1AP/asn/MIB-message.h b/src/codec_utils/F1AP/MIB-message.h similarity index 100% rename from src/du_app/F1AP/asn/MIB-message.h rename to src/codec_utils/F1AP/MIB-message.h diff --git a/src/du_app/F1AP/asn/Makefile.am.libasncodec b/src/codec_utils/F1AP/Makefile.am.libasncodec similarity index 100% rename from src/du_app/F1AP/asn/Makefile.am.libasncodec rename to src/codec_utils/F1AP/Makefile.am.libasncodec diff --git a/src/du_app/F1AP/asn/MaskedIMEISV.c b/src/codec_utils/F1AP/MaskedIMEISV.c similarity index 100% rename from src/du_app/F1AP/asn/MaskedIMEISV.c rename to src/codec_utils/F1AP/MaskedIMEISV.c diff --git a/src/du_app/F1AP/asn/MaskedIMEISV.h b/src/codec_utils/F1AP/MaskedIMEISV.h similarity index 100% rename from src/du_app/F1AP/asn/MaskedIMEISV.h rename to src/codec_utils/F1AP/MaskedIMEISV.h diff --git a/src/du_app/F1AP/asn/MaxDataBurstVolume.c b/src/codec_utils/F1AP/MaxDataBurstVolume.c similarity index 100% rename from src/du_app/F1AP/asn/MaxDataBurstVolume.c rename to src/codec_utils/F1AP/MaxDataBurstVolume.c diff --git a/src/du_app/F1AP/asn/MaxDataBurstVolume.h b/src/codec_utils/F1AP/MaxDataBurstVolume.h similarity index 100% rename from src/du_app/F1AP/asn/MaxDataBurstVolume.h rename to src/codec_utils/F1AP/MaxDataBurstVolume.h diff --git a/src/du_app/F1AP/asn/MaxPacketLossRate.c b/src/codec_utils/F1AP/MaxPacketLossRate.c similarity index 100% rename from src/du_app/F1AP/asn/MaxPacketLossRate.c rename to src/codec_utils/F1AP/MaxPacketLossRate.c diff --git a/src/du_app/F1AP/asn/MaxPacketLossRate.h b/src/codec_utils/F1AP/MaxPacketLossRate.h similarity index 100% rename from src/du_app/F1AP/asn/MaxPacketLossRate.h rename to src/codec_utils/F1AP/MaxPacketLossRate.h diff --git a/src/du_app/F1AP/asn/MeasConfig.c b/src/codec_utils/F1AP/MeasConfig.c similarity index 100% rename from src/du_app/F1AP/asn/MeasConfig.c rename to src/codec_utils/F1AP/MeasConfig.c diff --git a/src/du_app/F1AP/asn/MeasConfig.h b/src/codec_utils/F1AP/MeasConfig.h similarity index 100% rename from src/du_app/F1AP/asn/MeasConfig.h rename to src/codec_utils/F1AP/MeasConfig.h diff --git a/src/du_app/F1AP/asn/MeasGapConfig.c b/src/codec_utils/F1AP/MeasGapConfig.c similarity index 100% rename from src/du_app/F1AP/asn/MeasGapConfig.c rename to src/codec_utils/F1AP/MeasGapConfig.c diff --git a/src/du_app/F1AP/asn/MeasGapConfig.h b/src/codec_utils/F1AP/MeasGapConfig.h similarity index 100% rename from src/du_app/F1AP/asn/MeasGapConfig.h rename to src/codec_utils/F1AP/MeasGapConfig.h diff --git a/src/du_app/F1AP/asn/MeasurementTimingConfiguration.c b/src/codec_utils/F1AP/MeasurementTimingConfiguration.c similarity index 100% rename from src/du_app/F1AP/asn/MeasurementTimingConfiguration.c rename to src/codec_utils/F1AP/MeasurementTimingConfiguration.c diff --git a/src/du_app/F1AP/asn/MeasurementTimingConfiguration.h b/src/codec_utils/F1AP/MeasurementTimingConfiguration.h similarity index 100% rename from src/du_app/F1AP/asn/MeasurementTimingConfiguration.h rename to src/codec_utils/F1AP/MeasurementTimingConfiguration.h diff --git a/src/du_app/F1AP/asn/NGRANAllocationAndRetentionPriority.c b/src/codec_utils/F1AP/NGRANAllocationAndRetentionPriority.c similarity index 100% rename from src/du_app/F1AP/asn/NGRANAllocationAndRetentionPriority.c rename to src/codec_utils/F1AP/NGRANAllocationAndRetentionPriority.c diff --git a/src/du_app/F1AP/asn/NGRANAllocationAndRetentionPriority.h b/src/codec_utils/F1AP/NGRANAllocationAndRetentionPriority.h similarity index 100% rename from src/du_app/F1AP/asn/NGRANAllocationAndRetentionPriority.h rename to src/codec_utils/F1AP/NGRANAllocationAndRetentionPriority.h diff --git a/src/du_app/F1AP/asn/NR-CGI-List-For-Restart-Item.c b/src/codec_utils/F1AP/NR-CGI-List-For-Restart-Item.c similarity index 100% rename from src/du_app/F1AP/asn/NR-CGI-List-For-Restart-Item.c rename to src/codec_utils/F1AP/NR-CGI-List-For-Restart-Item.c diff --git a/src/du_app/F1AP/asn/NR-CGI-List-For-Restart-Item.h b/src/codec_utils/F1AP/NR-CGI-List-For-Restart-Item.h similarity index 100% rename from src/du_app/F1AP/asn/NR-CGI-List-For-Restart-Item.h rename to src/codec_utils/F1AP/NR-CGI-List-For-Restart-Item.h diff --git a/src/du_app/F1AP/asn/NR-CGI-List-For-Restart-List.c b/src/codec_utils/F1AP/NR-CGI-List-For-Restart-List.c similarity index 100% rename from src/du_app/F1AP/asn/NR-CGI-List-For-Restart-List.c rename to src/codec_utils/F1AP/NR-CGI-List-For-Restart-List.c diff --git a/src/du_app/F1AP/asn/NR-CGI-List-For-Restart-List.h b/src/codec_utils/F1AP/NR-CGI-List-For-Restart-List.h similarity index 100% rename from src/du_app/F1AP/asn/NR-CGI-List-For-Restart-List.h rename to src/codec_utils/F1AP/NR-CGI-List-For-Restart-List.h diff --git a/src/du_app/F1AP/asn/NR-Mode-Info.c b/src/codec_utils/F1AP/NR-Mode-Info.c similarity index 100% rename from src/du_app/F1AP/asn/NR-Mode-Info.c rename to src/codec_utils/F1AP/NR-Mode-Info.c diff --git a/src/codec_utils/F1AP/NR-Mode-Info.h b/src/codec_utils/F1AP/NR-Mode-Info.h new file mode 100644 index 000000000..d876afd9c --- /dev/null +++ b/src/codec_utils/F1AP/NR-Mode-Info.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _NR_Mode_Info_H_ +#define _NR_Mode_Info_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum NR_Mode_Info_PR { + NR_Mode_Info_PR_NOTHING, /* No components present */ + NR_Mode_Info_PR_fDD, + NR_Mode_Info_PR_tDD, + NR_Mode_Info_PR_choice_extension +} NR_Mode_Info_PR; + +/* Forward declarations */ +struct FDD_Info; +struct TDD_Info; +struct ProtocolIE_SingleContainer; + +/* NR-Mode-Info */ +typedef struct NR_Mode_Info { + NR_Mode_Info_PR present; + union NR_Mode_Info_u { + FDD_Info_t *fDD; + TDD_Info_t *tDD; + // struct TDD_Info *tDD; + struct ProtocolIE_SingleContainer *choice_extension; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NR_Mode_Info_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NR_Mode_Info; +extern asn_CHOICE_specifics_t asn_SPC_NR_Mode_Info_specs_1; +extern asn_TYPE_member_t asn_MBR_NR_Mode_Info_1[3]; +extern asn_per_constraints_t asn_PER_type_NR_Mode_Info_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _NR_Mode_Info_H_ */ +#include diff --git a/src/du_app/F1AP/asn/NRCGI.c b/src/codec_utils/F1AP/NRCGI.c similarity index 100% rename from src/du_app/F1AP/asn/NRCGI.c rename to src/codec_utils/F1AP/NRCGI.c diff --git a/src/du_app/F1AP/asn/NRCGI.h b/src/codec_utils/F1AP/NRCGI.h similarity index 100% rename from src/du_app/F1AP/asn/NRCGI.h rename to src/codec_utils/F1AP/NRCGI.h diff --git a/src/du_app/F1AP/asn/NRCellIdentity.c b/src/codec_utils/F1AP/NRCellIdentity.c similarity index 100% rename from src/du_app/F1AP/asn/NRCellIdentity.c rename to src/codec_utils/F1AP/NRCellIdentity.c diff --git a/src/du_app/F1AP/asn/NRCellIdentity.h b/src/codec_utils/F1AP/NRCellIdentity.h similarity index 100% rename from src/du_app/F1AP/asn/NRCellIdentity.h rename to src/codec_utils/F1AP/NRCellIdentity.h diff --git a/src/du_app/F1AP/asn/NRFreqInfo.c b/src/codec_utils/F1AP/NRFreqInfo.c similarity index 100% rename from src/du_app/F1AP/asn/NRFreqInfo.c rename to src/codec_utils/F1AP/NRFreqInfo.c diff --git a/src/codec_utils/F1AP/NRFreqInfo.h b/src/codec_utils/F1AP/NRFreqInfo.h new file mode 100644 index 000000000..4b1cfd413 --- /dev/null +++ b/src/codec_utils/F1AP/NRFreqInfo.h @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _NRFreqInfo_H_ +#define _NRFreqInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SUL_Information; +struct ProtocolExtensionContainer; +struct FreqBandNrItem; + +/* NRFreqInfo */ +typedef struct NRFreqInfo { + long nRARFCN; + struct SUL_Information *sul_Information; /* OPTIONAL */ + struct NRFreqInfo__freqBandListNr { + A_SEQUENCE_OF(FreqBandNrItem_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } freqBandListNr; + struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NRFreqInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NRFreqInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_NRFreqInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_NRFreqInfo_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _NRFreqInfo_H_ */ +#include diff --git a/src/du_app/F1AP/asn/NRNRB.c b/src/codec_utils/F1AP/NRNRB.c similarity index 100% rename from src/du_app/F1AP/asn/NRNRB.c rename to src/codec_utils/F1AP/NRNRB.c diff --git a/src/du_app/F1AP/asn/NRNRB.h b/src/codec_utils/F1AP/NRNRB.h similarity index 100% rename from src/du_app/F1AP/asn/NRNRB.h rename to src/codec_utils/F1AP/NRNRB.h diff --git a/src/du_app/F1AP/asn/NRPCI.c b/src/codec_utils/F1AP/NRPCI.c similarity index 100% rename from src/du_app/F1AP/asn/NRPCI.c rename to src/codec_utils/F1AP/NRPCI.c diff --git a/src/du_app/F1AP/asn/NRPCI.h b/src/codec_utils/F1AP/NRPCI.h similarity index 100% rename from src/du_app/F1AP/asn/NRPCI.h rename to src/codec_utils/F1AP/NRPCI.h diff --git a/src/du_app/F1AP/asn/NRSCS.c b/src/codec_utils/F1AP/NRSCS.c similarity index 100% rename from src/du_app/F1AP/asn/NRSCS.c rename to src/codec_utils/F1AP/NRSCS.c diff --git a/src/du_app/F1AP/asn/NRSCS.h b/src/codec_utils/F1AP/NRSCS.h similarity index 100% rename from src/du_app/F1AP/asn/NRSCS.h rename to src/codec_utils/F1AP/NRSCS.h diff --git a/src/du_app/F1AP/asn/NativeEnumerated.c b/src/codec_utils/F1AP/NativeEnumerated.c similarity index 100% rename from src/du_app/F1AP/asn/NativeEnumerated.c rename to src/codec_utils/F1AP/NativeEnumerated.c diff --git a/src/du_app/F1AP/asn/NativeEnumerated.h b/src/codec_utils/F1AP/NativeEnumerated.h similarity index 100% rename from src/du_app/F1AP/asn/NativeEnumerated.h rename to src/codec_utils/F1AP/NativeEnumerated.h diff --git a/src/du_app/F1AP/asn/NativeEnumerated_oer.c b/src/codec_utils/F1AP/NativeEnumerated_oer.c similarity index 100% rename from src/du_app/F1AP/asn/NativeEnumerated_oer.c rename to src/codec_utils/F1AP/NativeEnumerated_oer.c diff --git a/src/du_app/F1AP/asn/NativeInteger.c b/src/codec_utils/F1AP/NativeInteger.c similarity index 100% rename from src/du_app/F1AP/asn/NativeInteger.c rename to src/codec_utils/F1AP/NativeInteger.c diff --git a/src/du_app/F1AP/asn/NativeInteger.h b/src/codec_utils/F1AP/NativeInteger.h similarity index 100% rename from src/du_app/F1AP/asn/NativeInteger.h rename to src/codec_utils/F1AP/NativeInteger.h diff --git a/src/du_app/F1AP/asn/NativeInteger_oer.c b/src/codec_utils/F1AP/NativeInteger_oer.c similarity index 100% rename from src/du_app/F1AP/asn/NativeInteger_oer.c rename to src/codec_utils/F1AP/NativeInteger_oer.c diff --git a/src/du_app/F1AP/asn/NeedforGap.c b/src/codec_utils/F1AP/NeedforGap.c similarity index 100% rename from src/du_app/F1AP/asn/NeedforGap.c rename to src/codec_utils/F1AP/NeedforGap.c diff --git a/src/du_app/F1AP/asn/NeedforGap.h b/src/codec_utils/F1AP/NeedforGap.h similarity index 100% rename from src/du_app/F1AP/asn/NeedforGap.h rename to src/codec_utils/F1AP/NeedforGap.h diff --git a/src/du_app/F1AP/asn/NonDynamic5QIDescriptor.c b/src/codec_utils/F1AP/NonDynamic5QIDescriptor.c similarity index 100% rename from src/du_app/F1AP/asn/NonDynamic5QIDescriptor.c rename to src/codec_utils/F1AP/NonDynamic5QIDescriptor.c diff --git a/src/du_app/F1AP/asn/NonDynamic5QIDescriptor.h b/src/codec_utils/F1AP/NonDynamic5QIDescriptor.h similarity index 100% rename from src/du_app/F1AP/asn/NonDynamic5QIDescriptor.h rename to src/codec_utils/F1AP/NonDynamic5QIDescriptor.h diff --git a/src/du_app/F1AP/asn/Notification-Cause.c b/src/codec_utils/F1AP/Notification-Cause.c similarity index 100% rename from src/du_app/F1AP/asn/Notification-Cause.c rename to src/codec_utils/F1AP/Notification-Cause.c diff --git a/src/du_app/F1AP/asn/Notification-Cause.h b/src/codec_utils/F1AP/Notification-Cause.h similarity index 100% rename from src/du_app/F1AP/asn/Notification-Cause.h rename to src/codec_utils/F1AP/Notification-Cause.h diff --git a/src/du_app/F1AP/asn/NotificationControl.c b/src/codec_utils/F1AP/NotificationControl.c similarity index 100% rename from src/du_app/F1AP/asn/NotificationControl.c rename to src/codec_utils/F1AP/NotificationControl.c diff --git a/src/du_app/F1AP/asn/NotificationControl.h b/src/codec_utils/F1AP/NotificationControl.h similarity index 100% rename from src/du_app/F1AP/asn/NotificationControl.h rename to src/codec_utils/F1AP/NotificationControl.h diff --git a/src/du_app/F1AP/asn/Notify.c b/src/codec_utils/F1AP/Notify.c similarity index 100% rename from src/du_app/F1AP/asn/Notify.c rename to src/codec_utils/F1AP/Notify.c diff --git a/src/du_app/F1AP/asn/Notify.h b/src/codec_utils/F1AP/Notify.h similarity index 100% rename from src/du_app/F1AP/asn/Notify.h rename to src/codec_utils/F1AP/Notify.h diff --git a/src/du_app/F1AP/asn/NumberOfBroadcasts.c b/src/codec_utils/F1AP/NumberOfBroadcasts.c similarity index 100% rename from src/du_app/F1AP/asn/NumberOfBroadcasts.c rename to src/codec_utils/F1AP/NumberOfBroadcasts.c diff --git a/src/du_app/F1AP/asn/NumberOfBroadcasts.h b/src/codec_utils/F1AP/NumberOfBroadcasts.h similarity index 100% rename from src/du_app/F1AP/asn/NumberOfBroadcasts.h rename to src/codec_utils/F1AP/NumberOfBroadcasts.h diff --git a/src/du_app/F1AP/asn/NumberofBroadcastRequest.c b/src/codec_utils/F1AP/NumberofBroadcastRequest.c similarity index 100% rename from src/du_app/F1AP/asn/NumberofBroadcastRequest.c rename to src/codec_utils/F1AP/NumberofBroadcastRequest.c diff --git a/src/du_app/F1AP/asn/NumberofBroadcastRequest.h b/src/codec_utils/F1AP/NumberofBroadcastRequest.h similarity index 100% rename from src/du_app/F1AP/asn/NumberofBroadcastRequest.h rename to src/codec_utils/F1AP/NumberofBroadcastRequest.h diff --git a/src/du_app/F1AP/asn/OBJECT_IDENTIFIER.c b/src/codec_utils/F1AP/OBJECT_IDENTIFIER.c similarity index 100% rename from src/du_app/F1AP/asn/OBJECT_IDENTIFIER.c rename to src/codec_utils/F1AP/OBJECT_IDENTIFIER.c diff --git a/src/du_app/F1AP/asn/OBJECT_IDENTIFIER.h b/src/codec_utils/F1AP/OBJECT_IDENTIFIER.h similarity index 100% rename from src/du_app/F1AP/asn/OBJECT_IDENTIFIER.h rename to src/codec_utils/F1AP/OBJECT_IDENTIFIER.h diff --git a/src/du_app/F1AP/asn/OffsetToPointA.c b/src/codec_utils/F1AP/OffsetToPointA.c similarity index 100% rename from src/du_app/F1AP/asn/OffsetToPointA.c rename to src/codec_utils/F1AP/OffsetToPointA.c diff --git a/src/du_app/F1AP/asn/OffsetToPointA.h b/src/codec_utils/F1AP/OffsetToPointA.h similarity index 100% rename from src/du_app/F1AP/asn/OffsetToPointA.h rename to src/codec_utils/F1AP/OffsetToPointA.h diff --git a/src/du_app/F1AP/asn/PDCP-SN.c b/src/codec_utils/F1AP/PDCP-SN.c similarity index 100% rename from src/du_app/F1AP/asn/PDCP-SN.c rename to src/codec_utils/F1AP/PDCP-SN.c diff --git a/src/du_app/F1AP/asn/PDCP-SN.h b/src/codec_utils/F1AP/PDCP-SN.h similarity index 100% rename from src/du_app/F1AP/asn/PDCP-SN.h rename to src/codec_utils/F1AP/PDCP-SN.h diff --git a/src/du_app/F1AP/asn/PDCPSNLength.c b/src/codec_utils/F1AP/PDCPSNLength.c similarity index 100% rename from src/du_app/F1AP/asn/PDCPSNLength.c rename to src/codec_utils/F1AP/PDCPSNLength.c diff --git a/src/du_app/F1AP/asn/PDCPSNLength.h b/src/codec_utils/F1AP/PDCPSNLength.h similarity index 100% rename from src/du_app/F1AP/asn/PDCPSNLength.h rename to src/codec_utils/F1AP/PDCPSNLength.h diff --git a/src/du_app/F1AP/asn/PDUSessionID.c b/src/codec_utils/F1AP/PDUSessionID.c similarity index 100% rename from src/du_app/F1AP/asn/PDUSessionID.c rename to src/codec_utils/F1AP/PDUSessionID.c diff --git a/src/du_app/F1AP/asn/PDUSessionID.h b/src/codec_utils/F1AP/PDUSessionID.h similarity index 100% rename from src/du_app/F1AP/asn/PDUSessionID.h rename to src/codec_utils/F1AP/PDUSessionID.h diff --git a/src/du_app/F1AP/asn/PER-Exponent.c b/src/codec_utils/F1AP/PER-Exponent.c similarity index 100% rename from src/du_app/F1AP/asn/PER-Exponent.c rename to src/codec_utils/F1AP/PER-Exponent.c diff --git a/src/du_app/F1AP/asn/PER-Exponent.h b/src/codec_utils/F1AP/PER-Exponent.h similarity index 100% rename from src/du_app/F1AP/asn/PER-Exponent.h rename to src/codec_utils/F1AP/PER-Exponent.h diff --git a/src/du_app/F1AP/asn/PER-Scalar.c b/src/codec_utils/F1AP/PER-Scalar.c similarity index 100% rename from src/du_app/F1AP/asn/PER-Scalar.c rename to src/codec_utils/F1AP/PER-Scalar.c diff --git a/src/du_app/F1AP/asn/PER-Scalar.h b/src/codec_utils/F1AP/PER-Scalar.h similarity index 100% rename from src/du_app/F1AP/asn/PER-Scalar.h rename to src/codec_utils/F1AP/PER-Scalar.h diff --git a/src/du_app/F1AP/asn/PLMN-Identity.c b/src/codec_utils/F1AP/PLMN-Identity.c similarity index 100% rename from src/du_app/F1AP/asn/PLMN-Identity.c rename to src/codec_utils/F1AP/PLMN-Identity.c diff --git a/src/du_app/F1AP/asn/PLMN-Identity.h b/src/codec_utils/F1AP/PLMN-Identity.h similarity index 100% rename from src/du_app/F1AP/asn/PLMN-Identity.h rename to src/codec_utils/F1AP/PLMN-Identity.h diff --git a/src/du_app/F1AP/asn/PWS-Failed-NR-CGI-Item.c b/src/codec_utils/F1AP/PWS-Failed-NR-CGI-Item.c similarity index 100% rename from src/du_app/F1AP/asn/PWS-Failed-NR-CGI-Item.c rename to src/codec_utils/F1AP/PWS-Failed-NR-CGI-Item.c diff --git a/src/du_app/F1AP/asn/PWS-Failed-NR-CGI-Item.h b/src/codec_utils/F1AP/PWS-Failed-NR-CGI-Item.h similarity index 100% rename from src/du_app/F1AP/asn/PWS-Failed-NR-CGI-Item.h rename to src/codec_utils/F1AP/PWS-Failed-NR-CGI-Item.h diff --git a/src/du_app/F1AP/asn/PWS-Failed-NR-CGI-List.c b/src/codec_utils/F1AP/PWS-Failed-NR-CGI-List.c similarity index 100% rename from src/du_app/F1AP/asn/PWS-Failed-NR-CGI-List.c rename to src/codec_utils/F1AP/PWS-Failed-NR-CGI-List.c diff --git a/src/du_app/F1AP/asn/PWS-Failed-NR-CGI-List.h b/src/codec_utils/F1AP/PWS-Failed-NR-CGI-List.h similarity index 100% rename from src/du_app/F1AP/asn/PWS-Failed-NR-CGI-List.h rename to src/codec_utils/F1AP/PWS-Failed-NR-CGI-List.h diff --git a/src/du_app/F1AP/asn/PWSCancelRequest.c b/src/codec_utils/F1AP/PWSCancelRequest.c similarity index 100% rename from src/du_app/F1AP/asn/PWSCancelRequest.c rename to src/codec_utils/F1AP/PWSCancelRequest.c diff --git a/src/du_app/F1AP/asn/PWSCancelRequest.h b/src/codec_utils/F1AP/PWSCancelRequest.h similarity index 100% rename from src/du_app/F1AP/asn/PWSCancelRequest.h rename to src/codec_utils/F1AP/PWSCancelRequest.h diff --git a/src/du_app/F1AP/asn/PWSCancelResponse.c b/src/codec_utils/F1AP/PWSCancelResponse.c similarity index 100% rename from src/du_app/F1AP/asn/PWSCancelResponse.c rename to src/codec_utils/F1AP/PWSCancelResponse.c diff --git a/src/du_app/F1AP/asn/PWSCancelResponse.h b/src/codec_utils/F1AP/PWSCancelResponse.h similarity index 100% rename from src/du_app/F1AP/asn/PWSCancelResponse.h rename to src/codec_utils/F1AP/PWSCancelResponse.h diff --git a/src/du_app/F1AP/asn/PWSFailureIndication.c b/src/codec_utils/F1AP/PWSFailureIndication.c similarity index 100% rename from src/du_app/F1AP/asn/PWSFailureIndication.c rename to src/codec_utils/F1AP/PWSFailureIndication.c diff --git a/src/du_app/F1AP/asn/PWSFailureIndication.h b/src/codec_utils/F1AP/PWSFailureIndication.h similarity index 100% rename from src/du_app/F1AP/asn/PWSFailureIndication.h rename to src/codec_utils/F1AP/PWSFailureIndication.h diff --git a/src/du_app/F1AP/asn/PWSRestartIndication.c b/src/codec_utils/F1AP/PWSRestartIndication.c similarity index 100% rename from src/du_app/F1AP/asn/PWSRestartIndication.c rename to src/codec_utils/F1AP/PWSRestartIndication.c diff --git a/src/du_app/F1AP/asn/PWSRestartIndication.h b/src/codec_utils/F1AP/PWSRestartIndication.h similarity index 100% rename from src/du_app/F1AP/asn/PWSRestartIndication.h rename to src/codec_utils/F1AP/PWSRestartIndication.h diff --git a/src/du_app/F1AP/asn/PWSSystemInformation.c b/src/codec_utils/F1AP/PWSSystemInformation.c similarity index 100% rename from src/du_app/F1AP/asn/PWSSystemInformation.c rename to src/codec_utils/F1AP/PWSSystemInformation.c diff --git a/src/du_app/F1AP/asn/PWSSystemInformation.h b/src/codec_utils/F1AP/PWSSystemInformation.h similarity index 100% rename from src/du_app/F1AP/asn/PWSSystemInformation.h rename to src/codec_utils/F1AP/PWSSystemInformation.h diff --git a/src/du_app/F1AP/asn/PacketDelayBudget.c b/src/codec_utils/F1AP/PacketDelayBudget.c similarity index 100% rename from src/du_app/F1AP/asn/PacketDelayBudget.c rename to src/codec_utils/F1AP/PacketDelayBudget.c diff --git a/src/du_app/F1AP/asn/PacketDelayBudget.h b/src/codec_utils/F1AP/PacketDelayBudget.h similarity index 100% rename from src/du_app/F1AP/asn/PacketDelayBudget.h rename to src/codec_utils/F1AP/PacketDelayBudget.h diff --git a/src/du_app/F1AP/asn/PacketErrorRate.c b/src/codec_utils/F1AP/PacketErrorRate.c similarity index 100% rename from src/du_app/F1AP/asn/PacketErrorRate.c rename to src/codec_utils/F1AP/PacketErrorRate.c diff --git a/src/du_app/F1AP/asn/PacketErrorRate.h b/src/codec_utils/F1AP/PacketErrorRate.h similarity index 100% rename from src/du_app/F1AP/asn/PacketErrorRate.h rename to src/codec_utils/F1AP/PacketErrorRate.h diff --git a/src/du_app/F1AP/asn/Paging.c b/src/codec_utils/F1AP/Paging.c similarity index 100% rename from src/du_app/F1AP/asn/Paging.c rename to src/codec_utils/F1AP/Paging.c diff --git a/src/du_app/F1AP/asn/Paging.h b/src/codec_utils/F1AP/Paging.h similarity index 100% rename from src/du_app/F1AP/asn/Paging.h rename to src/codec_utils/F1AP/Paging.h diff --git a/src/du_app/F1AP/asn/PagingCell-Item.c b/src/codec_utils/F1AP/PagingCell-Item.c similarity index 100% rename from src/du_app/F1AP/asn/PagingCell-Item.c rename to src/codec_utils/F1AP/PagingCell-Item.c diff --git a/src/du_app/F1AP/asn/PagingCell-Item.h b/src/codec_utils/F1AP/PagingCell-Item.h similarity index 100% rename from src/du_app/F1AP/asn/PagingCell-Item.h rename to src/codec_utils/F1AP/PagingCell-Item.h diff --git a/src/du_app/F1AP/asn/PagingCell-list.c b/src/codec_utils/F1AP/PagingCell-list.c similarity index 100% rename from src/du_app/F1AP/asn/PagingCell-list.c rename to src/codec_utils/F1AP/PagingCell-list.c diff --git a/src/du_app/F1AP/asn/PagingCell-list.h b/src/codec_utils/F1AP/PagingCell-list.h similarity index 100% rename from src/du_app/F1AP/asn/PagingCell-list.h rename to src/codec_utils/F1AP/PagingCell-list.h diff --git a/src/du_app/F1AP/asn/PagingDRX.c b/src/codec_utils/F1AP/PagingDRX.c similarity index 100% rename from src/du_app/F1AP/asn/PagingDRX.c rename to src/codec_utils/F1AP/PagingDRX.c diff --git a/src/du_app/F1AP/asn/PagingDRX.h b/src/codec_utils/F1AP/PagingDRX.h similarity index 100% rename from src/du_app/F1AP/asn/PagingDRX.h rename to src/codec_utils/F1AP/PagingDRX.h diff --git a/src/du_app/F1AP/asn/PagingIdentity.c b/src/codec_utils/F1AP/PagingIdentity.c similarity index 100% rename from src/du_app/F1AP/asn/PagingIdentity.c rename to src/codec_utils/F1AP/PagingIdentity.c diff --git a/src/du_app/F1AP/asn/PagingIdentity.h b/src/codec_utils/F1AP/PagingIdentity.h similarity index 100% rename from src/du_app/F1AP/asn/PagingIdentity.h rename to src/codec_utils/F1AP/PagingIdentity.h diff --git a/src/du_app/F1AP/asn/PagingOrigin.c b/src/codec_utils/F1AP/PagingOrigin.c similarity index 100% rename from src/du_app/F1AP/asn/PagingOrigin.c rename to src/codec_utils/F1AP/PagingOrigin.c diff --git a/src/du_app/F1AP/asn/PagingOrigin.h b/src/codec_utils/F1AP/PagingOrigin.h similarity index 100% rename from src/du_app/F1AP/asn/PagingOrigin.h rename to src/codec_utils/F1AP/PagingOrigin.h diff --git a/src/du_app/F1AP/asn/PagingPriority.c b/src/codec_utils/F1AP/PagingPriority.c similarity index 100% rename from src/du_app/F1AP/asn/PagingPriority.c rename to src/codec_utils/F1AP/PagingPriority.c diff --git a/src/du_app/F1AP/asn/PagingPriority.h b/src/codec_utils/F1AP/PagingPriority.h similarity index 100% rename from src/du_app/F1AP/asn/PagingPriority.h rename to src/codec_utils/F1AP/PagingPriority.h diff --git a/src/du_app/F1AP/asn/Ph-InfoSCG.c b/src/codec_utils/F1AP/Ph-InfoSCG.c similarity index 100% rename from src/du_app/F1AP/asn/Ph-InfoSCG.c rename to src/codec_utils/F1AP/Ph-InfoSCG.c diff --git a/src/du_app/F1AP/asn/Ph-InfoSCG.h b/src/codec_utils/F1AP/Ph-InfoSCG.h similarity index 100% rename from src/du_app/F1AP/asn/Ph-InfoSCG.h rename to src/codec_utils/F1AP/Ph-InfoSCG.h diff --git a/src/du_app/F1AP/asn/Potential-SpCell-Item.c b/src/codec_utils/F1AP/Potential-SpCell-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Potential-SpCell-Item.c rename to src/codec_utils/F1AP/Potential-SpCell-Item.c diff --git a/src/du_app/F1AP/asn/Potential-SpCell-Item.h b/src/codec_utils/F1AP/Potential-SpCell-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Potential-SpCell-Item.h rename to src/codec_utils/F1AP/Potential-SpCell-Item.h diff --git a/src/du_app/F1AP/asn/Potential-SpCell-List.c b/src/codec_utils/F1AP/Potential-SpCell-List.c similarity index 100% rename from src/du_app/F1AP/asn/Potential-SpCell-List.c rename to src/codec_utils/F1AP/Potential-SpCell-List.c diff --git a/src/du_app/F1AP/asn/Potential-SpCell-List.h b/src/codec_utils/F1AP/Potential-SpCell-List.h similarity index 100% rename from src/du_app/F1AP/asn/Potential-SpCell-List.h rename to src/codec_utils/F1AP/Potential-SpCell-List.h diff --git a/src/du_app/F1AP/asn/Pre-emptionCapability.c b/src/codec_utils/F1AP/Pre-emptionCapability.c similarity index 100% rename from src/du_app/F1AP/asn/Pre-emptionCapability.c rename to src/codec_utils/F1AP/Pre-emptionCapability.c diff --git a/src/du_app/F1AP/asn/Pre-emptionCapability.h b/src/codec_utils/F1AP/Pre-emptionCapability.h similarity index 100% rename from src/du_app/F1AP/asn/Pre-emptionCapability.h rename to src/codec_utils/F1AP/Pre-emptionCapability.h diff --git a/src/du_app/F1AP/asn/Pre-emptionVulnerability.c b/src/codec_utils/F1AP/Pre-emptionVulnerability.c similarity index 100% rename from src/du_app/F1AP/asn/Pre-emptionVulnerability.c rename to src/codec_utils/F1AP/Pre-emptionVulnerability.c diff --git a/src/du_app/F1AP/asn/Pre-emptionVulnerability.h b/src/codec_utils/F1AP/Pre-emptionVulnerability.h similarity index 100% rename from src/du_app/F1AP/asn/Pre-emptionVulnerability.h rename to src/codec_utils/F1AP/Pre-emptionVulnerability.h diff --git a/src/du_app/F1AP/asn/Presence.c b/src/codec_utils/F1AP/Presence.c similarity index 100% rename from src/du_app/F1AP/asn/Presence.c rename to src/codec_utils/F1AP/Presence.c diff --git a/src/du_app/F1AP/asn/Presence.h b/src/codec_utils/F1AP/Presence.h similarity index 100% rename from src/du_app/F1AP/asn/Presence.h rename to src/codec_utils/F1AP/Presence.h diff --git a/src/du_app/F1AP/asn/PrintableString.c b/src/codec_utils/F1AP/PrintableString.c similarity index 100% rename from src/du_app/F1AP/asn/PrintableString.c rename to src/codec_utils/F1AP/PrintableString.c diff --git a/src/du_app/F1AP/asn/PrintableString.h b/src/codec_utils/F1AP/PrintableString.h similarity index 100% rename from src/du_app/F1AP/asn/PrintableString.h rename to src/codec_utils/F1AP/PrintableString.h diff --git a/src/du_app/F1AP/asn/PriorityLevel.c b/src/codec_utils/F1AP/PriorityLevel.c similarity index 100% rename from src/du_app/F1AP/asn/PriorityLevel.c rename to src/codec_utils/F1AP/PriorityLevel.c diff --git a/src/du_app/F1AP/asn/PriorityLevel.h b/src/codec_utils/F1AP/PriorityLevel.h similarity index 100% rename from src/du_app/F1AP/asn/PriorityLevel.h rename to src/codec_utils/F1AP/PriorityLevel.h diff --git a/src/du_app/F1AP/asn/PrivateIE-Container.c b/src/codec_utils/F1AP/PrivateIE-Container.c similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-Container.c rename to src/codec_utils/F1AP/PrivateIE-Container.c diff --git a/src/du_app/F1AP/asn/PrivateIE-Container.h b/src/codec_utils/F1AP/PrivateIE-Container.h similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-Container.h rename to src/codec_utils/F1AP/PrivateIE-Container.h diff --git a/src/du_app/F1AP/asn/PrivateIE-Field.c b/src/codec_utils/F1AP/PrivateIE-Field.c similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-Field.c rename to src/codec_utils/F1AP/PrivateIE-Field.c diff --git a/src/du_app/F1AP/asn/PrivateIE-Field.h b/src/codec_utils/F1AP/PrivateIE-Field.h similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-Field.h rename to src/codec_utils/F1AP/PrivateIE-Field.h diff --git a/src/du_app/F1AP/asn/PrivateIE-ID.c b/src/codec_utils/F1AP/PrivateIE-ID.c similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-ID.c rename to src/codec_utils/F1AP/PrivateIE-ID.c diff --git a/src/du_app/F1AP/asn/PrivateIE-ID.h b/src/codec_utils/F1AP/PrivateIE-ID.h similarity index 100% rename from src/du_app/F1AP/asn/PrivateIE-ID.h rename to src/codec_utils/F1AP/PrivateIE-ID.h diff --git a/src/du_app/F1AP/asn/PrivateMessage.c b/src/codec_utils/F1AP/PrivateMessage.c similarity index 100% rename from src/du_app/F1AP/asn/PrivateMessage.c rename to src/codec_utils/F1AP/PrivateMessage.c diff --git a/src/du_app/F1AP/asn/PrivateMessage.h b/src/codec_utils/F1AP/PrivateMessage.h similarity index 100% rename from src/du_app/F1AP/asn/PrivateMessage.h rename to src/codec_utils/F1AP/PrivateMessage.h diff --git a/src/du_app/F1AP/asn/ProcedureCode.c b/src/codec_utils/F1AP/ProcedureCode.c similarity index 100% rename from src/du_app/F1AP/asn/ProcedureCode.c rename to src/codec_utils/F1AP/ProcedureCode.c diff --git a/src/du_app/F1AP/asn/ProcedureCode.h b/src/codec_utils/F1AP/ProcedureCode.h similarity index 100% rename from src/du_app/F1AP/asn/ProcedureCode.h rename to src/codec_utils/F1AP/ProcedureCode.h diff --git a/src/du_app/F1AP/asn/Protected-EUTRA-Resources-Item.c b/src/codec_utils/F1AP/Protected-EUTRA-Resources-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Protected-EUTRA-Resources-Item.c rename to src/codec_utils/F1AP/Protected-EUTRA-Resources-Item.c diff --git a/src/du_app/F1AP/asn/Protected-EUTRA-Resources-Item.h b/src/codec_utils/F1AP/Protected-EUTRA-Resources-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Protected-EUTRA-Resources-Item.h rename to src/codec_utils/F1AP/Protected-EUTRA-Resources-Item.h diff --git a/src/du_app/F1AP/asn/Protected-EUTRA-Resources-List.c b/src/codec_utils/F1AP/Protected-EUTRA-Resources-List.c similarity index 100% rename from src/du_app/F1AP/asn/Protected-EUTRA-Resources-List.c rename to src/codec_utils/F1AP/Protected-EUTRA-Resources-List.c diff --git a/src/du_app/F1AP/asn/Protected-EUTRA-Resources-List.h b/src/codec_utils/F1AP/Protected-EUTRA-Resources-List.h similarity index 100% rename from src/du_app/F1AP/asn/Protected-EUTRA-Resources-List.h rename to src/codec_utils/F1AP/Protected-EUTRA-Resources-List.h diff --git a/src/du_app/F1AP/asn/ProtectedEUTRAResourceIndication.c b/src/codec_utils/F1AP/ProtectedEUTRAResourceIndication.c similarity index 100% rename from src/du_app/F1AP/asn/ProtectedEUTRAResourceIndication.c rename to src/codec_utils/F1AP/ProtectedEUTRAResourceIndication.c diff --git a/src/du_app/F1AP/asn/ProtectedEUTRAResourceIndication.h b/src/codec_utils/F1AP/ProtectedEUTRAResourceIndication.h similarity index 100% rename from src/du_app/F1AP/asn/ProtectedEUTRAResourceIndication.h rename to src/codec_utils/F1AP/ProtectedEUTRAResourceIndication.h diff --git a/src/du_app/F1AP/asn/ProtocolExtensionContainer.c b/src/codec_utils/F1AP/ProtocolExtensionContainer.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionContainer.c rename to src/codec_utils/F1AP/ProtocolExtensionContainer.c diff --git a/src/du_app/F1AP/asn/ProtocolExtensionContainer.h b/src/codec_utils/F1AP/ProtocolExtensionContainer.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionContainer.h rename to src/codec_utils/F1AP/ProtocolExtensionContainer.h diff --git a/src/du_app/F1AP/asn/ProtocolExtensionField.c b/src/codec_utils/F1AP/ProtocolExtensionField.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionField.c rename to src/codec_utils/F1AP/ProtocolExtensionField.c diff --git a/src/du_app/F1AP/asn/ProtocolExtensionField.h b/src/codec_utils/F1AP/ProtocolExtensionField.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionField.h rename to src/codec_utils/F1AP/ProtocolExtensionField.h diff --git a/src/du_app/F1AP/asn/ProtocolExtensionID.c b/src/codec_utils/F1AP/ProtocolExtensionID.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionID.c rename to src/codec_utils/F1AP/ProtocolExtensionID.c diff --git a/src/du_app/F1AP/asn/ProtocolExtensionID.h b/src/codec_utils/F1AP/ProtocolExtensionID.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolExtensionID.h rename to src/codec_utils/F1AP/ProtocolExtensionID.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-Container.c b/src/codec_utils/F1AP/ProtocolIE-Container.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-Container.c rename to src/codec_utils/F1AP/ProtocolIE-Container.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-Container.h b/src/codec_utils/F1AP/ProtocolIE-Container.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-Container.h rename to src/codec_utils/F1AP/ProtocolIE-Container.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-ContainerPair.c b/src/codec_utils/F1AP/ProtocolIE-ContainerPair.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-ContainerPair.c rename to src/codec_utils/F1AP/ProtocolIE-ContainerPair.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-ContainerPair.h b/src/codec_utils/F1AP/ProtocolIE-ContainerPair.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-ContainerPair.h rename to src/codec_utils/F1AP/ProtocolIE-ContainerPair.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-Field.c b/src/codec_utils/F1AP/ProtocolIE-Field.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-Field.c rename to src/codec_utils/F1AP/ProtocolIE-Field.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-Field.h b/src/codec_utils/F1AP/ProtocolIE-Field.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-Field.h rename to src/codec_utils/F1AP/ProtocolIE-Field.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-FieldPair.c b/src/codec_utils/F1AP/ProtocolIE-FieldPair.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-FieldPair.c rename to src/codec_utils/F1AP/ProtocolIE-FieldPair.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-FieldPair.h b/src/codec_utils/F1AP/ProtocolIE-FieldPair.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-FieldPair.h rename to src/codec_utils/F1AP/ProtocolIE-FieldPair.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-ID.c b/src/codec_utils/F1AP/ProtocolIE-ID.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-ID.c rename to src/codec_utils/F1AP/ProtocolIE-ID.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-ID.h b/src/codec_utils/F1AP/ProtocolIE-ID.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-ID.h rename to src/codec_utils/F1AP/ProtocolIE-ID.h diff --git a/src/du_app/F1AP/asn/ProtocolIE-SingleContainer.c b/src/codec_utils/F1AP/ProtocolIE-SingleContainer.c similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-SingleContainer.c rename to src/codec_utils/F1AP/ProtocolIE-SingleContainer.c diff --git a/src/du_app/F1AP/asn/ProtocolIE-SingleContainer.h b/src/codec_utils/F1AP/ProtocolIE-SingleContainer.h similarity index 100% rename from src/du_app/F1AP/asn/ProtocolIE-SingleContainer.h rename to src/codec_utils/F1AP/ProtocolIE-SingleContainer.h diff --git a/src/du_app/F1AP/asn/QCI.c b/src/codec_utils/F1AP/QCI.c similarity index 100% rename from src/du_app/F1AP/asn/QCI.c rename to src/codec_utils/F1AP/QCI.c diff --git a/src/du_app/F1AP/asn/QCI.h b/src/codec_utils/F1AP/QCI.h similarity index 100% rename from src/du_app/F1AP/asn/QCI.h rename to src/codec_utils/F1AP/QCI.h diff --git a/src/du_app/F1AP/asn/QoS-Characteristics.c b/src/codec_utils/F1AP/QoS-Characteristics.c similarity index 100% rename from src/du_app/F1AP/asn/QoS-Characteristics.c rename to src/codec_utils/F1AP/QoS-Characteristics.c diff --git a/src/codec_utils/F1AP/QoS-Characteristics.h b/src/codec_utils/F1AP/QoS-Characteristics.h new file mode 100755 index 000000000..20f84f9c3 --- /dev/null +++ b/src/codec_utils/F1AP/QoS-Characteristics.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _QoS_Characteristics_H_ +#define _QoS_Characteristics_H_ + + +#include + +/* Including external dependencies */ +#include +#include "NonDynamic5QIDescriptor.h" +#include "Dynamic5QIDescriptor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum QoS_Characteristics_PR { + QoS_Characteristics_PR_NOTHING, /* No components present */ + QoS_Characteristics_PR_non_Dynamic_5QI, + QoS_Characteristics_PR_dynamic_5QI, + QoS_Characteristics_PR_choice_extension +} QoS_Characteristics_PR; + +/* Forward declarations */ +struct NonDynamic5QIDescriptor; +struct Dynamic5QIDescriptor; +struct ProtocolIE_SingleContainer; + +/* QoS-Characteristics */ +typedef struct QoS_Characteristics { + QoS_Characteristics_PR present; + union QoS_Characteristics_u { + NonDynamic5QIDescriptor_t *non_Dynamic_5QI; + Dynamic5QIDescriptor_t *dynamic_5QI; + struct ProtocolIE_SingleContainer *choice_extension; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} QoS_Characteristics_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_QoS_Characteristics; +extern asn_CHOICE_specifics_t asn_SPC_QoS_Characteristics_specs_1; +extern asn_TYPE_member_t asn_MBR_QoS_Characteristics_1[3]; +extern asn_per_constraints_t asn_PER_type_QoS_Characteristics_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _QoS_Characteristics_H_ */ +#include diff --git a/src/du_app/F1AP/asn/QoSFlowIdentifier.c b/src/codec_utils/F1AP/QoSFlowIdentifier.c similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowIdentifier.c rename to src/codec_utils/F1AP/QoSFlowIdentifier.c diff --git a/src/du_app/F1AP/asn/QoSFlowIdentifier.h b/src/codec_utils/F1AP/QoSFlowIdentifier.h similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowIdentifier.h rename to src/codec_utils/F1AP/QoSFlowIdentifier.h diff --git a/src/du_app/F1AP/asn/QoSFlowLevelQoSParameters.c b/src/codec_utils/F1AP/QoSFlowLevelQoSParameters.c similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowLevelQoSParameters.c rename to src/codec_utils/F1AP/QoSFlowLevelQoSParameters.c diff --git a/src/du_app/F1AP/asn/QoSFlowLevelQoSParameters.h b/src/codec_utils/F1AP/QoSFlowLevelQoSParameters.h similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowLevelQoSParameters.h rename to src/codec_utils/F1AP/QoSFlowLevelQoSParameters.h diff --git a/src/du_app/F1AP/asn/QoSFlowMappingIndication.c b/src/codec_utils/F1AP/QoSFlowMappingIndication.c similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowMappingIndication.c rename to src/codec_utils/F1AP/QoSFlowMappingIndication.c diff --git a/src/du_app/F1AP/asn/QoSFlowMappingIndication.h b/src/codec_utils/F1AP/QoSFlowMappingIndication.h similarity index 100% rename from src/du_app/F1AP/asn/QoSFlowMappingIndication.h rename to src/codec_utils/F1AP/QoSFlowMappingIndication.h diff --git a/src/du_app/F1AP/asn/QoSInformation.c b/src/codec_utils/F1AP/QoSInformation.c similarity index 100% rename from src/du_app/F1AP/asn/QoSInformation.c rename to src/codec_utils/F1AP/QoSInformation.c diff --git a/src/codec_utils/F1AP/QoSInformation.h b/src/codec_utils/F1AP/QoSInformation.h new file mode 100755 index 000000000..bb092de65 --- /dev/null +++ b/src/codec_utils/F1AP/QoSInformation.h @@ -0,0 +1,55 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _QoSInformation_H_ +#define _QoSInformation_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum QoSInformation_PR { + QoSInformation_PR_NOTHING, /* No components present */ + QoSInformation_PR_eUTRANQoS, + QoSInformation_PR_choice_extension +} QoSInformation_PR; + +/* Forward declarations */ +struct EUTRANQoS; +struct ProtocolIE_SingleContainer; + +/* QoSInformation */ +typedef struct QoSInformation { + QoSInformation_PR present; + union QoSInformation_u { + struct EUTRANQoS *eUTRANQoS; + struct QoSInformation_ExtIEs *choice_extension; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} QoSInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_QoSInformation; +extern asn_CHOICE_specifics_t asn_SPC_QoSInformation_specs_1; +extern asn_TYPE_member_t asn_MBR_QoSInformation_1[2]; +extern asn_per_constraints_t asn_PER_type_QoSInformation_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _QoSInformation_H_ */ +#include diff --git a/src/du_app/F1AP/asn/RANAC.c b/src/codec_utils/F1AP/RANAC.c similarity index 100% rename from src/du_app/F1AP/asn/RANAC.c rename to src/codec_utils/F1AP/RANAC.c diff --git a/src/du_app/F1AP/asn/RANAC.h b/src/codec_utils/F1AP/RANAC.h similarity index 100% rename from src/du_app/F1AP/asn/RANAC.h rename to src/codec_utils/F1AP/RANAC.h diff --git a/src/du_app/F1AP/asn/RANUEPagingIdentity.c b/src/codec_utils/F1AP/RANUEPagingIdentity.c similarity index 100% rename from src/du_app/F1AP/asn/RANUEPagingIdentity.c rename to src/codec_utils/F1AP/RANUEPagingIdentity.c diff --git a/src/du_app/F1AP/asn/RANUEPagingIdentity.h b/src/codec_utils/F1AP/RANUEPagingIdentity.h similarity index 100% rename from src/du_app/F1AP/asn/RANUEPagingIdentity.h rename to src/codec_utils/F1AP/RANUEPagingIdentity.h diff --git a/src/du_app/F1AP/asn/RAT-FrequencyPriorityInformation.c b/src/codec_utils/F1AP/RAT-FrequencyPriorityInformation.c similarity index 100% rename from src/du_app/F1AP/asn/RAT-FrequencyPriorityInformation.c rename to src/codec_utils/F1AP/RAT-FrequencyPriorityInformation.c diff --git a/src/du_app/F1AP/asn/RAT-FrequencyPriorityInformation.h b/src/codec_utils/F1AP/RAT-FrequencyPriorityInformation.h similarity index 100% rename from src/du_app/F1AP/asn/RAT-FrequencyPriorityInformation.h rename to src/codec_utils/F1AP/RAT-FrequencyPriorityInformation.h diff --git a/src/du_app/F1AP/asn/RAT-FrequencySelectionPriority.c b/src/codec_utils/F1AP/RAT-FrequencySelectionPriority.c similarity index 100% rename from src/du_app/F1AP/asn/RAT-FrequencySelectionPriority.c rename to src/codec_utils/F1AP/RAT-FrequencySelectionPriority.c diff --git a/src/du_app/F1AP/asn/RAT-FrequencySelectionPriority.h b/src/codec_utils/F1AP/RAT-FrequencySelectionPriority.h similarity index 100% rename from src/du_app/F1AP/asn/RAT-FrequencySelectionPriority.h rename to src/codec_utils/F1AP/RAT-FrequencySelectionPriority.h diff --git a/src/du_app/F1AP/asn/RLC-Status.c b/src/codec_utils/F1AP/RLC-Status.c similarity index 100% rename from src/du_app/F1AP/asn/RLC-Status.c rename to src/codec_utils/F1AP/RLC-Status.c diff --git a/src/du_app/F1AP/asn/RLC-Status.h b/src/codec_utils/F1AP/RLC-Status.h similarity index 100% rename from src/du_app/F1AP/asn/RLC-Status.h rename to src/codec_utils/F1AP/RLC-Status.h diff --git a/src/du_app/F1AP/asn/RLCFailureIndication.c b/src/codec_utils/F1AP/RLCFailureIndication.c similarity index 100% rename from src/du_app/F1AP/asn/RLCFailureIndication.c rename to src/codec_utils/F1AP/RLCFailureIndication.c diff --git a/src/du_app/F1AP/asn/RLCFailureIndication.h b/src/codec_utils/F1AP/RLCFailureIndication.h similarity index 100% rename from src/du_app/F1AP/asn/RLCFailureIndication.h rename to src/codec_utils/F1AP/RLCFailureIndication.h diff --git a/src/du_app/F1AP/asn/RLCMode.c b/src/codec_utils/F1AP/RLCMode.c similarity index 100% rename from src/du_app/F1AP/asn/RLCMode.c rename to src/codec_utils/F1AP/RLCMode.c diff --git a/src/du_app/F1AP/asn/RLCMode.h b/src/codec_utils/F1AP/RLCMode.h similarity index 100% rename from src/du_app/F1AP/asn/RLCMode.h rename to src/codec_utils/F1AP/RLCMode.h diff --git a/src/du_app/F1AP/asn/RRC-Version.c b/src/codec_utils/F1AP/RRC-Version.c similarity index 100% rename from src/du_app/F1AP/asn/RRC-Version.c rename to src/codec_utils/F1AP/RRC-Version.c diff --git a/src/codec_utils/F1AP/RRC-Version.h b/src/codec_utils/F1AP/RRC-Version.h new file mode 100644 index 000000000..ca093a18b --- /dev/null +++ b/src/codec_utils/F1AP/RRC-Version.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _RRC_Version_H_ +#define _RRC_Version_H_ + + +#include +#include +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolExtensionContainer; + +/* RRC-Version */ +typedef struct RRC_Version { + BIT_STRING_t latest_RRC_Version; + ProtocolExtensionContainer_4624P81_t *iE_Extensions; + //struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RRC_Version_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RRC_Version; + +#ifdef __cplusplus +} +#endif + +#endif /* _RRC_Version_H_ */ +#include diff --git a/src/du_app/F1AP/asn/RRCContainer.c b/src/codec_utils/F1AP/RRCContainer.c similarity index 100% rename from src/du_app/F1AP/asn/RRCContainer.c rename to src/codec_utils/F1AP/RRCContainer.c diff --git a/src/du_app/F1AP/asn/RRCContainer.h b/src/codec_utils/F1AP/RRCContainer.h similarity index 100% rename from src/du_app/F1AP/asn/RRCContainer.h rename to src/codec_utils/F1AP/RRCContainer.h diff --git a/src/du_app/F1AP/asn/RRCDeliveryReport.c b/src/codec_utils/F1AP/RRCDeliveryReport.c similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryReport.c rename to src/codec_utils/F1AP/RRCDeliveryReport.c diff --git a/src/du_app/F1AP/asn/RRCDeliveryReport.h b/src/codec_utils/F1AP/RRCDeliveryReport.h similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryReport.h rename to src/codec_utils/F1AP/RRCDeliveryReport.h diff --git a/src/du_app/F1AP/asn/RRCDeliveryStatus.c b/src/codec_utils/F1AP/RRCDeliveryStatus.c similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryStatus.c rename to src/codec_utils/F1AP/RRCDeliveryStatus.c diff --git a/src/du_app/F1AP/asn/RRCDeliveryStatus.h b/src/codec_utils/F1AP/RRCDeliveryStatus.h similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryStatus.h rename to src/codec_utils/F1AP/RRCDeliveryStatus.h diff --git a/src/du_app/F1AP/asn/RRCDeliveryStatusRequest.c b/src/codec_utils/F1AP/RRCDeliveryStatusRequest.c similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryStatusRequest.c rename to src/codec_utils/F1AP/RRCDeliveryStatusRequest.c diff --git a/src/du_app/F1AP/asn/RRCDeliveryStatusRequest.h b/src/codec_utils/F1AP/RRCDeliveryStatusRequest.h similarity index 100% rename from src/du_app/F1AP/asn/RRCDeliveryStatusRequest.h rename to src/codec_utils/F1AP/RRCDeliveryStatusRequest.h diff --git a/src/du_app/F1AP/asn/RRCReconfigurationCompleteIndicator.c b/src/codec_utils/F1AP/RRCReconfigurationCompleteIndicator.c similarity index 100% rename from src/du_app/F1AP/asn/RRCReconfigurationCompleteIndicator.c rename to src/codec_utils/F1AP/RRCReconfigurationCompleteIndicator.c diff --git a/src/du_app/F1AP/asn/RRCReconfigurationCompleteIndicator.h b/src/codec_utils/F1AP/RRCReconfigurationCompleteIndicator.h similarity index 100% rename from src/du_app/F1AP/asn/RRCReconfigurationCompleteIndicator.h rename to src/codec_utils/F1AP/RRCReconfigurationCompleteIndicator.h diff --git a/src/du_app/F1AP/asn/Reestablishment-Indication.c b/src/codec_utils/F1AP/Reestablishment-Indication.c similarity index 100% rename from src/du_app/F1AP/asn/Reestablishment-Indication.c rename to src/codec_utils/F1AP/Reestablishment-Indication.c diff --git a/src/du_app/F1AP/asn/Reestablishment-Indication.h b/src/codec_utils/F1AP/Reestablishment-Indication.h similarity index 100% rename from src/du_app/F1AP/asn/Reestablishment-Indication.h rename to src/codec_utils/F1AP/Reestablishment-Indication.h diff --git a/src/du_app/F1AP/asn/RepetitionPeriod.c b/src/codec_utils/F1AP/RepetitionPeriod.c similarity index 100% rename from src/du_app/F1AP/asn/RepetitionPeriod.c rename to src/codec_utils/F1AP/RepetitionPeriod.c diff --git a/src/du_app/F1AP/asn/RepetitionPeriod.h b/src/codec_utils/F1AP/RepetitionPeriod.h similarity index 100% rename from src/du_app/F1AP/asn/RepetitionPeriod.h rename to src/codec_utils/F1AP/RepetitionPeriod.h diff --git a/src/du_app/F1AP/asn/RequestType.c b/src/codec_utils/F1AP/RequestType.c similarity index 100% rename from src/du_app/F1AP/asn/RequestType.c rename to src/codec_utils/F1AP/RequestType.c diff --git a/src/du_app/F1AP/asn/RequestType.h b/src/codec_utils/F1AP/RequestType.h similarity index 100% rename from src/du_app/F1AP/asn/RequestType.h rename to src/codec_utils/F1AP/RequestType.h diff --git a/src/du_app/F1AP/asn/RequestedBandCombinationIndex.c b/src/codec_utils/F1AP/RequestedBandCombinationIndex.c similarity index 100% rename from src/du_app/F1AP/asn/RequestedBandCombinationIndex.c rename to src/codec_utils/F1AP/RequestedBandCombinationIndex.c diff --git a/src/du_app/F1AP/asn/RequestedBandCombinationIndex.h b/src/codec_utils/F1AP/RequestedBandCombinationIndex.h similarity index 100% rename from src/du_app/F1AP/asn/RequestedBandCombinationIndex.h rename to src/codec_utils/F1AP/RequestedBandCombinationIndex.h diff --git a/src/du_app/F1AP/asn/RequestedFeatureSetEntryIndex.c b/src/codec_utils/F1AP/RequestedFeatureSetEntryIndex.c similarity index 100% rename from src/du_app/F1AP/asn/RequestedFeatureSetEntryIndex.c rename to src/codec_utils/F1AP/RequestedFeatureSetEntryIndex.c diff --git a/src/du_app/F1AP/asn/RequestedFeatureSetEntryIndex.h b/src/codec_utils/F1AP/RequestedFeatureSetEntryIndex.h similarity index 100% rename from src/du_app/F1AP/asn/RequestedFeatureSetEntryIndex.h rename to src/codec_utils/F1AP/RequestedFeatureSetEntryIndex.h diff --git a/src/du_app/F1AP/asn/RequestedP-MaxFR2.c b/src/codec_utils/F1AP/RequestedP-MaxFR2.c similarity index 100% rename from src/du_app/F1AP/asn/RequestedP-MaxFR2.c rename to src/codec_utils/F1AP/RequestedP-MaxFR2.c diff --git a/src/du_app/F1AP/asn/RequestedP-MaxFR2.h b/src/codec_utils/F1AP/RequestedP-MaxFR2.h similarity index 100% rename from src/du_app/F1AP/asn/RequestedP-MaxFR2.h rename to src/codec_utils/F1AP/RequestedP-MaxFR2.h diff --git a/src/du_app/F1AP/asn/Reset.c b/src/codec_utils/F1AP/Reset.c similarity index 100% rename from src/du_app/F1AP/asn/Reset.c rename to src/codec_utils/F1AP/Reset.c diff --git a/src/du_app/F1AP/asn/Reset.h b/src/codec_utils/F1AP/Reset.h similarity index 100% rename from src/du_app/F1AP/asn/Reset.h rename to src/codec_utils/F1AP/Reset.h diff --git a/src/du_app/F1AP/asn/ResetAcknowledge.c b/src/codec_utils/F1AP/ResetAcknowledge.c similarity index 100% rename from src/du_app/F1AP/asn/ResetAcknowledge.c rename to src/codec_utils/F1AP/ResetAcknowledge.c diff --git a/src/du_app/F1AP/asn/ResetAcknowledge.h b/src/codec_utils/F1AP/ResetAcknowledge.h similarity index 100% rename from src/du_app/F1AP/asn/ResetAcknowledge.h rename to src/codec_utils/F1AP/ResetAcknowledge.h diff --git a/src/du_app/F1AP/asn/ResetAll.c b/src/codec_utils/F1AP/ResetAll.c similarity index 100% rename from src/du_app/F1AP/asn/ResetAll.c rename to src/codec_utils/F1AP/ResetAll.c diff --git a/src/du_app/F1AP/asn/ResetAll.h b/src/codec_utils/F1AP/ResetAll.h similarity index 100% rename from src/du_app/F1AP/asn/ResetAll.h rename to src/codec_utils/F1AP/ResetAll.h diff --git a/src/du_app/F1AP/asn/ResetType.c b/src/codec_utils/F1AP/ResetType.c similarity index 100% rename from src/du_app/F1AP/asn/ResetType.c rename to src/codec_utils/F1AP/ResetType.c diff --git a/src/du_app/F1AP/asn/ResetType.h b/src/codec_utils/F1AP/ResetType.h similarity index 100% rename from src/du_app/F1AP/asn/ResetType.h rename to src/codec_utils/F1AP/ResetType.h diff --git a/src/du_app/F1AP/asn/ResourceCoordinationEUTRACellInfo.c b/src/codec_utils/F1AP/ResourceCoordinationEUTRACellInfo.c similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationEUTRACellInfo.c rename to src/codec_utils/F1AP/ResourceCoordinationEUTRACellInfo.c diff --git a/src/du_app/F1AP/asn/ResourceCoordinationEUTRACellInfo.h b/src/codec_utils/F1AP/ResourceCoordinationEUTRACellInfo.h similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationEUTRACellInfo.h rename to src/codec_utils/F1AP/ResourceCoordinationEUTRACellInfo.h diff --git a/src/du_app/F1AP/asn/ResourceCoordinationTransferContainer.c b/src/codec_utils/F1AP/ResourceCoordinationTransferContainer.c similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationTransferContainer.c rename to src/codec_utils/F1AP/ResourceCoordinationTransferContainer.c diff --git a/src/du_app/F1AP/asn/ResourceCoordinationTransferContainer.h b/src/codec_utils/F1AP/ResourceCoordinationTransferContainer.h similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationTransferContainer.h rename to src/codec_utils/F1AP/ResourceCoordinationTransferContainer.h diff --git a/src/du_app/F1AP/asn/ResourceCoordinationTransferInformation.c b/src/codec_utils/F1AP/ResourceCoordinationTransferInformation.c similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationTransferInformation.c rename to src/codec_utils/F1AP/ResourceCoordinationTransferInformation.c diff --git a/src/du_app/F1AP/asn/ResourceCoordinationTransferInformation.h b/src/codec_utils/F1AP/ResourceCoordinationTransferInformation.h similarity index 100% rename from src/du_app/F1AP/asn/ResourceCoordinationTransferInformation.h rename to src/codec_utils/F1AP/ResourceCoordinationTransferInformation.h diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetup-Item.c b/src/codec_utils/F1AP/SCell-FailedtoSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetup-Item.c rename to src/codec_utils/F1AP/SCell-FailedtoSetup-Item.c diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetup-Item.h b/src/codec_utils/F1AP/SCell-FailedtoSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetup-Item.h rename to src/codec_utils/F1AP/SCell-FailedtoSetup-Item.h diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetup-List.c b/src/codec_utils/F1AP/SCell-FailedtoSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetup-List.c rename to src/codec_utils/F1AP/SCell-FailedtoSetup-List.c diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetup-List.h b/src/codec_utils/F1AP/SCell-FailedtoSetup-List.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetup-List.h rename to src/codec_utils/F1AP/SCell-FailedtoSetup-List.h diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetupMod-Item.c b/src/codec_utils/F1AP/SCell-FailedtoSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetupMod-Item.c rename to src/codec_utils/F1AP/SCell-FailedtoSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetupMod-Item.h b/src/codec_utils/F1AP/SCell-FailedtoSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetupMod-Item.h rename to src/codec_utils/F1AP/SCell-FailedtoSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetupMod-List.c b/src/codec_utils/F1AP/SCell-FailedtoSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetupMod-List.c rename to src/codec_utils/F1AP/SCell-FailedtoSetupMod-List.c diff --git a/src/du_app/F1AP/asn/SCell-FailedtoSetupMod-List.h b/src/codec_utils/F1AP/SCell-FailedtoSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-FailedtoSetupMod-List.h rename to src/codec_utils/F1AP/SCell-FailedtoSetupMod-List.h diff --git a/src/du_app/F1AP/asn/SCell-ToBeRemoved-Item.c b/src/codec_utils/F1AP/SCell-ToBeRemoved-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeRemoved-Item.c rename to src/codec_utils/F1AP/SCell-ToBeRemoved-Item.c diff --git a/src/du_app/F1AP/asn/SCell-ToBeRemoved-Item.h b/src/codec_utils/F1AP/SCell-ToBeRemoved-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeRemoved-Item.h rename to src/codec_utils/F1AP/SCell-ToBeRemoved-Item.h diff --git a/src/du_app/F1AP/asn/SCell-ToBeRemoved-List.c b/src/codec_utils/F1AP/SCell-ToBeRemoved-List.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeRemoved-List.c rename to src/codec_utils/F1AP/SCell-ToBeRemoved-List.c diff --git a/src/du_app/F1AP/asn/SCell-ToBeRemoved-List.h b/src/codec_utils/F1AP/SCell-ToBeRemoved-List.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeRemoved-List.h rename to src/codec_utils/F1AP/SCell-ToBeRemoved-List.h diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetup-Item.c b/src/codec_utils/F1AP/SCell-ToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetup-Item.c rename to src/codec_utils/F1AP/SCell-ToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetup-Item.h b/src/codec_utils/F1AP/SCell-ToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetup-Item.h rename to src/codec_utils/F1AP/SCell-ToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetup-List.c b/src/codec_utils/F1AP/SCell-ToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetup-List.c rename to src/codec_utils/F1AP/SCell-ToBeSetup-List.c diff --git a/src/codec_utils/F1AP/SCell-ToBeSetup-List.h b/src/codec_utils/F1AP/SCell-ToBeSetup-List.h new file mode 100755 index 000000000..1bd9914df --- /dev/null +++ b/src/codec_utils/F1AP/SCell-ToBeSetup-List.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SCell_ToBeSetup_List_H_ +#define _SCell_ToBeSetup_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* SCell-ToBeSetup-List */ +typedef struct SCell_ToBeSetup_List { + A_SEQUENCE_OF(struct SCell_ToBeSetup_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SCell_ToBeSetup_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SCell_ToBeSetup_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _SCell_ToBeSetup_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetupMod-Item.c b/src/codec_utils/F1AP/SCell-ToBeSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetupMod-Item.c rename to src/codec_utils/F1AP/SCell-ToBeSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetupMod-Item.h b/src/codec_utils/F1AP/SCell-ToBeSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetupMod-Item.h rename to src/codec_utils/F1AP/SCell-ToBeSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetupMod-List.c b/src/codec_utils/F1AP/SCell-ToBeSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetupMod-List.c rename to src/codec_utils/F1AP/SCell-ToBeSetupMod-List.c diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetupMod-List.h b/src/codec_utils/F1AP/SCell-ToBeSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/SCell-ToBeSetupMod-List.h rename to src/codec_utils/F1AP/SCell-ToBeSetupMod-List.h diff --git a/src/du_app/F1AP/asn/SCellIndex.c b/src/codec_utils/F1AP/SCellIndex.c similarity index 100% rename from src/du_app/F1AP/asn/SCellIndex.c rename to src/codec_utils/F1AP/SCellIndex.c diff --git a/src/du_app/F1AP/asn/SCellIndex.h b/src/codec_utils/F1AP/SCellIndex.h similarity index 100% rename from src/du_app/F1AP/asn/SCellIndex.h rename to src/codec_utils/F1AP/SCellIndex.h diff --git a/src/du_app/F1AP/asn/SIB1-message.c b/src/codec_utils/F1AP/SIB1-message.c similarity index 100% rename from src/du_app/F1AP/asn/SIB1-message.c rename to src/codec_utils/F1AP/SIB1-message.c diff --git a/src/du_app/F1AP/asn/SIB1-message.h b/src/codec_utils/F1AP/SIB1-message.h similarity index 100% rename from src/du_app/F1AP/asn/SIB1-message.h rename to src/codec_utils/F1AP/SIB1-message.h diff --git a/src/du_app/F1AP/asn/SIBType-PWS.c b/src/codec_utils/F1AP/SIBType-PWS.c similarity index 100% rename from src/du_app/F1AP/asn/SIBType-PWS.c rename to src/codec_utils/F1AP/SIBType-PWS.c diff --git a/src/du_app/F1AP/asn/SIBType-PWS.h b/src/codec_utils/F1AP/SIBType-PWS.h similarity index 100% rename from src/du_app/F1AP/asn/SIBType-PWS.h rename to src/codec_utils/F1AP/SIBType-PWS.h diff --git a/src/du_app/F1AP/asn/SItype-Item.c b/src/codec_utils/F1AP/SItype-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SItype-Item.c rename to src/codec_utils/F1AP/SItype-Item.c diff --git a/src/du_app/F1AP/asn/SItype-Item.h b/src/codec_utils/F1AP/SItype-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SItype-Item.h rename to src/codec_utils/F1AP/SItype-Item.h diff --git a/src/du_app/F1AP/asn/SItype-List.c b/src/codec_utils/F1AP/SItype-List.c similarity index 100% rename from src/du_app/F1AP/asn/SItype-List.c rename to src/codec_utils/F1AP/SItype-List.c diff --git a/src/du_app/F1AP/asn/SItype-List.h b/src/codec_utils/F1AP/SItype-List.h similarity index 100% rename from src/du_app/F1AP/asn/SItype-List.h rename to src/codec_utils/F1AP/SItype-List.h diff --git a/src/du_app/F1AP/asn/SItype.c b/src/codec_utils/F1AP/SItype.c similarity index 100% rename from src/du_app/F1AP/asn/SItype.c rename to src/codec_utils/F1AP/SItype.c diff --git a/src/du_app/F1AP/asn/SItype.h b/src/codec_utils/F1AP/SItype.h similarity index 100% rename from src/du_app/F1AP/asn/SItype.h rename to src/codec_utils/F1AP/SItype.h diff --git a/src/du_app/F1AP/asn/SNSSAI.c b/src/codec_utils/F1AP/SNSSAI.c similarity index 100% rename from src/du_app/F1AP/asn/SNSSAI.c rename to src/codec_utils/F1AP/SNSSAI.c diff --git a/src/du_app/F1AP/asn/SNSSAI.h b/src/codec_utils/F1AP/SNSSAI.h similarity index 100% rename from src/du_app/F1AP/asn/SNSSAI.h rename to src/codec_utils/F1AP/SNSSAI.h diff --git a/src/du_app/F1AP/asn/SRBID.c b/src/codec_utils/F1AP/SRBID.c similarity index 100% rename from src/du_app/F1AP/asn/SRBID.c rename to src/codec_utils/F1AP/SRBID.c diff --git a/src/du_app/F1AP/asn/SRBID.h b/src/codec_utils/F1AP/SRBID.h similarity index 100% rename from src/du_app/F1AP/asn/SRBID.h rename to src/codec_utils/F1AP/SRBID.h diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetup-Item.c b/src/codec_utils/F1AP/SRBs-FailedToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetup-Item.c rename to src/codec_utils/F1AP/SRBs-FailedToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetup-Item.h b/src/codec_utils/F1AP/SRBs-FailedToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetup-Item.h rename to src/codec_utils/F1AP/SRBs-FailedToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetup-List.c b/src/codec_utils/F1AP/SRBs-FailedToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetup-List.c rename to src/codec_utils/F1AP/SRBs-FailedToBeSetup-List.c diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetup-List.h b/src/codec_utils/F1AP/SRBs-FailedToBeSetup-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetup-List.h rename to src/codec_utils/F1AP/SRBs-FailedToBeSetup-List.h diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-Item.c b/src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-Item.c rename to src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-Item.h b/src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-Item.h rename to src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-List.c b/src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-List.c rename to src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-List.c diff --git a/src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-List.h b/src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-FailedToBeSetupMod-List.h rename to src/codec_utils/F1AP/SRBs-FailedToBeSetupMod-List.h diff --git a/src/du_app/F1AP/asn/SRBs-Modified-Item.c b/src/codec_utils/F1AP/SRBs-Modified-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Modified-Item.c rename to src/codec_utils/F1AP/SRBs-Modified-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-Modified-Item.h b/src/codec_utils/F1AP/SRBs-Modified-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Modified-Item.h rename to src/codec_utils/F1AP/SRBs-Modified-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-Modified-List.c b/src/codec_utils/F1AP/SRBs-Modified-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Modified-List.c rename to src/codec_utils/F1AP/SRBs-Modified-List.c diff --git a/src/du_app/F1AP/asn/SRBs-Modified-List.h b/src/codec_utils/F1AP/SRBs-Modified-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Modified-List.h rename to src/codec_utils/F1AP/SRBs-Modified-List.h diff --git a/src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-Item.c b/src/codec_utils/F1AP/SRBs-Required-ToBeReleased-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-Item.c rename to src/codec_utils/F1AP/SRBs-Required-ToBeReleased-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-Item.h b/src/codec_utils/F1AP/SRBs-Required-ToBeReleased-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-Item.h rename to src/codec_utils/F1AP/SRBs-Required-ToBeReleased-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-List.c b/src/codec_utils/F1AP/SRBs-Required-ToBeReleased-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-List.c rename to src/codec_utils/F1AP/SRBs-Required-ToBeReleased-List.c diff --git a/src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-List.h b/src/codec_utils/F1AP/SRBs-Required-ToBeReleased-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Required-ToBeReleased-List.h rename to src/codec_utils/F1AP/SRBs-Required-ToBeReleased-List.h diff --git a/src/du_app/F1AP/asn/SRBs-Setup-Item.c b/src/codec_utils/F1AP/SRBs-Setup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Setup-Item.c rename to src/codec_utils/F1AP/SRBs-Setup-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-Setup-Item.h b/src/codec_utils/F1AP/SRBs-Setup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Setup-Item.h rename to src/codec_utils/F1AP/SRBs-Setup-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-Setup-List.c b/src/codec_utils/F1AP/SRBs-Setup-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Setup-List.c rename to src/codec_utils/F1AP/SRBs-Setup-List.c diff --git a/src/du_app/F1AP/asn/SRBs-Setup-List.h b/src/codec_utils/F1AP/SRBs-Setup-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-Setup-List.h rename to src/codec_utils/F1AP/SRBs-Setup-List.h diff --git a/src/du_app/F1AP/asn/SRBs-SetupMod-Item.c b/src/codec_utils/F1AP/SRBs-SetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-SetupMod-Item.c rename to src/codec_utils/F1AP/SRBs-SetupMod-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-SetupMod-Item.h b/src/codec_utils/F1AP/SRBs-SetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-SetupMod-Item.h rename to src/codec_utils/F1AP/SRBs-SetupMod-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-SetupMod-List.c b/src/codec_utils/F1AP/SRBs-SetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-SetupMod-List.c rename to src/codec_utils/F1AP/SRBs-SetupMod-List.c diff --git a/src/du_app/F1AP/asn/SRBs-SetupMod-List.h b/src/codec_utils/F1AP/SRBs-SetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-SetupMod-List.h rename to src/codec_utils/F1AP/SRBs-SetupMod-List.h diff --git a/src/du_app/F1AP/asn/SRBs-ToBeReleased-Item.c b/src/codec_utils/F1AP/SRBs-ToBeReleased-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeReleased-Item.c rename to src/codec_utils/F1AP/SRBs-ToBeReleased-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-ToBeReleased-Item.h b/src/codec_utils/F1AP/SRBs-ToBeReleased-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeReleased-Item.h rename to src/codec_utils/F1AP/SRBs-ToBeReleased-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-ToBeReleased-List.c b/src/codec_utils/F1AP/SRBs-ToBeReleased-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeReleased-List.c rename to src/codec_utils/F1AP/SRBs-ToBeReleased-List.c diff --git a/src/du_app/F1AP/asn/SRBs-ToBeReleased-List.h b/src/codec_utils/F1AP/SRBs-ToBeReleased-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeReleased-List.h rename to src/codec_utils/F1AP/SRBs-ToBeReleased-List.h diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetup-Item.c b/src/codec_utils/F1AP/SRBs-ToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetup-Item.c rename to src/codec_utils/F1AP/SRBs-ToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetup-Item.h b/src/codec_utils/F1AP/SRBs-ToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetup-Item.h rename to src/codec_utils/F1AP/SRBs-ToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetup-List.c b/src/codec_utils/F1AP/SRBs-ToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetup-List.c rename to src/codec_utils/F1AP/SRBs-ToBeSetup-List.c diff --git a/src/codec_utils/F1AP/SRBs-ToBeSetup-List.h b/src/codec_utils/F1AP/SRBs-ToBeSetup-List.h new file mode 100755 index 000000000..a54347920 --- /dev/null +++ b/src/codec_utils/F1AP/SRBs-ToBeSetup-List.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SRBs_ToBeSetup_List_H_ +#define _SRBs_ToBeSetup_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* SRBs-ToBeSetup-List */ +typedef struct SRBs_ToBeSetup_List { + A_SEQUENCE_OF(struct SRBs_ToBeSetup_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SRBs_ToBeSetup_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SRBs_ToBeSetup_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _SRBs_ToBeSetup_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetupMod-Item.c b/src/codec_utils/F1AP/SRBs-ToBeSetupMod-Item.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetupMod-Item.c rename to src/codec_utils/F1AP/SRBs-ToBeSetupMod-Item.c diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetupMod-Item.h b/src/codec_utils/F1AP/SRBs-ToBeSetupMod-Item.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetupMod-Item.h rename to src/codec_utils/F1AP/SRBs-ToBeSetupMod-Item.h diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetupMod-List.c b/src/codec_utils/F1AP/SRBs-ToBeSetupMod-List.c similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetupMod-List.c rename to src/codec_utils/F1AP/SRBs-ToBeSetupMod-List.c diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetupMod-List.h b/src/codec_utils/F1AP/SRBs-ToBeSetupMod-List.h similarity index 100% rename from src/du_app/F1AP/asn/SRBs-ToBeSetupMod-List.h rename to src/codec_utils/F1AP/SRBs-ToBeSetupMod-List.h diff --git a/src/du_app/F1AP/asn/SUL-Information.c b/src/codec_utils/F1AP/SUL-Information.c similarity index 100% rename from src/du_app/F1AP/asn/SUL-Information.c rename to src/codec_utils/F1AP/SUL-Information.c diff --git a/src/du_app/F1AP/asn/SUL-Information.h b/src/codec_utils/F1AP/SUL-Information.h similarity index 100% rename from src/du_app/F1AP/asn/SUL-Information.h rename to src/codec_utils/F1AP/SUL-Information.h diff --git a/src/du_app/F1AP/asn/SULAccessIndication.c b/src/codec_utils/F1AP/SULAccessIndication.c similarity index 100% rename from src/du_app/F1AP/asn/SULAccessIndication.c rename to src/codec_utils/F1AP/SULAccessIndication.c diff --git a/src/du_app/F1AP/asn/SULAccessIndication.h b/src/codec_utils/F1AP/SULAccessIndication.h similarity index 100% rename from src/du_app/F1AP/asn/SULAccessIndication.h rename to src/codec_utils/F1AP/SULAccessIndication.h diff --git a/src/du_app/F1AP/asn/SelectedBandCombinationIndex.c b/src/codec_utils/F1AP/SelectedBandCombinationIndex.c similarity index 100% rename from src/du_app/F1AP/asn/SelectedBandCombinationIndex.c rename to src/codec_utils/F1AP/SelectedBandCombinationIndex.c diff --git a/src/du_app/F1AP/asn/SelectedBandCombinationIndex.h b/src/codec_utils/F1AP/SelectedBandCombinationIndex.h similarity index 100% rename from src/du_app/F1AP/asn/SelectedBandCombinationIndex.h rename to src/codec_utils/F1AP/SelectedBandCombinationIndex.h diff --git a/src/du_app/F1AP/asn/SelectedFeatureSetEntryIndex.c b/src/codec_utils/F1AP/SelectedFeatureSetEntryIndex.c similarity index 100% rename from src/du_app/F1AP/asn/SelectedFeatureSetEntryIndex.c rename to src/codec_utils/F1AP/SelectedFeatureSetEntryIndex.c diff --git a/src/du_app/F1AP/asn/SelectedFeatureSetEntryIndex.h b/src/codec_utils/F1AP/SelectedFeatureSetEntryIndex.h similarity index 100% rename from src/du_app/F1AP/asn/SelectedFeatureSetEntryIndex.h rename to src/codec_utils/F1AP/SelectedFeatureSetEntryIndex.h diff --git a/src/du_app/F1AP/asn/ServCellIndex.c b/src/codec_utils/F1AP/ServCellIndex.c similarity index 100% rename from src/du_app/F1AP/asn/ServCellIndex.c rename to src/codec_utils/F1AP/ServCellIndex.c diff --git a/src/du_app/F1AP/asn/ServCellIndex.h b/src/codec_utils/F1AP/ServCellIndex.h similarity index 100% rename from src/du_app/F1AP/asn/ServCellIndex.h rename to src/codec_utils/F1AP/ServCellIndex.h diff --git a/src/du_app/F1AP/asn/Served-Cell-Information.c b/src/codec_utils/F1AP/Served-Cell-Information.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cell-Information.c rename to src/codec_utils/F1AP/Served-Cell-Information.c diff --git a/src/du_app/F1AP/asn/Served-Cell-Information.h b/src/codec_utils/F1AP/Served-Cell-Information.h similarity index 100% rename from src/du_app/F1AP/asn/Served-Cell-Information.h rename to src/codec_utils/F1AP/Served-Cell-Information.h diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Add-Item.c b/src/codec_utils/F1AP/Served-Cells-To-Add-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Add-Item.c rename to src/codec_utils/F1AP/Served-Cells-To-Add-Item.c diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Add-Item.h b/src/codec_utils/F1AP/Served-Cells-To-Add-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Add-Item.h rename to src/codec_utils/F1AP/Served-Cells-To-Add-Item.h diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Add-List.c b/src/codec_utils/F1AP/Served-Cells-To-Add-List.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Add-List.c rename to src/codec_utils/F1AP/Served-Cells-To-Add-List.c diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Add-List.h b/src/codec_utils/F1AP/Served-Cells-To-Add-List.h similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Add-List.h rename to src/codec_utils/F1AP/Served-Cells-To-Add-List.h diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Delete-Item.c b/src/codec_utils/F1AP/Served-Cells-To-Delete-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Delete-Item.c rename to src/codec_utils/F1AP/Served-Cells-To-Delete-Item.c diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Delete-Item.h b/src/codec_utils/F1AP/Served-Cells-To-Delete-Item.h similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Delete-Item.h rename to src/codec_utils/F1AP/Served-Cells-To-Delete-Item.h diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Delete-List.c b/src/codec_utils/F1AP/Served-Cells-To-Delete-List.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Delete-List.c rename to src/codec_utils/F1AP/Served-Cells-To-Delete-List.c diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Delete-List.h b/src/codec_utils/F1AP/Served-Cells-To-Delete-List.h similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Delete-List.h rename to src/codec_utils/F1AP/Served-Cells-To-Delete-List.h diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Modify-Item.c b/src/codec_utils/F1AP/Served-Cells-To-Modify-Item.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Modify-Item.c rename to src/codec_utils/F1AP/Served-Cells-To-Modify-Item.c diff --git a/src/codec_utils/F1AP/Served-Cells-To-Modify-Item.h b/src/codec_utils/F1AP/Served-Cells-To-Modify-Item.h new file mode 100755 index 000000000..376792110 --- /dev/null +++ b/src/codec_utils/F1AP/Served-Cells-To-Modify-Item.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Served_Cells_To_Modify_Item_H_ +#define _Served_Cells_To_Modify_Item_H_ + + +#include + +/* Including external dependencies */ +#include "NRCGI.h" +#include "Served-Cell-Information.h" +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GNB_DU_System_Information; +struct ProtocolExtensionContainer; + +/* Served-Cells-To-Modify-Item */ +typedef struct Served_Cells_To_Modify_Item { + NRCGI_t oldNRCGI; + Served_Cell_Information_t served_Cell_Information; + GNB_DU_System_Information_t *gNB_DU_System_Information; /* OPTIONAL */ + struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Served_Cells_To_Modify_Item_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Served_Cells_To_Modify_Item; + +#ifdef __cplusplus +} +#endif + +#endif /* _Served_Cells_To_Modify_Item_H_ */ +#include diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Modify-List.c b/src/codec_utils/F1AP/Served-Cells-To-Modify-List.c similarity index 100% rename from src/du_app/F1AP/asn/Served-Cells-To-Modify-List.c rename to src/codec_utils/F1AP/Served-Cells-To-Modify-List.c diff --git a/src/codec_utils/F1AP/Served-Cells-To-Modify-List.h b/src/codec_utils/F1AP/Served-Cells-To-Modify-List.h new file mode 100755 index 000000000..8443d98ca --- /dev/null +++ b/src/codec_utils/F1AP/Served-Cells-To-Modify-List.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-PDU-Contents" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Served_Cells_To_Modify_List_H_ +#define _Served_Cells_To_Modify_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolIE_SingleContainer; + +/* Served-Cells-To-Modify-List */ +typedef struct Served_Cells_To_Modify_List { + A_SEQUENCE_OF(struct Served_Cells_To_Modify_ItemIEs) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Served_Cells_To_Modify_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Served_Cells_To_Modify_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _Served_Cells_To_Modify_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/Served-EUTRA-Cells-Information.c b/src/codec_utils/F1AP/Served-EUTRA-Cells-Information.c similarity index 100% rename from src/du_app/F1AP/asn/Served-EUTRA-Cells-Information.c rename to src/codec_utils/F1AP/Served-EUTRA-Cells-Information.c diff --git a/src/du_app/F1AP/asn/Served-EUTRA-Cells-Information.h b/src/codec_utils/F1AP/Served-EUTRA-Cells-Information.h similarity index 100% rename from src/du_app/F1AP/asn/Served-EUTRA-Cells-Information.h rename to src/codec_utils/F1AP/Served-EUTRA-Cells-Information.h diff --git a/src/du_app/F1AP/asn/ServedPLMNs-Item.c b/src/codec_utils/F1AP/ServedPLMNs-Item.c similarity index 100% rename from src/du_app/F1AP/asn/ServedPLMNs-Item.c rename to src/codec_utils/F1AP/ServedPLMNs-Item.c diff --git a/src/codec_utils/F1AP/ServedPLMNs-Item.h b/src/codec_utils/F1AP/ServedPLMNs-Item.h new file mode 100755 index 000000000..b9995a50a --- /dev/null +++ b/src/codec_utils/F1AP/ServedPLMNs-Item.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ServedPLMNs_Item_H_ +#define _ServedPLMNs_Item_H_ + + +#include + +/* Including external dependencies */ +#include "PLMN-Identity.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ProtocolExtensionContainer; + +/* ServedPLMNs-Item */ +typedef struct ServedPLMNs_Item { + PLMN_Identity_t pLMN_Identity; + struct ProtocolExtensionContainer_4624P3 *iE_Extensions; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ServedPLMNs_Item_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ServedPLMNs_Item; +extern asn_SEQUENCE_specifics_t asn_SPC_ServedPLMNs_Item_specs_1; +extern asn_TYPE_member_t asn_MBR_ServedPLMNs_Item_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _ServedPLMNs_Item_H_ */ +#include diff --git a/src/du_app/F1AP/asn/ServedPLMNs-List.c b/src/codec_utils/F1AP/ServedPLMNs-List.c similarity index 100% rename from src/du_app/F1AP/asn/ServedPLMNs-List.c rename to src/codec_utils/F1AP/ServedPLMNs-List.c diff --git a/src/codec_utils/F1AP/ServedPLMNs-List.h b/src/codec_utils/F1AP/ServedPLMNs-List.h new file mode 100644 index 000000000..6e99ca486 --- /dev/null +++ b/src/codec_utils/F1AP/ServedPLMNs-List.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ServedPLMNs_List_H_ +#define _ServedPLMNs_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ServedPLMNs_Item; + +/* ServedPLMNs-List */ +typedef struct ServedPLMNs_List { + A_SEQUENCE_OF(ServedPLMNs_Item_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ServedPLMNs_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ServedPLMNs_List; +extern asn_SET_OF_specifics_t asn_SPC_ServedPLMNs_List_specs_1; +extern asn_TYPE_member_t asn_MBR_ServedPLMNs_List_1[1]; +extern asn_per_constraints_t asn_PER_type_ServedPLMNs_List_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _ServedPLMNs_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/Service-State.c b/src/codec_utils/F1AP/Service-State.c similarity index 100% rename from src/du_app/F1AP/asn/Service-State.c rename to src/codec_utils/F1AP/Service-State.c diff --git a/src/du_app/F1AP/asn/Service-State.h b/src/codec_utils/F1AP/Service-State.h similarity index 100% rename from src/du_app/F1AP/asn/Service-State.h rename to src/codec_utils/F1AP/Service-State.h diff --git a/src/du_app/F1AP/asn/Service-Status.c b/src/codec_utils/F1AP/Service-Status.c similarity index 100% rename from src/du_app/F1AP/asn/Service-Status.c rename to src/codec_utils/F1AP/Service-Status.c diff --git a/src/du_app/F1AP/asn/Service-Status.h b/src/codec_utils/F1AP/Service-Status.h similarity index 100% rename from src/du_app/F1AP/asn/Service-Status.h rename to src/codec_utils/F1AP/Service-Status.h diff --git a/src/du_app/F1AP/asn/ServingCellMO.c b/src/codec_utils/F1AP/ServingCellMO.c similarity index 100% rename from src/du_app/F1AP/asn/ServingCellMO.c rename to src/codec_utils/F1AP/ServingCellMO.c diff --git a/src/du_app/F1AP/asn/ServingCellMO.h b/src/codec_utils/F1AP/ServingCellMO.h similarity index 100% rename from src/du_app/F1AP/asn/ServingCellMO.h rename to src/codec_utils/F1AP/ServingCellMO.h diff --git a/src/du_app/F1AP/asn/ShortDRXCycleLength.c b/src/codec_utils/F1AP/ShortDRXCycleLength.c similarity index 100% rename from src/du_app/F1AP/asn/ShortDRXCycleLength.c rename to src/codec_utils/F1AP/ShortDRXCycleLength.c diff --git a/src/du_app/F1AP/asn/ShortDRXCycleLength.h b/src/codec_utils/F1AP/ShortDRXCycleLength.h similarity index 100% rename from src/du_app/F1AP/asn/ShortDRXCycleLength.h rename to src/codec_utils/F1AP/ShortDRXCycleLength.h diff --git a/src/du_app/F1AP/asn/ShortDRXCycleTimer.c b/src/codec_utils/F1AP/ShortDRXCycleTimer.c similarity index 100% rename from src/du_app/F1AP/asn/ShortDRXCycleTimer.c rename to src/codec_utils/F1AP/ShortDRXCycleTimer.c diff --git a/src/du_app/F1AP/asn/ShortDRXCycleTimer.h b/src/codec_utils/F1AP/ShortDRXCycleTimer.h similarity index 100% rename from src/du_app/F1AP/asn/ShortDRXCycleTimer.h rename to src/codec_utils/F1AP/ShortDRXCycleTimer.h diff --git a/src/du_app/F1AP/asn/SibtypetobeupdatedListItem.c b/src/codec_utils/F1AP/SibtypetobeupdatedListItem.c similarity index 100% rename from src/du_app/F1AP/asn/SibtypetobeupdatedListItem.c rename to src/codec_utils/F1AP/SibtypetobeupdatedListItem.c diff --git a/src/du_app/F1AP/asn/SibtypetobeupdatedListItem.h b/src/codec_utils/F1AP/SibtypetobeupdatedListItem.h similarity index 100% rename from src/du_app/F1AP/asn/SibtypetobeupdatedListItem.h rename to src/codec_utils/F1AP/SibtypetobeupdatedListItem.h diff --git a/src/du_app/F1AP/asn/SliceSupportItem.c b/src/codec_utils/F1AP/SliceSupportItem.c similarity index 100% rename from src/du_app/F1AP/asn/SliceSupportItem.c rename to src/codec_utils/F1AP/SliceSupportItem.c diff --git a/src/du_app/F1AP/asn/SliceSupportItem.h b/src/codec_utils/F1AP/SliceSupportItem.h similarity index 100% rename from src/du_app/F1AP/asn/SliceSupportItem.h rename to src/codec_utils/F1AP/SliceSupportItem.h diff --git a/src/du_app/F1AP/asn/SliceSupportList.c b/src/codec_utils/F1AP/SliceSupportList.c similarity index 100% rename from src/du_app/F1AP/asn/SliceSupportList.c rename to src/codec_utils/F1AP/SliceSupportList.c diff --git a/src/codec_utils/F1AP/SliceSupportList.h b/src/codec_utils/F1AP/SliceSupportList.h new file mode 100644 index 000000000..9849cb5d7 --- /dev/null +++ b/src/codec_utils/F1AP/SliceSupportList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SliceSupportList_H_ +#define _SliceSupportList_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SliceSupportItem; + +/* SliceSupportList */ +typedef struct SliceSupportList { + A_SEQUENCE_OF(SliceSupportItem_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SliceSupportList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SliceSupportList; +extern asn_SET_OF_specifics_t asn_SPC_SliceSupportList_specs_1; +extern asn_TYPE_member_t asn_MBR_SliceSupportList_1[1]; +extern asn_per_constraints_t asn_PER_type_SliceSupportList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _SliceSupportList_H_ */ +#include diff --git a/src/du_app/F1AP/asn/SpectrumSharingGroupID.c b/src/codec_utils/F1AP/SpectrumSharingGroupID.c similarity index 100% rename from src/du_app/F1AP/asn/SpectrumSharingGroupID.c rename to src/codec_utils/F1AP/SpectrumSharingGroupID.c diff --git a/src/du_app/F1AP/asn/SpectrumSharingGroupID.h b/src/codec_utils/F1AP/SpectrumSharingGroupID.h similarity index 100% rename from src/du_app/F1AP/asn/SpectrumSharingGroupID.h rename to src/codec_utils/F1AP/SpectrumSharingGroupID.h diff --git a/src/du_app/F1AP/asn/SubscriberProfileIDforRFP.c b/src/codec_utils/F1AP/SubscriberProfileIDforRFP.c similarity index 100% rename from src/du_app/F1AP/asn/SubscriberProfileIDforRFP.c rename to src/codec_utils/F1AP/SubscriberProfileIDforRFP.c diff --git a/src/du_app/F1AP/asn/SubscriberProfileIDforRFP.h b/src/codec_utils/F1AP/SubscriberProfileIDforRFP.h similarity index 100% rename from src/du_app/F1AP/asn/SubscriberProfileIDforRFP.h rename to src/codec_utils/F1AP/SubscriberProfileIDforRFP.h diff --git a/src/du_app/F1AP/asn/SuccessfulOutcome.c b/src/codec_utils/F1AP/SuccessfulOutcome.c similarity index 100% rename from src/du_app/F1AP/asn/SuccessfulOutcome.c rename to src/codec_utils/F1AP/SuccessfulOutcome.c diff --git a/src/du_app/F1AP/asn/SuccessfulOutcome.h b/src/codec_utils/F1AP/SuccessfulOutcome.h similarity index 100% rename from src/du_app/F1AP/asn/SuccessfulOutcome.h rename to src/codec_utils/F1AP/SuccessfulOutcome.h diff --git a/src/du_app/F1AP/asn/SupportedSULFreqBandItem.c b/src/codec_utils/F1AP/SupportedSULFreqBandItem.c similarity index 100% rename from src/du_app/F1AP/asn/SupportedSULFreqBandItem.c rename to src/codec_utils/F1AP/SupportedSULFreqBandItem.c diff --git a/src/du_app/F1AP/asn/SupportedSULFreqBandItem.h b/src/codec_utils/F1AP/SupportedSULFreqBandItem.h similarity index 100% rename from src/du_app/F1AP/asn/SupportedSULFreqBandItem.h rename to src/codec_utils/F1AP/SupportedSULFreqBandItem.h diff --git a/src/du_app/F1AP/asn/SystemInformationDeliveryCommand.c b/src/codec_utils/F1AP/SystemInformationDeliveryCommand.c similarity index 100% rename from src/du_app/F1AP/asn/SystemInformationDeliveryCommand.c rename to src/codec_utils/F1AP/SystemInformationDeliveryCommand.c diff --git a/src/du_app/F1AP/asn/SystemInformationDeliveryCommand.h b/src/codec_utils/F1AP/SystemInformationDeliveryCommand.h similarity index 100% rename from src/du_app/F1AP/asn/SystemInformationDeliveryCommand.h rename to src/codec_utils/F1AP/SystemInformationDeliveryCommand.h diff --git a/src/du_app/F1AP/asn/TDD-Info.c b/src/codec_utils/F1AP/TDD-Info.c similarity index 100% rename from src/du_app/F1AP/asn/TDD-Info.c rename to src/codec_utils/F1AP/TDD-Info.c diff --git a/src/du_app/F1AP/asn/TDD-Info.h b/src/codec_utils/F1AP/TDD-Info.h similarity index 100% rename from src/du_app/F1AP/asn/TDD-Info.h rename to src/codec_utils/F1AP/TDD-Info.h diff --git a/src/du_app/F1AP/asn/TNLAssociationUsage.c b/src/codec_utils/F1AP/TNLAssociationUsage.c similarity index 100% rename from src/du_app/F1AP/asn/TNLAssociationUsage.c rename to src/codec_utils/F1AP/TNLAssociationUsage.c diff --git a/src/du_app/F1AP/asn/TNLAssociationUsage.h b/src/codec_utils/F1AP/TNLAssociationUsage.h similarity index 100% rename from src/du_app/F1AP/asn/TNLAssociationUsage.h rename to src/codec_utils/F1AP/TNLAssociationUsage.h diff --git a/src/du_app/F1AP/asn/TimeToWait.c b/src/codec_utils/F1AP/TimeToWait.c similarity index 100% rename from src/du_app/F1AP/asn/TimeToWait.c rename to src/codec_utils/F1AP/TimeToWait.c diff --git a/src/du_app/F1AP/asn/TimeToWait.h b/src/codec_utils/F1AP/TimeToWait.h similarity index 100% rename from src/du_app/F1AP/asn/TimeToWait.h rename to src/codec_utils/F1AP/TimeToWait.h diff --git a/src/du_app/F1AP/asn/TransactionID.c b/src/codec_utils/F1AP/TransactionID.c similarity index 100% rename from src/du_app/F1AP/asn/TransactionID.c rename to src/codec_utils/F1AP/TransactionID.c diff --git a/src/du_app/F1AP/asn/TransactionID.h b/src/codec_utils/F1AP/TransactionID.h similarity index 100% rename from src/du_app/F1AP/asn/TransactionID.h rename to src/codec_utils/F1AP/TransactionID.h diff --git a/src/du_app/F1AP/asn/Transmission-Bandwidth.c b/src/codec_utils/F1AP/Transmission-Bandwidth.c similarity index 100% rename from src/du_app/F1AP/asn/Transmission-Bandwidth.c rename to src/codec_utils/F1AP/Transmission-Bandwidth.c diff --git a/src/du_app/F1AP/asn/Transmission-Bandwidth.h b/src/codec_utils/F1AP/Transmission-Bandwidth.h similarity index 100% rename from src/du_app/F1AP/asn/Transmission-Bandwidth.h rename to src/codec_utils/F1AP/Transmission-Bandwidth.h diff --git a/src/du_app/F1AP/asn/TransmissionActionIndicator.c b/src/codec_utils/F1AP/TransmissionActionIndicator.c similarity index 100% rename from src/du_app/F1AP/asn/TransmissionActionIndicator.c rename to src/codec_utils/F1AP/TransmissionActionIndicator.c diff --git a/src/du_app/F1AP/asn/TransmissionActionIndicator.h b/src/codec_utils/F1AP/TransmissionActionIndicator.h similarity index 100% rename from src/du_app/F1AP/asn/TransmissionActionIndicator.h rename to src/codec_utils/F1AP/TransmissionActionIndicator.h diff --git a/src/du_app/F1AP/asn/TransportLayerAddress.c b/src/codec_utils/F1AP/TransportLayerAddress.c similarity index 100% rename from src/du_app/F1AP/asn/TransportLayerAddress.c rename to src/codec_utils/F1AP/TransportLayerAddress.c diff --git a/src/du_app/F1AP/asn/TransportLayerAddress.h b/src/codec_utils/F1AP/TransportLayerAddress.h similarity index 100% rename from src/du_app/F1AP/asn/TransportLayerAddress.h rename to src/codec_utils/F1AP/TransportLayerAddress.h diff --git a/src/du_app/F1AP/asn/TriggeringMessage.c b/src/codec_utils/F1AP/TriggeringMessage.c similarity index 100% rename from src/du_app/F1AP/asn/TriggeringMessage.c rename to src/codec_utils/F1AP/TriggeringMessage.c diff --git a/src/du_app/F1AP/asn/TriggeringMessage.h b/src/codec_utils/F1AP/TriggeringMessage.h similarity index 100% rename from src/du_app/F1AP/asn/TriggeringMessage.h rename to src/codec_utils/F1AP/TriggeringMessage.h diff --git a/src/du_app/F1AP/asn/TypeOfError.c b/src/codec_utils/F1AP/TypeOfError.c similarity index 100% rename from src/du_app/F1AP/asn/TypeOfError.c rename to src/codec_utils/F1AP/TypeOfError.c diff --git a/src/du_app/F1AP/asn/TypeOfError.h b/src/codec_utils/F1AP/TypeOfError.h similarity index 100% rename from src/du_app/F1AP/asn/TypeOfError.h rename to src/codec_utils/F1AP/TypeOfError.h diff --git a/src/du_app/F1AP/asn/UE-CapabilityRAT-ContainerList.c b/src/codec_utils/F1AP/UE-CapabilityRAT-ContainerList.c similarity index 100% rename from src/du_app/F1AP/asn/UE-CapabilityRAT-ContainerList.c rename to src/codec_utils/F1AP/UE-CapabilityRAT-ContainerList.c diff --git a/src/du_app/F1AP/asn/UE-CapabilityRAT-ContainerList.h b/src/codec_utils/F1AP/UE-CapabilityRAT-ContainerList.h similarity index 100% rename from src/du_app/F1AP/asn/UE-CapabilityRAT-ContainerList.h rename to src/codec_utils/F1AP/UE-CapabilityRAT-ContainerList.h diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionItem.c b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionItem.c similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionItem.c rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionItem.c diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionItem.h b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionItem.h similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionItem.h rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionItem.h diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListRes.c b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListRes.c similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListRes.c rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListRes.c diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListRes.h b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListRes.h similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListRes.h rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListRes.h diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListResAck.c b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListResAck.c similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListResAck.c rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListResAck.c diff --git a/src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListResAck.h b/src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListResAck.h similarity index 100% rename from src/du_app/F1AP/asn/UE-associatedLogicalF1-ConnectionListResAck.h rename to src/codec_utils/F1AP/UE-associatedLogicalF1-ConnectionListResAck.h diff --git a/src/du_app/F1AP/asn/UEAssistanceInformation.c b/src/codec_utils/F1AP/UEAssistanceInformation.c similarity index 100% rename from src/du_app/F1AP/asn/UEAssistanceInformation.c rename to src/codec_utils/F1AP/UEAssistanceInformation.c diff --git a/src/du_app/F1AP/asn/UEAssistanceInformation.h b/src/codec_utils/F1AP/UEAssistanceInformation.h similarity index 100% rename from src/du_app/F1AP/asn/UEAssistanceInformation.h rename to src/codec_utils/F1AP/UEAssistanceInformation.h diff --git a/src/du_app/F1AP/asn/UEContextModificationConfirm.c b/src/codec_utils/F1AP/UEContextModificationConfirm.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationConfirm.c rename to src/codec_utils/F1AP/UEContextModificationConfirm.c diff --git a/src/du_app/F1AP/asn/UEContextModificationConfirm.h b/src/codec_utils/F1AP/UEContextModificationConfirm.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationConfirm.h rename to src/codec_utils/F1AP/UEContextModificationConfirm.h diff --git a/src/du_app/F1AP/asn/UEContextModificationFailure.c b/src/codec_utils/F1AP/UEContextModificationFailure.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationFailure.c rename to src/codec_utils/F1AP/UEContextModificationFailure.c diff --git a/src/du_app/F1AP/asn/UEContextModificationFailure.h b/src/codec_utils/F1AP/UEContextModificationFailure.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationFailure.h rename to src/codec_utils/F1AP/UEContextModificationFailure.h diff --git a/src/du_app/F1AP/asn/UEContextModificationRefuse.c b/src/codec_utils/F1AP/UEContextModificationRefuse.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRefuse.c rename to src/codec_utils/F1AP/UEContextModificationRefuse.c diff --git a/src/du_app/F1AP/asn/UEContextModificationRefuse.h b/src/codec_utils/F1AP/UEContextModificationRefuse.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRefuse.h rename to src/codec_utils/F1AP/UEContextModificationRefuse.h diff --git a/src/du_app/F1AP/asn/UEContextModificationRequest.c b/src/codec_utils/F1AP/UEContextModificationRequest.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRequest.c rename to src/codec_utils/F1AP/UEContextModificationRequest.c diff --git a/src/du_app/F1AP/asn/UEContextModificationRequest.h b/src/codec_utils/F1AP/UEContextModificationRequest.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRequest.h rename to src/codec_utils/F1AP/UEContextModificationRequest.h diff --git a/src/du_app/F1AP/asn/UEContextModificationRequired.c b/src/codec_utils/F1AP/UEContextModificationRequired.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRequired.c rename to src/codec_utils/F1AP/UEContextModificationRequired.c diff --git a/src/du_app/F1AP/asn/UEContextModificationRequired.h b/src/codec_utils/F1AP/UEContextModificationRequired.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationRequired.h rename to src/codec_utils/F1AP/UEContextModificationRequired.h diff --git a/src/du_app/F1AP/asn/UEContextModificationResponse.c b/src/codec_utils/F1AP/UEContextModificationResponse.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationResponse.c rename to src/codec_utils/F1AP/UEContextModificationResponse.c diff --git a/src/du_app/F1AP/asn/UEContextModificationResponse.h b/src/codec_utils/F1AP/UEContextModificationResponse.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextModificationResponse.h rename to src/codec_utils/F1AP/UEContextModificationResponse.h diff --git a/src/du_app/F1AP/asn/UEContextReleaseCommand.c b/src/codec_utils/F1AP/UEContextReleaseCommand.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseCommand.c rename to src/codec_utils/F1AP/UEContextReleaseCommand.c diff --git a/src/du_app/F1AP/asn/UEContextReleaseCommand.h b/src/codec_utils/F1AP/UEContextReleaseCommand.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseCommand.h rename to src/codec_utils/F1AP/UEContextReleaseCommand.h diff --git a/src/du_app/F1AP/asn/UEContextReleaseComplete.c b/src/codec_utils/F1AP/UEContextReleaseComplete.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseComplete.c rename to src/codec_utils/F1AP/UEContextReleaseComplete.c diff --git a/src/du_app/F1AP/asn/UEContextReleaseComplete.h b/src/codec_utils/F1AP/UEContextReleaseComplete.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseComplete.h rename to src/codec_utils/F1AP/UEContextReleaseComplete.h diff --git a/src/du_app/F1AP/asn/UEContextReleaseRequest.c b/src/codec_utils/F1AP/UEContextReleaseRequest.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseRequest.c rename to src/codec_utils/F1AP/UEContextReleaseRequest.c diff --git a/src/du_app/F1AP/asn/UEContextReleaseRequest.h b/src/codec_utils/F1AP/UEContextReleaseRequest.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextReleaseRequest.h rename to src/codec_utils/F1AP/UEContextReleaseRequest.h diff --git a/src/du_app/F1AP/asn/UEContextSetupFailure.c b/src/codec_utils/F1AP/UEContextSetupFailure.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupFailure.c rename to src/codec_utils/F1AP/UEContextSetupFailure.c diff --git a/src/du_app/F1AP/asn/UEContextSetupFailure.h b/src/codec_utils/F1AP/UEContextSetupFailure.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupFailure.h rename to src/codec_utils/F1AP/UEContextSetupFailure.h diff --git a/src/du_app/F1AP/asn/UEContextSetupRequest.c b/src/codec_utils/F1AP/UEContextSetupRequest.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupRequest.c rename to src/codec_utils/F1AP/UEContextSetupRequest.c diff --git a/src/du_app/F1AP/asn/UEContextSetupRequest.h b/src/codec_utils/F1AP/UEContextSetupRequest.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupRequest.h rename to src/codec_utils/F1AP/UEContextSetupRequest.h diff --git a/src/du_app/F1AP/asn/UEContextSetupResponse.c b/src/codec_utils/F1AP/UEContextSetupResponse.c similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupResponse.c rename to src/codec_utils/F1AP/UEContextSetupResponse.c diff --git a/src/du_app/F1AP/asn/UEContextSetupResponse.h b/src/codec_utils/F1AP/UEContextSetupResponse.h similarity index 100% rename from src/du_app/F1AP/asn/UEContextSetupResponse.h rename to src/codec_utils/F1AP/UEContextSetupResponse.h diff --git a/src/du_app/F1AP/asn/UEIdentityIndexValue.c b/src/codec_utils/F1AP/UEIdentityIndexValue.c similarity index 100% rename from src/du_app/F1AP/asn/UEIdentityIndexValue.c rename to src/codec_utils/F1AP/UEIdentityIndexValue.c diff --git a/src/du_app/F1AP/asn/UEIdentityIndexValue.h b/src/codec_utils/F1AP/UEIdentityIndexValue.h similarity index 100% rename from src/du_app/F1AP/asn/UEIdentityIndexValue.h rename to src/codec_utils/F1AP/UEIdentityIndexValue.h diff --git a/src/du_app/F1AP/asn/UEInactivityNotification.c b/src/codec_utils/F1AP/UEInactivityNotification.c similarity index 100% rename from src/du_app/F1AP/asn/UEInactivityNotification.c rename to src/codec_utils/F1AP/UEInactivityNotification.c diff --git a/src/du_app/F1AP/asn/UEInactivityNotification.h b/src/codec_utils/F1AP/UEInactivityNotification.h similarity index 100% rename from src/du_app/F1AP/asn/UEInactivityNotification.h rename to src/codec_utils/F1AP/UEInactivityNotification.h diff --git a/src/du_app/F1AP/asn/ULConfiguration.c b/src/codec_utils/F1AP/ULConfiguration.c similarity index 100% rename from src/du_app/F1AP/asn/ULConfiguration.c rename to src/codec_utils/F1AP/ULConfiguration.c diff --git a/src/du_app/F1AP/asn/ULConfiguration.h b/src/codec_utils/F1AP/ULConfiguration.h similarity index 100% rename from src/du_app/F1AP/asn/ULConfiguration.h rename to src/codec_utils/F1AP/ULConfiguration.h diff --git a/src/du_app/F1AP/asn/ULRRCMessageTransfer.c b/src/codec_utils/F1AP/ULRRCMessageTransfer.c similarity index 100% rename from src/du_app/F1AP/asn/ULRRCMessageTransfer.c rename to src/codec_utils/F1AP/ULRRCMessageTransfer.c diff --git a/src/du_app/F1AP/asn/ULRRCMessageTransfer.h b/src/codec_utils/F1AP/ULRRCMessageTransfer.h similarity index 100% rename from src/du_app/F1AP/asn/ULRRCMessageTransfer.h rename to src/codec_utils/F1AP/ULRRCMessageTransfer.h diff --git a/src/du_app/F1AP/asn/ULUEConfiguration.c b/src/codec_utils/F1AP/ULUEConfiguration.c similarity index 100% rename from src/du_app/F1AP/asn/ULUEConfiguration.c rename to src/codec_utils/F1AP/ULUEConfiguration.c diff --git a/src/du_app/F1AP/asn/ULUEConfiguration.h b/src/codec_utils/F1AP/ULUEConfiguration.h similarity index 100% rename from src/du_app/F1AP/asn/ULUEConfiguration.h rename to src/codec_utils/F1AP/ULUEConfiguration.h diff --git a/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-Item.c b/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-Item.c similarity index 100% rename from src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-Item.c rename to src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-Item.c diff --git a/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-Item.h b/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-Item.h similarity index 100% rename from src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-Item.h rename to src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-Item.h diff --git a/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-List.c b/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-List.c similarity index 100% rename from src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-List.c rename to src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-List.c diff --git a/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-List.h b/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-List.h new file mode 100755 index 000000000..2d410e7d8 --- /dev/null +++ b/src/codec_utils/F1AP/ULUPTNLInformation-ToBeSetup-List.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ULUPTNLInformation_ToBeSetup_List_H_ +#define _ULUPTNLInformation_ToBeSetup_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include "ULUPTNLInformation-ToBeSetup-Item.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ULUPTNLInformation_ToBeSetup_Item; + +/* ULUPTNLInformation-ToBeSetup-List */ +typedef struct ULUPTNLInformation_ToBeSetup_List { + A_SEQUENCE_OF(struct ULUPTNLInformation_ToBeSetup_Item) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ULUPTNLInformation_ToBeSetup_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ULUPTNLInformation_ToBeSetup_List; +extern asn_SET_OF_specifics_t asn_SPC_ULUPTNLInformation_ToBeSetup_List_specs_1; +extern asn_TYPE_member_t asn_MBR_ULUPTNLInformation_ToBeSetup_List_1[1]; +extern asn_per_constraints_t asn_PER_type_ULUPTNLInformation_ToBeSetup_List_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _ULUPTNLInformation_ToBeSetup_List_H_ */ +#include diff --git a/src/du_app/F1AP/asn/UPTransportLayerInformation.c b/src/codec_utils/F1AP/UPTransportLayerInformation.c similarity index 100% rename from src/du_app/F1AP/asn/UPTransportLayerInformation.c rename to src/codec_utils/F1AP/UPTransportLayerInformation.c diff --git a/src/codec_utils/F1AP/UPTransportLayerInformation.h b/src/codec_utils/F1AP/UPTransportLayerInformation.h new file mode 100755 index 000000000..386e2f145 --- /dev/null +++ b/src/codec_utils/F1AP/UPTransportLayerInformation.h @@ -0,0 +1,55 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "F1AP-IEs" + * found in "F1.asn1" + * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UPTransportLayerInformation_H_ +#define _UPTransportLayerInformation_H_ + + +#include +#include "GTPTunnel.h" +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UPTransportLayerInformation_PR { + UPTransportLayerInformation_PR_NOTHING, /* No components present */ + UPTransportLayerInformation_PR_gTPTunnel, + UPTransportLayerInformation_PR_choice_extension +} UPTransportLayerInformation_PR; + +/* Forward declarations */ +struct GTPTunnel; +struct ProtocolIE_SingleContainer; + +/* UPTransportLayerInformation */ +typedef struct UPTransportLayerInformation { + UPTransportLayerInformation_PR present; + union UPTransportLayerInformation_u { + struct GTPTunnel *gTPTunnel; + struct ProtocolIE_SingleContainer *choice_extension; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UPTransportLayerInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UPTransportLayerInformation; +extern asn_CHOICE_specifics_t asn_SPC_UPTransportLayerInformation_specs_1; +extern asn_TYPE_member_t asn_MBR_UPTransportLayerInformation_1[2]; +extern asn_per_constraints_t asn_PER_type_UPTransportLayerInformation_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _UPTransportLayerInformation_H_ */ +#include diff --git a/src/du_app/F1AP/asn/UnsuccessfulOutcome.c b/src/codec_utils/F1AP/UnsuccessfulOutcome.c similarity index 100% rename from src/du_app/F1AP/asn/UnsuccessfulOutcome.c rename to src/codec_utils/F1AP/UnsuccessfulOutcome.c diff --git a/src/du_app/F1AP/asn/UnsuccessfulOutcome.h b/src/codec_utils/F1AP/UnsuccessfulOutcome.h similarity index 100% rename from src/du_app/F1AP/asn/UnsuccessfulOutcome.h rename to src/codec_utils/F1AP/UnsuccessfulOutcome.h diff --git a/src/du_app/F1AP/asn/UplinkTxDirectCurrentListInformation.c b/src/codec_utils/F1AP/UplinkTxDirectCurrentListInformation.c similarity index 100% rename from src/du_app/F1AP/asn/UplinkTxDirectCurrentListInformation.c rename to src/codec_utils/F1AP/UplinkTxDirectCurrentListInformation.c diff --git a/src/du_app/F1AP/asn/UplinkTxDirectCurrentListInformation.h b/src/codec_utils/F1AP/UplinkTxDirectCurrentListInformation.h similarity index 100% rename from src/du_app/F1AP/asn/UplinkTxDirectCurrentListInformation.h rename to src/codec_utils/F1AP/UplinkTxDirectCurrentListInformation.h diff --git a/src/du_app/F1AP/asn/WriteReplaceWarningRequest.c b/src/codec_utils/F1AP/WriteReplaceWarningRequest.c similarity index 100% rename from src/du_app/F1AP/asn/WriteReplaceWarningRequest.c rename to src/codec_utils/F1AP/WriteReplaceWarningRequest.c diff --git a/src/du_app/F1AP/asn/WriteReplaceWarningRequest.h b/src/codec_utils/F1AP/WriteReplaceWarningRequest.h similarity index 100% rename from src/du_app/F1AP/asn/WriteReplaceWarningRequest.h rename to src/codec_utils/F1AP/WriteReplaceWarningRequest.h diff --git a/src/du_app/F1AP/asn/WriteReplaceWarningResponse.c b/src/codec_utils/F1AP/WriteReplaceWarningResponse.c similarity index 100% rename from src/du_app/F1AP/asn/WriteReplaceWarningResponse.c rename to src/codec_utils/F1AP/WriteReplaceWarningResponse.c diff --git a/src/du_app/F1AP/asn/WriteReplaceWarningResponse.h b/src/codec_utils/F1AP/WriteReplaceWarningResponse.h similarity index 100% rename from src/du_app/F1AP/asn/WriteReplaceWarningResponse.h rename to src/codec_utils/F1AP/WriteReplaceWarningResponse.h diff --git a/src/codec_utils/SYSINFO/ARFCN-ValueNR.c b/src/codec_utils/SYSINFO/ARFCN-ValueNR.c new file mode 100644 index 000000000..6ef5479a8 --- /dev/null +++ b/src/codec_utils/SYSINFO/ARFCN-ValueNR.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ARFCN-ValueNR.h" + +int +ARFCN_ValueNR_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3279165)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_ARFCN_ValueNR_constr_1 CC_NOTUSED = { + { 4, 1 } /* (0..3279165) */, + -1}; +asn_per_constraints_t asn_PER_type_ARFCN_ValueNR_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 22, -1, 0, 3279165 } /* (0..3279165) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_ARFCN_ValueNR_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ARFCN_ValueNR = { + "ARFCN-ValueNR", + "ARFCN-ValueNR", + &asn_OP_NativeInteger, + asn_DEF_ARFCN_ValueNR_tags_1, + sizeof(asn_DEF_ARFCN_ValueNR_tags_1) + /sizeof(asn_DEF_ARFCN_ValueNR_tags_1[0]), /* 1 */ + asn_DEF_ARFCN_ValueNR_tags_1, /* Same as above */ + sizeof(asn_DEF_ARFCN_ValueNR_tags_1) + /sizeof(asn_DEF_ARFCN_ValueNR_tags_1[0]), /* 1 */ + { &asn_OER_type_ARFCN_ValueNR_constr_1, &asn_PER_type_ARFCN_ValueNR_constr_1, ARFCN_ValueNR_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/ARFCN-ValueNR.h b/src/codec_utils/SYSINFO/ARFCN-ValueNR.h new file mode 100644 index 000000000..49b441f73 --- /dev/null +++ b/src/codec_utils/SYSINFO/ARFCN-ValueNR.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ARFCN_ValueNR_H_ +#define _ARFCN_ValueNR_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ARFCN-ValueNR */ +typedef long ARFCN_ValueNR_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_ARFCN_ValueNR_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_ARFCN_ValueNR; +asn_struct_free_f ARFCN_ValueNR_free; +asn_struct_print_f ARFCN_ValueNR_print; +asn_constr_check_f ARFCN_ValueNR_constraint; +ber_type_decoder_f ARFCN_ValueNR_decode_ber; +der_type_encoder_f ARFCN_ValueNR_encode_der; +xer_type_decoder_f ARFCN_ValueNR_decode_xer; +xer_type_encoder_f ARFCN_ValueNR_encode_xer; +oer_type_decoder_f ARFCN_ValueNR_decode_oer; +oer_type_encoder_f ARFCN_ValueNR_encode_oer; +per_type_decoder_f ARFCN_ValueNR_decode_uper; +per_type_encoder_f ARFCN_ValueNR_encode_uper; +per_type_decoder_f ARFCN_ValueNR_decode_aper; +per_type_encoder_f ARFCN_ValueNR_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ARFCN_ValueNR_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.c b/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.c new file mode 100644 index 000000000..3f022eb24 --- /dev/null +++ b/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "AdditionalSpectrumEmission.h" + +int +AdditionalSpectrumEmission_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_AdditionalSpectrumEmission_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..7) */, + -1}; +asn_per_constraints_t asn_PER_type_AdditionalSpectrumEmission_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_AdditionalSpectrumEmission_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_AdditionalSpectrumEmission = { + "AdditionalSpectrumEmission", + "AdditionalSpectrumEmission", + &asn_OP_NativeInteger, + asn_DEF_AdditionalSpectrumEmission_tags_1, + sizeof(asn_DEF_AdditionalSpectrumEmission_tags_1) + /sizeof(asn_DEF_AdditionalSpectrumEmission_tags_1[0]), /* 1 */ + asn_DEF_AdditionalSpectrumEmission_tags_1, /* Same as above */ + sizeof(asn_DEF_AdditionalSpectrumEmission_tags_1) + /sizeof(asn_DEF_AdditionalSpectrumEmission_tags_1[0]), /* 1 */ + { &asn_OER_type_AdditionalSpectrumEmission_constr_1, &asn_PER_type_AdditionalSpectrumEmission_constr_1, AdditionalSpectrumEmission_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.h b/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.h new file mode 100644 index 000000000..de5f41db7 --- /dev/null +++ b/src/codec_utils/SYSINFO/AdditionalSpectrumEmission.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _AdditionalSpectrumEmission_H_ +#define _AdditionalSpectrumEmission_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AdditionalSpectrumEmission */ +typedef long AdditionalSpectrumEmission_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_AdditionalSpectrumEmission_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_AdditionalSpectrumEmission; +asn_struct_free_f AdditionalSpectrumEmission_free; +asn_struct_print_f AdditionalSpectrumEmission_print; +asn_constr_check_f AdditionalSpectrumEmission_constraint; +ber_type_decoder_f AdditionalSpectrumEmission_decode_ber; +der_type_encoder_f AdditionalSpectrumEmission_encode_der; +xer_type_decoder_f AdditionalSpectrumEmission_decode_xer; +xer_type_encoder_f AdditionalSpectrumEmission_encode_xer; +oer_type_decoder_f AdditionalSpectrumEmission_decode_oer; +oer_type_encoder_f AdditionalSpectrumEmission_encode_oer; +per_type_decoder_f AdditionalSpectrumEmission_decode_uper; +per_type_encoder_f AdditionalSpectrumEmission_encode_uper; +per_type_decoder_f AdditionalSpectrumEmission_decode_aper; +per_type_encoder_f AdditionalSpectrumEmission_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _AdditionalSpectrumEmission_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/BCCH-Config.c b/src/codec_utils/SYSINFO/BCCH-Config.c new file mode 100644 index 000000000..0340ba746 --- /dev/null +++ b/src/codec_utils/SYSINFO/BCCH-Config.c @@ -0,0 +1,103 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "BCCH-Config.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_modificationPeriodCoeff_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_modificationPeriodCoeff_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_modificationPeriodCoeff_value2enum_2[] = { + { 0, 2, "n2" }, + { 1, 2, "n4" }, + { 2, 2, "n8" }, + { 3, 3, "n16" } +}; +static const unsigned int asn_MAP_modificationPeriodCoeff_enum2value_2[] = { + 3, /* n16(3) */ + 0, /* n2(0) */ + 1, /* n4(1) */ + 2 /* n8(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_modificationPeriodCoeff_specs_2 = { + asn_MAP_modificationPeriodCoeff_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_modificationPeriodCoeff_enum2value_2, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_modificationPeriodCoeff_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_modificationPeriodCoeff_2 = { + "modificationPeriodCoeff", + "modificationPeriodCoeff", + &asn_OP_NativeEnumerated, + asn_DEF_modificationPeriodCoeff_tags_2, + sizeof(asn_DEF_modificationPeriodCoeff_tags_2) + /sizeof(asn_DEF_modificationPeriodCoeff_tags_2[0]) - 1, /* 1 */ + asn_DEF_modificationPeriodCoeff_tags_2, /* Same as above */ + sizeof(asn_DEF_modificationPeriodCoeff_tags_2) + /sizeof(asn_DEF_modificationPeriodCoeff_tags_2[0]), /* 2 */ + { &asn_OER_type_modificationPeriodCoeff_constr_2, &asn_PER_type_modificationPeriodCoeff_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_modificationPeriodCoeff_specs_2 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_BCCH_Config_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BCCH_Config, modificationPeriodCoeff), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_modificationPeriodCoeff_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "modificationPeriodCoeff" + }, +}; +static const ber_tlv_tag_t asn_DEF_BCCH_Config_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_BCCH_Config_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* modificationPeriodCoeff */ +}; +asn_SEQUENCE_specifics_t asn_SPC_BCCH_Config_specs_1 = { + sizeof(struct BCCH_Config), + offsetof(struct BCCH_Config, _asn_ctx), + asn_MAP_BCCH_Config_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_BCCH_Config = { + "BCCH-Config", + "BCCH-Config", + &asn_OP_SEQUENCE, + asn_DEF_BCCH_Config_tags_1, + sizeof(asn_DEF_BCCH_Config_tags_1) + /sizeof(asn_DEF_BCCH_Config_tags_1[0]), /* 1 */ + asn_DEF_BCCH_Config_tags_1, /* Same as above */ + sizeof(asn_DEF_BCCH_Config_tags_1) + /sizeof(asn_DEF_BCCH_Config_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_BCCH_Config_1, + 1, /* Elements count */ + &asn_SPC_BCCH_Config_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/BCCH-Config.h b/src/codec_utils/SYSINFO/BCCH-Config.h new file mode 100644 index 000000000..41d02486c --- /dev/null +++ b/src/codec_utils/SYSINFO/BCCH-Config.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _BCCH_Config_H_ +#define _BCCH_Config_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum BCCH_Config__modificationPeriodCoeff { + BCCH_Config__modificationPeriodCoeff_n2 = 0, + BCCH_Config__modificationPeriodCoeff_n4 = 1, + BCCH_Config__modificationPeriodCoeff_n8 = 2, + BCCH_Config__modificationPeriodCoeff_n16 = 3 +} e_BCCH_Config__modificationPeriodCoeff; + +/* BCCH-Config */ +typedef struct BCCH_Config { + long modificationPeriodCoeff; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BCCH_Config_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_modificationPeriodCoeff_2; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_BCCH_Config; +extern asn_SEQUENCE_specifics_t asn_SPC_BCCH_Config_specs_1; +extern asn_TYPE_member_t asn_MBR_BCCH_Config_1[1]; + +#ifdef __cplusplus +} +#endif + +#endif /* _BCCH_Config_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/BWP-DownlinkCommon.c b/src/codec_utils/SYSINFO/BWP-DownlinkCommon.c new file mode 100644 index 000000000..f1d4d7674 --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP-DownlinkCommon.c @@ -0,0 +1,188 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "BWP-DownlinkCommon.h" + +#include "PDCCH-ConfigCommon.h" +#include "PDSCH-ConfigCommon.h" +static asn_oer_constraints_t asn_OER_type_pdcch_ConfigCommon_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_pdcch_ConfigCommon_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_pdsch_ConfigCommon_constr_6 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_pdsch_ConfigCommon_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_pdcch_ConfigCommon_3[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_DownlinkCommon__pdcch_ConfigCommon, choice.release), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "release" + }, + { ATF_POINTER, 0, offsetof(struct BWP_DownlinkCommon__pdcch_ConfigCommon, choice.setup), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PDCCH_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "setup" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_pdcch_ConfigCommon_tag2el_3[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* release */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setup */ +}; +static asn_CHOICE_specifics_t asn_SPC_pdcch_ConfigCommon_specs_3 = { + sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon), + offsetof(struct BWP_DownlinkCommon__pdcch_ConfigCommon, _asn_ctx), + offsetof(struct BWP_DownlinkCommon__pdcch_ConfigCommon, present), + sizeof(((struct BWP_DownlinkCommon__pdcch_ConfigCommon *)0)->present), + asn_MAP_pdcch_ConfigCommon_tag2el_3, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_pdcch_ConfigCommon_3 = { + "pdcch-ConfigCommon", + "pdcch-ConfigCommon", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_pdcch_ConfigCommon_constr_3, &asn_PER_type_pdcch_ConfigCommon_constr_3, CHOICE_constraint }, + asn_MBR_pdcch_ConfigCommon_3, + 2, /* Elements count */ + &asn_SPC_pdcch_ConfigCommon_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_pdsch_ConfigCommon_6[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_DownlinkCommon__pdsch_ConfigCommon, choice.release), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "release" + }, + { ATF_POINTER, 0, offsetof(struct BWP_DownlinkCommon__pdsch_ConfigCommon, choice.setup), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PDSCH_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "setup" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_pdsch_ConfigCommon_tag2el_6[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* release */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setup */ +}; +static asn_CHOICE_specifics_t asn_SPC_pdsch_ConfigCommon_specs_6 = { + sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon), + offsetof(struct BWP_DownlinkCommon__pdsch_ConfigCommon, _asn_ctx), + offsetof(struct BWP_DownlinkCommon__pdsch_ConfigCommon, present), + sizeof(((struct BWP_DownlinkCommon__pdsch_ConfigCommon *)0)->present), + asn_MAP_pdsch_ConfigCommon_tag2el_6, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_pdsch_ConfigCommon_6 = { + "pdsch-ConfigCommon", + "pdsch-ConfigCommon", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_pdsch_ConfigCommon_constr_6, &asn_PER_type_pdsch_ConfigCommon_constr_6, CHOICE_constraint }, + asn_MBR_pdsch_ConfigCommon_6, + 2, /* Elements count */ + &asn_SPC_pdsch_ConfigCommon_specs_6 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_BWP_DownlinkCommon_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_DownlinkCommon, genericParameters), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BWP, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "genericParameters" + }, + { ATF_POINTER, 2, offsetof(struct BWP_DownlinkCommon, pdcch_ConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_pdcch_ConfigCommon_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pdcch-ConfigCommon" + }, + { ATF_POINTER, 1, offsetof(struct BWP_DownlinkCommon, pdsch_ConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_pdsch_ConfigCommon_6, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pdsch-ConfigCommon" + }, +}; +static const int asn_MAP_BWP_DownlinkCommon_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_BWP_DownlinkCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_BWP_DownlinkCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* genericParameters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pdcch-ConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* pdsch-ConfigCommon */ +}; +asn_SEQUENCE_specifics_t asn_SPC_BWP_DownlinkCommon_specs_1 = { + sizeof(struct BWP_DownlinkCommon), + offsetof(struct BWP_DownlinkCommon, _asn_ctx), + asn_MAP_BWP_DownlinkCommon_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_BWP_DownlinkCommon_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + 3, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_BWP_DownlinkCommon = { + "BWP-DownlinkCommon", + "BWP-DownlinkCommon", + &asn_OP_SEQUENCE, + asn_DEF_BWP_DownlinkCommon_tags_1, + sizeof(asn_DEF_BWP_DownlinkCommon_tags_1) + /sizeof(asn_DEF_BWP_DownlinkCommon_tags_1[0]), /* 1 */ + asn_DEF_BWP_DownlinkCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_BWP_DownlinkCommon_tags_1) + /sizeof(asn_DEF_BWP_DownlinkCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_BWP_DownlinkCommon_1, + 3, /* Elements count */ + &asn_SPC_BWP_DownlinkCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/BWP-DownlinkCommon.h b/src/codec_utils/SYSINFO/BWP-DownlinkCommon.h new file mode 100644 index 000000000..2527fddde --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP-DownlinkCommon.h @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _BWP_DownlinkCommon_H_ +#define _BWP_DownlinkCommon_H_ + + +#include + +/* Including external dependencies */ +#include "BWP.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum BWP_DownlinkCommon__pdcch_ConfigCommon_PR { + BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING, /* No components present */ + BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release, + BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup +} BWP_DownlinkCommon__pdcch_ConfigCommon_PR; +typedef enum BWP_DownlinkCommon__pdsch_ConfigCommon_PR { + BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING, /* No components present */ + BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release, + BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup +} BWP_DownlinkCommon__pdsch_ConfigCommon_PR; + +/* Forward declarations */ +struct PDCCH_ConfigCommon; +struct PDSCH_ConfigCommon; + +/* BWP-DownlinkCommon */ +typedef struct BWP_DownlinkCommon { + BWP_t genericParameters; + struct BWP_DownlinkCommon__pdcch_ConfigCommon { + BWP_DownlinkCommon__pdcch_ConfigCommon_PR present; + union BWP_DownlinkCommon__pdcch_ConfigCommon_u { + NULL_t release; + struct PDCCH_ConfigCommon *setup; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *pdcch_ConfigCommon; + struct BWP_DownlinkCommon__pdsch_ConfigCommon { + BWP_DownlinkCommon__pdsch_ConfigCommon_PR present; + union BWP_DownlinkCommon__pdsch_ConfigCommon_u { + NULL_t release; + struct PDSCH_ConfigCommon *setup; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *pdsch_ConfigCommon; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BWP_DownlinkCommon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BWP_DownlinkCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_BWP_DownlinkCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_BWP_DownlinkCommon_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _BWP_DownlinkCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/BWP-UplinkCommon.c b/src/codec_utils/SYSINFO/BWP-UplinkCommon.c new file mode 100644 index 000000000..48c8491fd --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP-UplinkCommon.c @@ -0,0 +1,256 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "BWP-UplinkCommon.h" + +#include "RACH-ConfigCommon.h" +#include "PUSCH-ConfigCommon.h" +#include "PUCCH-ConfigCommon.h" +static asn_oer_constraints_t asn_OER_type_rach_ConfigCommon_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_rach_ConfigCommon_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_pusch_ConfigCommon_constr_6 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_pusch_ConfigCommon_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_pucch_ConfigCommon_constr_9 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_pucch_ConfigCommon_constr_9 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_rach_ConfigCommon_3[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_UplinkCommon__rach_ConfigCommon, choice.release), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "release" + }, + { ATF_POINTER, 0, offsetof(struct BWP_UplinkCommon__rach_ConfigCommon, choice.setup), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RACH_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "setup" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_rach_ConfigCommon_tag2el_3[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* release */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setup */ +}; +static asn_CHOICE_specifics_t asn_SPC_rach_ConfigCommon_specs_3 = { + sizeof(struct BWP_UplinkCommon__rach_ConfigCommon), + offsetof(struct BWP_UplinkCommon__rach_ConfigCommon, _asn_ctx), + offsetof(struct BWP_UplinkCommon__rach_ConfigCommon, present), + sizeof(((struct BWP_UplinkCommon__rach_ConfigCommon *)0)->present), + asn_MAP_rach_ConfigCommon_tag2el_3, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_rach_ConfigCommon_3 = { + "rach-ConfigCommon", + "rach-ConfigCommon", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_rach_ConfigCommon_constr_3, &asn_PER_type_rach_ConfigCommon_constr_3, CHOICE_constraint }, + asn_MBR_rach_ConfigCommon_3, + 2, /* Elements count */ + &asn_SPC_rach_ConfigCommon_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_pusch_ConfigCommon_6[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_UplinkCommon__pusch_ConfigCommon, choice.release), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "release" + }, + { ATF_POINTER, 0, offsetof(struct BWP_UplinkCommon__pusch_ConfigCommon, choice.setup), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PUSCH_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "setup" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_pusch_ConfigCommon_tag2el_6[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* release */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setup */ +}; +static asn_CHOICE_specifics_t asn_SPC_pusch_ConfigCommon_specs_6 = { + sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon), + offsetof(struct BWP_UplinkCommon__pusch_ConfigCommon, _asn_ctx), + offsetof(struct BWP_UplinkCommon__pusch_ConfigCommon, present), + sizeof(((struct BWP_UplinkCommon__pusch_ConfigCommon *)0)->present), + asn_MAP_pusch_ConfigCommon_tag2el_6, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_pusch_ConfigCommon_6 = { + "pusch-ConfigCommon", + "pusch-ConfigCommon", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_pusch_ConfigCommon_constr_6, &asn_PER_type_pusch_ConfigCommon_constr_6, CHOICE_constraint }, + asn_MBR_pusch_ConfigCommon_6, + 2, /* Elements count */ + &asn_SPC_pusch_ConfigCommon_specs_6 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_pucch_ConfigCommon_9[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_UplinkCommon__pucch_ConfigCommon, choice.release), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "release" + }, + { ATF_POINTER, 0, offsetof(struct BWP_UplinkCommon__pucch_ConfigCommon, choice.setup), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PUCCH_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "setup" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_pucch_ConfigCommon_tag2el_9[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* release */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setup */ +}; +static asn_CHOICE_specifics_t asn_SPC_pucch_ConfigCommon_specs_9 = { + sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon), + offsetof(struct BWP_UplinkCommon__pucch_ConfigCommon, _asn_ctx), + offsetof(struct BWP_UplinkCommon__pucch_ConfigCommon, present), + sizeof(((struct BWP_UplinkCommon__pucch_ConfigCommon *)0)->present), + asn_MAP_pucch_ConfigCommon_tag2el_9, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_pucch_ConfigCommon_9 = { + "pucch-ConfigCommon", + "pucch-ConfigCommon", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_pucch_ConfigCommon_constr_9, &asn_PER_type_pucch_ConfigCommon_constr_9, CHOICE_constraint }, + asn_MBR_pucch_ConfigCommon_9, + 2, /* Elements count */ + &asn_SPC_pucch_ConfigCommon_specs_9 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_BWP_UplinkCommon_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP_UplinkCommon, genericParameters), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BWP, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "genericParameters" + }, + { ATF_POINTER, 3, offsetof(struct BWP_UplinkCommon, rach_ConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_rach_ConfigCommon_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rach-ConfigCommon" + }, + { ATF_POINTER, 2, offsetof(struct BWP_UplinkCommon, pusch_ConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_pusch_ConfigCommon_6, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pusch-ConfigCommon" + }, + { ATF_POINTER, 1, offsetof(struct BWP_UplinkCommon, pucch_ConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_pucch_ConfigCommon_9, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pucch-ConfigCommon" + }, +}; +static const int asn_MAP_BWP_UplinkCommon_oms_1[] = { 1, 2, 3 }; +static const ber_tlv_tag_t asn_DEF_BWP_UplinkCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_BWP_UplinkCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* genericParameters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rach-ConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* pusch-ConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pucch-ConfigCommon */ +}; +asn_SEQUENCE_specifics_t asn_SPC_BWP_UplinkCommon_specs_1 = { + sizeof(struct BWP_UplinkCommon), + offsetof(struct BWP_UplinkCommon, _asn_ctx), + asn_MAP_BWP_UplinkCommon_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_BWP_UplinkCommon_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_BWP_UplinkCommon = { + "BWP-UplinkCommon", + "BWP-UplinkCommon", + &asn_OP_SEQUENCE, + asn_DEF_BWP_UplinkCommon_tags_1, + sizeof(asn_DEF_BWP_UplinkCommon_tags_1) + /sizeof(asn_DEF_BWP_UplinkCommon_tags_1[0]), /* 1 */ + asn_DEF_BWP_UplinkCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_BWP_UplinkCommon_tags_1) + /sizeof(asn_DEF_BWP_UplinkCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_BWP_UplinkCommon_1, + 4, /* Elements count */ + &asn_SPC_BWP_UplinkCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/BWP-UplinkCommon.h b/src/codec_utils/SYSINFO/BWP-UplinkCommon.h new file mode 100644 index 000000000..f26215bba --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP-UplinkCommon.h @@ -0,0 +1,98 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _BWP_UplinkCommon_H_ +#define _BWP_UplinkCommon_H_ + + +#include + +/* Including external dependencies */ +#include "BWP.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum BWP_UplinkCommon__rach_ConfigCommon_PR { + BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING, /* No components present */ + BWP_UplinkCommon__rach_ConfigCommon_PR_release, + BWP_UplinkCommon__rach_ConfigCommon_PR_setup +} BWP_UplinkCommon__rach_ConfigCommon_PR; +typedef enum BWP_UplinkCommon__pusch_ConfigCommon_PR { + BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING, /* No components present */ + BWP_UplinkCommon__pusch_ConfigCommon_PR_release, + BWP_UplinkCommon__pusch_ConfigCommon_PR_setup +} BWP_UplinkCommon__pusch_ConfigCommon_PR; +typedef enum BWP_UplinkCommon__pucch_ConfigCommon_PR { + BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING, /* No components present */ + BWP_UplinkCommon__pucch_ConfigCommon_PR_release, + BWP_UplinkCommon__pucch_ConfigCommon_PR_setup +} BWP_UplinkCommon__pucch_ConfigCommon_PR; + +/* Forward declarations */ +struct RACH_ConfigCommon; +struct PUSCH_ConfigCommon; +struct PUCCH_ConfigCommon; + +/* BWP-UplinkCommon */ +typedef struct BWP_UplinkCommon { + BWP_t genericParameters; + struct BWP_UplinkCommon__rach_ConfigCommon { + BWP_UplinkCommon__rach_ConfigCommon_PR present; + union BWP_UplinkCommon__rach_ConfigCommon_u { + NULL_t release; + struct RACH_ConfigCommon *setup; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *rach_ConfigCommon; + struct BWP_UplinkCommon__pusch_ConfigCommon { + BWP_UplinkCommon__pusch_ConfigCommon_PR present; + union BWP_UplinkCommon__pusch_ConfigCommon_u { + NULL_t release; + struct PUSCH_ConfigCommon *setup; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *pusch_ConfigCommon; + struct BWP_UplinkCommon__pucch_ConfigCommon { + BWP_UplinkCommon__pucch_ConfigCommon_PR present; + union BWP_UplinkCommon__pucch_ConfigCommon_u { + NULL_t release; + struct PUCCH_ConfigCommon *setup; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *pucch_ConfigCommon; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BWP_UplinkCommon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BWP_UplinkCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_BWP_UplinkCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_BWP_UplinkCommon_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _BWP_UplinkCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/BWP.c b/src/codec_utils/SYSINFO/BWP.c new file mode 100644 index 000000000..dcdb73cc2 --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP.c @@ -0,0 +1,152 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "BWP.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_locationAndBandwidth_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 37949)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_cyclicPrefix_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_cyclicPrefix_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_locationAndBandwidth_constr_2 CC_NOTUSED = { + { 2, 1 } /* (0..37949) */, + -1}; +static asn_per_constraints_t asn_PER_memb_locationAndBandwidth_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 16, 16, 0, 37949 } /* (0..37949) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_cyclicPrefix_value2enum_4[] = { + { 0, 8, "extended" } +}; +static const unsigned int asn_MAP_cyclicPrefix_enum2value_4[] = { + 0 /* extended(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_cyclicPrefix_specs_4 = { + asn_MAP_cyclicPrefix_value2enum_4, /* "tag" => N; sorted by tag */ + asn_MAP_cyclicPrefix_enum2value_4, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_cyclicPrefix_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cyclicPrefix_4 = { + "cyclicPrefix", + "cyclicPrefix", + &asn_OP_NativeEnumerated, + asn_DEF_cyclicPrefix_tags_4, + sizeof(asn_DEF_cyclicPrefix_tags_4) + /sizeof(asn_DEF_cyclicPrefix_tags_4[0]) - 1, /* 1 */ + asn_DEF_cyclicPrefix_tags_4, /* Same as above */ + sizeof(asn_DEF_cyclicPrefix_tags_4) + /sizeof(asn_DEF_cyclicPrefix_tags_4[0]), /* 2 */ + { &asn_OER_type_cyclicPrefix_constr_4, &asn_PER_type_cyclicPrefix_constr_4, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_cyclicPrefix_specs_4 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_BWP_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BWP, locationAndBandwidth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_locationAndBandwidth_constr_2, &asn_PER_memb_locationAndBandwidth_constr_2, memb_locationAndBandwidth_constraint_1 }, + 0, 0, /* No default value */ + "locationAndBandwidth" + }, + { ATF_NOFLAGS, 0, offsetof(struct BWP, subcarrierSpacing), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SubcarrierSpacing, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "subcarrierSpacing" + }, + { ATF_POINTER, 1, offsetof(struct BWP, cyclicPrefix), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_cyclicPrefix_4, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cyclicPrefix" + }, +}; +static const int asn_MAP_BWP_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_BWP_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_BWP_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* locationAndBandwidth */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* subcarrierSpacing */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cyclicPrefix */ +}; +asn_SEQUENCE_specifics_t asn_SPC_BWP_specs_1 = { + sizeof(struct BWP), + offsetof(struct BWP, _asn_ctx), + asn_MAP_BWP_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_BWP_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_BWP = { + "BWP", + "BWP", + &asn_OP_SEQUENCE, + asn_DEF_BWP_tags_1, + sizeof(asn_DEF_BWP_tags_1) + /sizeof(asn_DEF_BWP_tags_1[0]), /* 1 */ + asn_DEF_BWP_tags_1, /* Same as above */ + sizeof(asn_DEF_BWP_tags_1) + /sizeof(asn_DEF_BWP_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_BWP_1, + 3, /* Elements count */ + &asn_SPC_BWP_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/BWP.h b/src/codec_utils/SYSINFO/BWP.h new file mode 100644 index 000000000..e653637dc --- /dev/null +++ b/src/codec_utils/SYSINFO/BWP.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _BWP_H_ +#define _BWP_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SubcarrierSpacing.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum BWP__cyclicPrefix { + BWP__cyclicPrefix_extended = 0 +} e_BWP__cyclicPrefix; + +/* BWP */ +typedef struct BWP { + long locationAndBandwidth; + SubcarrierSpacing_t subcarrierSpacing; + long *cyclicPrefix; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BWP_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_cyclicPrefix_4; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_BWP; +extern asn_SEQUENCE_specifics_t asn_SPC_BWP_specs_1; +extern asn_TYPE_member_t asn_MBR_BWP_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _BWP_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/CellAccessRelatedInfo.c b/src/codec_utils/SYSINFO/CellAccessRelatedInfo.c new file mode 100644 index 000000000..3ca463fc3 --- /dev/null +++ b/src/codec_utils/SYSINFO/CellAccessRelatedInfo.c @@ -0,0 +1,109 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "CellAccessRelatedInfo.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_cellReservedForOtherUse_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_cellReservedForOtherUse_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_cellReservedForOtherUse_value2enum_3[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_cellReservedForOtherUse_enum2value_3[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_cellReservedForOtherUse_specs_3 = { + asn_MAP_cellReservedForOtherUse_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_cellReservedForOtherUse_enum2value_3, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_cellReservedForOtherUse_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cellReservedForOtherUse_3 = { + "cellReservedForOtherUse", + "cellReservedForOtherUse", + &asn_OP_NativeEnumerated, + asn_DEF_cellReservedForOtherUse_tags_3, + sizeof(asn_DEF_cellReservedForOtherUse_tags_3) + /sizeof(asn_DEF_cellReservedForOtherUse_tags_3[0]) - 1, /* 1 */ + asn_DEF_cellReservedForOtherUse_tags_3, /* Same as above */ + sizeof(asn_DEF_cellReservedForOtherUse_tags_3) + /sizeof(asn_DEF_cellReservedForOtherUse_tags_3[0]), /* 2 */ + { &asn_OER_type_cellReservedForOtherUse_constr_3, &asn_PER_type_cellReservedForOtherUse_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_cellReservedForOtherUse_specs_3 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_CellAccessRelatedInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CellAccessRelatedInfo, plmn_IdentityList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PLMN_IdentityInfoList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "plmn-IdentityList" + }, + { ATF_POINTER, 1, offsetof(struct CellAccessRelatedInfo, cellReservedForOtherUse), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_cellReservedForOtherUse_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellReservedForOtherUse" + }, +}; +static const int asn_MAP_CellAccessRelatedInfo_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_CellAccessRelatedInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_CellAccessRelatedInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmn-IdentityList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cellReservedForOtherUse */ +}; +asn_SEQUENCE_specifics_t asn_SPC_CellAccessRelatedInfo_specs_1 = { + sizeof(struct CellAccessRelatedInfo), + offsetof(struct CellAccessRelatedInfo, _asn_ctx), + asn_MAP_CellAccessRelatedInfo_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_CellAccessRelatedInfo_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 2, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_CellAccessRelatedInfo = { + "CellAccessRelatedInfo", + "CellAccessRelatedInfo", + &asn_OP_SEQUENCE, + asn_DEF_CellAccessRelatedInfo_tags_1, + sizeof(asn_DEF_CellAccessRelatedInfo_tags_1) + /sizeof(asn_DEF_CellAccessRelatedInfo_tags_1[0]), /* 1 */ + asn_DEF_CellAccessRelatedInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_CellAccessRelatedInfo_tags_1) + /sizeof(asn_DEF_CellAccessRelatedInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_CellAccessRelatedInfo_1, + 2, /* Elements count */ + &asn_SPC_CellAccessRelatedInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/CellAccessRelatedInfo.h b/src/codec_utils/SYSINFO/CellAccessRelatedInfo.h new file mode 100644 index 000000000..71ffe4594 --- /dev/null +++ b/src/codec_utils/SYSINFO/CellAccessRelatedInfo.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _CellAccessRelatedInfo_H_ +#define _CellAccessRelatedInfo_H_ + + +#include + +/* Including external dependencies */ +#include "PLMN-IdentityInfoList.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum CellAccessRelatedInfo__cellReservedForOtherUse { + CellAccessRelatedInfo__cellReservedForOtherUse_true = 0 +} e_CellAccessRelatedInfo__cellReservedForOtherUse; + +/* CellAccessRelatedInfo */ +typedef struct CellAccessRelatedInfo { + PLMN_IdentityInfoList_t plmn_IdentityList; + long *cellReservedForOtherUse; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CellAccessRelatedInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_cellReservedForOtherUse_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_CellAccessRelatedInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_CellAccessRelatedInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_CellAccessRelatedInfo_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellAccessRelatedInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/CellIdentity.c b/src/codec_utils/SYSINFO/CellIdentity.c new file mode 100644 index 000000000..dc6c92fe7 --- /dev/null +++ b/src/codec_utils/SYSINFO/CellIdentity.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "CellIdentity.h" + +int +CellIdentity_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 36)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_CellIdentity_constr_1 CC_NOTUSED = { + { 0, 0 }, + 36 /* (SIZE(36..36)) */}; +asn_per_constraints_t asn_PER_type_CellIdentity_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 36, 36 } /* (SIZE(36..36)) */, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_CellIdentity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_CellIdentity = { + "CellIdentity", + "CellIdentity", + &asn_OP_BIT_STRING, + asn_DEF_CellIdentity_tags_1, + sizeof(asn_DEF_CellIdentity_tags_1) + /sizeof(asn_DEF_CellIdentity_tags_1[0]), /* 1 */ + asn_DEF_CellIdentity_tags_1, /* Same as above */ + sizeof(asn_DEF_CellIdentity_tags_1) + /sizeof(asn_DEF_CellIdentity_tags_1[0]), /* 1 */ + { &asn_OER_type_CellIdentity_constr_1, &asn_PER_type_CellIdentity_constr_1, CellIdentity_constraint }, + 0, 0, /* No members */ + &asn_SPC_BIT_STRING_specs /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/CellIdentity.h b/src/codec_utils/SYSINFO/CellIdentity.h new file mode 100644 index 000000000..65142bfd7 --- /dev/null +++ b/src/codec_utils/SYSINFO/CellIdentity.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _CellIdentity_H_ +#define _CellIdentity_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CellIdentity */ +typedef BIT_STRING_t CellIdentity_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_CellIdentity_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_CellIdentity; +asn_struct_free_f CellIdentity_free; +asn_struct_print_f CellIdentity_print; +asn_constr_check_f CellIdentity_constraint; +ber_type_decoder_f CellIdentity_decode_ber; +der_type_encoder_f CellIdentity_encode_der; +xer_type_decoder_f CellIdentity_decode_xer; +xer_type_encoder_f CellIdentity_encode_xer; +oer_type_decoder_f CellIdentity_decode_oer; +oer_type_encoder_f CellIdentity_encode_oer; +per_type_decoder_f CellIdentity_decode_uper; +per_type_encoder_f CellIdentity_encode_uper; +per_type_decoder_f CellIdentity_decode_aper; +per_type_encoder_f CellIdentity_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellIdentity_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/ConnEstFailureControl.c b/src/codec_utils/SYSINFO/ConnEstFailureControl.c new file mode 100644 index 000000000..3b9dc94a9 --- /dev/null +++ b/src/codec_utils/SYSINFO/ConnEstFailureControl.c @@ -0,0 +1,219 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ConnEstFailureControl.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_connEstFailOffset_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_connEstFailCount_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_connEstFailCount_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_connEstFailOffsetValidity_constr_7 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_connEstFailOffsetValidity_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_connEstFailOffset_constr_16 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_connEstFailOffset_constr_16 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_connEstFailCount_value2enum_2[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" }, + { 2, 2, "n3" }, + { 3, 2, "n4" } +}; +static const unsigned int asn_MAP_connEstFailCount_enum2value_2[] = { + 0, /* n1(0) */ + 1, /* n2(1) */ + 2, /* n3(2) */ + 3 /* n4(3) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_connEstFailCount_specs_2 = { + asn_MAP_connEstFailCount_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_connEstFailCount_enum2value_2, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_connEstFailCount_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_connEstFailCount_2 = { + "connEstFailCount", + "connEstFailCount", + &asn_OP_NativeEnumerated, + asn_DEF_connEstFailCount_tags_2, + sizeof(asn_DEF_connEstFailCount_tags_2) + /sizeof(asn_DEF_connEstFailCount_tags_2[0]) - 1, /* 1 */ + asn_DEF_connEstFailCount_tags_2, /* Same as above */ + sizeof(asn_DEF_connEstFailCount_tags_2) + /sizeof(asn_DEF_connEstFailCount_tags_2[0]), /* 2 */ + { &asn_OER_type_connEstFailCount_constr_2, &asn_PER_type_connEstFailCount_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_connEstFailCount_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_connEstFailOffsetValidity_value2enum_7[] = { + { 0, 3, "s30" }, + { 1, 3, "s60" }, + { 2, 4, "s120" }, + { 3, 4, "s240" }, + { 4, 4, "s300" }, + { 5, 4, "s420" }, + { 6, 4, "s600" }, + { 7, 4, "s900" } +}; +static const unsigned int asn_MAP_connEstFailOffsetValidity_enum2value_7[] = { + 2, /* s120(2) */ + 3, /* s240(3) */ + 0, /* s30(0) */ + 4, /* s300(4) */ + 5, /* s420(5) */ + 1, /* s60(1) */ + 6, /* s600(6) */ + 7 /* s900(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_connEstFailOffsetValidity_specs_7 = { + asn_MAP_connEstFailOffsetValidity_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_connEstFailOffsetValidity_enum2value_7, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_connEstFailOffsetValidity_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_connEstFailOffsetValidity_7 = { + "connEstFailOffsetValidity", + "connEstFailOffsetValidity", + &asn_OP_NativeEnumerated, + asn_DEF_connEstFailOffsetValidity_tags_7, + sizeof(asn_DEF_connEstFailOffsetValidity_tags_7) + /sizeof(asn_DEF_connEstFailOffsetValidity_tags_7[0]) - 1, /* 1 */ + asn_DEF_connEstFailOffsetValidity_tags_7, /* Same as above */ + sizeof(asn_DEF_connEstFailOffsetValidity_tags_7) + /sizeof(asn_DEF_connEstFailOffsetValidity_tags_7[0]), /* 2 */ + { &asn_OER_type_connEstFailOffsetValidity_constr_7, &asn_PER_type_connEstFailOffsetValidity_constr_7, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_connEstFailOffsetValidity_specs_7 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_ConnEstFailureControl_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ConnEstFailureControl, connEstFailCount), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_connEstFailCount_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "connEstFailCount" + }, + { ATF_NOFLAGS, 0, offsetof(struct ConnEstFailureControl, connEstFailOffsetValidity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_connEstFailOffsetValidity_7, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "connEstFailOffsetValidity" + }, + { ATF_POINTER, 1, offsetof(struct ConnEstFailureControl, connEstFailOffset), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_connEstFailOffset_constr_16, &asn_PER_memb_connEstFailOffset_constr_16, memb_connEstFailOffset_constraint_1 }, + 0, 0, /* No default value */ + "connEstFailOffset" + }, +}; +static const int asn_MAP_ConnEstFailureControl_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_ConnEstFailureControl_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ConnEstFailureControl_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* connEstFailCount */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* connEstFailOffsetValidity */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* connEstFailOffset */ +}; +asn_SEQUENCE_specifics_t asn_SPC_ConnEstFailureControl_specs_1 = { + sizeof(struct ConnEstFailureControl), + offsetof(struct ConnEstFailureControl, _asn_ctx), + asn_MAP_ConnEstFailureControl_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_ConnEstFailureControl_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_ConnEstFailureControl = { + "ConnEstFailureControl", + "ConnEstFailureControl", + &asn_OP_SEQUENCE, + asn_DEF_ConnEstFailureControl_tags_1, + sizeof(asn_DEF_ConnEstFailureControl_tags_1) + /sizeof(asn_DEF_ConnEstFailureControl_tags_1[0]), /* 1 */ + asn_DEF_ConnEstFailureControl_tags_1, /* Same as above */ + sizeof(asn_DEF_ConnEstFailureControl_tags_1) + /sizeof(asn_DEF_ConnEstFailureControl_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ConnEstFailureControl_1, + 3, /* Elements count */ + &asn_SPC_ConnEstFailureControl_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/ConnEstFailureControl.h b/src/codec_utils/SYSINFO/ConnEstFailureControl.h new file mode 100644 index 000000000..6b5c8f2fd --- /dev/null +++ b/src/codec_utils/SYSINFO/ConnEstFailureControl.h @@ -0,0 +1,63 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ConnEstFailureControl_H_ +#define _ConnEstFailureControl_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ConnEstFailureControl__connEstFailCount { + ConnEstFailureControl__connEstFailCount_n1 = 0, + ConnEstFailureControl__connEstFailCount_n2 = 1, + ConnEstFailureControl__connEstFailCount_n3 = 2, + ConnEstFailureControl__connEstFailCount_n4 = 3 +} e_ConnEstFailureControl__connEstFailCount; +typedef enum ConnEstFailureControl__connEstFailOffsetValidity { + ConnEstFailureControl__connEstFailOffsetValidity_s30 = 0, + ConnEstFailureControl__connEstFailOffsetValidity_s60 = 1, + ConnEstFailureControl__connEstFailOffsetValidity_s120 = 2, + ConnEstFailureControl__connEstFailOffsetValidity_s240 = 3, + ConnEstFailureControl__connEstFailOffsetValidity_s300 = 4, + ConnEstFailureControl__connEstFailOffsetValidity_s420 = 5, + ConnEstFailureControl__connEstFailOffsetValidity_s600 = 6, + ConnEstFailureControl__connEstFailOffsetValidity_s900 = 7 +} e_ConnEstFailureControl__connEstFailOffsetValidity; + +/* ConnEstFailureControl */ +typedef struct ConnEstFailureControl { + long connEstFailCount; + long connEstFailOffsetValidity; + long *connEstFailOffset; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ConnEstFailureControl_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_connEstFailCount_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_connEstFailOffsetValidity_7; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_ConnEstFailureControl; +extern asn_SEQUENCE_specifics_t asn_SPC_ConnEstFailureControl_specs_1; +extern asn_TYPE_member_t asn_MBR_ConnEstFailureControl_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _ConnEstFailureControl_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/ControlResourceSet.c b/src/codec_utils/SYSINFO/ControlResourceSet.c new file mode 100644 index 000000000..99d170316 --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSet.c @@ -0,0 +1,748 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ControlResourceSet.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_shiftIndex_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 274)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_frequencyDomainResources_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 45)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_duration_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_tci_StatesPDCCH_ToAddList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 64)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_tci_StatesPDCCH_ToReleaseList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 64)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_pdcch_DMRS_ScramblingID_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_reg_BundleSize_constr_7 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_reg_BundleSize_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_interleaverSize_constr_11 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_interleaverSize_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_shiftIndex_constr_15 CC_NOTUSED = { + { 2, 1 } /* (0..274) */, + -1}; +static asn_per_constraints_t asn_PER_memb_shiftIndex_constr_15 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 274 } /* (0..274) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_cce_REG_MappingType_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_cce_REG_MappingType_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_precoderGranularity_constr_17 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_precoderGranularity_constr_17 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_tci_StatesPDCCH_ToAddList_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..64)) */}; +static asn_per_constraints_t asn_PER_type_tci_StatesPDCCH_ToAddList_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_tci_StatesPDCCH_ToReleaseList_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..64)) */}; +static asn_per_constraints_t asn_PER_type_tci_StatesPDCCH_ToReleaseList_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_tci_PresentInDCI_constr_24 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_tci_PresentInDCI_constr_24 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_frequencyDomainResources_constr_3 CC_NOTUSED = { + { 0, 0 }, + 45 /* (SIZE(45..45)) */}; +static asn_per_constraints_t asn_PER_memb_frequencyDomainResources_constr_3 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 45, 45 } /* (SIZE(45..45)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_duration_constr_4 CC_NOTUSED = { + { 1, 1 } /* (1..3) */, + -1}; +static asn_per_constraints_t asn_PER_memb_duration_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (1..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_tci_StatesPDCCH_ToAddList_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..64)) */}; +static asn_per_constraints_t asn_PER_memb_tci_StatesPDCCH_ToAddList_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_tci_StatesPDCCH_ToReleaseList_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..64)) */}; +static asn_per_constraints_t asn_PER_memb_tci_StatesPDCCH_ToReleaseList_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_pdcch_DMRS_ScramblingID_constr_26 CC_NOTUSED = { + { 2, 1 } /* (0..65535) */, + -1}; +static asn_per_constraints_t asn_PER_memb_pdcch_DMRS_ScramblingID_constr_26 CC_NOTUSED = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_reg_BundleSize_value2enum_7[] = { + { 0, 2, "n2" }, + { 1, 2, "n3" }, + { 2, 2, "n6" } +}; +static const unsigned int asn_MAP_reg_BundleSize_enum2value_7[] = { + 0, /* n2(0) */ + 1, /* n3(1) */ + 2 /* n6(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_reg_BundleSize_specs_7 = { + asn_MAP_reg_BundleSize_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_reg_BundleSize_enum2value_7, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_reg_BundleSize_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_reg_BundleSize_7 = { + "reg-BundleSize", + "reg-BundleSize", + &asn_OP_NativeEnumerated, + asn_DEF_reg_BundleSize_tags_7, + sizeof(asn_DEF_reg_BundleSize_tags_7) + /sizeof(asn_DEF_reg_BundleSize_tags_7[0]) - 1, /* 1 */ + asn_DEF_reg_BundleSize_tags_7, /* Same as above */ + sizeof(asn_DEF_reg_BundleSize_tags_7) + /sizeof(asn_DEF_reg_BundleSize_tags_7[0]), /* 2 */ + { &asn_OER_type_reg_BundleSize_constr_7, &asn_PER_type_reg_BundleSize_constr_7, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_reg_BundleSize_specs_7 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_interleaverSize_value2enum_11[] = { + { 0, 2, "n2" }, + { 1, 2, "n3" }, + { 2, 2, "n6" } +}; +static const unsigned int asn_MAP_interleaverSize_enum2value_11[] = { + 0, /* n2(0) */ + 1, /* n3(1) */ + 2 /* n6(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_interleaverSize_specs_11 = { + asn_MAP_interleaverSize_value2enum_11, /* "tag" => N; sorted by tag */ + asn_MAP_interleaverSize_enum2value_11, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_interleaverSize_tags_11[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_interleaverSize_11 = { + "interleaverSize", + "interleaverSize", + &asn_OP_NativeEnumerated, + asn_DEF_interleaverSize_tags_11, + sizeof(asn_DEF_interleaverSize_tags_11) + /sizeof(asn_DEF_interleaverSize_tags_11[0]) - 1, /* 1 */ + asn_DEF_interleaverSize_tags_11, /* Same as above */ + sizeof(asn_DEF_interleaverSize_tags_11) + /sizeof(asn_DEF_interleaverSize_tags_11[0]), /* 2 */ + { &asn_OER_type_interleaverSize_constr_11, &asn_PER_type_interleaverSize_constr_11, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_interleaverSize_specs_11 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_interleaved_6[] = { + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet__cce_REG_MappingType__interleaved, reg_BundleSize), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_reg_BundleSize_7, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "reg-BundleSize" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet__cce_REG_MappingType__interleaved, interleaverSize), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_interleaverSize_11, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "interleaverSize" + }, + { ATF_POINTER, 1, offsetof(struct ControlResourceSet__cce_REG_MappingType__interleaved, shiftIndex), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_shiftIndex_constr_15, &asn_PER_memb_shiftIndex_constr_15, memb_shiftIndex_constraint_6 }, + 0, 0, /* No default value */ + "shiftIndex" + }, +}; +static const int asn_MAP_interleaved_oms_6[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_interleaved_tags_6[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_interleaved_tag2el_6[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* reg-BundleSize */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* interleaverSize */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* shiftIndex */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_interleaved_specs_6 = { + sizeof(struct ControlResourceSet__cce_REG_MappingType__interleaved), + offsetof(struct ControlResourceSet__cce_REG_MappingType__interleaved, _asn_ctx), + asn_MAP_interleaved_tag2el_6, + 3, /* Count of tags in the map */ + asn_MAP_interleaved_oms_6, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_interleaved_6 = { + "interleaved", + "interleaved", + &asn_OP_SEQUENCE, + asn_DEF_interleaved_tags_6, + sizeof(asn_DEF_interleaved_tags_6) + /sizeof(asn_DEF_interleaved_tags_6[0]) - 1, /* 1 */ + asn_DEF_interleaved_tags_6, /* Same as above */ + sizeof(asn_DEF_interleaved_tags_6) + /sizeof(asn_DEF_interleaved_tags_6[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_interleaved_6, + 3, /* Elements count */ + &asn_SPC_interleaved_specs_6 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_cce_REG_MappingType_5[] = { + { ATF_POINTER, 0, offsetof(struct ControlResourceSet__cce_REG_MappingType, choice.interleaved), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_interleaved_6, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "interleaved" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet__cce_REG_MappingType, choice.nonInterleaved), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nonInterleaved" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_cce_REG_MappingType_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* interleaved */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* nonInterleaved */ +}; +static asn_CHOICE_specifics_t asn_SPC_cce_REG_MappingType_specs_5 = { + sizeof(struct ControlResourceSet__cce_REG_MappingType), + offsetof(struct ControlResourceSet__cce_REG_MappingType, _asn_ctx), + offsetof(struct ControlResourceSet__cce_REG_MappingType, present), + sizeof(((struct ControlResourceSet__cce_REG_MappingType *)0)->present), + asn_MAP_cce_REG_MappingType_tag2el_5, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cce_REG_MappingType_5 = { + "cce-REG-MappingType", + "cce-REG-MappingType", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_cce_REG_MappingType_constr_5, &asn_PER_type_cce_REG_MappingType_constr_5, CHOICE_constraint }, + asn_MBR_cce_REG_MappingType_5, + 2, /* Elements count */ + &asn_SPC_cce_REG_MappingType_specs_5 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_precoderGranularity_value2enum_17[] = { + { 0, 16, "sameAsREG-bundle" }, + { 1, 16, "allContiguousRBs" } +}; +static const unsigned int asn_MAP_precoderGranularity_enum2value_17[] = { + 1, /* allContiguousRBs(1) */ + 0 /* sameAsREG-bundle(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_precoderGranularity_specs_17 = { + asn_MAP_precoderGranularity_value2enum_17, /* "tag" => N; sorted by tag */ + asn_MAP_precoderGranularity_enum2value_17, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_precoderGranularity_tags_17[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_precoderGranularity_17 = { + "precoderGranularity", + "precoderGranularity", + &asn_OP_NativeEnumerated, + asn_DEF_precoderGranularity_tags_17, + sizeof(asn_DEF_precoderGranularity_tags_17) + /sizeof(asn_DEF_precoderGranularity_tags_17[0]) - 1, /* 1 */ + asn_DEF_precoderGranularity_tags_17, /* Same as above */ + sizeof(asn_DEF_precoderGranularity_tags_17) + /sizeof(asn_DEF_precoderGranularity_tags_17[0]), /* 2 */ + { &asn_OER_type_precoderGranularity_constr_17, &asn_PER_type_precoderGranularity_constr_17, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_precoderGranularity_specs_17 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_tci_StatesPDCCH_ToAddList_20[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_TCI_StateId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_tci_StatesPDCCH_ToAddList_tags_20[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_tci_StatesPDCCH_ToAddList_specs_20 = { + sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList), + offsetof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_tci_StatesPDCCH_ToAddList_20 = { + "tci-StatesPDCCH-ToAddList", + "tci-StatesPDCCH-ToAddList", + &asn_OP_SEQUENCE_OF, + asn_DEF_tci_StatesPDCCH_ToAddList_tags_20, + sizeof(asn_DEF_tci_StatesPDCCH_ToAddList_tags_20) + /sizeof(asn_DEF_tci_StatesPDCCH_ToAddList_tags_20[0]) - 1, /* 1 */ + asn_DEF_tci_StatesPDCCH_ToAddList_tags_20, /* Same as above */ + sizeof(asn_DEF_tci_StatesPDCCH_ToAddList_tags_20) + /sizeof(asn_DEF_tci_StatesPDCCH_ToAddList_tags_20[0]), /* 2 */ + { &asn_OER_type_tci_StatesPDCCH_ToAddList_constr_20, &asn_PER_type_tci_StatesPDCCH_ToAddList_constr_20, SEQUENCE_OF_constraint }, + asn_MBR_tci_StatesPDCCH_ToAddList_20, + 1, /* Single element */ + &asn_SPC_tci_StatesPDCCH_ToAddList_specs_20 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_tci_StatesPDCCH_ToReleaseList_22[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_TCI_StateId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_tci_StatesPDCCH_ToReleaseList_specs_22 = { + sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToReleaseList), + offsetof(struct ControlResourceSet__tci_StatesPDCCH_ToReleaseList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_tci_StatesPDCCH_ToReleaseList_22 = { + "tci-StatesPDCCH-ToReleaseList", + "tci-StatesPDCCH-ToReleaseList", + &asn_OP_SEQUENCE_OF, + asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22, + sizeof(asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22) + /sizeof(asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22[0]) - 1, /* 1 */ + asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22, /* Same as above */ + sizeof(asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22) + /sizeof(asn_DEF_tci_StatesPDCCH_ToReleaseList_tags_22[0]), /* 2 */ + { &asn_OER_type_tci_StatesPDCCH_ToReleaseList_constr_22, &asn_PER_type_tci_StatesPDCCH_ToReleaseList_constr_22, SEQUENCE_OF_constraint }, + asn_MBR_tci_StatesPDCCH_ToReleaseList_22, + 1, /* Single element */ + &asn_SPC_tci_StatesPDCCH_ToReleaseList_specs_22 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_tci_PresentInDCI_value2enum_24[] = { + { 0, 7, "enabled" } +}; +static const unsigned int asn_MAP_tci_PresentInDCI_enum2value_24[] = { + 0 /* enabled(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_tci_PresentInDCI_specs_24 = { + asn_MAP_tci_PresentInDCI_value2enum_24, /* "tag" => N; sorted by tag */ + asn_MAP_tci_PresentInDCI_enum2value_24, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_tci_PresentInDCI_tags_24[] = { + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_tci_PresentInDCI_24 = { + "tci-PresentInDCI", + "tci-PresentInDCI", + &asn_OP_NativeEnumerated, + asn_DEF_tci_PresentInDCI_tags_24, + sizeof(asn_DEF_tci_PresentInDCI_tags_24) + /sizeof(asn_DEF_tci_PresentInDCI_tags_24[0]) - 1, /* 1 */ + asn_DEF_tci_PresentInDCI_tags_24, /* Same as above */ + sizeof(asn_DEF_tci_PresentInDCI_tags_24) + /sizeof(asn_DEF_tci_PresentInDCI_tags_24[0]), /* 2 */ + { &asn_OER_type_tci_PresentInDCI_constr_24, &asn_PER_type_tci_PresentInDCI_constr_24, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_tci_PresentInDCI_specs_24 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_ControlResourceSet_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet, controlResourceSetId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlResourceSetId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "controlResourceSetId" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet, frequencyDomainResources), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_frequencyDomainResources_constr_3, &asn_PER_memb_frequencyDomainResources_constr_3, memb_frequencyDomainResources_constraint_1 }, + 0, 0, /* No default value */ + "frequencyDomainResources" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet, duration), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_duration_constr_4, &asn_PER_memb_duration_constr_4, memb_duration_constraint_1 }, + 0, 0, /* No default value */ + "duration" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet, cce_REG_MappingType), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_cce_REG_MappingType_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cce-REG-MappingType" + }, + { ATF_NOFLAGS, 0, offsetof(struct ControlResourceSet, precoderGranularity), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_precoderGranularity_17, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "precoderGranularity" + }, + { ATF_POINTER, 4, offsetof(struct ControlResourceSet, tci_StatesPDCCH_ToAddList), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + 0, + &asn_DEF_tci_StatesPDCCH_ToAddList_20, + 0, + { &asn_OER_memb_tci_StatesPDCCH_ToAddList_constr_20, &asn_PER_memb_tci_StatesPDCCH_ToAddList_constr_20, memb_tci_StatesPDCCH_ToAddList_constraint_1 }, + 0, 0, /* No default value */ + "tci-StatesPDCCH-ToAddList" + }, + { ATF_POINTER, 3, offsetof(struct ControlResourceSet, tci_StatesPDCCH_ToReleaseList), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + 0, + &asn_DEF_tci_StatesPDCCH_ToReleaseList_22, + 0, + { &asn_OER_memb_tci_StatesPDCCH_ToReleaseList_constr_22, &asn_PER_memb_tci_StatesPDCCH_ToReleaseList_constr_22, memb_tci_StatesPDCCH_ToReleaseList_constraint_1 }, + 0, 0, /* No default value */ + "tci-StatesPDCCH-ToReleaseList" + }, + { ATF_POINTER, 2, offsetof(struct ControlResourceSet, tci_PresentInDCI), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_tci_PresentInDCI_24, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "tci-PresentInDCI" + }, + { ATF_POINTER, 1, offsetof(struct ControlResourceSet, pdcch_DMRS_ScramblingID), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_pdcch_DMRS_ScramblingID_constr_26, &asn_PER_memb_pdcch_DMRS_ScramblingID_constr_26, memb_pdcch_DMRS_ScramblingID_constraint_1 }, + 0, 0, /* No default value */ + "pdcch-DMRS-ScramblingID" + }, +}; +static const int asn_MAP_ControlResourceSet_oms_1[] = { 5, 6, 7, 8 }; +static const ber_tlv_tag_t asn_DEF_ControlResourceSet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ControlResourceSet_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* controlResourceSetId */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* frequencyDomainResources */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* duration */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* cce-REG-MappingType */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* precoderGranularity */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* tci-StatesPDCCH-ToAddList */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* tci-StatesPDCCH-ToReleaseList */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* tci-PresentInDCI */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* pdcch-DMRS-ScramblingID */ +}; +asn_SEQUENCE_specifics_t asn_SPC_ControlResourceSet_specs_1 = { + sizeof(struct ControlResourceSet), + offsetof(struct ControlResourceSet, _asn_ctx), + asn_MAP_ControlResourceSet_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_ControlResourceSet_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + 9, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_ControlResourceSet = { + "ControlResourceSet", + "ControlResourceSet", + &asn_OP_SEQUENCE, + asn_DEF_ControlResourceSet_tags_1, + sizeof(asn_DEF_ControlResourceSet_tags_1) + /sizeof(asn_DEF_ControlResourceSet_tags_1[0]), /* 1 */ + asn_DEF_ControlResourceSet_tags_1, /* Same as above */ + sizeof(asn_DEF_ControlResourceSet_tags_1) + /sizeof(asn_DEF_ControlResourceSet_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ControlResourceSet_1, + 9, /* Elements count */ + &asn_SPC_ControlResourceSet_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/ControlResourceSet.h b/src/codec_utils/SYSINFO/ControlResourceSet.h new file mode 100644 index 000000000..714b7b491 --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSet.h @@ -0,0 +1,114 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ControlResourceSet_H_ +#define _ControlResourceSet_H_ + + +#include + +/* Including external dependencies */ +#include "ControlResourceSetId.h" +#include +#include +#include +#include +#include +#include +#include "TCI-StateId.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ControlResourceSet__cce_REG_MappingType_PR { + ControlResourceSet__cce_REG_MappingType_PR_NOTHING, /* No components present */ + ControlResourceSet__cce_REG_MappingType_PR_interleaved, + ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved +} ControlResourceSet__cce_REG_MappingType_PR; +typedef enum ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize { + ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n2 = 0, + ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n3 = 1, + ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6 = 2 +} e_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize; +typedef enum ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize { + ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2 = 0, + ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n3 = 1, + ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6 = 2 +} e_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize; +typedef enum ControlResourceSet__precoderGranularity { + ControlResourceSet__precoderGranularity_sameAsREG_bundle = 0, + ControlResourceSet__precoderGranularity_allContiguousRBs = 1 +} e_ControlResourceSet__precoderGranularity; +typedef enum ControlResourceSet__tci_PresentInDCI { + ControlResourceSet__tci_PresentInDCI_enabled = 0 +} e_ControlResourceSet__tci_PresentInDCI; + +/* ControlResourceSet */ +typedef struct ControlResourceSet { + ControlResourceSetId_t controlResourceSetId; + BIT_STRING_t frequencyDomainResources; + long duration; + struct ControlResourceSet__cce_REG_MappingType { + ControlResourceSet__cce_REG_MappingType_PR present; + union ControlResourceSet__cce_REG_MappingType_u { + struct ControlResourceSet__cce_REG_MappingType__interleaved { + long reg_BundleSize; + long interleaverSize; + long *shiftIndex; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *interleaved; + NULL_t nonInterleaved; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } cce_REG_MappingType; + long precoderGranularity; + struct ControlResourceSet__tci_StatesPDCCH_ToAddList { + A_SEQUENCE_OF(TCI_StateId_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *tci_StatesPDCCH_ToAddList; + struct ControlResourceSet__tci_StatesPDCCH_ToReleaseList { + A_SEQUENCE_OF(TCI_StateId_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *tci_StatesPDCCH_ToReleaseList; + long *tci_PresentInDCI; /* OPTIONAL */ + long *pdcch_DMRS_ScramblingID; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ControlResourceSet_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_reg_BundleSize_7; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_interleaverSize_11; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_precoderGranularity_17; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_tci_PresentInDCI_24; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_ControlResourceSet; +extern asn_SEQUENCE_specifics_t asn_SPC_ControlResourceSet_specs_1; +extern asn_TYPE_member_t asn_MBR_ControlResourceSet_1[9]; + +#ifdef __cplusplus +} +#endif + +#endif /* _ControlResourceSet_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/ControlResourceSetId.c b/src/codec_utils/SYSINFO/ControlResourceSetId.c new file mode 100644 index 000000000..dafa9ff9b --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSetId.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ControlResourceSetId.h" + +int +ControlResourceSetId_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 11)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_ControlResourceSetId_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..11) */, + -1}; +asn_per_constraints_t asn_PER_type_ControlResourceSetId_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 11 } /* (0..11) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_ControlResourceSetId_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ControlResourceSetId = { + "ControlResourceSetId", + "ControlResourceSetId", + &asn_OP_NativeInteger, + asn_DEF_ControlResourceSetId_tags_1, + sizeof(asn_DEF_ControlResourceSetId_tags_1) + /sizeof(asn_DEF_ControlResourceSetId_tags_1[0]), /* 1 */ + asn_DEF_ControlResourceSetId_tags_1, /* Same as above */ + sizeof(asn_DEF_ControlResourceSetId_tags_1) + /sizeof(asn_DEF_ControlResourceSetId_tags_1[0]), /* 1 */ + { &asn_OER_type_ControlResourceSetId_constr_1, &asn_PER_type_ControlResourceSetId_constr_1, ControlResourceSetId_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/ControlResourceSetId.h b/src/codec_utils/SYSINFO/ControlResourceSetId.h new file mode 100644 index 000000000..3865ed5a5 --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSetId.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ControlResourceSetId_H_ +#define _ControlResourceSetId_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ControlResourceSetId */ +typedef long ControlResourceSetId_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_ControlResourceSetId_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_ControlResourceSetId; +asn_struct_free_f ControlResourceSetId_free; +asn_struct_print_f ControlResourceSetId_print; +asn_constr_check_f ControlResourceSetId_constraint; +ber_type_decoder_f ControlResourceSetId_decode_ber; +der_type_encoder_f ControlResourceSetId_encode_der; +xer_type_decoder_f ControlResourceSetId_decode_xer; +xer_type_encoder_f ControlResourceSetId_encode_xer; +oer_type_decoder_f ControlResourceSetId_decode_oer; +oer_type_encoder_f ControlResourceSetId_encode_oer; +per_type_decoder_f ControlResourceSetId_decode_uper; +per_type_encoder_f ControlResourceSetId_encode_uper; +per_type_decoder_f ControlResourceSetId_decode_aper; +per_type_encoder_f ControlResourceSetId_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ControlResourceSetId_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/ControlResourceSetZero.c b/src/codec_utils/SYSINFO/ControlResourceSetZero.c new file mode 100644 index 000000000..e5803ea0e --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSetZero.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ControlResourceSetZero.h" + +int +ControlResourceSetZero_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_ControlResourceSetZero_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +asn_per_constraints_t asn_PER_type_ControlResourceSetZero_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_ControlResourceSetZero_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ControlResourceSetZero = { + "ControlResourceSetZero", + "ControlResourceSetZero", + &asn_OP_NativeInteger, + asn_DEF_ControlResourceSetZero_tags_1, + sizeof(asn_DEF_ControlResourceSetZero_tags_1) + /sizeof(asn_DEF_ControlResourceSetZero_tags_1[0]), /* 1 */ + asn_DEF_ControlResourceSetZero_tags_1, /* Same as above */ + sizeof(asn_DEF_ControlResourceSetZero_tags_1) + /sizeof(asn_DEF_ControlResourceSetZero_tags_1[0]), /* 1 */ + { &asn_OER_type_ControlResourceSetZero_constr_1, &asn_PER_type_ControlResourceSetZero_constr_1, ControlResourceSetZero_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/ControlResourceSetZero.h b/src/codec_utils/SYSINFO/ControlResourceSetZero.h new file mode 100644 index 000000000..55de11b19 --- /dev/null +++ b/src/codec_utils/SYSINFO/ControlResourceSetZero.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ControlResourceSetZero_H_ +#define _ControlResourceSetZero_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ControlResourceSetZero */ +typedef long ControlResourceSetZero_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_ControlResourceSetZero_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_ControlResourceSetZero; +asn_struct_free_f ControlResourceSetZero_free; +asn_struct_print_f ControlResourceSetZero_print; +asn_constr_check_f ControlResourceSetZero_constraint; +ber_type_decoder_f ControlResourceSetZero_decode_ber; +der_type_encoder_f ControlResourceSetZero_encode_der; +xer_type_decoder_f ControlResourceSetZero_decode_xer; +xer_type_encoder_f ControlResourceSetZero_encode_xer; +oer_type_decoder_f ControlResourceSetZero_decode_oer; +oer_type_encoder_f ControlResourceSetZero_encode_oer; +per_type_decoder_f ControlResourceSetZero_decode_uper; +per_type_encoder_f ControlResourceSetZero_encode_uper; +per_type_decoder_f ControlResourceSetZero_decode_aper; +per_type_encoder_f ControlResourceSetZero_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ControlResourceSetZero_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.c b/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.c new file mode 100644 index 000000000..fc55c19e5 --- /dev/null +++ b/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.c @@ -0,0 +1,80 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "DownlinkConfigCommonSIB.h" + +asn_TYPE_member_t asn_MBR_DownlinkConfigCommonSIB_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct DownlinkConfigCommonSIB, frequencyInfoDL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoDL_SIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "frequencyInfoDL" + }, + { ATF_NOFLAGS, 0, offsetof(struct DownlinkConfigCommonSIB, initialDownlinkBWP), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BWP_DownlinkCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "initialDownlinkBWP" + }, + { ATF_NOFLAGS, 0, offsetof(struct DownlinkConfigCommonSIB, bcch_Config), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCH_Config, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "bcch-Config" + }, + { ATF_NOFLAGS, 0, offsetof(struct DownlinkConfigCommonSIB, pcch_Config), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PCCH_Config, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pcch-Config" + }, +}; +static const ber_tlv_tag_t asn_DEF_DownlinkConfigCommonSIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_DownlinkConfigCommonSIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyInfoDL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* initialDownlinkBWP */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* bcch-Config */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pcch-Config */ +}; +asn_SEQUENCE_specifics_t asn_SPC_DownlinkConfigCommonSIB_specs_1 = { + sizeof(struct DownlinkConfigCommonSIB), + offsetof(struct DownlinkConfigCommonSIB, _asn_ctx), + asn_MAP_DownlinkConfigCommonSIB_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_DownlinkConfigCommonSIB = { + "DownlinkConfigCommonSIB", + "DownlinkConfigCommonSIB", + &asn_OP_SEQUENCE, + asn_DEF_DownlinkConfigCommonSIB_tags_1, + sizeof(asn_DEF_DownlinkConfigCommonSIB_tags_1) + /sizeof(asn_DEF_DownlinkConfigCommonSIB_tags_1[0]), /* 1 */ + asn_DEF_DownlinkConfigCommonSIB_tags_1, /* Same as above */ + sizeof(asn_DEF_DownlinkConfigCommonSIB_tags_1) + /sizeof(asn_DEF_DownlinkConfigCommonSIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_DownlinkConfigCommonSIB_1, + 4, /* Elements count */ + &asn_SPC_DownlinkConfigCommonSIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.h b/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.h new file mode 100644 index 000000000..c2b5d219e --- /dev/null +++ b/src/codec_utils/SYSINFO/DownlinkConfigCommonSIB.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _DownlinkConfigCommonSIB_H_ +#define _DownlinkConfigCommonSIB_H_ + + +#include + +/* Including external dependencies */ +#include "FrequencyInfoDL-SIB.h" +#include "BWP-DownlinkCommon.h" +#include "BCCH-Config.h" +#include "PCCH-Config.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* DownlinkConfigCommonSIB */ +typedef struct DownlinkConfigCommonSIB { + FrequencyInfoDL_SIB_t frequencyInfoDL; + BWP_DownlinkCommon_t initialDownlinkBWP; + BCCH_Config_t bcch_Config; + PCCH_Config_t pcch_Config; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} DownlinkConfigCommonSIB_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DownlinkConfigCommonSIB; +extern asn_SEQUENCE_specifics_t asn_SPC_DownlinkConfigCommonSIB_specs_1; +extern asn_TYPE_member_t asn_MBR_DownlinkConfigCommonSIB_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _DownlinkConfigCommonSIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/FreqBandIndicatorNR.c b/src/codec_utils/SYSINFO/FreqBandIndicatorNR.c new file mode 100644 index 000000000..af7f16094 --- /dev/null +++ b/src/codec_utils/SYSINFO/FreqBandIndicatorNR.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "FreqBandIndicatorNR.h" + +int +FreqBandIndicatorNR_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 1024)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_FreqBandIndicatorNR_constr_1 CC_NOTUSED = { + { 2, 1 } /* (1..1024) */, + -1}; +asn_per_constraints_t asn_PER_type_FreqBandIndicatorNR_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 1, 1024 } /* (1..1024) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FreqBandIndicatorNR_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FreqBandIndicatorNR = { + "FreqBandIndicatorNR", + "FreqBandIndicatorNR", + &asn_OP_NativeInteger, + asn_DEF_FreqBandIndicatorNR_tags_1, + sizeof(asn_DEF_FreqBandIndicatorNR_tags_1) + /sizeof(asn_DEF_FreqBandIndicatorNR_tags_1[0]), /* 1 */ + asn_DEF_FreqBandIndicatorNR_tags_1, /* Same as above */ + sizeof(asn_DEF_FreqBandIndicatorNR_tags_1) + /sizeof(asn_DEF_FreqBandIndicatorNR_tags_1[0]), /* 1 */ + { &asn_OER_type_FreqBandIndicatorNR_constr_1, &asn_PER_type_FreqBandIndicatorNR_constr_1, FreqBandIndicatorNR_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/FreqBandIndicatorNR.h b/src/codec_utils/SYSINFO/FreqBandIndicatorNR.h new file mode 100644 index 000000000..7f1fa8b7a --- /dev/null +++ b/src/codec_utils/SYSINFO/FreqBandIndicatorNR.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _FreqBandIndicatorNR_H_ +#define _FreqBandIndicatorNR_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FreqBandIndicatorNR */ +typedef long FreqBandIndicatorNR_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_FreqBandIndicatorNR_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_FreqBandIndicatorNR; +asn_struct_free_f FreqBandIndicatorNR_free; +asn_struct_print_f FreqBandIndicatorNR_print; +asn_constr_check_f FreqBandIndicatorNR_constraint; +ber_type_decoder_f FreqBandIndicatorNR_decode_ber; +der_type_encoder_f FreqBandIndicatorNR_encode_der; +xer_type_decoder_f FreqBandIndicatorNR_decode_xer; +xer_type_encoder_f FreqBandIndicatorNR_encode_xer; +oer_type_decoder_f FreqBandIndicatorNR_decode_oer; +oer_type_encoder_f FreqBandIndicatorNR_encode_oer; +per_type_decoder_f FreqBandIndicatorNR_decode_uper; +per_type_encoder_f FreqBandIndicatorNR_encode_uper; +per_type_decoder_f FreqBandIndicatorNR_decode_aper; +per_type_encoder_f FreqBandIndicatorNR_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FreqBandIndicatorNR_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.c b/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.c new file mode 100644 index 000000000..554b540aa --- /dev/null +++ b/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.c @@ -0,0 +1,183 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "FrequencyInfoDL-SIB.h" + +#include "SCS-SpecificCarrier.h" +static int +memb_offsetToPointA_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2199)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_scs_SpecificCarrierList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 5)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..5)) */}; +static asn_per_constraints_t asn_PER_type_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_offsetToPointA_constr_3 CC_NOTUSED = { + { 2, 1 } /* (0..2199) */, + -1}; +static asn_per_constraints_t asn_PER_memb_offsetToPointA_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2199 } /* (0..2199) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..5)) */}; +static asn_per_constraints_t asn_PER_memb_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_scs_SpecificCarrierList_4[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SCS_SpecificCarrier, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_scs_SpecificCarrierList_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_scs_SpecificCarrierList_specs_4 = { + sizeof(struct FrequencyInfoDL_SIB__scs_SpecificCarrierList), + offsetof(struct FrequencyInfoDL_SIB__scs_SpecificCarrierList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_scs_SpecificCarrierList_4 = { + "scs-SpecificCarrierList", + "scs-SpecificCarrierList", + &asn_OP_SEQUENCE_OF, + asn_DEF_scs_SpecificCarrierList_tags_4, + sizeof(asn_DEF_scs_SpecificCarrierList_tags_4) + /sizeof(asn_DEF_scs_SpecificCarrierList_tags_4[0]) - 1, /* 1 */ + asn_DEF_scs_SpecificCarrierList_tags_4, /* Same as above */ + sizeof(asn_DEF_scs_SpecificCarrierList_tags_4) + /sizeof(asn_DEF_scs_SpecificCarrierList_tags_4[0]), /* 2 */ + { &asn_OER_type_scs_SpecificCarrierList_constr_4, &asn_PER_type_scs_SpecificCarrierList_constr_4, SEQUENCE_OF_constraint }, + asn_MBR_scs_SpecificCarrierList_4, + 1, /* Single element */ + &asn_SPC_scs_SpecificCarrierList_specs_4 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_FrequencyInfoDL_SIB_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoDL_SIB, frequencyBandList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrequencyBandListNR_SIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "frequencyBandList" + }, + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoDL_SIB, offsetToPointA), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_offsetToPointA_constr_3, &asn_PER_memb_offsetToPointA_constr_3, memb_offsetToPointA_constraint_1 }, + 0, 0, /* No default value */ + "offsetToPointA" + }, + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoDL_SIB, scs_SpecificCarrierList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_scs_SpecificCarrierList_4, + 0, + { &asn_OER_memb_scs_SpecificCarrierList_constr_4, &asn_PER_memb_scs_SpecificCarrierList_constr_4, memb_scs_SpecificCarrierList_constraint_1 }, + 0, 0, /* No default value */ + "scs-SpecificCarrierList" + }, +}; +static const ber_tlv_tag_t asn_DEF_FrequencyInfoDL_SIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FrequencyInfoDL_SIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyBandList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* offsetToPointA */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* scs-SpecificCarrierList */ +}; +asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoDL_SIB_specs_1 = { + sizeof(struct FrequencyInfoDL_SIB), + offsetof(struct FrequencyInfoDL_SIB, _asn_ctx), + asn_MAP_FrequencyInfoDL_SIB_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_FrequencyInfoDL_SIB = { + "FrequencyInfoDL-SIB", + "FrequencyInfoDL-SIB", + &asn_OP_SEQUENCE, + asn_DEF_FrequencyInfoDL_SIB_tags_1, + sizeof(asn_DEF_FrequencyInfoDL_SIB_tags_1) + /sizeof(asn_DEF_FrequencyInfoDL_SIB_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoDL_SIB_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoDL_SIB_tags_1) + /sizeof(asn_DEF_FrequencyInfoDL_SIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_FrequencyInfoDL_SIB_1, + 3, /* Elements count */ + &asn_SPC_FrequencyInfoDL_SIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.h b/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.h new file mode 100644 index 000000000..9ea3fa582 --- /dev/null +++ b/src/codec_utils/SYSINFO/FrequencyInfoDL-SIB.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _FrequencyInfoDL_SIB_H_ +#define _FrequencyInfoDL_SIB_H_ + + +#include + +/* Including external dependencies */ +#include "MultiFrequencyBandListNR-SIB.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SCS_SpecificCarrier; + +/* FrequencyInfoDL-SIB */ +typedef struct FrequencyInfoDL_SIB { + MultiFrequencyBandListNR_SIB_t frequencyBandList; + long offsetToPointA; + struct FrequencyInfoDL_SIB__scs_SpecificCarrierList { + A_SEQUENCE_OF(struct SCS_SpecificCarrier) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } scs_SpecificCarrierList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FrequencyInfoDL_SIB_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrequencyInfoDL_SIB; +extern asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoDL_SIB_specs_1; +extern asn_TYPE_member_t asn_MBR_FrequencyInfoDL_SIB_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrequencyInfoDL_SIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.c b/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.c new file mode 100644 index 000000000..20510e582 --- /dev/null +++ b/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.c @@ -0,0 +1,220 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "FrequencyInfoUL-SIB.h" + +#include "MultiFrequencyBandListNR-SIB.h" +#include "SCS-SpecificCarrier.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_scs_SpecificCarrierList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 5)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..5)) */}; +static asn_per_constraints_t asn_PER_type_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_frequencyShift7p5khz_constr_7 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_frequencyShift7p5khz_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..5)) */}; +static asn_per_constraints_t asn_PER_memb_scs_SpecificCarrierList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_scs_SpecificCarrierList_4[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SCS_SpecificCarrier, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_scs_SpecificCarrierList_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_scs_SpecificCarrierList_specs_4 = { + sizeof(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList), + offsetof(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_scs_SpecificCarrierList_4 = { + "scs-SpecificCarrierList", + "scs-SpecificCarrierList", + &asn_OP_SEQUENCE_OF, + asn_DEF_scs_SpecificCarrierList_tags_4, + sizeof(asn_DEF_scs_SpecificCarrierList_tags_4) + /sizeof(asn_DEF_scs_SpecificCarrierList_tags_4[0]) - 1, /* 1 */ + asn_DEF_scs_SpecificCarrierList_tags_4, /* Same as above */ + sizeof(asn_DEF_scs_SpecificCarrierList_tags_4) + /sizeof(asn_DEF_scs_SpecificCarrierList_tags_4[0]), /* 2 */ + { &asn_OER_type_scs_SpecificCarrierList_constr_4, &asn_PER_type_scs_SpecificCarrierList_constr_4, SEQUENCE_OF_constraint }, + asn_MBR_scs_SpecificCarrierList_4, + 1, /* Single element */ + &asn_SPC_scs_SpecificCarrierList_specs_4 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_frequencyShift7p5khz_value2enum_7[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_frequencyShift7p5khz_enum2value_7[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_frequencyShift7p5khz_specs_7 = { + asn_MAP_frequencyShift7p5khz_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_frequencyShift7p5khz_enum2value_7, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_frequencyShift7p5khz_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_frequencyShift7p5khz_7 = { + "frequencyShift7p5khz", + "frequencyShift7p5khz", + &asn_OP_NativeEnumerated, + asn_DEF_frequencyShift7p5khz_tags_7, + sizeof(asn_DEF_frequencyShift7p5khz_tags_7) + /sizeof(asn_DEF_frequencyShift7p5khz_tags_7[0]) - 1, /* 1 */ + asn_DEF_frequencyShift7p5khz_tags_7, /* Same as above */ + sizeof(asn_DEF_frequencyShift7p5khz_tags_7) + /sizeof(asn_DEF_frequencyShift7p5khz_tags_7[0]), /* 2 */ + { &asn_OER_type_frequencyShift7p5khz_constr_7, &asn_PER_type_frequencyShift7p5khz_constr_7, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_frequencyShift7p5khz_specs_7 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_FrequencyInfoUL_SIB_1[] = { + { ATF_POINTER, 2, offsetof(struct FrequencyInfoUL_SIB, frequencyBandList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrequencyBandListNR_SIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "frequencyBandList" + }, + { ATF_POINTER, 1, offsetof(struct FrequencyInfoUL_SIB, absoluteFrequencyPointA), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ARFCN_ValueNR, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "absoluteFrequencyPointA" + }, + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoUL_SIB, scs_SpecificCarrierList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_scs_SpecificCarrierList_4, + 0, + { &asn_OER_memb_scs_SpecificCarrierList_constr_4, &asn_PER_memb_scs_SpecificCarrierList_constr_4, memb_scs_SpecificCarrierList_constraint_1 }, + 0, 0, /* No default value */ + "scs-SpecificCarrierList" + }, + { ATF_POINTER, 2, offsetof(struct FrequencyInfoUL_SIB, p_Max), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_P_Max, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "p-Max" + }, + { ATF_POINTER, 1, offsetof(struct FrequencyInfoUL_SIB, frequencyShift7p5khz), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_frequencyShift7p5khz_7, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "frequencyShift7p5khz" + }, +}; +static const int asn_MAP_FrequencyInfoUL_SIB_oms_1[] = { 0, 1, 3, 4 }; +static const ber_tlv_tag_t asn_DEF_FrequencyInfoUL_SIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FrequencyInfoUL_SIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyBandList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* absoluteFrequencyPointA */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* scs-SpecificCarrierList */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* p-Max */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* frequencyShift7p5khz */ +}; +asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoUL_SIB_specs_1 = { + sizeof(struct FrequencyInfoUL_SIB), + offsetof(struct FrequencyInfoUL_SIB, _asn_ctx), + asn_MAP_FrequencyInfoUL_SIB_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_FrequencyInfoUL_SIB_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + 5, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_FrequencyInfoUL_SIB = { + "FrequencyInfoUL-SIB", + "FrequencyInfoUL-SIB", + &asn_OP_SEQUENCE, + asn_DEF_FrequencyInfoUL_SIB_tags_1, + sizeof(asn_DEF_FrequencyInfoUL_SIB_tags_1) + /sizeof(asn_DEF_FrequencyInfoUL_SIB_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoUL_SIB_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoUL_SIB_tags_1) + /sizeof(asn_DEF_FrequencyInfoUL_SIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_FrequencyInfoUL_SIB_1, + 5, /* Elements count */ + &asn_SPC_FrequencyInfoUL_SIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.h b/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.h new file mode 100644 index 000000000..fbe77fcb0 --- /dev/null +++ b/src/codec_utils/SYSINFO/FrequencyInfoUL-SIB.h @@ -0,0 +1,67 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _FrequencyInfoUL_SIB_H_ +#define _FrequencyInfoUL_SIB_H_ + + +#include + +/* Including external dependencies */ +#include "ARFCN-ValueNR.h" +#include "P-Max.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FrequencyInfoUL_SIB__frequencyShift7p5khz { + FrequencyInfoUL_SIB__frequencyShift7p5khz_true = 0 +} e_FrequencyInfoUL_SIB__frequencyShift7p5khz; + +/* Forward declarations */ +struct MultiFrequencyBandListNR_SIB; +struct SCS_SpecificCarrier; + +/* FrequencyInfoUL-SIB */ +typedef struct FrequencyInfoUL_SIB { + struct MultiFrequencyBandListNR_SIB *frequencyBandList; /* OPTIONAL */ + ARFCN_ValueNR_t *absoluteFrequencyPointA; /* OPTIONAL */ + struct FrequencyInfoUL_SIB__scs_SpecificCarrierList { + A_SEQUENCE_OF(struct SCS_SpecificCarrier) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } scs_SpecificCarrierList; + P_Max_t *p_Max; /* OPTIONAL */ + long *frequencyShift7p5khz; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FrequencyInfoUL_SIB_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_frequencyShift7p5khz_7; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_FrequencyInfoUL_SIB; +extern asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoUL_SIB_specs_1; +extern asn_TYPE_member_t asn_MBR_FrequencyInfoUL_SIB_1[5]; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrequencyInfoUL_SIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/MCC-MNC-Digit.c b/src/codec_utils/SYSINFO/MCC-MNC-Digit.c new file mode 100644 index 000000000..fa54f88d0 --- /dev/null +++ b/src/codec_utils/SYSINFO/MCC-MNC-Digit.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "MCC-MNC-Digit.h" + +int +MCC_MNC_Digit_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 9)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_MCC_MNC_Digit_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..9) */, + -1}; +asn_per_constraints_t asn_PER_type_MCC_MNC_Digit_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 9 } /* (0..9) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_MCC_MNC_Digit_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MCC_MNC_Digit = { + "MCC-MNC-Digit", + "MCC-MNC-Digit", + &asn_OP_NativeInteger, + asn_DEF_MCC_MNC_Digit_tags_1, + sizeof(asn_DEF_MCC_MNC_Digit_tags_1) + /sizeof(asn_DEF_MCC_MNC_Digit_tags_1[0]), /* 1 */ + asn_DEF_MCC_MNC_Digit_tags_1, /* Same as above */ + sizeof(asn_DEF_MCC_MNC_Digit_tags_1) + /sizeof(asn_DEF_MCC_MNC_Digit_tags_1[0]), /* 1 */ + { &asn_OER_type_MCC_MNC_Digit_constr_1, &asn_PER_type_MCC_MNC_Digit_constr_1, MCC_MNC_Digit_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/MCC-MNC-Digit.h b/src/codec_utils/SYSINFO/MCC-MNC-Digit.h new file mode 100644 index 000000000..774ef7dc4 --- /dev/null +++ b/src/codec_utils/SYSINFO/MCC-MNC-Digit.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _MCC_MNC_Digit_H_ +#define _MCC_MNC_Digit_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MCC-MNC-Digit */ +typedef long MCC_MNC_Digit_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_MCC_MNC_Digit_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_MCC_MNC_Digit; +asn_struct_free_f MCC_MNC_Digit_free; +asn_struct_print_f MCC_MNC_Digit_print; +asn_constr_check_f MCC_MNC_Digit_constraint; +ber_type_decoder_f MCC_MNC_Digit_decode_ber; +der_type_encoder_f MCC_MNC_Digit_encode_der; +xer_type_decoder_f MCC_MNC_Digit_decode_xer; +xer_type_encoder_f MCC_MNC_Digit_encode_xer; +oer_type_decoder_f MCC_MNC_Digit_decode_oer; +oer_type_encoder_f MCC_MNC_Digit_encode_oer; +per_type_decoder_f MCC_MNC_Digit_decode_uper; +per_type_encoder_f MCC_MNC_Digit_encode_uper; +per_type_decoder_f MCC_MNC_Digit_decode_aper; +per_type_encoder_f MCC_MNC_Digit_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MCC_MNC_Digit_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/MCC.c b/src/codec_utils/SYSINFO/MCC.c new file mode 100644 index 000000000..36ce36924 --- /dev/null +++ b/src/codec_utils/SYSINFO/MCC.c @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "MCC.h" + +static asn_oer_constraints_t asn_OER_type_MCC_constr_1 CC_NOTUSED = { + { 0, 0 }, + 3 /* (SIZE(3..3)) */}; +asn_per_constraints_t asn_PER_type_MCC_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 3, 3 } /* (SIZE(3..3)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_MCC_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_MCC_MNC_Digit, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_MCC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_MCC_specs_1 = { + sizeof(struct MCC), + offsetof(struct MCC, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_MCC = { + "MCC", + "MCC", + &asn_OP_SEQUENCE_OF, + asn_DEF_MCC_tags_1, + sizeof(asn_DEF_MCC_tags_1) + /sizeof(asn_DEF_MCC_tags_1[0]), /* 1 */ + asn_DEF_MCC_tags_1, /* Same as above */ + sizeof(asn_DEF_MCC_tags_1) + /sizeof(asn_DEF_MCC_tags_1[0]), /* 1 */ + { &asn_OER_type_MCC_constr_1, &asn_PER_type_MCC_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_MCC_1, + 1, /* Single element */ + &asn_SPC_MCC_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/MCC.h b/src/codec_utils/SYSINFO/MCC.h new file mode 100644 index 000000000..1b582cdc4 --- /dev/null +++ b/src/codec_utils/SYSINFO/MCC.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _MCC_H_ +#define _MCC_H_ + + +#include + +/* Including external dependencies */ +#include "MCC-MNC-Digit.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MCC */ +typedef struct MCC { + A_SEQUENCE_OF(MCC_MNC_Digit_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MCC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MCC; +extern asn_SET_OF_specifics_t asn_SPC_MCC_specs_1; +extern asn_TYPE_member_t asn_MBR_MCC_1[1]; +extern asn_per_constraints_t asn_PER_type_MCC_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _MCC_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/MIB.c b/src/codec_utils/SYSINFO/MIB.c new file mode 100644 index 000000000..afca43f78 --- /dev/null +++ b/src/codec_utils/SYSINFO/MIB.c @@ -0,0 +1,427 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "MIB.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_systemFrameNumber_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 6)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ssb_SubcarrierOffset_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_spare_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 1)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_subCarrierSpacingCommon_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_subCarrierSpacingCommon_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_dmrs_TypeA_Position_constr_7 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dmrs_TypeA_Position_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_cellBarred_constr_11 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_cellBarred_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_intraFreqReselection_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_intraFreqReselection_constr_14 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_systemFrameNumber_constr_2 CC_NOTUSED = { + { 0, 0 }, + 6 /* (SIZE(6..6)) */}; +static asn_per_constraints_t asn_PER_memb_systemFrameNumber_constr_2 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_ssb_SubcarrierOffset_constr_6 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_ssb_SubcarrierOffset_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_spare_constr_17 CC_NOTUSED = { + { 0, 0 }, + 1 /* (SIZE(1..1)) */}; +static asn_per_constraints_t asn_PER_memb_spare_constr_17 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_subCarrierSpacingCommon_value2enum_3[] = { + { 0, 9, "scs15or60" }, + { 1, 10, "scs30or120" } +}; +static const unsigned int asn_MAP_subCarrierSpacingCommon_enum2value_3[] = { + 0, /* scs15or60(0) */ + 1 /* scs30or120(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_subCarrierSpacingCommon_specs_3 = { + asn_MAP_subCarrierSpacingCommon_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_subCarrierSpacingCommon_enum2value_3, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_subCarrierSpacingCommon_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_subCarrierSpacingCommon_3 = { + "subCarrierSpacingCommon", + "subCarrierSpacingCommon", + &asn_OP_NativeEnumerated, + asn_DEF_subCarrierSpacingCommon_tags_3, + sizeof(asn_DEF_subCarrierSpacingCommon_tags_3) + /sizeof(asn_DEF_subCarrierSpacingCommon_tags_3[0]) - 1, /* 1 */ + asn_DEF_subCarrierSpacingCommon_tags_3, /* Same as above */ + sizeof(asn_DEF_subCarrierSpacingCommon_tags_3) + /sizeof(asn_DEF_subCarrierSpacingCommon_tags_3[0]), /* 2 */ + { &asn_OER_type_subCarrierSpacingCommon_constr_3, &asn_PER_type_subCarrierSpacingCommon_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_subCarrierSpacingCommon_specs_3 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_dmrs_TypeA_Position_value2enum_7[] = { + { 0, 4, "pos2" }, + { 1, 4, "pos3" } +}; +static const unsigned int asn_MAP_dmrs_TypeA_Position_enum2value_7[] = { + 0, /* pos2(0) */ + 1 /* pos3(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dmrs_TypeA_Position_specs_7 = { + asn_MAP_dmrs_TypeA_Position_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_dmrs_TypeA_Position_enum2value_7, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dmrs_TypeA_Position_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dmrs_TypeA_Position_7 = { + "dmrs-TypeA-Position", + "dmrs-TypeA-Position", + &asn_OP_NativeEnumerated, + asn_DEF_dmrs_TypeA_Position_tags_7, + sizeof(asn_DEF_dmrs_TypeA_Position_tags_7) + /sizeof(asn_DEF_dmrs_TypeA_Position_tags_7[0]) - 1, /* 1 */ + asn_DEF_dmrs_TypeA_Position_tags_7, /* Same as above */ + sizeof(asn_DEF_dmrs_TypeA_Position_tags_7) + /sizeof(asn_DEF_dmrs_TypeA_Position_tags_7[0]), /* 2 */ + { &asn_OER_type_dmrs_TypeA_Position_constr_7, &asn_PER_type_dmrs_TypeA_Position_constr_7, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dmrs_TypeA_Position_specs_7 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_cellBarred_value2enum_11[] = { + { 0, 6, "barred" }, + { 1, 9, "notBarred" } +}; +static const unsigned int asn_MAP_cellBarred_enum2value_11[] = { + 0, /* barred(0) */ + 1 /* notBarred(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_cellBarred_specs_11 = { + asn_MAP_cellBarred_value2enum_11, /* "tag" => N; sorted by tag */ + asn_MAP_cellBarred_enum2value_11, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_cellBarred_tags_11[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cellBarred_11 = { + "cellBarred", + "cellBarred", + &asn_OP_NativeEnumerated, + asn_DEF_cellBarred_tags_11, + sizeof(asn_DEF_cellBarred_tags_11) + /sizeof(asn_DEF_cellBarred_tags_11[0]) - 1, /* 1 */ + asn_DEF_cellBarred_tags_11, /* Same as above */ + sizeof(asn_DEF_cellBarred_tags_11) + /sizeof(asn_DEF_cellBarred_tags_11[0]), /* 2 */ + { &asn_OER_type_cellBarred_constr_11, &asn_PER_type_cellBarred_constr_11, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_cellBarred_specs_11 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_intraFreqReselection_value2enum_14[] = { + { 0, 7, "allowed" }, + { 1, 10, "notAllowed" } +}; +static const unsigned int asn_MAP_intraFreqReselection_enum2value_14[] = { + 0, /* allowed(0) */ + 1 /* notAllowed(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_intraFreqReselection_specs_14 = { + asn_MAP_intraFreqReselection_value2enum_14, /* "tag" => N; sorted by tag */ + asn_MAP_intraFreqReselection_enum2value_14, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_intraFreqReselection_tags_14[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_intraFreqReselection_14 = { + "intraFreqReselection", + "intraFreqReselection", + &asn_OP_NativeEnumerated, + asn_DEF_intraFreqReselection_tags_14, + sizeof(asn_DEF_intraFreqReselection_tags_14) + /sizeof(asn_DEF_intraFreqReselection_tags_14[0]) - 1, /* 1 */ + asn_DEF_intraFreqReselection_tags_14, /* Same as above */ + sizeof(asn_DEF_intraFreqReselection_tags_14) + /sizeof(asn_DEF_intraFreqReselection_tags_14[0]), /* 2 */ + { &asn_OER_type_intraFreqReselection_constr_14, &asn_PER_type_intraFreqReselection_constr_14, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_intraFreqReselection_specs_14 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_MIB_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MIB, systemFrameNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_systemFrameNumber_constr_2, &asn_PER_memb_systemFrameNumber_constr_2, memb_systemFrameNumber_constraint_1 }, + 0, 0, /* No default value */ + "systemFrameNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, subCarrierSpacingCommon), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_subCarrierSpacingCommon_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "subCarrierSpacingCommon" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, ssb_SubcarrierOffset), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_ssb_SubcarrierOffset_constr_6, &asn_PER_memb_ssb_SubcarrierOffset_constr_6, memb_ssb_SubcarrierOffset_constraint_1 }, + 0, 0, /* No default value */ + "ssb-SubcarrierOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, dmrs_TypeA_Position), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dmrs_TypeA_Position_7, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dmrs-TypeA-Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, pdcch_ConfigSIB1), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PDCCH_ConfigSIB1, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pdcch-ConfigSIB1" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, cellBarred), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_cellBarred_11, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellBarred" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, intraFreqReselection), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_intraFreqReselection_14, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "intraFreqReselection" + }, + { ATF_NOFLAGS, 0, offsetof(struct MIB, spare), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_spare_constr_17, &asn_PER_memb_spare_constr_17, memb_spare_constraint_1 }, + 0, 0, /* No default value */ + "spare" + }, +}; +static const ber_tlv_tag_t asn_DEF_MIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_MIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* systemFrameNumber */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* subCarrierSpacingCommon */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ssb-SubcarrierOffset */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* dmrs-TypeA-Position */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* pdcch-ConfigSIB1 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* cellBarred */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* intraFreqReselection */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* spare */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MIB_specs_1 = { + sizeof(struct MIB), + offsetof(struct MIB, _asn_ctx), + asn_MAP_MIB_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_MIB = { + "MIB", + "MIB", + &asn_OP_SEQUENCE, + asn_DEF_MIB_tags_1, + sizeof(asn_DEF_MIB_tags_1) + /sizeof(asn_DEF_MIB_tags_1[0]), /* 1 */ + asn_DEF_MIB_tags_1, /* Same as above */ + sizeof(asn_DEF_MIB_tags_1) + /sizeof(asn_DEF_MIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_MIB_1, + 8, /* Elements count */ + &asn_SPC_MIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/MIB.h b/src/codec_utils/SYSINFO/MIB.h new file mode 100644 index 000000000..78c124206 --- /dev/null +++ b/src/codec_utils/SYSINFO/MIB.h @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _MIB_H_ +#define _MIB_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include "PDCCH-ConfigSIB1.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum MIB__subCarrierSpacingCommon { + MIB__subCarrierSpacingCommon_scs15or60 = 0, + MIB__subCarrierSpacingCommon_scs30or120 = 1 +} e_MIB__subCarrierSpacingCommon; +typedef enum MIB__dmrs_TypeA_Position { + MIB__dmrs_TypeA_Position_pos2 = 0, + MIB__dmrs_TypeA_Position_pos3 = 1 +} e_MIB__dmrs_TypeA_Position; +typedef enum MIB__cellBarred { + MIB__cellBarred_barred = 0, + MIB__cellBarred_notBarred = 1 +} e_MIB__cellBarred; +typedef enum MIB__intraFreqReselection { + MIB__intraFreqReselection_allowed = 0, + MIB__intraFreqReselection_notAllowed = 1 +} e_MIB__intraFreqReselection; + +/* MIB */ +typedef struct MIB { + BIT_STRING_t systemFrameNumber; + long subCarrierSpacingCommon; + long ssb_SubcarrierOffset; + long dmrs_TypeA_Position; + PDCCH_ConfigSIB1_t pdcch_ConfigSIB1; + long cellBarred; + long intraFreqReselection; + BIT_STRING_t spare; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MIB_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_subCarrierSpacingCommon_3; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_dmrs_TypeA_Position_7; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_cellBarred_11; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_intraFreqReselection_14; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_MIB; + +#ifdef __cplusplus +} +#endif + +#endif /* _MIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/MNC.c b/src/codec_utils/SYSINFO/MNC.c new file mode 100644 index 000000000..491fc1733 --- /dev/null +++ b/src/codec_utils/SYSINFO/MNC.c @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "MNC.h" + +static asn_oer_constraints_t asn_OER_type_MNC_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(2..3)) */}; +asn_per_constraints_t asn_PER_type_MNC_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 1, 1, 2, 3 } /* (SIZE(2..3)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_MNC_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_MCC_MNC_Digit, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_MNC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_MNC_specs_1 = { + sizeof(struct MNC), + offsetof(struct MNC, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_MNC = { + "MNC", + "MNC", + &asn_OP_SEQUENCE_OF, + asn_DEF_MNC_tags_1, + sizeof(asn_DEF_MNC_tags_1) + /sizeof(asn_DEF_MNC_tags_1[0]), /* 1 */ + asn_DEF_MNC_tags_1, /* Same as above */ + sizeof(asn_DEF_MNC_tags_1) + /sizeof(asn_DEF_MNC_tags_1[0]), /* 1 */ + { &asn_OER_type_MNC_constr_1, &asn_PER_type_MNC_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_MNC_1, + 1, /* Single element */ + &asn_SPC_MNC_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/MNC.h b/src/codec_utils/SYSINFO/MNC.h new file mode 100644 index 000000000..fab2ca0bd --- /dev/null +++ b/src/codec_utils/SYSINFO/MNC.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _MNC_H_ +#define _MNC_H_ + + +#include + +/* Including external dependencies */ +#include "MCC-MNC-Digit.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MNC */ +typedef struct MNC { + A_SEQUENCE_OF(MCC_MNC_Digit_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MNC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MNC; +extern asn_SET_OF_specifics_t asn_SPC_MNC_specs_1; +extern asn_TYPE_member_t asn_MBR_MNC_1[1]; +extern asn_per_constraints_t asn_PER_type_MNC_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _MNC_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/Makefile.am.libasncodec b/src/codec_utils/SYSINFO/Makefile.am.libasncodec new file mode 100644 index 000000000..103c7076a --- /dev/null +++ b/src/codec_utils/SYSINFO/Makefile.am.libasncodec @@ -0,0 +1,240 @@ +ASN_MODULE_SRCS= \ + ./mib_sib_out/MIB.c \ + ./mib_sib_out/PDCCH-ConfigSIB1.c \ + ./mib_sib_out/ControlResourceSetZero.c \ + ./mib_sib_out/SearchSpaceZero.c \ + ./mib_sib_out/SIB1.c \ + ./mib_sib_out/UAC-AccessCategory1-SelectionAssistanceInfo.c \ + ./mib_sib_out/Q-QualMin.c \ + ./mib_sib_out/Q-RxLevMin.c \ + ./mib_sib_out/CellAccessRelatedInfo.c \ + ./mib_sib_out/PLMN-IdentityInfoList.c \ + ./mib_sib_out/PLMN-IdentityInfo.c \ + ./mib_sib_out/PLMN-Identity.c \ + ./mib_sib_out/MCC.c \ + ./mib_sib_out/MNC.c \ + ./mib_sib_out/MCC-MNC-Digit.c \ + ./mib_sib_out/TrackingAreaCode.c \ + ./mib_sib_out/RAN-AreaCode.c \ + ./mib_sib_out/CellIdentity.c \ + ./mib_sib_out/ConnEstFailureControl.c \ + ./mib_sib_out/SI-SchedulingInfo.c \ + ./mib_sib_out/SchedulingInfo.c \ + ./mib_sib_out/SIB-Mapping.c \ + ./mib_sib_out/SIB-TypeInfo.c \ + ./mib_sib_out/SI-RequestConfig.c \ + ./mib_sib_out/SI-RequestResources.c \ + ./mib_sib_out/RACH-ConfigGeneric.c \ + ./mib_sib_out/ServingCellConfigCommonSIB.c \ + ./mib_sib_out/DownlinkConfigCommonSIB.c \ + ./mib_sib_out/BCCH-Config.c \ + ./mib_sib_out/PCCH-Config.c \ + ./mib_sib_out/PagingCycle.c \ + ./mib_sib_out/FrequencyInfoDL-SIB.c \ + ./mib_sib_out/MultiFrequencyBandListNR-SIB.c \ + ./mib_sib_out/NR-MultiBandInfo.c \ + ./mib_sib_out/FreqBandIndicatorNR.c \ + ./mib_sib_out/NR-NS-PmaxList.c \ + ./mib_sib_out/NR-NS-PmaxValue.c \ + ./mib_sib_out/P-Max.c \ + ./mib_sib_out/AdditionalSpectrumEmission.c \ + ./mib_sib_out/SCS-SpecificCarrier.c \ + ./mib_sib_out/SubcarrierSpacing.c \ + ./mib_sib_out/BWP-DownlinkCommon.c \ + ./mib_sib_out/PDCCH-ConfigCommon.c \ + ./mib_sib_out/ControlResourceSet.c \ + ./mib_sib_out/ControlResourceSetId.c \ + ./mib_sib_out/SearchSpace.c \ + ./mib_sib_out/SearchSpaceId.c \ + ./mib_sib_out/PDSCH-ConfigCommon.c \ + ./mib_sib_out/PDSCH-TimeDomainResourceAllocationList.c \ + ./mib_sib_out/PDSCH-TimeDomainResourceAllocation.c \ + ./mib_sib_out/UplinkConfigCommonSIB.c \ + ./mib_sib_out/FrequencyInfoUL-SIB.c \ + ./mib_sib_out/ARFCN-ValueNR.c \ + ./mib_sib_out/BWP-UplinkCommon.c \ + ./mib_sib_out/BWP.c \ + ./mib_sib_out/PUSCH-ConfigCommon.c \ + ./mib_sib_out/PUSCH-TimeDomainResourceAllocationList.c \ + ./mib_sib_out/PUSCH-TimeDomainResourceAllocation.c \ + ./mib_sib_out/PUCCH-ConfigCommon.c \ + ./mib_sib_out/TimeAlignmentTimer.c \ + ./mib_sib_out/TDD-UL-DL-ConfigCommon.c \ + ./mib_sib_out/TDD-UL-DL-Pattern.c \ + ./mib_sib_out/RACH-ConfigCommon.c \ + ./mib_sib_out/RSRP-Range.c \ + ./mib_sib_out/UE-TimersAndConstants.c \ + ./mib_sib_out/UAC-BarringPerCatList.c \ + ./mib_sib_out/UAC-BarringPerCat.c \ + ./mib_sib_out/UAC-BarringInfoSetIndex.c \ + ./mib_sib_out/UAC-BarringPerPLMN-List.c \ + ./mib_sib_out/UAC-BarringPerPLMN.c \ + ./mib_sib_out/UAC-BarringInfoSetList.c \ + ./mib_sib_out/UAC-BarringInfoSet.c \ + ./mib_sib_out/TCI-StateId.c + +ASN_MODULE_HDRS= \ + ./mib_sib_out/MIB.h \ + ./mib_sib_out/PDCCH-ConfigSIB1.h \ + ./mib_sib_out/ControlResourceSetZero.h \ + ./mib_sib_out/SearchSpaceZero.h \ + ./mib_sib_out/SIB1.h \ + ./mib_sib_out/UAC-AccessCategory1-SelectionAssistanceInfo.h \ + ./mib_sib_out/Q-QualMin.h \ + ./mib_sib_out/Q-RxLevMin.h \ + ./mib_sib_out/CellAccessRelatedInfo.h \ + ./mib_sib_out/PLMN-IdentityInfoList.h \ + ./mib_sib_out/PLMN-IdentityInfo.h \ + ./mib_sib_out/PLMN-Identity.h \ + ./mib_sib_out/MCC.h \ + ./mib_sib_out/MNC.h \ + ./mib_sib_out/MCC-MNC-Digit.h \ + ./mib_sib_out/TrackingAreaCode.h \ + ./mib_sib_out/RAN-AreaCode.h \ + ./mib_sib_out/CellIdentity.h \ + ./mib_sib_out/ConnEstFailureControl.h \ + ./mib_sib_out/SI-SchedulingInfo.h \ + ./mib_sib_out/SchedulingInfo.h \ + ./mib_sib_out/SIB-Mapping.h \ + ./mib_sib_out/SIB-TypeInfo.h \ + ./mib_sib_out/SI-RequestConfig.h \ + ./mib_sib_out/SI-RequestResources.h \ + ./mib_sib_out/RACH-ConfigGeneric.h \ + ./mib_sib_out/ServingCellConfigCommonSIB.h \ + ./mib_sib_out/DownlinkConfigCommonSIB.h \ + ./mib_sib_out/BCCH-Config.h \ + ./mib_sib_out/PCCH-Config.h \ + ./mib_sib_out/PagingCycle.h \ + ./mib_sib_out/FrequencyInfoDL-SIB.h \ + ./mib_sib_out/MultiFrequencyBandListNR-SIB.h \ + ./mib_sib_out/NR-MultiBandInfo.h \ + ./mib_sib_out/FreqBandIndicatorNR.h \ + ./mib_sib_out/NR-NS-PmaxList.h \ + ./mib_sib_out/NR-NS-PmaxValue.h \ + ./mib_sib_out/P-Max.h \ + ./mib_sib_out/AdditionalSpectrumEmission.h \ + ./mib_sib_out/SCS-SpecificCarrier.h \ + ./mib_sib_out/SubcarrierSpacing.h \ + ./mib_sib_out/BWP-DownlinkCommon.h \ + ./mib_sib_out/PDCCH-ConfigCommon.h \ + ./mib_sib_out/ControlResourceSet.h \ + ./mib_sib_out/ControlResourceSetId.h \ + ./mib_sib_out/SearchSpace.h \ + ./mib_sib_out/SearchSpaceId.h \ + ./mib_sib_out/PDSCH-ConfigCommon.h \ + ./mib_sib_out/PDSCH-TimeDomainResourceAllocationList.h \ + ./mib_sib_out/PDSCH-TimeDomainResourceAllocation.h \ + ./mib_sib_out/UplinkConfigCommonSIB.h \ + ./mib_sib_out/FrequencyInfoUL-SIB.h \ + ./mib_sib_out/ARFCN-ValueNR.h \ + ./mib_sib_out/BWP-UplinkCommon.h \ + ./mib_sib_out/BWP.h \ + ./mib_sib_out/PUSCH-ConfigCommon.h \ + ./mib_sib_out/PUSCH-TimeDomainResourceAllocationList.h \ + ./mib_sib_out/PUSCH-TimeDomainResourceAllocation.h \ + ./mib_sib_out/PUCCH-ConfigCommon.h \ + ./mib_sib_out/TimeAlignmentTimer.h \ + ./mib_sib_out/TDD-UL-DL-ConfigCommon.h \ + ./mib_sib_out/TDD-UL-DL-Pattern.h \ + ./mib_sib_out/RACH-ConfigCommon.h \ + ./mib_sib_out/RSRP-Range.h \ + ./mib_sib_out/UE-TimersAndConstants.h \ + ./mib_sib_out/UAC-BarringPerCatList.h \ + ./mib_sib_out/UAC-BarringPerCat.h \ + ./mib_sib_out/UAC-BarringInfoSetIndex.h \ + ./mib_sib_out/UAC-BarringPerPLMN-List.h \ + ./mib_sib_out/UAC-BarringPerPLMN.h \ + ./mib_sib_out/UAC-BarringInfoSetList.h \ + ./mib_sib_out/UAC-BarringInfoSet.h \ + ./mib_sib_out/TCI-StateId.h + +ASN_MODULE_HDRS+=./mib_sib_out/OPEN_TYPE.h +ASN_MODULE_SRCS+=./mib_sib_out/OPEN_TYPE.c +ASN_MODULE_HDRS+=./mib_sib_out/constr_CHOICE.h +ASN_MODULE_HDRS+=./mib_sib_out/BOOLEAN.h +ASN_MODULE_SRCS+=./mib_sib_out/BOOLEAN.c +ASN_MODULE_HDRS+=./mib_sib_out/INTEGER.h +ASN_MODULE_SRCS+=./mib_sib_out/INTEGER.c +ASN_MODULE_HDRS+=./mib_sib_out/NULL.h +ASN_MODULE_SRCS+=./mib_sib_out/NULL.c +ASN_MODULE_HDRS+=./mib_sib_out/NativeEnumerated.h +ASN_MODULE_SRCS+=./mib_sib_out/NativeEnumerated.c +ASN_MODULE_HDRS+=./mib_sib_out/NativeInteger.h +ASN_MODULE_SRCS+=./mib_sib_out/NativeInteger.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_SEQUENCE_OF.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_SEQUENCE_OF.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_SET_OF.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_SET_OF.c +ASN_MODULE_SRCS+=./mib_sib_out/constr_CHOICE.c +ASN_MODULE_HDRS+=./mib_sib_out/constr_SEQUENCE.h +ASN_MODULE_SRCS+=./mib_sib_out/constr_SEQUENCE.c +ASN_MODULE_HDRS+=./mib_sib_out/constr_SEQUENCE_OF.h +ASN_MODULE_SRCS+=./mib_sib_out/constr_SEQUENCE_OF.c +ASN_MODULE_HDRS+=./mib_sib_out/constr_SET_OF.h +ASN_MODULE_SRCS+=./mib_sib_out/constr_SET_OF.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_application.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_application.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_ioc.h +ASN_MODULE_HDRS+=./mib_sib_out/asn_system.h +ASN_MODULE_HDRS+=./mib_sib_out/asn_codecs.h +ASN_MODULE_HDRS+=./mib_sib_out/asn_internal.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_internal.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_random_fill.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_random_fill.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_bit_data.h +ASN_MODULE_SRCS+=./mib_sib_out/asn_bit_data.c +ASN_MODULE_HDRS+=./mib_sib_out/OCTET_STRING.h +ASN_MODULE_SRCS+=./mib_sib_out/OCTET_STRING.c +ASN_MODULE_HDRS+=./mib_sib_out/BIT_STRING.h +ASN_MODULE_SRCS+=./mib_sib_out/BIT_STRING.c +ASN_MODULE_SRCS+=./mib_sib_out/asn_codecs_prim.c +ASN_MODULE_HDRS+=./mib_sib_out/asn_codecs_prim.h +ASN_MODULE_HDRS+=./mib_sib_out/ber_tlv_length.h +ASN_MODULE_SRCS+=./mib_sib_out/ber_tlv_length.c +ASN_MODULE_HDRS+=./mib_sib_out/ber_tlv_tag.h +ASN_MODULE_SRCS+=./mib_sib_out/ber_tlv_tag.c +ASN_MODULE_HDRS+=./mib_sib_out/ber_decoder.h +ASN_MODULE_SRCS+=./mib_sib_out/ber_decoder.c +ASN_MODULE_HDRS+=./mib_sib_out/der_encoder.h +ASN_MODULE_SRCS+=./mib_sib_out/der_encoder.c +ASN_MODULE_HDRS+=./mib_sib_out/constr_TYPE.h +ASN_MODULE_SRCS+=./mib_sib_out/constr_TYPE.c +ASN_MODULE_HDRS+=./mib_sib_out/constraints.h +ASN_MODULE_SRCS+=./mib_sib_out/constraints.c +ASN_MODULE_HDRS+=./mib_sib_out/xer_support.h +ASN_MODULE_SRCS+=./mib_sib_out/xer_support.c +ASN_MODULE_HDRS+=./mib_sib_out/xer_decoder.h +ASN_MODULE_SRCS+=./mib_sib_out/xer_decoder.c +ASN_MODULE_HDRS+=./mib_sib_out/xer_encoder.h +ASN_MODULE_SRCS+=./mib_sib_out/xer_encoder.c +ASN_MODULE_HDRS+=./mib_sib_out/per_support.h +ASN_MODULE_SRCS+=./mib_sib_out/per_support.c +ASN_MODULE_HDRS+=./mib_sib_out/per_decoder.h +ASN_MODULE_SRCS+=./mib_sib_out/per_decoder.c +ASN_MODULE_HDRS+=./mib_sib_out/per_encoder.h +ASN_MODULE_SRCS+=./mib_sib_out/per_encoder.c +ASN_MODULE_HDRS+=./mib_sib_out/per_opentype.h +ASN_MODULE_SRCS+=./mib_sib_out/per_opentype.c +ASN_MODULE_HDRS+=./mib_sib_out/oer_decoder.h +ASN_MODULE_HDRS+=./mib_sib_out/oer_encoder.h +ASN_MODULE_HDRS+=./mib_sib_out/oer_support.h +ASN_MODULE_SRCS+=./mib_sib_out/oer_decoder.c +ASN_MODULE_SRCS+=./mib_sib_out/oer_encoder.c +ASN_MODULE_SRCS+=./mib_sib_out/oer_support.c +ASN_MODULE_SRCS+=./mib_sib_out/OPEN_TYPE_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/INTEGER_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/BIT_STRING_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/OCTET_STRING_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/NativeInteger_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/NativeEnumerated_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/constr_CHOICE_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/constr_SEQUENCE_oer.c +ASN_MODULE_SRCS+=./mib_sib_out/constr_SET_OF_oer.c + +ASN_MODULE_CFLAGS= + +lib_LTLIBRARIES+=libasncodec.la +libasncodec_la_SOURCES=$(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS) +libasncodec_la_CPPFLAGS=-I$(top_srcdir)/./mib_sib_out/ +libasncodec_la_CFLAGS=$(ASN_MODULE_CFLAGS) +libasncodec_la_LDFLAGS=-lm diff --git a/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.c b/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.c new file mode 100644 index 000000000..fe82b79da --- /dev/null +++ b/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "MultiFrequencyBandListNR-SIB.h" + +#include "NR-MultiBandInfo.h" +static asn_oer_constraints_t asn_OER_type_MultiFrequencyBandListNR_SIB_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..8)) */}; +asn_per_constraints_t asn_PER_type_MultiFrequencyBandListNR_SIB_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_MultiFrequencyBandListNR_SIB_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_NR_MultiBandInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_MultiFrequencyBandListNR_SIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_MultiFrequencyBandListNR_SIB_specs_1 = { + sizeof(struct MultiFrequencyBandListNR_SIB), + offsetof(struct MultiFrequencyBandListNR_SIB, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_MultiFrequencyBandListNR_SIB = { + "MultiFrequencyBandListNR-SIB", + "MultiFrequencyBandListNR-SIB", + &asn_OP_SEQUENCE_OF, + asn_DEF_MultiFrequencyBandListNR_SIB_tags_1, + sizeof(asn_DEF_MultiFrequencyBandListNR_SIB_tags_1) + /sizeof(asn_DEF_MultiFrequencyBandListNR_SIB_tags_1[0]), /* 1 */ + asn_DEF_MultiFrequencyBandListNR_SIB_tags_1, /* Same as above */ + sizeof(asn_DEF_MultiFrequencyBandListNR_SIB_tags_1) + /sizeof(asn_DEF_MultiFrequencyBandListNR_SIB_tags_1[0]), /* 1 */ + { &asn_OER_type_MultiFrequencyBandListNR_SIB_constr_1, &asn_PER_type_MultiFrequencyBandListNR_SIB_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_MultiFrequencyBandListNR_SIB_1, + 1, /* Single element */ + &asn_SPC_MultiFrequencyBandListNR_SIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.h b/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.h new file mode 100644 index 000000000..55ec89e5f --- /dev/null +++ b/src/codec_utils/SYSINFO/MultiFrequencyBandListNR-SIB.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _MultiFrequencyBandListNR_SIB_H_ +#define _MultiFrequencyBandListNR_SIB_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NR_MultiBandInfo; + +/* MultiFrequencyBandListNR-SIB */ +typedef struct MultiFrequencyBandListNR_SIB { + A_SEQUENCE_OF(struct NR_MultiBandInfo) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MultiFrequencyBandListNR_SIB_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MultiFrequencyBandListNR_SIB; +extern asn_SET_OF_specifics_t asn_SPC_MultiFrequencyBandListNR_SIB_specs_1; +extern asn_TYPE_member_t asn_MBR_MultiFrequencyBandListNR_SIB_1[1]; +extern asn_per_constraints_t asn_PER_type_MultiFrequencyBandListNR_SIB_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _MultiFrequencyBandListNR_SIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/NR-MultiBandInfo.c b/src/codec_utils/SYSINFO/NR-MultiBandInfo.c new file mode 100644 index 000000000..8196c3ee7 --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-MultiBandInfo.c @@ -0,0 +1,63 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "NR-MultiBandInfo.h" + +#include "NR-NS-PmaxList.h" +asn_TYPE_member_t asn_MBR_NR_MultiBandInfo_1[] = { + { ATF_POINTER, 2, offsetof(struct NR_MultiBandInfo, freqBandIndicatorNR), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FreqBandIndicatorNR, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "freqBandIndicatorNR" + }, + { ATF_POINTER, 1, offsetof(struct NR_MultiBandInfo, nr_NS_PmaxList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NR_NS_PmaxList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nr-NS-PmaxList" + }, +}; +static const int asn_MAP_NR_MultiBandInfo_oms_1[] = { 0, 1 }; +static const ber_tlv_tag_t asn_DEF_NR_MultiBandInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_NR_MultiBandInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* freqBandIndicatorNR */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* nr-NS-PmaxList */ +}; +asn_SEQUENCE_specifics_t asn_SPC_NR_MultiBandInfo_specs_1 = { + sizeof(struct NR_MultiBandInfo), + offsetof(struct NR_MultiBandInfo, _asn_ctx), + asn_MAP_NR_MultiBandInfo_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_NR_MultiBandInfo_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_NR_MultiBandInfo = { + "NR-MultiBandInfo", + "NR-MultiBandInfo", + &asn_OP_SEQUENCE, + asn_DEF_NR_MultiBandInfo_tags_1, + sizeof(asn_DEF_NR_MultiBandInfo_tags_1) + /sizeof(asn_DEF_NR_MultiBandInfo_tags_1[0]), /* 1 */ + asn_DEF_NR_MultiBandInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_NR_MultiBandInfo_tags_1) + /sizeof(asn_DEF_NR_MultiBandInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_NR_MultiBandInfo_1, + 2, /* Elements count */ + &asn_SPC_NR_MultiBandInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/NR-MultiBandInfo.h b/src/codec_utils/SYSINFO/NR-MultiBandInfo.h new file mode 100644 index 000000000..91bc6306f --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-MultiBandInfo.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _NR_MultiBandInfo_H_ +#define _NR_MultiBandInfo_H_ + + +#include + +/* Including external dependencies */ +#include "FreqBandIndicatorNR.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NR_NS_PmaxList; + +/* NR-MultiBandInfo */ +typedef struct NR_MultiBandInfo { + FreqBandIndicatorNR_t *freqBandIndicatorNR; /* OPTIONAL */ + struct NR_NS_PmaxList *nr_NS_PmaxList; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NR_MultiBandInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NR_MultiBandInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_NR_MultiBandInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_NR_MultiBandInfo_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _NR_MultiBandInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/NR-NS-PmaxList.c b/src/codec_utils/SYSINFO/NR-NS-PmaxList.c new file mode 100644 index 000000000..5e75849d8 --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-NS-PmaxList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "NR-NS-PmaxList.h" + +#include "NR-NS-PmaxValue.h" +static asn_oer_constraints_t asn_OER_type_NR_NS_PmaxList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..8)) */}; +asn_per_constraints_t asn_PER_type_NR_NS_PmaxList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_NR_NS_PmaxList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_NR_NS_PmaxValue, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_NR_NS_PmaxList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_NR_NS_PmaxList_specs_1 = { + sizeof(struct NR_NS_PmaxList), + offsetof(struct NR_NS_PmaxList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_NR_NS_PmaxList = { + "NR-NS-PmaxList", + "NR-NS-PmaxList", + &asn_OP_SEQUENCE_OF, + asn_DEF_NR_NS_PmaxList_tags_1, + sizeof(asn_DEF_NR_NS_PmaxList_tags_1) + /sizeof(asn_DEF_NR_NS_PmaxList_tags_1[0]), /* 1 */ + asn_DEF_NR_NS_PmaxList_tags_1, /* Same as above */ + sizeof(asn_DEF_NR_NS_PmaxList_tags_1) + /sizeof(asn_DEF_NR_NS_PmaxList_tags_1[0]), /* 1 */ + { &asn_OER_type_NR_NS_PmaxList_constr_1, &asn_PER_type_NR_NS_PmaxList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_NR_NS_PmaxList_1, + 1, /* Single element */ + &asn_SPC_NR_NS_PmaxList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/NR-NS-PmaxList.h b/src/codec_utils/SYSINFO/NR-NS-PmaxList.h new file mode 100644 index 000000000..df94234e2 --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-NS-PmaxList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _NR_NS_PmaxList_H_ +#define _NR_NS_PmaxList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NR_NS_PmaxValue; + +/* NR-NS-PmaxList */ +typedef struct NR_NS_PmaxList { + A_SEQUENCE_OF(struct NR_NS_PmaxValue) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NR_NS_PmaxList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NR_NS_PmaxList; +extern asn_SET_OF_specifics_t asn_SPC_NR_NS_PmaxList_specs_1; +extern asn_TYPE_member_t asn_MBR_NR_NS_PmaxList_1[1]; +extern asn_per_constraints_t asn_PER_type_NR_NS_PmaxList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _NR_NS_PmaxList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/NR-NS-PmaxValue.c b/src/codec_utils/SYSINFO/NR-NS-PmaxValue.c new file mode 100644 index 000000000..d6998c60a --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-NS-PmaxValue.c @@ -0,0 +1,62 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "NR-NS-PmaxValue.h" + +asn_TYPE_member_t asn_MBR_NR_NS_PmaxValue_1[] = { + { ATF_POINTER, 1, offsetof(struct NR_NS_PmaxValue, additionalPmax), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_P_Max, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "additionalPmax" + }, + { ATF_NOFLAGS, 0, offsetof(struct NR_NS_PmaxValue, additionalSpectrumEmission), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AdditionalSpectrumEmission, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "additionalSpectrumEmission" + }, +}; +static const int asn_MAP_NR_NS_PmaxValue_oms_1[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_NR_NS_PmaxValue_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_NR_NS_PmaxValue_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* additionalPmax */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* additionalSpectrumEmission */ +}; +asn_SEQUENCE_specifics_t asn_SPC_NR_NS_PmaxValue_specs_1 = { + sizeof(struct NR_NS_PmaxValue), + offsetof(struct NR_NS_PmaxValue, _asn_ctx), + asn_MAP_NR_NS_PmaxValue_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_NR_NS_PmaxValue_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_NR_NS_PmaxValue = { + "NR-NS-PmaxValue", + "NR-NS-PmaxValue", + &asn_OP_SEQUENCE, + asn_DEF_NR_NS_PmaxValue_tags_1, + sizeof(asn_DEF_NR_NS_PmaxValue_tags_1) + /sizeof(asn_DEF_NR_NS_PmaxValue_tags_1[0]), /* 1 */ + asn_DEF_NR_NS_PmaxValue_tags_1, /* Same as above */ + sizeof(asn_DEF_NR_NS_PmaxValue_tags_1) + /sizeof(asn_DEF_NR_NS_PmaxValue_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_NR_NS_PmaxValue_1, + 2, /* Elements count */ + &asn_SPC_NR_NS_PmaxValue_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/NR-NS-PmaxValue.h b/src/codec_utils/SYSINFO/NR-NS-PmaxValue.h new file mode 100644 index 000000000..1af6f6452 --- /dev/null +++ b/src/codec_utils/SYSINFO/NR-NS-PmaxValue.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _NR_NS_PmaxValue_H_ +#define _NR_NS_PmaxValue_H_ + + +#include + +/* Including external dependencies */ +#include "P-Max.h" +#include "AdditionalSpectrumEmission.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NR-NS-PmaxValue */ +typedef struct NR_NS_PmaxValue { + P_Max_t *additionalPmax; /* OPTIONAL */ + AdditionalSpectrumEmission_t additionalSpectrumEmission; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NR_NS_PmaxValue_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NR_NS_PmaxValue; +extern asn_SEQUENCE_specifics_t asn_SPC_NR_NS_PmaxValue_specs_1; +extern asn_TYPE_member_t asn_MBR_NR_NS_PmaxValue_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _NR_NS_PmaxValue_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/NULL.c b/src/codec_utils/SYSINFO/NULL.c new file mode 100644 index 000000000..4a2914f4b --- /dev/null +++ b/src/codec_utils/SYSINFO/NULL.c @@ -0,0 +1,299 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include /* Implemented in terms of BOOLEAN type */ + +/* + * NULL basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NULL_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) +}; +asn_TYPE_operation_t asn_OP_NULL = { + BOOLEAN_free, + NULL_print, + NULL_compare, + BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ + NULL_encode_der, /* Special handling of DER encoding */ + NULL_decode_xer, + NULL_encode_xer, +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + NULL_decode_oer, + NULL_encode_oer, +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + NULL_decode_uper, /* Unaligned PER decoder */ + NULL_encode_uper, /* Unaligned PER encoder */ + NULL_decode_aper, /* Aligned PER decoder */ + NULL_encode_aper, /* Aligned PER encoder */ +#endif /* ASN_DISABLE_PER_SUPPORT */ + NULL_random_fill, + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_NULL = { + "NULL", + "NULL", + &asn_OP_NULL, + asn_DEF_NULL_tags, + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + asn_DEF_NULL_tags, /* Same as above */ + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + { 0, 0, asn_generic_no_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NULL_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, + ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval = {0,0,0}; + + erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = ptr; + } + + ASN__ENCODED_OK(erval); +} + +asn_enc_rval_t +NULL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, + void *app_key) { + asn_enc_rval_t er = {0,0,0}; + + (void)td; + (void)sptr; + (void)ilevel; + (void)flags; + (void)cb; + (void)app_key; + + /* XMLNullValue is empty */ + er.encoded = 0; + ASN__ENCODED_OK(er); +} + + +static enum xer_pbd_rval +NULL__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr, + const void *chunk_buf, size_t chunk_size) { + (void)td; + (void)sptr; + (void)chunk_buf; /* Going to be empty according to the rules below. */ + + /* + * There must be no content in self-terminating tag. + */ + if(chunk_size) + return XPBD_BROKEN_ENCODING; + else + return XPBD_BODY_CONSUMED; +} + +asn_dec_rval_t +NULL_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return xer_decode_primitive(opt_codec_ctx, td, + sptr, sizeof(NULL_t), opt_mname, buf_ptr, size, + NULL__xer_body_decode); +} + +int +NULL_compare(const asn_TYPE_descriptor_t *td, const void *a, const void *b) { + (void)td; + (void)a; + (void)b; + return 0; +} + +int +NULL_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(sptr) { + return (cb("", 9, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +#ifndef ASN_DISABLE_OER_SUPPORT + +asn_dec_rval_t +NULL_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, void **sptr, + const void *ptr, size_t size) { + asn_dec_rval_t rv = {RC_OK, 0}; + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)ptr; + (void)size; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + ASN__DECODE_FAILED; + } + } + + return rv; +} + +asn_enc_rval_t +NULL_encode_oer(const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, const void *sptr, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er = {0,0,0}; + + (void)td; + (void)sptr; + (void)constraints; + (void)cb; + (void)app_key; + + er.encoded = 0; /* Encoding in 0 bytes. */ + + ASN__ENCODED_OK(er); +} + +#endif /* ASN_DISABLE_OER_SUPPORT */ + +#ifndef ASN_DISABLE_PER_SUPPORT + +asn_dec_rval_t +NULL_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, void **sptr, + asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)pd; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + ASN__DECODE_FAILED; + } + } + + /* + * NULL type does not have content octets. + */ + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + +asn_enc_rval_t +NULL_encode_uper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, const void *sptr, + asn_per_outp_t *po) { + asn_enc_rval_t er = {0,0,0}; + + (void)td; + (void)constraints; + (void)sptr; + (void)po; + + er.encoded = 0; + ASN__ENCODED_OK(er); +} + +asn_dec_rval_t +NULL_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv = {RC_OK, 0}; + + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)pd; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + ASN__DECODE_FAILED; + } + } + + /* + * NULL type does not have content octets. + */ + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + + +asn_enc_rval_t +NULL_encode_aper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + asn_enc_rval_t er = {0,0,0}; + + (void)td; + (void)constraints; + (void)sptr; + (void)po; + + er.encoded = 0; + ASN__ENCODED_OK(er); +} + +#endif /* ASN_DISABLE_PER_SUPPORT */ + +asn_random_fill_result_t +NULL_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, + const asn_encoding_constraints_t *constr, + size_t max_length) { + asn_random_fill_result_t result_ok = {ARFILL_OK, 1}; + asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0}; + asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0}; + NULL_t *st = *sptr; + + (void)td; + (void)constr; + + if(max_length == 0) return result_skipped; + + if(st == NULL) { + st = (NULL_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(st == NULL) { + return result_failed; + } + } + + return result_ok; +} + diff --git a/src/codec_utils/SYSINFO/NULL.h b/src/codec_utils/SYSINFO/NULL.h new file mode 100644 index 000000000..802d12c00 --- /dev/null +++ b/src/codec_utils/SYSINFO/NULL.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2003-2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_TYPE_NULL_H +#define ASN_TYPE_NULL_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The value of the NULL type is meaningless: see BOOLEAN if you want to + * carry true/false semantics. + */ +typedef int NULL_t; + +extern asn_TYPE_descriptor_t asn_DEF_NULL; +extern asn_TYPE_operation_t asn_OP_NULL; + +asn_struct_print_f NULL_print; +asn_struct_compare_f NULL_compare; +der_type_encoder_f NULL_encode_der; +xer_type_decoder_f NULL_decode_xer; +xer_type_encoder_f NULL_encode_xer; +oer_type_decoder_f NULL_decode_oer; +oer_type_encoder_f NULL_encode_oer; +per_type_decoder_f NULL_decode_uper; +per_type_encoder_f NULL_encode_uper; +per_type_decoder_f NULL_decode_aper; +per_type_encoder_f NULL_encode_aper; +asn_random_fill_f NULL_random_fill; + +#define NULL_free BOOLEAN_free +#define NULL_decode_ber BOOLEAN_decode_ber +#define NULL_constraint asn_generic_no_constraint + +#ifdef __cplusplus +} +#endif + +#endif /* NULL_H */ diff --git a/src/codec_utils/SYSINFO/NativeEnumerated.c b/src/codec_utils/SYSINFO/NativeEnumerated.c new file mode 100644 index 000000000..50ffb1d78 --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeEnumerated.c @@ -0,0 +1,367 @@ +/*- + * Copyright (c) 2004, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeEnumerated basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_operation_t asn_OP_NativeEnumerated = { + NativeInteger_free, + NativeInteger_print, + NativeInteger_compare, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeEnumerated_encode_xer, +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + NativeEnumerated_decode_oer, + NativeEnumerated_encode_oer, +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + NativeEnumerated_decode_uper, + NativeEnumerated_encode_uper, + NativeEnumerated_decode_aper, + NativeEnumerated_encode_aper, +#endif /* ASN_DISABLE_PER_SUPPORT */ + NativeEnumerated_random_fill, + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", + &asn_OP_NativeEnumerated, + asn_DEF_NativeEnumerated_tags, + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + { 0, 0, asn_generic_no_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NativeEnumerated_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + const long *native = (const long *)sptr; + const asn_INTEGER_enum_map_t *el; + + (void)ilevel; + (void)flags; + + if(!native) ASN__ENCODE_FAILED; + + el = INTEGER_map_value2enum(specs, *native); + if(el) { + er.encoded = + asn__format_to_callback(cb, app_key, "<%s/>", el->enum_name); + if(er.encoded < 0) ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } else { + ASN_DEBUG( + "ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + ASN__ENCODE_FAILED; + } +} + +asn_dec_rval_t +NativeEnumerated_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + const asn_INTEGER_specifics_t *specs = td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + const asn_per_constraint_t *ct = NULL; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->encoding_constraints.per_constraints) + ct = &td->encoding_constraints.per_constraints->value; + else ASN__DECODE_FAILED; /* Mandatory! */ + if(!specs) ASN__DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + ASN__DECODE_FAILED; + } else { + if(!specs->extension) + ASN__DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + ASN__DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + +static int +NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { + const asn_INTEGER_enum_map_t *a = ap; + const asn_INTEGER_enum_map_t *b = bp; + if(a->nat_value == b->nat_value) + return 0; + if(a->nat_value < b->nat_value) + return -1; + return 1; +} + +asn_enc_rval_t +NativeEnumerated_encode_uper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + long native, value; + const asn_per_constraint_t *ct = NULL; + int inext = 0; + asn_INTEGER_enum_map_t key; + const asn_INTEGER_enum_map_t *kf; + + if(!sptr) ASN__ENCODE_FAILED; + if(!specs) ASN__ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->encoding_constraints.per_constraints) + ct = &td->encoding_constraints.per_constraints->value; + else ASN__ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(const long *)sptr; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + ASN__ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct && ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct && ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + if(!specs->extension) + ASN__ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + +asn_dec_rval_t +NativeEnumerated_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + const asn_per_constraint_t *ct = NULL; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->encoding_constraints.per_constraints) + ct = &td->encoding_constraints.per_constraints->value; + else ASN__DECODE_FAILED; /* Mandatory! */ + if(!specs) ASN__DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + /* Deal with APER padding */ + if(ct && ct->upper_bound >= 255) { + int padding = 0; + padding = (8 - (pd->moved % 8)) % 8; + ASN_DEBUG("For NativeEnumerated %s,offset= %lu Padding bits = %d", td->name, pd->moved, padding); + ASN_DEBUG("For NativeEnumerated %s, upper bound = %lu", td->name, ct->upper_bound); + if(padding > 0) + per_get_few_bits(pd, padding); + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + ASN__DECODE_FAILED; + } else { + if(!specs->extension) + ASN__DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + ASN__DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + +asn_enc_rval_t +NativeEnumerated_encode_aper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + long native, value; + const asn_per_constraint_t *ct = NULL; + int inext = 0; + asn_INTEGER_enum_map_t key; + asn_INTEGER_enum_map_t *kf; + + if(!sptr) ASN__ENCODE_FAILED; + if(!specs) ASN__ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->encoding_constraints.per_constraints) + ct = &td->encoding_constraints.per_constraints->value; + else ASN__ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(const long *)sptr; + if(native < 0) ASN__ENCODE_FAILED; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + ASN__ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct && ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct && ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + if(!specs->extension) + ASN__ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} diff --git a/src/codec_utils/SYSINFO/NativeEnumerated.h b/src/codec_utils/SYSINFO/NativeEnumerated.h new file mode 100644 index 000000000..459f0e633 --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeEnumerated.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2004-2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard ENUMERATED in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeEnumerated_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeEnumerated_H_ +#define _NativeEnumerated_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; +extern asn_TYPE_operation_t asn_OP_NativeEnumerated; + +xer_type_encoder_f NativeEnumerated_encode_xer; +oer_type_decoder_f NativeEnumerated_decode_oer; +oer_type_encoder_f NativeEnumerated_encode_oer; +per_type_decoder_f NativeEnumerated_decode_uper; +per_type_encoder_f NativeEnumerated_encode_uper; +per_type_decoder_f NativeEnumerated_decode_aper; +per_type_encoder_f NativeEnumerated_encode_aper; + +#define NativeEnumerated_free NativeInteger_free +#define NativeEnumerated_print NativeInteger_print +#define NativeEnumerated_compare NativeInteger_compare +#define NativeEnumerated_random_fill NativeInteger_random_fill +#define NativeEnumerated_constraint asn_generic_no_constraint +#define NativeEnumerated_decode_ber NativeInteger_decode_ber +#define NativeEnumerated_encode_der NativeInteger_encode_der +#define NativeEnumerated_decode_xer NativeInteger_decode_xer + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeEnumerated_H_ */ diff --git a/src/codec_utils/SYSINFO/NativeEnumerated_oer.c b/src/codec_utils/SYSINFO/NativeEnumerated_oer.c new file mode 100644 index 000000000..ee3c1895e --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeEnumerated_oer.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2017 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_DISABLE_OER_SUPPORT + +#include +#include +#include + +static long +asn__nativeenumerated_convert(const uint8_t *b, const uint8_t *end) { + unsigned long value; + + /* Perform the sign initialization */ + /* Actually value = -(*b >> 7); gains nothing, yet unreadable! */ + if((*b >> 7)) { + value = (unsigned long)(-1); + } else { + value = 0; + } + + /* Conversion engine */ + for(; b < end; b++) { + value = (value << 8) | *b; + } + + return value; +} + +asn_dec_rval_t +NativeEnumerated_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, + void **nint_ptr, const void *ptr, size_t size) { + asn_dec_rval_t rval = {RC_OK, 0}; + long *native = (long *)*nint_ptr; + const uint8_t *b = ptr; + + (void)opt_codec_ctx; + (void)constraints; + + if(size < 1) { + ASN__DECODE_STARVED; + } + + if((*b & 0x80) == 0) { + /* + * X.696 (08/2015) #11.2 Short form for Enumerated. + */ + if(!native) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + *native = *b; + rval.consumed = 1; + } else { + /* + * X.696 (08/2015) #11.4 Long form for Enumerated. + */ + size_t length = *b & 0x7f; + const uint8_t *bend; + long value; + + if(length < 1 || length > sizeof(*native)) { + ASN__DECODE_FAILED; + } + if((1 + length) > size) { + ASN__DECODE_STARVED; + } + b++; + bend = b + length; + + value = asn__nativeenumerated_convert(b, bend); + if(value < 0) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + if(specs && specs->field_unsigned) { + ASN__DECODE_FAILED; + } + } + + if(!native) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + *native = value; + + rval.consumed = (1 + length); + } + + return rval; +} + +/* + * Encode as Canonical OER. + */ +asn_enc_rval_t +NativeEnumerated_encode_oer(const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, + const void *sptr, asn_app_consume_bytes_f *cb, + void *app_key) { + asn_enc_rval_t er = {0,0,0}; + long native; + + (void)constraints; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(const long *)sptr; + + if(native >= 0 && native <= 127) { + /* #11.2 Short form */ + uint8_t b = native; + er.encoded = 1; + if(cb(&b, er.encoded, app_key) < 0) { + ASN__ENCODE_FAILED; + } + ASN__ENCODED_OK(er); + } else { + /* #11.2 Long form */ + uint8_t buf[1 + sizeof(native)]; + uint8_t *b = &buf[sizeof(native)]; /* Last addressable */ + long final_pattern = -1 * (native < 0); + + for(;;) { + *b-- = native; + native >>= 8; + if(native == final_pattern) { + if(final_pattern) { + if((b[1] & 0x80)) break; + } else { + if(!(b[1] & 0x80)) break; + } + } + } + *b = 0x80 | (&buf[sizeof(native)] - b); + er.encoded = 1 + (&buf[sizeof(native)] - b); + if(cb(b, er.encoded, app_key) < 0) { + ASN__ENCODE_FAILED; + } + ASN__ENCODED_OK(er); + } +} + +#endif /* ASN_DISABLE_OER_SUPPORT */ diff --git a/src/codec_utils/SYSINFO/NativeInteger.c b/src/codec_utils/SYSINFO/NativeInteger.c new file mode 100644 index 000000000..316e8720a --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeInteger.c @@ -0,0 +1,550 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeInteger basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_operation_t asn_OP_NativeInteger = { + NativeInteger_free, + NativeInteger_print, + NativeInteger_compare, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeInteger_encode_xer, +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + NativeInteger_decode_oer, /* OER decoder */ + NativeInteger_encode_oer, /* Canonical OER encoder */ +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + NativeInteger_decode_aper, /* Aligned PER decoder */ + NativeInteger_encode_aper, /* Aligned PER encoder */ +#endif /* ASN_DISABLE_PER_SUPPORT */ + NativeInteger_random_fill, + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_NativeInteger = { + "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", + &asn_OP_NativeInteger, + asn_DEF_NativeInteger_tags, + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + asn_DEF_NativeInteger_tags, /* Same as above */ + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + { 0, 0, asn_generic_no_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode INTEGER type. + */ +asn_dec_rval_t +NativeInteger_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, void **nint_ptr, + const void *buf_ptr, size_t size, int tag_mode) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + long *native = (long *)*nint_ptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(native == NULL) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(native == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", + td->name, tag_mode); + + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, + tag_mode, 0, &length, 0); + if(rval.code != RC_OK) + return rval; + + ASN_DEBUG("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this length. + */ + buf_ptr = ((const char *)buf_ptr) + rval.consumed; + size -= rval.consumed; + if(length > (ber_tlv_len_t)size) { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } + + /* + * ASN.1 encoded INTEGER: buf_ptr, length + * Fill the native, at the same time checking for overflow. + * If overflow occured, return with RC_FAIL. + */ + { + INTEGER_t tmp; + union { + const void *constbuf; + void *nonconstbuf; + } unconst_buf; + long l; + + unconst_buf.constbuf = buf_ptr; + tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; + tmp.size = length; + + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */ + : asn_INTEGER2long(&tmp, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + + *native = l; + } + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", + (long)rval.consumed, (long)length, td->name, (long)*native); + + return rval; +} + +/* + * Encode the NativeInteger using the standard INTEGER type DER encoder. + */ +asn_enc_rval_t +NativeInteger_encode_der(const asn_TYPE_descriptor_t *sd, const void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + unsigned long native = *(const unsigned long *)ptr; /* Disable sign ext. */ + asn_enc_rval_t erval = {0,0,0}; + INTEGER_t tmp; + +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ + + tmp.buf = (uint8_t *)&native; + tmp.size = sizeof(native); + +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ + uint8_t buf[sizeof(native)]; + uint8_t *p; + + /* Prepare a fake INTEGER */ + for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + *p = (uint8_t)native; + + tmp.buf = buf; + tmp.size = sizeof(buf); +#endif /* WORDS_BIGENDIAN */ + + /* Encode fake INTEGER */ + erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); + if(erval.structure_ptr == &tmp) { + erval.structure_ptr = ptr; + } + return erval; +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +asn_dec_rval_t +NativeInteger_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + INTEGER_t st; + void *st_ptr = (void *)&st; + long *native = (long *)*sptr; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&st, 0, sizeof(st)); + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + opt_mname, buf_ptr, size); + if(rval.code == RC_OK) { + long l; + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */ + : asn_INTEGER2long(&st, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + } else { + *native = l; + } + } else { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); + return rval; +} + + +asn_enc_rval_t +NativeInteger_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ + asn_enc_rval_t er = {0,0,0}; + const long *native = (const long *)sptr; + + (void)ilevel; + (void)flags; + + if(!native) ASN__ENCODE_FAILED; + + er.encoded = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) + || cb(scratch, er.encoded, app_key) < 0) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + +#ifndef ASN_DISABLE_PER_SUPPORT + +asn_dec_rval_t +NativeInteger_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, void **sptr, + asn_per_data_t *pd) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + +asn_enc_rval_t +NativeInteger_encode_uper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + long native; + INTEGER_t tmpint; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(const long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) + ASN__ENCODE_FAILED; + er = INTEGER_encode_uper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + +asn_dec_rval_t +NativeInteger_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_aper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + +asn_enc_rval_t +NativeInteger_encode_aper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + + const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + long native; + INTEGER_t tmpint; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(const long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (APER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, (unsigned long)native) + : asn_long2INTEGER(&tmpint, native)) + ASN__ENCODE_FAILED; + er = INTEGER_encode_aper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + +#endif /* ASN_DISABLE_PER_SUPPORT */ + +/* + * INTEGER specific human-readable output. + */ +int +NativeInteger_print(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + const long *native = (const long *)sptr; + char scratch[32]; /* Enough for 64-bit int */ + int ret; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(native) { + long value = *native; + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) ? "%lu" : "%ld", value); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + if(cb(scratch, ret, app_key) < 0) return -1; + if(specs && (value >= 0 || !specs->field_unsigned)) { + const asn_INTEGER_enum_map_t *el = + INTEGER_map_value2enum(specs, value); + if(el) { + if(cb(" (", 2, app_key) < 0) return -1; + if(cb(el->enum_name, el->enum_len, app_key) < 0) return -1; + if(cb(")", 1, app_key) < 0) return -1; + } + } + return 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +NativeInteger_free(const asn_TYPE_descriptor_t *td, void *ptr, + enum asn_struct_free_method method) { + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", + td->name, method, ptr); + + switch(method) { + case ASFM_FREE_EVERYTHING: + FREEMEM(ptr); + break; + case ASFM_FREE_UNDERLYING: + break; + case ASFM_FREE_UNDERLYING_AND_RESET: + memset(ptr, 0, sizeof(long)); + break; + } +} + +int +NativeInteger_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bptr) { + (void)td; + + if(aptr && bptr) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + if(specs && specs->field_unsigned) { + const unsigned long *a = aptr; + const unsigned long *b = bptr; + if(*a < *b) { + return -1; + } else if(*a > *b) { + return 1; + } else { + return 0; + } + } else { + const long *a = aptr; + const long *b = bptr; + if(*a < *b) { + return -1; + } else if(*a > *b) { + return 1; + } else { + return 0; + } + } + } else if(!aptr) { + return -1; + } else { + return 1; + } +} + +asn_random_fill_result_t +NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, + const asn_encoding_constraints_t *constraints, + size_t max_length) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_random_fill_result_t result_ok = {ARFILL_OK, 1}; + asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0}; + asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0}; + long *st = *sptr; + const asn_INTEGER_enum_map_t *emap; + size_t emap_len; + intmax_t value; + int find_inside_map; + + if(max_length == 0) return result_skipped; + + if(st == NULL) { + st = (long *)CALLOC(1, sizeof(*st)); + if(st == NULL) { + return result_failed; + } + } + + if(specs) { + emap = specs->value2enum; + emap_len = specs->map_count; + if(specs->strict_enumeration) { + find_inside_map = emap_len > 0; + } else { + find_inside_map = emap_len ? asn_random_between(0, 1) : 0; + } + } else { + emap = 0; + emap_len = 0; + find_inside_map = 0; + } + + if(find_inside_map) { + assert(emap_len > 0); + value = emap[asn_random_between(0, emap_len - 1)].nat_value; + } else { + const asn_per_constraints_t *ct; + + static const long variants[] = { + -65536, -65535, -65534, -32769, -32768, -32767, -16385, -16384, + -16383, -257, -256, -255, -254, -129, -128, -127, + -126, -1, 0, 1, 126, 127, 128, 129, + 254, 255, 256, 257, 16383, 16384, 16385, 32767, + 32768, 32769, 65534, 65535, 65536, 65537}; + if(specs && specs->field_unsigned) { + assert(variants[18] == 0); + value = variants[asn_random_between( + 18, sizeof(variants) / sizeof(variants[0]) - 1)]; + } else { + value = variants[asn_random_between( + 0, sizeof(variants) / sizeof(variants[0]) - 1)]; + } + + if(!constraints) constraints = &td->encoding_constraints; + ct = constraints ? constraints->per_constraints : 0; + if(ct && (ct->value.flags & APC_CONSTRAINED)) { + if(value < ct->value.lower_bound || value > ct->value.upper_bound) { + value = asn_random_between(ct->value.lower_bound, + ct->value.upper_bound); + } + } + } + + *sptr = st; + *st = value; + return result_ok; +} diff --git a/src/codec_utils/SYSINFO/NativeInteger.h b/src/codec_utils/SYSINFO/NativeInteger.h new file mode 100644 index 000000000..c74406a8a --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeInteger.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2004-2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard INTEGER in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeInteger_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeInteger_H_ +#define _NativeInteger_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; +extern asn_TYPE_operation_t asn_OP_NativeInteger; + +asn_struct_free_f NativeInteger_free; +asn_struct_print_f NativeInteger_print; +asn_struct_compare_f NativeInteger_compare; +ber_type_decoder_f NativeInteger_decode_ber; +der_type_encoder_f NativeInteger_encode_der; +xer_type_decoder_f NativeInteger_decode_xer; +xer_type_encoder_f NativeInteger_encode_xer; +oer_type_decoder_f NativeInteger_decode_oer; +oer_type_encoder_f NativeInteger_encode_oer; +per_type_decoder_f NativeInteger_decode_uper; +per_type_encoder_f NativeInteger_encode_uper; +per_type_decoder_f NativeInteger_decode_aper; +per_type_encoder_f NativeInteger_encode_aper; +asn_random_fill_f NativeInteger_random_fill; + +#define NativeInteger_constraint asn_generic_no_constraint + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeInteger_H_ */ diff --git a/src/codec_utils/SYSINFO/NativeInteger_oer.c b/src/codec_utils/SYSINFO/NativeInteger_oer.c new file mode 100644 index 000000000..411413a24 --- /dev/null +++ b/src/codec_utils/SYSINFO/NativeInteger_oer.c @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2017 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_DISABLE_OER_SUPPORT + +#include +#include +#include + +asn_dec_rval_t +NativeInteger_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, + void **nint_ptr, const void *ptr, size_t size) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = {RC_OK, 0}; + long *native = (long *)*nint_ptr; + INTEGER_t tmpint; + INTEGER_t *tmpintptr = &tmpint; + + memset(&tmpint, 0, sizeof(tmpint)); + + if(!native) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + /* + * OPTIMIZATION: Encode directly rather than passing through INTEGER. + * Saves a memory allocation. + */ + rval = INTEGER_decode_oer(opt_codec_ctx, td, constraints, + (void **)&tmpintptr, ptr, size); + if(rval.code != RC_OK) { + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return rval; + } + + if(specs && specs->field_unsigned) { + unsigned long ul; + int ok = asn_INTEGER2ulong(&tmpint, &ul) == 0; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + if(ok) { + *native = ul; + } else { + rval.code = RC_FAIL; + return rval; + } + } else { + long l; + int ok = asn_INTEGER2long(&tmpint, &l) == 0; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + if(ok) { + *native = l; + } else { + rval.code = RC_FAIL; + return rval; + } + } + + return rval; +} + +/* + * Encode as Canonical OER. + */ +asn_enc_rval_t +NativeInteger_encode_oer(const asn_TYPE_descriptor_t *td, + const asn_oer_constraints_t *constraints, + const void *sptr, asn_app_consume_bytes_f *cb, + void *app_key) { + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + INTEGER_t tmpint; + long native; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(const long *)sptr; + memset(&tmpint, 0, sizeof(tmpint)); + + ASN_DEBUG("Encoding %s %ld as NativeInteger", td ? td->name : "", native); + + if((specs && specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) { + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + ASN__ENCODE_FAILED; + } else { + asn_enc_rval_t er = + INTEGER_encode_oer(td, constraints, &tmpint, cb, app_key); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; + } +} + +#endif /* ASN_DISABLE_OER_SUPPORT */ diff --git a/src/codec_utils/SYSINFO/P-Max.c b/src/codec_utils/SYSINFO/P-Max.c new file mode 100644 index 000000000..1edb6b697 --- /dev/null +++ b/src/codec_utils/SYSINFO/P-Max.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "P-Max.h" + +int +P_Max_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -30 && value <= 33)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_P_Max_constr_1 CC_NOTUSED = { + { 1, 0 } /* (-30..33) */, + -1}; +asn_per_constraints_t asn_PER_type_P_Max_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, -30, 33 } /* (-30..33) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_P_Max_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_P_Max = { + "P-Max", + "P-Max", + &asn_OP_NativeInteger, + asn_DEF_P_Max_tags_1, + sizeof(asn_DEF_P_Max_tags_1) + /sizeof(asn_DEF_P_Max_tags_1[0]), /* 1 */ + asn_DEF_P_Max_tags_1, /* Same as above */ + sizeof(asn_DEF_P_Max_tags_1) + /sizeof(asn_DEF_P_Max_tags_1[0]), /* 1 */ + { &asn_OER_type_P_Max_constr_1, &asn_PER_type_P_Max_constr_1, P_Max_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/P-Max.h b/src/codec_utils/SYSINFO/P-Max.h new file mode 100644 index 000000000..a36ab9a70 --- /dev/null +++ b/src/codec_utils/SYSINFO/P-Max.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _P_Max_H_ +#define _P_Max_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* P-Max */ +typedef long P_Max_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_P_Max_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_P_Max; +asn_struct_free_f P_Max_free; +asn_struct_print_f P_Max_print; +asn_constr_check_f P_Max_constraint; +ber_type_decoder_f P_Max_decode_ber; +der_type_encoder_f P_Max_encode_der; +xer_type_decoder_f P_Max_decode_xer; +xer_type_encoder_f P_Max_encode_xer; +oer_type_decoder_f P_Max_decode_oer; +oer_type_encoder_f P_Max_encode_oer; +per_type_decoder_f P_Max_decode_uper; +per_type_encoder_f P_Max_encode_uper; +per_type_decoder_f P_Max_decode_aper; +per_type_encoder_f P_Max_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _P_Max_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PCCH-Config.c b/src/codec_utils/SYSINFO/PCCH-Config.c new file mode 100644 index 000000000..94dfc9ba3 --- /dev/null +++ b/src/codec_utils/SYSINFO/PCCH-Config.c @@ -0,0 +1,1365 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PCCH-Config.h" + +static int +memb_halfT_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_quarterT_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_oneEighthT_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_oneSixteenthT_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_NativeInteger_constraint_14(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 139)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_16(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 279)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_18(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 559)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_20(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1119)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_22(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2239)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_24(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4479)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_26(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8959)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_28(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 17919)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS15KHZoneT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS30KHZoneT_SCS15KHZhalfT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_memb_halfT_constr_5 CC_NOTUSED = { + { 1, 1 } /* (0..1) */, + -1}; +static asn_per_constraints_t asn_PER_memb_halfT_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_quarterT_constr_6 CC_NOTUSED = { + { 1, 1 } /* (0..3) */, + -1}; +static asn_per_constraints_t asn_PER_memb_quarterT_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_oneEighthT_constr_7 CC_NOTUSED = { + { 1, 1 } /* (0..7) */, + -1}; +static asn_per_constraints_t asn_PER_memb_oneEighthT_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_oneSixteenthT_constr_8 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_oneSixteenthT_constr_8 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_nAndPagingFrameOffset_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_nAndPagingFrameOffset_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ns_constr_9 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ns_constr_9 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_15 CC_NOTUSED = { + { 1, 1 } /* (0..139) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_15 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 139 } /* (0..139) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_17 CC_NOTUSED = { + { 2, 1 } /* (0..279) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_17 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 279 } /* (0..279) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_19 CC_NOTUSED = { + { 2, 1 } /* (0..559) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_19 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 559 } /* (0..559) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_21 CC_NOTUSED = { + { 2, 1 } /* (0..1119) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_21 CC_NOTUSED = { + { APC_CONSTRAINED, 11, 11, 0, 1119 } /* (0..1119) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_23 CC_NOTUSED = { + { 2, 1 } /* (0..2239) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_23 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2239 } /* (0..2239) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_25 CC_NOTUSED = { + { 2, 1 } /* (0..4479) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_25 CC_NOTUSED = { + { APC_CONSTRAINED, 13, 13, 0, 4479 } /* (0..4479) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_27 CC_NOTUSED = { + { 2, 1 } /* (0..8959) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_27 CC_NOTUSED = { + { APC_CONSTRAINED, 14, 14, 0, 8959 } /* (0..8959) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_29 CC_NOTUSED = { + { 2, 1 } /* (0..17919) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_29 CC_NOTUSED = { + { APC_CONSTRAINED, 15, 15, 0, 17919 } /* (0..17919) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_nAndPagingFrameOffset_3[] = { + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config__nAndPagingFrameOffset, choice.oneT), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "oneT" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config__nAndPagingFrameOffset, choice.halfT), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_halfT_constr_5, &asn_PER_memb_halfT_constr_5, memb_halfT_constraint_3 }, + 0, 0, /* No default value */ + "halfT" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config__nAndPagingFrameOffset, choice.quarterT), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_quarterT_constr_6, &asn_PER_memb_quarterT_constr_6, memb_quarterT_constraint_3 }, + 0, 0, /* No default value */ + "quarterT" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config__nAndPagingFrameOffset, choice.oneEighthT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_oneEighthT_constr_7, &asn_PER_memb_oneEighthT_constr_7, memb_oneEighthT_constraint_3 }, + 0, 0, /* No default value */ + "oneEighthT" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config__nAndPagingFrameOffset, choice.oneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_oneSixteenthT_constr_8, &asn_PER_memb_oneSixteenthT_constr_8, memb_oneSixteenthT_constraint_3 }, + 0, 0, /* No default value */ + "oneSixteenthT" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_nAndPagingFrameOffset_tag2el_3[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* oneT */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* halfT */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* quarterT */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* oneEighthT */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* oneSixteenthT */ +}; +static asn_CHOICE_specifics_t asn_SPC_nAndPagingFrameOffset_specs_3 = { + sizeof(struct PCCH_Config__nAndPagingFrameOffset), + offsetof(struct PCCH_Config__nAndPagingFrameOffset, _asn_ctx), + offsetof(struct PCCH_Config__nAndPagingFrameOffset, present), + sizeof(((struct PCCH_Config__nAndPagingFrameOffset *)0)->present), + asn_MAP_nAndPagingFrameOffset_tag2el_3, + 5, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_nAndPagingFrameOffset_3 = { + "nAndPagingFrameOffset", + "nAndPagingFrameOffset", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_nAndPagingFrameOffset_constr_3, &asn_PER_type_nAndPagingFrameOffset_constr_3, CHOICE_constraint }, + asn_MBR_nAndPagingFrameOffset_3, + 5, /* Elements count */ + &asn_SPC_nAndPagingFrameOffset_specs_3 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ns_value2enum_9[] = { + { 0, 4, "four" }, + { 1, 3, "two" }, + { 2, 3, "one" } +}; +static const unsigned int asn_MAP_ns_enum2value_9[] = { + 0, /* four(0) */ + 2, /* one(2) */ + 1 /* two(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ns_specs_9 = { + asn_MAP_ns_value2enum_9, /* "tag" => N; sorted by tag */ + asn_MAP_ns_enum2value_9, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ns_tags_9[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ns_9 = { + "ns", + "ns", + &asn_OP_NativeEnumerated, + asn_DEF_ns_tags_9, + sizeof(asn_DEF_ns_tags_9) + /sizeof(asn_DEF_ns_tags_9[0]) - 1, /* 1 */ + asn_DEF_ns_tags_9, /* Same as above */ + sizeof(asn_DEF_ns_tags_9) + /sizeof(asn_DEF_ns_tags_9[0]), /* 2 */ + { &asn_OER_type_ns_constr_9, &asn_PER_type_ns_constr_9, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ns_specs_9 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS15KHZoneT_14[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_15, &asn_PER_memb_Member_constr_15, memb_NativeInteger_constraint_14 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS15KHZoneT_tags_14[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS15KHZoneT_specs_14 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS15KHZoneT_14 = { + "sCS15KHZoneT", + "sCS15KHZoneT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS15KHZoneT_tags_14, + sizeof(asn_DEF_sCS15KHZoneT_tags_14) + /sizeof(asn_DEF_sCS15KHZoneT_tags_14[0]) - 1, /* 1 */ + asn_DEF_sCS15KHZoneT_tags_14, /* Same as above */ + sizeof(asn_DEF_sCS15KHZoneT_tags_14) + /sizeof(asn_DEF_sCS15KHZoneT_tags_14[0]), /* 2 */ + { &asn_OER_type_sCS15KHZoneT_constr_14, &asn_PER_type_sCS15KHZoneT_constr_14, SEQUENCE_OF_constraint }, + asn_MBR_sCS15KHZoneT_14, + 1, /* Single element */ + &asn_SPC_sCS15KHZoneT_specs_14 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS30KHZoneT_SCS15KHZhalfT_16[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_17, &asn_PER_memb_Member_constr_17, memb_NativeInteger_constraint_16 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS30KHZoneT_SCS15KHZhalfT_specs_16 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_16 = { + "sCS30KHZoneT-SCS15KHZhalfT", + "sCS30KHZoneT-SCS15KHZhalfT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16, + sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16) + /sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[0]) - 1, /* 1 */ + asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16, /* Same as above */ + sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16) + /sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[0]), /* 2 */ + { &asn_OER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16, &asn_PER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16, SEQUENCE_OF_constraint }, + asn_MBR_sCS30KHZoneT_SCS15KHZhalfT_16, + 1, /* Single element */ + &asn_SPC_sCS30KHZoneT_SCS15KHZhalfT_specs_16 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_19, &asn_PER_memb_Member_constr_19, memb_NativeInteger_constraint_18 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_specs_18 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18 = { + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT", + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18, + sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18) + /sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[0]) - 1, /* 1 */ + asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18, /* Same as above */ + sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18) + /sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[0]), /* 2 */ + { &asn_OER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, &asn_PER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, SEQUENCE_OF_constraint }, + asn_MBR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18, + 1, /* Single element */ + &asn_SPC_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_specs_18 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_21, &asn_PER_memb_Member_constr_21, memb_NativeInteger_constraint_20 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_specs_20 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20 = { + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT", + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20, + sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20) + /sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20) + /sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, &asn_PER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_specs_20 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_23, &asn_PER_memb_Member_constr_23, memb_NativeInteger_constraint_22 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_specs_22 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22 = { + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT", + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22, + sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22) + /sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22, /* Same as above */ + sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22) + /sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[0]), /* 2 */ + { &asn_OER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, &asn_PER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22, + 1, /* Single element */ + &asn_SPC_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_specs_22 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_25, &asn_PER_memb_Member_constr_25, memb_NativeInteger_constraint_24 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_specs_24 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24 = { + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT", + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24, + sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24) + /sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24, /* Same as above */ + sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24) + /sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[0]), /* 2 */ + { &asn_OER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, &asn_PER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24, + 1, /* Single element */ + &asn_SPC_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_specs_24 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_27, &asn_PER_memb_Member_constr_27, memb_NativeInteger_constraint_26 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_specs_26 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26 = { + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT", + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26, + sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26) + /sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26) + /sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, &asn_PER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_specs_26 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneSixteenthT_28[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_29, &asn_PER_memb_Member_constr_29, memb_NativeInteger_constraint_28 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneSixteenthT_tags_28[] = { + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneSixteenthT_specs_28 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneSixteenthT_28 = { + "sCS120KHZoneSixteenthT", + "sCS120KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneSixteenthT_tags_28, + sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28) + /sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneSixteenthT_tags_28, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28) + /sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneSixteenthT_constr_28, &asn_PER_type_sCS120KHZoneSixteenthT_constr_28, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneSixteenthT_28, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneSixteenthT_specs_28 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_firstPDCCH_MonitoringOccasionOfPO_13[] = { + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS15KHZoneT), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_sCS15KHZoneT_14, + 0, + { &asn_OER_memb_sCS15KHZoneT_constr_14, &asn_PER_memb_sCS15KHZoneT_constr_14, memb_sCS15KHZoneT_constraint_13 }, + 0, 0, /* No default value */ + "sCS15KHZoneT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS30KHZoneT_SCS15KHZhalfT), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_16, + 0, + { &asn_OER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16, &asn_PER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16, memb_sCS30KHZoneT_SCS15KHZhalfT_constraint_13 }, + 0, 0, /* No default value */ + "sCS30KHZoneT-SCS15KHZhalfT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18, + 0, + { &asn_OER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, &asn_PER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constraint_13 }, + 0, 0, /* No default value */ + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20, + 0, + { &asn_OER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, &asn_PER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + 0, + &asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22, + 0, + { &asn_OER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, &asn_PER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + 0, + &asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24, + 0, + { &asn_OER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, &asn_PER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneEighthT_SCS60KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + 0, + &asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26, + 0, + { &asn_OER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, &asn_PER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + 0, + &asn_DEF_sCS120KHZoneSixteenthT_28, + 0, + { &asn_OER_memb_sCS120KHZoneSixteenthT_constr_28, &asn_PER_memb_sCS120KHZoneSixteenthT_constr_28, memb_sCS120KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneSixteenthT" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_firstPDCCH_MonitoringOccasionOfPO_tag2el_13[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sCS15KHZoneT */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sCS30KHZoneT-SCS15KHZhalfT */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* sCS120KHZoneEighthT-SCS60KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* sCS120KHZoneSixteenthT */ +}; +static asn_CHOICE_specifics_t asn_SPC_firstPDCCH_MonitoringOccasionOfPO_specs_13 = { + sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, _asn_ctx), + offsetof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, present), + sizeof(((struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *)0)->present), + asn_MAP_firstPDCCH_MonitoringOccasionOfPO_tag2el_13, + 8, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_firstPDCCH_MonitoringOccasionOfPO_13 = { + "firstPDCCH-MonitoringOccasionOfPO", + "firstPDCCH-MonitoringOccasionOfPO", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13, &asn_PER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13, CHOICE_constraint }, + asn_MBR_firstPDCCH_MonitoringOccasionOfPO_13, + 8, /* Elements count */ + &asn_SPC_firstPDCCH_MonitoringOccasionOfPO_specs_13 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PCCH_Config_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config, defaultPagingCycle), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PagingCycle, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "defaultPagingCycle" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config, nAndPagingFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_nAndPagingFrameOffset_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nAndPagingFrameOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct PCCH_Config, ns), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ns_9, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ns" + }, + { ATF_POINTER, 1, offsetof(struct PCCH_Config, firstPDCCH_MonitoringOccasionOfPO), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_firstPDCCH_MonitoringOccasionOfPO_13, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "firstPDCCH-MonitoringOccasionOfPO" + }, +}; +static const int asn_MAP_PCCH_Config_oms_1[] = { 3 }; +static const ber_tlv_tag_t asn_DEF_PCCH_Config_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PCCH_Config_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* defaultPagingCycle */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nAndPagingFrameOffset */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ns */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* firstPDCCH-MonitoringOccasionOfPO */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PCCH_Config_specs_1 = { + sizeof(struct PCCH_Config), + offsetof(struct PCCH_Config, _asn_ctx), + asn_MAP_PCCH_Config_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_PCCH_Config_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PCCH_Config = { + "PCCH-Config", + "PCCH-Config", + &asn_OP_SEQUENCE, + asn_DEF_PCCH_Config_tags_1, + sizeof(asn_DEF_PCCH_Config_tags_1) + /sizeof(asn_DEF_PCCH_Config_tags_1[0]), /* 1 */ + asn_DEF_PCCH_Config_tags_1, /* Same as above */ + sizeof(asn_DEF_PCCH_Config_tags_1) + /sizeof(asn_DEF_PCCH_Config_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PCCH_Config_1, + 4, /* Elements count */ + &asn_SPC_PCCH_Config_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PCCH-Config.h b/src/codec_utils/SYSINFO/PCCH-Config.h new file mode 100644 index 000000000..daaa167e2 --- /dev/null +++ b/src/codec_utils/SYSINFO/PCCH-Config.h @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PCCH_Config_H_ +#define _PCCH_Config_H_ + + +#include + +/* Including external dependencies */ +#include "PagingCycle.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PCCH_Config__nAndPagingFrameOffset_PR { + PCCH_Config__nAndPagingFrameOffset_PR_NOTHING, /* No components present */ + PCCH_Config__nAndPagingFrameOffset_PR_oneT, + PCCH_Config__nAndPagingFrameOffset_PR_halfT, + PCCH_Config__nAndPagingFrameOffset_PR_quarterT, + PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT, + PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT +} PCCH_Config__nAndPagingFrameOffset_PR; +typedef enum PCCH_Config__ns { + PCCH_Config__ns_four = 0, + PCCH_Config__ns_two = 1, + PCCH_Config__ns_one = 2 +} e_PCCH_Config__ns; +typedef enum PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR { + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING, /* No components present */ + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT, + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneSixteenthT +} PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR; + +/* PCCH-Config */ +typedef struct PCCH_Config { + PagingCycle_t defaultPagingCycle; + struct PCCH_Config__nAndPagingFrameOffset { + PCCH_Config__nAndPagingFrameOffset_PR present; + union PCCH_Config__nAndPagingFrameOffset_u { + NULL_t oneT; + long halfT; + long quarterT; + long oneEighthT; + long oneSixteenthT; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } nAndPagingFrameOffset; + long ns; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO { + PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR present; + union PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_u { + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS15KHZoneT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS30KHZoneT_SCS15KHZhalfT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneEighthT_SCS60KHZoneSixteenthT; + struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneSixteenthT; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *firstPDCCH_MonitoringOccasionOfPO; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PCCH_Config_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_ns_9; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PCCH_Config; +extern asn_SEQUENCE_specifics_t asn_SPC_PCCH_Config_specs_1; +extern asn_TYPE_member_t asn_MBR_PCCH_Config_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PCCH_Config_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.c b/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.c new file mode 100644 index 000000000..defc2ac3c --- /dev/null +++ b/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.c @@ -0,0 +1,1271 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PDCCH-ConfigCommon.h" + +#include "ControlResourceSet.h" +#include "SearchSpace.h" +static int +memb_NativeInteger_constraint_14(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 139)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_16(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 279)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_18(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 559)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_20(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1119)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_22(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2239)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_24(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4479)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_26(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8959)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_NativeInteger_constraint_28(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 17919)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS15KHZoneT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS30KHZoneT_SCS15KHZhalfT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sCS120KHZoneSixteenthT_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_commonSearchSpaceList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 4)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_commonSearchSpaceList_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_commonSearchSpaceList_constr_5 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_15 CC_NOTUSED = { + { 1, 1 } /* (0..139) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_15 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 139 } /* (0..139) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_17 CC_NOTUSED = { + { 2, 1 } /* (0..279) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_17 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 279 } /* (0..279) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_19 CC_NOTUSED = { + { 2, 1 } /* (0..559) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_19 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 559 } /* (0..559) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_21 CC_NOTUSED = { + { 2, 1 } /* (0..1119) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_21 CC_NOTUSED = { + { APC_CONSTRAINED, 11, 11, 0, 1119 } /* (0..1119) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_23 CC_NOTUSED = { + { 2, 1 } /* (0..2239) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_23 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2239 } /* (0..2239) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_25 CC_NOTUSED = { + { 2, 1 } /* (0..4479) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_25 CC_NOTUSED = { + { APC_CONSTRAINED, 13, 13, 0, 4479 } /* (0..4479) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_27 CC_NOTUSED = { + { 2, 1 } /* (0..8959) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_27 CC_NOTUSED = { + { APC_CONSTRAINED, 14, 14, 0, 8959 } /* (0..8959) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_Member_constr_29 CC_NOTUSED = { + { 2, 1 } /* (0..17919) */, + -1}; +static asn_per_constraints_t asn_PER_memb_Member_constr_29 CC_NOTUSED = { + { APC_CONSTRAINED, 15, 15, 0, 17919 } /* (0..17919) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_type_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS15KHZoneT_constr_14 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_sCS120KHZoneSixteenthT_constr_28 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_commonSearchSpaceList_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..4)) */}; +static asn_per_constraints_t asn_PER_memb_commonSearchSpaceList_constr_5 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_commonSearchSpaceList_5[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SearchSpace, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_commonSearchSpaceList_tags_5[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_commonSearchSpaceList_specs_5 = { + sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList), + offsetof(struct PDCCH_ConfigCommon__commonSearchSpaceList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_commonSearchSpaceList_5 = { + "commonSearchSpaceList", + "commonSearchSpaceList", + &asn_OP_SEQUENCE_OF, + asn_DEF_commonSearchSpaceList_tags_5, + sizeof(asn_DEF_commonSearchSpaceList_tags_5) + /sizeof(asn_DEF_commonSearchSpaceList_tags_5[0]) - 1, /* 1 */ + asn_DEF_commonSearchSpaceList_tags_5, /* Same as above */ + sizeof(asn_DEF_commonSearchSpaceList_tags_5) + /sizeof(asn_DEF_commonSearchSpaceList_tags_5[0]), /* 2 */ + { &asn_OER_type_commonSearchSpaceList_constr_5, &asn_PER_type_commonSearchSpaceList_constr_5, SEQUENCE_OF_constraint }, + asn_MBR_commonSearchSpaceList_5, + 1, /* Single element */ + &asn_SPC_commonSearchSpaceList_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS15KHZoneT_14[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_15, &asn_PER_memb_Member_constr_15, memb_NativeInteger_constraint_14 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS15KHZoneT_tags_14[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS15KHZoneT_specs_14 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS15KHZoneT_14 = { + "sCS15KHZoneT", + "sCS15KHZoneT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS15KHZoneT_tags_14, + sizeof(asn_DEF_sCS15KHZoneT_tags_14) + /sizeof(asn_DEF_sCS15KHZoneT_tags_14[0]) - 1, /* 1 */ + asn_DEF_sCS15KHZoneT_tags_14, /* Same as above */ + sizeof(asn_DEF_sCS15KHZoneT_tags_14) + /sizeof(asn_DEF_sCS15KHZoneT_tags_14[0]), /* 2 */ + { &asn_OER_type_sCS15KHZoneT_constr_14, &asn_PER_type_sCS15KHZoneT_constr_14, SEQUENCE_OF_constraint }, + asn_MBR_sCS15KHZoneT_14, + 1, /* Single element */ + &asn_SPC_sCS15KHZoneT_specs_14 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS30KHZoneT_SCS15KHZhalfT_16[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_17, &asn_PER_memb_Member_constr_17, memb_NativeInteger_constraint_16 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS30KHZoneT_SCS15KHZhalfT_specs_16 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_16 = { + "sCS30KHZoneT-SCS15KHZhalfT", + "sCS30KHZoneT-SCS15KHZhalfT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16, + sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16) + /sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[0]) - 1, /* 1 */ + asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16, /* Same as above */ + sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16) + /sizeof(asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_tags_16[0]), /* 2 */ + { &asn_OER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16, &asn_PER_type_sCS30KHZoneT_SCS15KHZhalfT_constr_16, SEQUENCE_OF_constraint }, + asn_MBR_sCS30KHZoneT_SCS15KHZhalfT_16, + 1, /* Single element */ + &asn_SPC_sCS30KHZoneT_SCS15KHZhalfT_specs_16 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_19, &asn_PER_memb_Member_constr_19, memb_NativeInteger_constraint_18 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_specs_18 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18 = { + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT", + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18, + sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18) + /sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[0]) - 1, /* 1 */ + asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18, /* Same as above */ + sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18) + /sizeof(asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_tags_18[0]), /* 2 */ + { &asn_OER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, &asn_PER_type_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, SEQUENCE_OF_constraint }, + asn_MBR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18, + 1, /* Single element */ + &asn_SPC_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_specs_18 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_21, &asn_PER_memb_Member_constr_21, memb_NativeInteger_constraint_20 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_specs_20 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20 = { + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT", + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20, + sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20) + /sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20) + /sizeof(asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_tags_20[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, &asn_PER_type_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_specs_20 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_23, &asn_PER_memb_Member_constr_23, memb_NativeInteger_constraint_22 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_specs_22 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22 = { + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT", + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22, + sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22) + /sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22, /* Same as above */ + sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22) + /sizeof(asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_tags_22[0]), /* 2 */ + { &asn_OER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, &asn_PER_type_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22, + 1, /* Single element */ + &asn_SPC_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_specs_22 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_25, &asn_PER_memb_Member_constr_25, memb_NativeInteger_constraint_24 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_specs_24 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24 = { + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT", + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24, + sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24) + /sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24, /* Same as above */ + sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24) + /sizeof(asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_tags_24[0]), /* 2 */ + { &asn_OER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, &asn_PER_type_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24, + 1, /* Single element */ + &asn_SPC_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_specs_24 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_27, &asn_PER_memb_Member_constr_27, memb_NativeInteger_constraint_26 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_specs_26 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26 = { + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT", + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26, + sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26) + /sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26) + /sizeof(asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_tags_26[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, &asn_PER_type_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_specs_26 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_sCS120KHZoneSixteenthT_28[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_Member_constr_29, &asn_PER_memb_Member_constr_29, memb_NativeInteger_constraint_28 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_sCS120KHZoneSixteenthT_tags_28[] = { + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_sCS120KHZoneSixteenthT_specs_28 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_sCS120KHZoneSixteenthT_28 = { + "sCS120KHZoneSixteenthT", + "sCS120KHZoneSixteenthT", + &asn_OP_SEQUENCE_OF, + asn_DEF_sCS120KHZoneSixteenthT_tags_28, + sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28) + /sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28[0]) - 1, /* 1 */ + asn_DEF_sCS120KHZoneSixteenthT_tags_28, /* Same as above */ + sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28) + /sizeof(asn_DEF_sCS120KHZoneSixteenthT_tags_28[0]), /* 2 */ + { &asn_OER_type_sCS120KHZoneSixteenthT_constr_28, &asn_PER_type_sCS120KHZoneSixteenthT_constr_28, SEQUENCE_OF_constraint }, + asn_MBR_sCS120KHZoneSixteenthT_28, + 1, /* Single element */ + &asn_SPC_sCS120KHZoneSixteenthT_specs_28 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_firstPDCCH_MonitoringOccasionOfPO_13[] = { + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS15KHZoneT), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_sCS15KHZoneT_14, + 0, + { &asn_OER_memb_sCS15KHZoneT_constr_14, &asn_PER_memb_sCS15KHZoneT_constr_14, memb_sCS15KHZoneT_constraint_13 }, + 0, 0, /* No default value */ + "sCS15KHZoneT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS30KHZoneT_SCS15KHZhalfT), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_sCS30KHZoneT_SCS15KHZhalfT_16, + 0, + { &asn_OER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16, &asn_PER_memb_sCS30KHZoneT_SCS15KHZhalfT_constr_16, memb_sCS30KHZoneT_SCS15KHZhalfT_constraint_13 }, + 0, 0, /* No default value */ + "sCS30KHZoneT-SCS15KHZhalfT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_18, + 0, + { &asn_OER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, &asn_PER_memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constr_18, memb_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_constraint_13 }, + 0, 0, /* No default value */ + "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_20, + 0, + { &asn_OER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, &asn_PER_memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constr_20, memb_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + 0, + &asn_DEF_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_22, + 0, + { &asn_OER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, &asn_PER_memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constr_22, memb_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + 0, + &asn_DEF_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_24, + 0, + { &asn_OER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, &asn_PER_memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constr_24, memb_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneEighthT_SCS60KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + 0, + &asn_DEF_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_26, + 0, + { &asn_OER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, &asn_PER_memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constr_26, memb_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT" + }, + { ATF_POINTER, 0, offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, choice.sCS120KHZoneSixteenthT), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + 0, + &asn_DEF_sCS120KHZoneSixteenthT_28, + 0, + { &asn_OER_memb_sCS120KHZoneSixteenthT_constr_28, &asn_PER_memb_sCS120KHZoneSixteenthT_constr_28, memb_sCS120KHZoneSixteenthT_constraint_13 }, + 0, 0, /* No default value */ + "sCS120KHZoneSixteenthT" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_firstPDCCH_MonitoringOccasionOfPO_tag2el_13[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sCS15KHZoneT */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sCS30KHZoneT-SCS15KHZhalfT */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* sCS120KHZoneEighthT-SCS60KHZoneSixteenthT */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* sCS120KHZoneSixteenthT */ +}; +static asn_CHOICE_specifics_t asn_SPC_firstPDCCH_MonitoringOccasionOfPO_specs_13 = { + sizeof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, _asn_ctx), + offsetof(struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO, present), + sizeof(((struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO *)0)->present), + asn_MAP_firstPDCCH_MonitoringOccasionOfPO_tag2el_13, + 8, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_firstPDCCH_MonitoringOccasionOfPO_13 = { + "firstPDCCH-MonitoringOccasionOfPO", + "firstPDCCH-MonitoringOccasionOfPO", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13, &asn_PER_type_firstPDCCH_MonitoringOccasionOfPO_constr_13, CHOICE_constraint }, + asn_MBR_firstPDCCH_MonitoringOccasionOfPO_13, + 8, /* Elements count */ + &asn_SPC_firstPDCCH_MonitoringOccasionOfPO_specs_13 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_ext1_12[] = { + { ATF_POINTER, 1, offsetof(struct PDCCH_ConfigCommon__ext1, firstPDCCH_MonitoringOccasionOfPO), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_firstPDCCH_MonitoringOccasionOfPO_13, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "firstPDCCH-MonitoringOccasionOfPO" + }, +}; +static const int asn_MAP_ext1_oms_12[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_ext1_tags_12[] = { + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ext1_tag2el_12[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* firstPDCCH-MonitoringOccasionOfPO */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ext1_specs_12 = { + sizeof(struct PDCCH_ConfigCommon__ext1), + offsetof(struct PDCCH_ConfigCommon__ext1, _asn_ctx), + asn_MAP_ext1_tag2el_12, + 1, /* Count of tags in the map */ + asn_MAP_ext1_oms_12, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ext1_12 = { + "ext1", + "ext1", + &asn_OP_SEQUENCE, + asn_DEF_ext1_tags_12, + sizeof(asn_DEF_ext1_tags_12) + /sizeof(asn_DEF_ext1_tags_12[0]) - 1, /* 1 */ + asn_DEF_ext1_tags_12, /* Same as above */ + sizeof(asn_DEF_ext1_tags_12) + /sizeof(asn_DEF_ext1_tags_12[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ext1_12, + 1, /* Elements count */ + &asn_SPC_ext1_specs_12 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PDCCH_ConfigCommon_1[] = { + { ATF_POINTER, 9, offsetof(struct PDCCH_ConfigCommon, controlResourceSetZero), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlResourceSetZero, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "controlResourceSetZero" + }, + { ATF_POINTER, 8, offsetof(struct PDCCH_ConfigCommon, commonControlResourceSet), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlResourceSet, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "commonControlResourceSet" + }, + { ATF_POINTER, 7, offsetof(struct PDCCH_ConfigCommon, searchSpaceZero), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceZero, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceZero" + }, + { ATF_POINTER, 6, offsetof(struct PDCCH_ConfigCommon, commonSearchSpaceList), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_commonSearchSpaceList_5, + 0, + { &asn_OER_memb_commonSearchSpaceList_constr_5, &asn_PER_memb_commonSearchSpaceList_constr_5, memb_commonSearchSpaceList_constraint_1 }, + 0, 0, /* No default value */ + "commonSearchSpaceList" + }, + { ATF_POINTER, 5, offsetof(struct PDCCH_ConfigCommon, searchSpaceSIB1), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceSIB1" + }, + { ATF_POINTER, 4, offsetof(struct PDCCH_ConfigCommon, searchSpaceOtherSystemInformation), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceOtherSystemInformation" + }, + { ATF_POINTER, 3, offsetof(struct PDCCH_ConfigCommon, pagingSearchSpace), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pagingSearchSpace" + }, + { ATF_POINTER, 2, offsetof(struct PDCCH_ConfigCommon, ra_SearchSpace), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ra-SearchSpace" + }, + { ATF_POINTER, 1, offsetof(struct PDCCH_ConfigCommon, ext1), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + 0, + &asn_DEF_ext1_12, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ext1" + }, +}; +static const int asn_MAP_PDCCH_ConfigCommon_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static const ber_tlv_tag_t asn_DEF_PDCCH_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PDCCH_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* controlResourceSetZero */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* commonControlResourceSet */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* searchSpaceZero */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* commonSearchSpaceList */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* searchSpaceSIB1 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* searchSpaceOtherSystemInformation */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* pagingSearchSpace */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ra-SearchSpace */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* ext1 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PDCCH_ConfigCommon_specs_1 = { + sizeof(struct PDCCH_ConfigCommon), + offsetof(struct PDCCH_ConfigCommon, _asn_ctx), + asn_MAP_PDCCH_ConfigCommon_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_PDCCH_ConfigCommon_oms_1, /* Optional members */ + 8, 1, /* Root/Additions */ + 8, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PDCCH_ConfigCommon = { + "PDCCH-ConfigCommon", + "PDCCH-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_PDCCH_ConfigCommon_tags_1, + sizeof(asn_DEF_PDCCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PDCCH_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_PDCCH_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_PDCCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PDCCH_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PDCCH_ConfigCommon_1, + 9, /* Elements count */ + &asn_SPC_PDCCH_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.h b/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.h new file mode 100644 index 000000000..ff03e965f --- /dev/null +++ b/src/codec_utils/SYSINFO/PDCCH-ConfigCommon.h @@ -0,0 +1,140 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PDCCH_ConfigCommon_H_ +#define _PDCCH_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include "ControlResourceSetZero.h" +#include "SearchSpaceZero.h" +#include "SearchSpaceId.h" +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR { + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING, /* No components present */ + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT, + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneSixteenthT +} PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR; + +/* Forward declarations */ +struct ControlResourceSet; +struct SearchSpace; + +/* PDCCH-ConfigCommon */ +typedef struct PDCCH_ConfigCommon { + ControlResourceSetZero_t *controlResourceSetZero; /* OPTIONAL */ + struct ControlResourceSet *commonControlResourceSet; /* OPTIONAL */ + SearchSpaceZero_t *searchSpaceZero; /* OPTIONAL */ + struct PDCCH_ConfigCommon__commonSearchSpaceList { + A_SEQUENCE_OF(struct SearchSpace) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *commonSearchSpaceList; + SearchSpaceId_t *searchSpaceSIB1; /* OPTIONAL */ + SearchSpaceId_t *searchSpaceOtherSystemInformation; /* OPTIONAL */ + SearchSpaceId_t *pagingSearchSpace; /* OPTIONAL */ + SearchSpaceId_t *ra_SearchSpace; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + struct PDCCH_ConfigCommon__ext1 { + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO { + PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_PR present; + union PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO_u { + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS15KHZoneT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS30KHZoneT_SCS15KHZhalfT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneEighthT_SCS60KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneEighthT_SCS60KHZoneSixteenthT; + struct PDCCH_ConfigCommon__ext1__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneSixteenthT { + A_SEQUENCE_OF(long) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *sCS120KHZoneSixteenthT; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *firstPDCCH_MonitoringOccasionOfPO; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *ext1; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDCCH_ConfigCommon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PDCCH_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_PDCCH_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_PDCCH_ConfigCommon_1[9]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDCCH_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.c b/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.c new file mode 100644 index 000000000..6dc7dcc6a --- /dev/null +++ b/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.c @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PDCCH-ConfigSIB1.h" + +asn_TYPE_member_t asn_MBR_PDCCH_ConfigSIB1_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PDCCH_ConfigSIB1, controlResourceSetZero), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlResourceSetZero, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "controlResourceSetZero" + }, + { ATF_NOFLAGS, 0, offsetof(struct PDCCH_ConfigSIB1, searchSpaceZero), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceZero, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceZero" + }, +}; +static const ber_tlv_tag_t asn_DEF_PDCCH_ConfigSIB1_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PDCCH_ConfigSIB1_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* controlResourceSetZero */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* searchSpaceZero */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PDCCH_ConfigSIB1_specs_1 = { + sizeof(struct PDCCH_ConfigSIB1), + offsetof(struct PDCCH_ConfigSIB1, _asn_ctx), + asn_MAP_PDCCH_ConfigSIB1_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PDCCH_ConfigSIB1 = { + "PDCCH-ConfigSIB1", + "PDCCH-ConfigSIB1", + &asn_OP_SEQUENCE, + asn_DEF_PDCCH_ConfigSIB1_tags_1, + sizeof(asn_DEF_PDCCH_ConfigSIB1_tags_1) + /sizeof(asn_DEF_PDCCH_ConfigSIB1_tags_1[0]), /* 1 */ + asn_DEF_PDCCH_ConfigSIB1_tags_1, /* Same as above */ + sizeof(asn_DEF_PDCCH_ConfigSIB1_tags_1) + /sizeof(asn_DEF_PDCCH_ConfigSIB1_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PDCCH_ConfigSIB1_1, + 2, /* Elements count */ + &asn_SPC_PDCCH_ConfigSIB1_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.h b/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.h new file mode 100644 index 000000000..cd6f7dc84 --- /dev/null +++ b/src/codec_utils/SYSINFO/PDCCH-ConfigSIB1.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PDCCH_ConfigSIB1_H_ +#define _PDCCH_ConfigSIB1_H_ + + +#include + +/* Including external dependencies */ +#include "ControlResourceSetZero.h" +#include "SearchSpaceZero.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PDCCH-ConfigSIB1 */ +typedef struct PDCCH_ConfigSIB1 { + ControlResourceSetZero_t controlResourceSetZero; + SearchSpaceZero_t searchSpaceZero; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDCCH_ConfigSIB1_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PDCCH_ConfigSIB1; +extern asn_SEQUENCE_specifics_t asn_SPC_PDCCH_ConfigSIB1_specs_1; +extern asn_TYPE_member_t asn_MBR_PDCCH_ConfigSIB1_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDCCH_ConfigSIB1_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.c b/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.c new file mode 100644 index 000000000..e2e7ce53e --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PDSCH-ConfigCommon.h" + +#include "PDSCH-TimeDomainResourceAllocationList.h" +asn_TYPE_member_t asn_MBR_PDSCH_ConfigCommon_1[] = { + { ATF_POINTER, 1, offsetof(struct PDSCH_ConfigCommon, pdsch_TimeDomainAllocationList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PDSCH_TimeDomainResourceAllocationList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pdsch-TimeDomainAllocationList" + }, +}; +static const int asn_MAP_PDSCH_ConfigCommon_oms_1[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_PDSCH_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PDSCH_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* pdsch-TimeDomainAllocationList */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PDSCH_ConfigCommon_specs_1 = { + sizeof(struct PDSCH_ConfigCommon), + offsetof(struct PDSCH_ConfigCommon, _asn_ctx), + asn_MAP_PDSCH_ConfigCommon_tag2el_1, + 1, /* Count of tags in the map */ + asn_MAP_PDSCH_ConfigCommon_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PDSCH_ConfigCommon = { + "PDSCH-ConfigCommon", + "PDSCH-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_PDSCH_ConfigCommon_tags_1, + sizeof(asn_DEF_PDSCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PDSCH_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_PDSCH_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_PDSCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PDSCH_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PDSCH_ConfigCommon_1, + 1, /* Elements count */ + &asn_SPC_PDSCH_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.h b/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.h new file mode 100644 index 000000000..1be66cab6 --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-ConfigCommon.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PDSCH_ConfigCommon_H_ +#define _PDSCH_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct PDSCH_TimeDomainResourceAllocationList; + +/* PDSCH-ConfigCommon */ +typedef struct PDSCH_ConfigCommon { + struct PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDSCH_ConfigCommon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PDSCH_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_PDSCH_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_PDSCH_ConfigCommon_1[1]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDSCH_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.c b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.c new file mode 100644 index 000000000..b2baf4bea --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.c @@ -0,0 +1,187 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PDSCH-TimeDomainResourceAllocation.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_k0_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_startSymbolAndLength_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_mappingType_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_mappingType_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_k0_constr_2 CC_NOTUSED = { + { 1, 1 } /* (0..32) */, + -1}; +static asn_per_constraints_t asn_PER_memb_k0_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 32 } /* (0..32) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_startSymbolAndLength_constr_6 CC_NOTUSED = { + { 1, 1 } /* (0..127) */, + -1}; +static asn_per_constraints_t asn_PER_memb_startSymbolAndLength_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_mappingType_value2enum_3[] = { + { 0, 5, "typeA" }, + { 1, 5, "typeB" } +}; +static const unsigned int asn_MAP_mappingType_enum2value_3[] = { + 0, /* typeA(0) */ + 1 /* typeB(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_mappingType_specs_3 = { + asn_MAP_mappingType_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_mappingType_enum2value_3, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_mappingType_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_mappingType_3 = { + "mappingType", + "mappingType", + &asn_OP_NativeEnumerated, + asn_DEF_mappingType_tags_3, + sizeof(asn_DEF_mappingType_tags_3) + /sizeof(asn_DEF_mappingType_tags_3[0]) - 1, /* 1 */ + asn_DEF_mappingType_tags_3, /* Same as above */ + sizeof(asn_DEF_mappingType_tags_3) + /sizeof(asn_DEF_mappingType_tags_3[0]), /* 2 */ + { &asn_OER_type_mappingType_constr_3, &asn_PER_type_mappingType_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_mappingType_specs_3 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PDSCH_TimeDomainResourceAllocation_1[] = { + { ATF_POINTER, 1, offsetof(struct PDSCH_TimeDomainResourceAllocation, k0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_k0_constr_2, &asn_PER_memb_k0_constr_2, memb_k0_constraint_1 }, + 0, 0, /* No default value */ + "k0" + }, + { ATF_NOFLAGS, 0, offsetof(struct PDSCH_TimeDomainResourceAllocation, mappingType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_mappingType_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "mappingType" + }, + { ATF_NOFLAGS, 0, offsetof(struct PDSCH_TimeDomainResourceAllocation, startSymbolAndLength), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_startSymbolAndLength_constr_6, &asn_PER_memb_startSymbolAndLength_constr_6, memb_startSymbolAndLength_constraint_1 }, + 0, 0, /* No default value */ + "startSymbolAndLength" + }, +}; +static const int asn_MAP_PDSCH_TimeDomainResourceAllocation_oms_1[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PDSCH_TimeDomainResourceAllocation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* k0 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* mappingType */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* startSymbolAndLength */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PDSCH_TimeDomainResourceAllocation_specs_1 = { + sizeof(struct PDSCH_TimeDomainResourceAllocation), + offsetof(struct PDSCH_TimeDomainResourceAllocation, _asn_ctx), + asn_MAP_PDSCH_TimeDomainResourceAllocation_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_PDSCH_TimeDomainResourceAllocation_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PDSCH_TimeDomainResourceAllocation = { + "PDSCH-TimeDomainResourceAllocation", + "PDSCH-TimeDomainResourceAllocation", + &asn_OP_SEQUENCE, + asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1, + sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1) + /sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1[0]), /* 1 */ + asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1, /* Same as above */ + sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1) + /sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocation_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PDSCH_TimeDomainResourceAllocation_1, + 3, /* Elements count */ + &asn_SPC_PDSCH_TimeDomainResourceAllocation_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.h b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.h new file mode 100644 index 000000000..577d428cb --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocation.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PDSCH_TimeDomainResourceAllocation_H_ +#define _PDSCH_TimeDomainResourceAllocation_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PDSCH_TimeDomainResourceAllocation__mappingType { + PDSCH_TimeDomainResourceAllocation__mappingType_typeA = 0, + PDSCH_TimeDomainResourceAllocation__mappingType_typeB = 1 +} e_PDSCH_TimeDomainResourceAllocation__mappingType; + +/* PDSCH-TimeDomainResourceAllocation */ +typedef struct PDSCH_TimeDomainResourceAllocation { + long *k0; /* OPTIONAL */ + long mappingType; + long startSymbolAndLength; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDSCH_TimeDomainResourceAllocation_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_mappingType_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PDSCH_TimeDomainResourceAllocation; +extern asn_SEQUENCE_specifics_t asn_SPC_PDSCH_TimeDomainResourceAllocation_specs_1; +extern asn_TYPE_member_t asn_MBR_PDSCH_TimeDomainResourceAllocation_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDSCH_TimeDomainResourceAllocation_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.c b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.c new file mode 100644 index 000000000..43ac21e8c --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PDSCH-TimeDomainResourceAllocationList.h" + +#include "PDSCH-TimeDomainResourceAllocation.h" +static asn_oer_constraints_t asn_OER_type_PDSCH_TimeDomainResourceAllocationList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..16)) */}; +asn_per_constraints_t asn_PER_type_PDSCH_TimeDomainResourceAllocationList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_PDSCH_TimeDomainResourceAllocationList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_PDSCH_TimeDomainResourceAllocation, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_PDSCH_TimeDomainResourceAllocationList_specs_1 = { + sizeof(struct PDSCH_TimeDomainResourceAllocationList), + offsetof(struct PDSCH_TimeDomainResourceAllocationList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_PDSCH_TimeDomainResourceAllocationList = { + "PDSCH-TimeDomainResourceAllocationList", + "PDSCH-TimeDomainResourceAllocationList", + &asn_OP_SEQUENCE_OF, + asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1, + sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1) + /sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1[0]), /* 1 */ + asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1, /* Same as above */ + sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1) + /sizeof(asn_DEF_PDSCH_TimeDomainResourceAllocationList_tags_1[0]), /* 1 */ + { &asn_OER_type_PDSCH_TimeDomainResourceAllocationList_constr_1, &asn_PER_type_PDSCH_TimeDomainResourceAllocationList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_PDSCH_TimeDomainResourceAllocationList_1, + 1, /* Single element */ + &asn_SPC_PDSCH_TimeDomainResourceAllocationList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.h b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.h new file mode 100644 index 000000000..98d134957 --- /dev/null +++ b/src/codec_utils/SYSINFO/PDSCH-TimeDomainResourceAllocationList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PDSCH_TimeDomainResourceAllocationList_H_ +#define _PDSCH_TimeDomainResourceAllocationList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct PDSCH_TimeDomainResourceAllocation; + +/* PDSCH-TimeDomainResourceAllocationList */ +typedef struct PDSCH_TimeDomainResourceAllocationList { + A_SEQUENCE_OF(struct PDSCH_TimeDomainResourceAllocation) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDSCH_TimeDomainResourceAllocationList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PDSCH_TimeDomainResourceAllocationList; +extern asn_SET_OF_specifics_t asn_SPC_PDSCH_TimeDomainResourceAllocationList_specs_1; +extern asn_TYPE_member_t asn_MBR_PDSCH_TimeDomainResourceAllocationList_1[1]; +extern asn_per_constraints_t asn_PER_type_PDSCH_TimeDomainResourceAllocationList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDSCH_TimeDomainResourceAllocationList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PLMN-Identity.c b/src/codec_utils/SYSINFO/PLMN-Identity.c new file mode 100644 index 000000000..d721faa1b --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-Identity.c @@ -0,0 +1,63 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PLMN-Identity.h" + +#include "MCC.h" +asn_TYPE_member_t asn_MBR_PLMN_Identity_1[] = { + { ATF_POINTER, 1, offsetof(struct PLMN_Identity, mcc), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MCC, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "mcc" + }, + { ATF_NOFLAGS, 0, offsetof(struct PLMN_Identity, mnc), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MNC, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "mnc" + }, +}; +static const int asn_MAP_PLMN_Identity_oms_1[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_PLMN_Identity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PLMN_Identity_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* mcc */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* mnc */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PLMN_Identity_specs_1 = { + sizeof(struct PLMN_Identity), + offsetof(struct PLMN_Identity, _asn_ctx), + asn_MAP_PLMN_Identity_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_PLMN_Identity_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PLMN_Identity = { + "PLMN-Identity", + "PLMN-Identity", + &asn_OP_SEQUENCE, + asn_DEF_PLMN_Identity_tags_1, + sizeof(asn_DEF_PLMN_Identity_tags_1) + /sizeof(asn_DEF_PLMN_Identity_tags_1[0]), /* 1 */ + asn_DEF_PLMN_Identity_tags_1, /* Same as above */ + sizeof(asn_DEF_PLMN_Identity_tags_1) + /sizeof(asn_DEF_PLMN_Identity_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PLMN_Identity_1, + 2, /* Elements count */ + &asn_SPC_PLMN_Identity_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PLMN-Identity.h b/src/codec_utils/SYSINFO/PLMN-Identity.h new file mode 100644 index 000000000..b7d44b0a5 --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-Identity.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PLMN_Identity_H_ +#define _PLMN_Identity_H_ + + +#include + +/* Including external dependencies */ +#include "MNC.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MCC; + +/* PLMN-Identity */ +typedef struct PLMN_Identity { + struct MCC *mcc; /* OPTIONAL */ + MNC_t mnc; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PLMN_Identity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PLMN_Identity; +extern asn_SEQUENCE_specifics_t asn_SPC_PLMN_Identity_specs_1; +extern asn_TYPE_member_t asn_MBR_PLMN_Identity_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PLMN_Identity_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PLMN-IdentityInfo.c b/src/codec_utils/SYSINFO/PLMN-IdentityInfo.c new file mode 100644 index 000000000..dc7be5ce7 --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-IdentityInfo.c @@ -0,0 +1,221 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PLMN-IdentityInfo.h" + +#include "PLMN-Identity.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_plmn_IdentityList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 12)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_plmn_IdentityList_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..12)) */}; +static asn_per_constraints_t asn_PER_type_plmn_IdentityList_constr_2 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_cellReservedForOperatorUse_constr_7 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_cellReservedForOperatorUse_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_plmn_IdentityList_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..12)) */}; +static asn_per_constraints_t asn_PER_memb_plmn_IdentityList_constr_2 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_plmn_IdentityList_2[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_PLMN_Identity, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_plmn_IdentityList_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_plmn_IdentityList_specs_2 = { + sizeof(struct PLMN_IdentityInfo__plmn_IdentityList), + offsetof(struct PLMN_IdentityInfo__plmn_IdentityList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_plmn_IdentityList_2 = { + "plmn-IdentityList", + "plmn-IdentityList", + &asn_OP_SEQUENCE_OF, + asn_DEF_plmn_IdentityList_tags_2, + sizeof(asn_DEF_plmn_IdentityList_tags_2) + /sizeof(asn_DEF_plmn_IdentityList_tags_2[0]) - 1, /* 1 */ + asn_DEF_plmn_IdentityList_tags_2, /* Same as above */ + sizeof(asn_DEF_plmn_IdentityList_tags_2) + /sizeof(asn_DEF_plmn_IdentityList_tags_2[0]), /* 2 */ + { &asn_OER_type_plmn_IdentityList_constr_2, &asn_PER_type_plmn_IdentityList_constr_2, SEQUENCE_OF_constraint }, + asn_MBR_plmn_IdentityList_2, + 1, /* Single element */ + &asn_SPC_plmn_IdentityList_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_cellReservedForOperatorUse_value2enum_7[] = { + { 0, 8, "reserved" }, + { 1, 11, "notReserved" } +}; +static const unsigned int asn_MAP_cellReservedForOperatorUse_enum2value_7[] = { + 1, /* notReserved(1) */ + 0 /* reserved(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_cellReservedForOperatorUse_specs_7 = { + asn_MAP_cellReservedForOperatorUse_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_cellReservedForOperatorUse_enum2value_7, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_cellReservedForOperatorUse_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cellReservedForOperatorUse_7 = { + "cellReservedForOperatorUse", + "cellReservedForOperatorUse", + &asn_OP_NativeEnumerated, + asn_DEF_cellReservedForOperatorUse_tags_7, + sizeof(asn_DEF_cellReservedForOperatorUse_tags_7) + /sizeof(asn_DEF_cellReservedForOperatorUse_tags_7[0]) - 1, /* 1 */ + asn_DEF_cellReservedForOperatorUse_tags_7, /* Same as above */ + sizeof(asn_DEF_cellReservedForOperatorUse_tags_7) + /sizeof(asn_DEF_cellReservedForOperatorUse_tags_7[0]), /* 2 */ + { &asn_OER_type_cellReservedForOperatorUse_constr_7, &asn_PER_type_cellReservedForOperatorUse_constr_7, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_cellReservedForOperatorUse_specs_7 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PLMN_IdentityInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PLMN_IdentityInfo, plmn_IdentityList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_plmn_IdentityList_2, + 0, + { &asn_OER_memb_plmn_IdentityList_constr_2, &asn_PER_memb_plmn_IdentityList_constr_2, memb_plmn_IdentityList_constraint_1 }, + 0, 0, /* No default value */ + "plmn-IdentityList" + }, + { ATF_POINTER, 2, offsetof(struct PLMN_IdentityInfo, trackingAreaCode), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TrackingAreaCode, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "trackingAreaCode" + }, + { ATF_POINTER, 1, offsetof(struct PLMN_IdentityInfo, ranac), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RAN_AreaCode, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ranac" + }, + { ATF_NOFLAGS, 0, offsetof(struct PLMN_IdentityInfo, cellIdentity), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellIdentity, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellIdentity" + }, + { ATF_NOFLAGS, 0, offsetof(struct PLMN_IdentityInfo, cellReservedForOperatorUse), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_cellReservedForOperatorUse_7, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellReservedForOperatorUse" + }, +}; +static const int asn_MAP_PLMN_IdentityInfo_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_PLMN_IdentityInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PLMN_IdentityInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmn-IdentityList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* trackingAreaCode */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ranac */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* cellIdentity */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* cellReservedForOperatorUse */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PLMN_IdentityInfo_specs_1 = { + sizeof(struct PLMN_IdentityInfo), + offsetof(struct PLMN_IdentityInfo, _asn_ctx), + asn_MAP_PLMN_IdentityInfo_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_PLMN_IdentityInfo_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + 5, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PLMN_IdentityInfo = { + "PLMN-IdentityInfo", + "PLMN-IdentityInfo", + &asn_OP_SEQUENCE, + asn_DEF_PLMN_IdentityInfo_tags_1, + sizeof(asn_DEF_PLMN_IdentityInfo_tags_1) + /sizeof(asn_DEF_PLMN_IdentityInfo_tags_1[0]), /* 1 */ + asn_DEF_PLMN_IdentityInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_PLMN_IdentityInfo_tags_1) + /sizeof(asn_DEF_PLMN_IdentityInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PLMN_IdentityInfo_1, + 5, /* Elements count */ + &asn_SPC_PLMN_IdentityInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PLMN-IdentityInfo.h b/src/codec_utils/SYSINFO/PLMN-IdentityInfo.h new file mode 100644 index 000000000..4469000ae --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-IdentityInfo.h @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PLMN_IdentityInfo_H_ +#define _PLMN_IdentityInfo_H_ + + +#include + +/* Including external dependencies */ +#include "TrackingAreaCode.h" +#include "RAN-AreaCode.h" +#include "CellIdentity.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PLMN_IdentityInfo__cellReservedForOperatorUse { + PLMN_IdentityInfo__cellReservedForOperatorUse_reserved = 0, + PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved = 1 +} e_PLMN_IdentityInfo__cellReservedForOperatorUse; + +/* Forward declarations */ +struct PLMN_Identity; + +/* PLMN-IdentityInfo */ +typedef struct PLMN_IdentityInfo { + struct PLMN_IdentityInfo__plmn_IdentityList { + A_SEQUENCE_OF(struct PLMN_Identity) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } plmn_IdentityList; + TrackingAreaCode_t *trackingAreaCode; /* OPTIONAL */ + RAN_AreaCode_t *ranac; /* OPTIONAL */ + CellIdentity_t cellIdentity; + long cellReservedForOperatorUse; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PLMN_IdentityInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_cellReservedForOperatorUse_7; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PLMN_IdentityInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_PLMN_IdentityInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_PLMN_IdentityInfo_1[5]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PLMN_IdentityInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.c b/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.c new file mode 100644 index 000000000..ec60f902b --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PLMN-IdentityInfoList.h" + +#include "PLMN-IdentityInfo.h" +static asn_oer_constraints_t asn_OER_type_PLMN_IdentityInfoList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..12)) */}; +asn_per_constraints_t asn_PER_type_PLMN_IdentityInfoList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_PLMN_IdentityInfoList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_PLMN_IdentityInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_PLMN_IdentityInfoList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_PLMN_IdentityInfoList_specs_1 = { + sizeof(struct PLMN_IdentityInfoList), + offsetof(struct PLMN_IdentityInfoList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_PLMN_IdentityInfoList = { + "PLMN-IdentityInfoList", + "PLMN-IdentityInfoList", + &asn_OP_SEQUENCE_OF, + asn_DEF_PLMN_IdentityInfoList_tags_1, + sizeof(asn_DEF_PLMN_IdentityInfoList_tags_1) + /sizeof(asn_DEF_PLMN_IdentityInfoList_tags_1[0]), /* 1 */ + asn_DEF_PLMN_IdentityInfoList_tags_1, /* Same as above */ + sizeof(asn_DEF_PLMN_IdentityInfoList_tags_1) + /sizeof(asn_DEF_PLMN_IdentityInfoList_tags_1[0]), /* 1 */ + { &asn_OER_type_PLMN_IdentityInfoList_constr_1, &asn_PER_type_PLMN_IdentityInfoList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_PLMN_IdentityInfoList_1, + 1, /* Single element */ + &asn_SPC_PLMN_IdentityInfoList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.h b/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.h new file mode 100644 index 000000000..84b93e623 --- /dev/null +++ b/src/codec_utils/SYSINFO/PLMN-IdentityInfoList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PLMN_IdentityInfoList_H_ +#define _PLMN_IdentityInfoList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct PLMN_IdentityInfo; + +/* PLMN-IdentityInfoList */ +typedef struct PLMN_IdentityInfoList { + A_SEQUENCE_OF(struct PLMN_IdentityInfo) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PLMN_IdentityInfoList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PLMN_IdentityInfoList; +extern asn_SET_OF_specifics_t asn_SPC_PLMN_IdentityInfoList_specs_1; +extern asn_TYPE_member_t asn_MBR_PLMN_IdentityInfoList_1[1]; +extern asn_per_constraints_t asn_PER_type_PLMN_IdentityInfoList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _PLMN_IdentityInfoList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.c b/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.c new file mode 100644 index 000000000..f8dc0ecb5 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.c @@ -0,0 +1,232 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PUCCH-ConfigCommon.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_pucch_ResourceCommon_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_hoppingId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_p0_nominal_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -202 && value <= 24)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_pucch_GroupHopping_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_pucch_GroupHopping_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_pucch_ResourceCommon_constr_2 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_pucch_ResourceCommon_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_hoppingId_constr_7 CC_NOTUSED = { + { 2, 1 } /* (0..1023) */, + -1}; +static asn_per_constraints_t asn_PER_memb_hoppingId_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_p0_nominal_constr_8 CC_NOTUSED = { + { 2, 0 } /* (-202..24) */, + -1}; +static asn_per_constraints_t asn_PER_memb_p0_nominal_constr_8 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, -202, 24 } /* (-202..24) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_pucch_GroupHopping_value2enum_3[] = { + { 0, 7, "neither" }, + { 1, 6, "enable" }, + { 2, 7, "disable" } +}; +static const unsigned int asn_MAP_pucch_GroupHopping_enum2value_3[] = { + 2, /* disable(2) */ + 1, /* enable(1) */ + 0 /* neither(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_pucch_GroupHopping_specs_3 = { + asn_MAP_pucch_GroupHopping_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_pucch_GroupHopping_enum2value_3, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_pucch_GroupHopping_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_pucch_GroupHopping_3 = { + "pucch-GroupHopping", + "pucch-GroupHopping", + &asn_OP_NativeEnumerated, + asn_DEF_pucch_GroupHopping_tags_3, + sizeof(asn_DEF_pucch_GroupHopping_tags_3) + /sizeof(asn_DEF_pucch_GroupHopping_tags_3[0]) - 1, /* 1 */ + asn_DEF_pucch_GroupHopping_tags_3, /* Same as above */ + sizeof(asn_DEF_pucch_GroupHopping_tags_3) + /sizeof(asn_DEF_pucch_GroupHopping_tags_3[0]), /* 2 */ + { &asn_OER_type_pucch_GroupHopping_constr_3, &asn_PER_type_pucch_GroupHopping_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_pucch_GroupHopping_specs_3 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PUCCH_ConfigCommon_1[] = { + { ATF_POINTER, 1, offsetof(struct PUCCH_ConfigCommon, pucch_ResourceCommon), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_pucch_ResourceCommon_constr_2, &asn_PER_memb_pucch_ResourceCommon_constr_2, memb_pucch_ResourceCommon_constraint_1 }, + 0, 0, /* No default value */ + "pucch-ResourceCommon" + }, + { ATF_NOFLAGS, 0, offsetof(struct PUCCH_ConfigCommon, pucch_GroupHopping), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_pucch_GroupHopping_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pucch-GroupHopping" + }, + { ATF_POINTER, 2, offsetof(struct PUCCH_ConfigCommon, hoppingId), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_hoppingId_constr_7, &asn_PER_memb_hoppingId_constr_7, memb_hoppingId_constraint_1 }, + 0, 0, /* No default value */ + "hoppingId" + }, + { ATF_POINTER, 1, offsetof(struct PUCCH_ConfigCommon, p0_nominal), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_p0_nominal_constr_8, &asn_PER_memb_p0_nominal_constr_8, memb_p0_nominal_constraint_1 }, + 0, 0, /* No default value */ + "p0-nominal" + }, +}; +static const int asn_MAP_PUCCH_ConfigCommon_oms_1[] = { 0, 2, 3 }; +static const ber_tlv_tag_t asn_DEF_PUCCH_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PUCCH_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pucch-ResourceCommon */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pucch-GroupHopping */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* hoppingId */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* p0-nominal */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PUCCH_ConfigCommon_specs_1 = { + sizeof(struct PUCCH_ConfigCommon), + offsetof(struct PUCCH_ConfigCommon, _asn_ctx), + asn_MAP_PUCCH_ConfigCommon_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_PUCCH_ConfigCommon_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PUCCH_ConfigCommon = { + "PUCCH-ConfigCommon", + "PUCCH-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_PUCCH_ConfigCommon_tags_1, + sizeof(asn_DEF_PUCCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PUCCH_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_PUCCH_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_PUCCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PUCCH_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PUCCH_ConfigCommon_1, + 4, /* Elements count */ + &asn_SPC_PUCCH_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.h b/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.h new file mode 100644 index 000000000..4b12562b0 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUCCH-ConfigCommon.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PUCCH_ConfigCommon_H_ +#define _PUCCH_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PUCCH_ConfigCommon__pucch_GroupHopping { + PUCCH_ConfigCommon__pucch_GroupHopping_neither = 0, + PUCCH_ConfigCommon__pucch_GroupHopping_enable = 1, + PUCCH_ConfigCommon__pucch_GroupHopping_disable = 2 +} e_PUCCH_ConfigCommon__pucch_GroupHopping; + +/* PUCCH-ConfigCommon */ +typedef struct PUCCH_ConfigCommon { + long *pucch_ResourceCommon; /* OPTIONAL */ + long pucch_GroupHopping; + long *hoppingId; /* OPTIONAL */ + long *p0_nominal; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PUCCH_ConfigCommon_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_pucch_GroupHopping_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PUCCH_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_PUCCH_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_PUCCH_ConfigCommon_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PUCCH_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.c b/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.c new file mode 100644 index 000000000..f1300401c --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.c @@ -0,0 +1,196 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PUSCH-ConfigCommon.h" + +#include "PUSCH-TimeDomainResourceAllocationList.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_msg3_DeltaPreamble_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1 && value <= 6)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_p0_NominalWithGrant_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -202 && value <= 24)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_groupHoppingEnabledTransformPrecoding_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_groupHoppingEnabledTransformPrecoding_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_msg3_DeltaPreamble_constr_5 CC_NOTUSED = { + { 1, 0 } /* (-1..6) */, + -1}; +static asn_per_constraints_t asn_PER_memb_msg3_DeltaPreamble_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, -1, 6 } /* (-1..6) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_p0_NominalWithGrant_constr_6 CC_NOTUSED = { + { 2, 0 } /* (-202..24) */, + -1}; +static asn_per_constraints_t asn_PER_memb_p0_NominalWithGrant_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, -202, 24 } /* (-202..24) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_groupHoppingEnabledTransformPrecoding_value2enum_2[] = { + { 0, 7, "enabled" } +}; +static const unsigned int asn_MAP_groupHoppingEnabledTransformPrecoding_enum2value_2[] = { + 0 /* enabled(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_groupHoppingEnabledTransformPrecoding_specs_2 = { + asn_MAP_groupHoppingEnabledTransformPrecoding_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_groupHoppingEnabledTransformPrecoding_enum2value_2, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_groupHoppingEnabledTransformPrecoding_2 = { + "groupHoppingEnabledTransformPrecoding", + "groupHoppingEnabledTransformPrecoding", + &asn_OP_NativeEnumerated, + asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2, + sizeof(asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2) + /sizeof(asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2[0]) - 1, /* 1 */ + asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2, /* Same as above */ + sizeof(asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2) + /sizeof(asn_DEF_groupHoppingEnabledTransformPrecoding_tags_2[0]), /* 2 */ + { &asn_OER_type_groupHoppingEnabledTransformPrecoding_constr_2, &asn_PER_type_groupHoppingEnabledTransformPrecoding_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_groupHoppingEnabledTransformPrecoding_specs_2 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PUSCH_ConfigCommon_1[] = { + { ATF_POINTER, 4, offsetof(struct PUSCH_ConfigCommon, groupHoppingEnabledTransformPrecoding), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_groupHoppingEnabledTransformPrecoding_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "groupHoppingEnabledTransformPrecoding" + }, + { ATF_POINTER, 3, offsetof(struct PUSCH_ConfigCommon, pusch_TimeDomainAllocationList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PUSCH_TimeDomainResourceAllocationList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pusch-TimeDomainAllocationList" + }, + { ATF_POINTER, 2, offsetof(struct PUSCH_ConfigCommon, msg3_DeltaPreamble), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_msg3_DeltaPreamble_constr_5, &asn_PER_memb_msg3_DeltaPreamble_constr_5, memb_msg3_DeltaPreamble_constraint_1 }, + 0, 0, /* No default value */ + "msg3-DeltaPreamble" + }, + { ATF_POINTER, 1, offsetof(struct PUSCH_ConfigCommon, p0_NominalWithGrant), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_p0_NominalWithGrant_constr_6, &asn_PER_memb_p0_NominalWithGrant_constr_6, memb_p0_NominalWithGrant_constraint_1 }, + 0, 0, /* No default value */ + "p0-NominalWithGrant" + }, +}; +static const int asn_MAP_PUSCH_ConfigCommon_oms_1[] = { 0, 1, 2, 3 }; +static const ber_tlv_tag_t asn_DEF_PUSCH_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PUSCH_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* groupHoppingEnabledTransformPrecoding */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pusch-TimeDomainAllocationList */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msg3-DeltaPreamble */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* p0-NominalWithGrant */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PUSCH_ConfigCommon_specs_1 = { + sizeof(struct PUSCH_ConfigCommon), + offsetof(struct PUSCH_ConfigCommon, _asn_ctx), + asn_MAP_PUSCH_ConfigCommon_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_PUSCH_ConfigCommon_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PUSCH_ConfigCommon = { + "PUSCH-ConfigCommon", + "PUSCH-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_PUSCH_ConfigCommon_tags_1, + sizeof(asn_DEF_PUSCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PUSCH_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_PUSCH_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_PUSCH_ConfigCommon_tags_1) + /sizeof(asn_DEF_PUSCH_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PUSCH_ConfigCommon_1, + 4, /* Elements count */ + &asn_SPC_PUSCH_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.h b/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.h new file mode 100644 index 000000000..9c0a851a0 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-ConfigCommon.h @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PUSCH_ConfigCommon_H_ +#define _PUSCH_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding { + PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding_enabled = 0 +} e_PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding; + +/* Forward declarations */ +struct PUSCH_TimeDomainResourceAllocationList; + +/* PUSCH-ConfigCommon */ +typedef struct PUSCH_ConfigCommon { + long *groupHoppingEnabledTransformPrecoding; /* OPTIONAL */ + struct PUSCH_TimeDomainResourceAllocationList *pusch_TimeDomainAllocationList; /* OPTIONAL */ + long *msg3_DeltaPreamble; /* OPTIONAL */ + long *p0_NominalWithGrant; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PUSCH_ConfigCommon_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_groupHoppingEnabledTransformPrecoding_2; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PUSCH_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_PUSCH_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_PUSCH_ConfigCommon_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PUSCH_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.c b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.c new file mode 100644 index 000000000..46d2187c6 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.c @@ -0,0 +1,187 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PUSCH-TimeDomainResourceAllocation.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_k2_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_startSymbolAndLength_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_mappingType_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_mappingType_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_k2_constr_2 CC_NOTUSED = { + { 1, 1 } /* (0..32) */, + -1}; +static asn_per_constraints_t asn_PER_memb_k2_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 32 } /* (0..32) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_startSymbolAndLength_constr_6 CC_NOTUSED = { + { 1, 1 } /* (0..127) */, + -1}; +static asn_per_constraints_t asn_PER_memb_startSymbolAndLength_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_mappingType_value2enum_3[] = { + { 0, 5, "typeA" }, + { 1, 5, "typeB" } +}; +static const unsigned int asn_MAP_mappingType_enum2value_3[] = { + 0, /* typeA(0) */ + 1 /* typeB(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_mappingType_specs_3 = { + asn_MAP_mappingType_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_mappingType_enum2value_3, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_mappingType_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_mappingType_3 = { + "mappingType", + "mappingType", + &asn_OP_NativeEnumerated, + asn_DEF_mappingType_tags_3, + sizeof(asn_DEF_mappingType_tags_3) + /sizeof(asn_DEF_mappingType_tags_3[0]) - 1, /* 1 */ + asn_DEF_mappingType_tags_3, /* Same as above */ + sizeof(asn_DEF_mappingType_tags_3) + /sizeof(asn_DEF_mappingType_tags_3[0]), /* 2 */ + { &asn_OER_type_mappingType_constr_3, &asn_PER_type_mappingType_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_mappingType_specs_3 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_PUSCH_TimeDomainResourceAllocation_1[] = { + { ATF_POINTER, 1, offsetof(struct PUSCH_TimeDomainResourceAllocation, k2), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_k2_constr_2, &asn_PER_memb_k2_constr_2, memb_k2_constraint_1 }, + 0, 0, /* No default value */ + "k2" + }, + { ATF_NOFLAGS, 0, offsetof(struct PUSCH_TimeDomainResourceAllocation, mappingType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_mappingType_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "mappingType" + }, + { ATF_NOFLAGS, 0, offsetof(struct PUSCH_TimeDomainResourceAllocation, startSymbolAndLength), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_startSymbolAndLength_constr_6, &asn_PER_memb_startSymbolAndLength_constr_6, memb_startSymbolAndLength_constraint_1 }, + 0, 0, /* No default value */ + "startSymbolAndLength" + }, +}; +static const int asn_MAP_PUSCH_TimeDomainResourceAllocation_oms_1[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_PUSCH_TimeDomainResourceAllocation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* k2 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* mappingType */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* startSymbolAndLength */ +}; +asn_SEQUENCE_specifics_t asn_SPC_PUSCH_TimeDomainResourceAllocation_specs_1 = { + sizeof(struct PUSCH_TimeDomainResourceAllocation), + offsetof(struct PUSCH_TimeDomainResourceAllocation, _asn_ctx), + asn_MAP_PUSCH_TimeDomainResourceAllocation_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_PUSCH_TimeDomainResourceAllocation_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_PUSCH_TimeDomainResourceAllocation = { + "PUSCH-TimeDomainResourceAllocation", + "PUSCH-TimeDomainResourceAllocation", + &asn_OP_SEQUENCE, + asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1, + sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1) + /sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1[0]), /* 1 */ + asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1, /* Same as above */ + sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1) + /sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocation_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_PUSCH_TimeDomainResourceAllocation_1, + 3, /* Elements count */ + &asn_SPC_PUSCH_TimeDomainResourceAllocation_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.h b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.h new file mode 100644 index 000000000..1eaecda83 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocation.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PUSCH_TimeDomainResourceAllocation_H_ +#define _PUSCH_TimeDomainResourceAllocation_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PUSCH_TimeDomainResourceAllocation__mappingType { + PUSCH_TimeDomainResourceAllocation__mappingType_typeA = 0, + PUSCH_TimeDomainResourceAllocation__mappingType_typeB = 1 +} e_PUSCH_TimeDomainResourceAllocation__mappingType; + +/* PUSCH-TimeDomainResourceAllocation */ +typedef struct PUSCH_TimeDomainResourceAllocation { + long *k2; /* OPTIONAL */ + long mappingType; + long startSymbolAndLength; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PUSCH_TimeDomainResourceAllocation_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_mappingType_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PUSCH_TimeDomainResourceAllocation; +extern asn_SEQUENCE_specifics_t asn_SPC_PUSCH_TimeDomainResourceAllocation_specs_1; +extern asn_TYPE_member_t asn_MBR_PUSCH_TimeDomainResourceAllocation_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _PUSCH_TimeDomainResourceAllocation_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.c b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.c new file mode 100644 index 000000000..1a3a5d722 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PUSCH-TimeDomainResourceAllocationList.h" + +#include "PUSCH-TimeDomainResourceAllocation.h" +static asn_oer_constraints_t asn_OER_type_PUSCH_TimeDomainResourceAllocationList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..16)) */}; +asn_per_constraints_t asn_PER_type_PUSCH_TimeDomainResourceAllocationList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_PUSCH_TimeDomainResourceAllocationList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_PUSCH_TimeDomainResourceAllocation, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_PUSCH_TimeDomainResourceAllocationList_specs_1 = { + sizeof(struct PUSCH_TimeDomainResourceAllocationList), + offsetof(struct PUSCH_TimeDomainResourceAllocationList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_PUSCH_TimeDomainResourceAllocationList = { + "PUSCH-TimeDomainResourceAllocationList", + "PUSCH-TimeDomainResourceAllocationList", + &asn_OP_SEQUENCE_OF, + asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1, + sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1) + /sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1[0]), /* 1 */ + asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1, /* Same as above */ + sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1) + /sizeof(asn_DEF_PUSCH_TimeDomainResourceAllocationList_tags_1[0]), /* 1 */ + { &asn_OER_type_PUSCH_TimeDomainResourceAllocationList_constr_1, &asn_PER_type_PUSCH_TimeDomainResourceAllocationList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_PUSCH_TimeDomainResourceAllocationList_1, + 1, /* Single element */ + &asn_SPC_PUSCH_TimeDomainResourceAllocationList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.h b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.h new file mode 100644 index 000000000..011d5c067 --- /dev/null +++ b/src/codec_utils/SYSINFO/PUSCH-TimeDomainResourceAllocationList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PUSCH_TimeDomainResourceAllocationList_H_ +#define _PUSCH_TimeDomainResourceAllocationList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct PUSCH_TimeDomainResourceAllocation; + +/* PUSCH-TimeDomainResourceAllocationList */ +typedef struct PUSCH_TimeDomainResourceAllocationList { + A_SEQUENCE_OF(struct PUSCH_TimeDomainResourceAllocation) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PUSCH_TimeDomainResourceAllocationList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PUSCH_TimeDomainResourceAllocationList; +extern asn_SET_OF_specifics_t asn_SPC_PUSCH_TimeDomainResourceAllocationList_specs_1; +extern asn_TYPE_member_t asn_MBR_PUSCH_TimeDomainResourceAllocationList_1[1]; +extern asn_per_constraints_t asn_PER_type_PUSCH_TimeDomainResourceAllocationList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _PUSCH_TimeDomainResourceAllocationList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/PagingCycle.c b/src/codec_utils/SYSINFO/PagingCycle.c new file mode 100644 index 000000000..769104df5 --- /dev/null +++ b/src/codec_utils/SYSINFO/PagingCycle.c @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "PagingCycle.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_PagingCycle_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +asn_per_constraints_t asn_PER_type_PagingCycle_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_PagingCycle_value2enum_1[] = { + { 0, 4, "rf32" }, + { 1, 4, "rf64" }, + { 2, 5, "rf128" }, + { 3, 5, "rf256" } +}; +static const unsigned int asn_MAP_PagingCycle_enum2value_1[] = { + 2, /* rf128(2) */ + 3, /* rf256(3) */ + 0, /* rf32(0) */ + 1 /* rf64(1) */ +}; +const asn_INTEGER_specifics_t asn_SPC_PagingCycle_specs_1 = { + asn_MAP_PagingCycle_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PagingCycle_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_PagingCycle_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PagingCycle = { + "PagingCycle", + "PagingCycle", + &asn_OP_NativeEnumerated, + asn_DEF_PagingCycle_tags_1, + sizeof(asn_DEF_PagingCycle_tags_1) + /sizeof(asn_DEF_PagingCycle_tags_1[0]), /* 1 */ + asn_DEF_PagingCycle_tags_1, /* Same as above */ + sizeof(asn_DEF_PagingCycle_tags_1) + /sizeof(asn_DEF_PagingCycle_tags_1[0]), /* 1 */ + { &asn_OER_type_PagingCycle_constr_1, &asn_PER_type_PagingCycle_constr_1, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_PagingCycle_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/PagingCycle.h b/src/codec_utils/SYSINFO/PagingCycle.h new file mode 100644 index 000000000..a03c2a8ed --- /dev/null +++ b/src/codec_utils/SYSINFO/PagingCycle.h @@ -0,0 +1,55 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _PagingCycle_H_ +#define _PagingCycle_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PagingCycle { + PagingCycle_rf32 = 0, + PagingCycle_rf64 = 1, + PagingCycle_rf128 = 2, + PagingCycle_rf256 = 3 +} e_PagingCycle; + +/* PagingCycle */ +typedef long PagingCycle_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_PagingCycle_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_PagingCycle; +extern const asn_INTEGER_specifics_t asn_SPC_PagingCycle_specs_1; +asn_struct_free_f PagingCycle_free; +asn_struct_print_f PagingCycle_print; +asn_constr_check_f PagingCycle_constraint; +ber_type_decoder_f PagingCycle_decode_ber; +der_type_encoder_f PagingCycle_encode_der; +xer_type_decoder_f PagingCycle_decode_xer; +xer_type_encoder_f PagingCycle_encode_xer; +oer_type_decoder_f PagingCycle_decode_oer; +oer_type_encoder_f PagingCycle_encode_oer; +per_type_decoder_f PagingCycle_decode_uper; +per_type_encoder_f PagingCycle_encode_uper; +per_type_decoder_f PagingCycle_decode_aper; +per_type_encoder_f PagingCycle_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PagingCycle_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/Q-QualMin.c b/src/codec_utils/SYSINFO/Q-QualMin.c new file mode 100644 index 000000000..28d7db5d7 --- /dev/null +++ b/src/codec_utils/SYSINFO/Q-QualMin.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "Q-QualMin.h" + +int +Q_QualMin_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -43 && value <= -12)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_Q_QualMin_constr_1 CC_NOTUSED = { + { 1, 0 } /* (-43..-12) */, + -1}; +asn_per_constraints_t asn_PER_type_Q_QualMin_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, -43, -12 } /* (-43..-12) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_Q_QualMin_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Q_QualMin = { + "Q-QualMin", + "Q-QualMin", + &asn_OP_NativeInteger, + asn_DEF_Q_QualMin_tags_1, + sizeof(asn_DEF_Q_QualMin_tags_1) + /sizeof(asn_DEF_Q_QualMin_tags_1[0]), /* 1 */ + asn_DEF_Q_QualMin_tags_1, /* Same as above */ + sizeof(asn_DEF_Q_QualMin_tags_1) + /sizeof(asn_DEF_Q_QualMin_tags_1[0]), /* 1 */ + { &asn_OER_type_Q_QualMin_constr_1, &asn_PER_type_Q_QualMin_constr_1, Q_QualMin_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/Q-QualMin.h b/src/codec_utils/SYSINFO/Q-QualMin.h new file mode 100644 index 000000000..175b6cc6c --- /dev/null +++ b/src/codec_utils/SYSINFO/Q-QualMin.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Q_QualMin_H_ +#define _Q_QualMin_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Q-QualMin */ +typedef long Q_QualMin_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_Q_QualMin_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_Q_QualMin; +asn_struct_free_f Q_QualMin_free; +asn_struct_print_f Q_QualMin_print; +asn_constr_check_f Q_QualMin_constraint; +ber_type_decoder_f Q_QualMin_decode_ber; +der_type_encoder_f Q_QualMin_encode_der; +xer_type_decoder_f Q_QualMin_decode_xer; +xer_type_encoder_f Q_QualMin_encode_xer; +oer_type_decoder_f Q_QualMin_decode_oer; +oer_type_encoder_f Q_QualMin_encode_oer; +per_type_decoder_f Q_QualMin_decode_uper; +per_type_encoder_f Q_QualMin_encode_uper; +per_type_decoder_f Q_QualMin_decode_aper; +per_type_encoder_f Q_QualMin_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Q_QualMin_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/Q-RxLevMin.c b/src/codec_utils/SYSINFO/Q-RxLevMin.c new file mode 100644 index 000000000..d06dad7bd --- /dev/null +++ b/src/codec_utils/SYSINFO/Q-RxLevMin.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "Q-RxLevMin.h" + +int +Q_RxLevMin_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -70 && value <= -22)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_Q_RxLevMin_constr_1 CC_NOTUSED = { + { 1, 0 } /* (-70..-22) */, + -1}; +asn_per_constraints_t asn_PER_type_Q_RxLevMin_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, -70, -22 } /* (-70..-22) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_Q_RxLevMin_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Q_RxLevMin = { + "Q-RxLevMin", + "Q-RxLevMin", + &asn_OP_NativeInteger, + asn_DEF_Q_RxLevMin_tags_1, + sizeof(asn_DEF_Q_RxLevMin_tags_1) + /sizeof(asn_DEF_Q_RxLevMin_tags_1[0]), /* 1 */ + asn_DEF_Q_RxLevMin_tags_1, /* Same as above */ + sizeof(asn_DEF_Q_RxLevMin_tags_1) + /sizeof(asn_DEF_Q_RxLevMin_tags_1[0]), /* 1 */ + { &asn_OER_type_Q_RxLevMin_constr_1, &asn_PER_type_Q_RxLevMin_constr_1, Q_RxLevMin_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/Q-RxLevMin.h b/src/codec_utils/SYSINFO/Q-RxLevMin.h new file mode 100644 index 000000000..0af5bdae2 --- /dev/null +++ b/src/codec_utils/SYSINFO/Q-RxLevMin.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _Q_RxLevMin_H_ +#define _Q_RxLevMin_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Q-RxLevMin */ +typedef long Q_RxLevMin_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_Q_RxLevMin_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_Q_RxLevMin; +asn_struct_free_f Q_RxLevMin_free; +asn_struct_print_f Q_RxLevMin_print; +asn_constr_check_f Q_RxLevMin_constraint; +ber_type_decoder_f Q_RxLevMin_decode_ber; +der_type_encoder_f Q_RxLevMin_encode_der; +xer_type_decoder_f Q_RxLevMin_decode_xer; +xer_type_encoder_f Q_RxLevMin_encode_xer; +oer_type_decoder_f Q_RxLevMin_decode_oer; +oer_type_encoder_f Q_RxLevMin_encode_oer; +per_type_decoder_f Q_RxLevMin_decode_uper; +per_type_encoder_f Q_RxLevMin_encode_uper; +per_type_decoder_f Q_RxLevMin_decode_aper; +per_type_encoder_f Q_RxLevMin_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Q_RxLevMin_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/RACH-ConfigCommon.c b/src/codec_utils/SYSINFO/RACH-ConfigCommon.c new file mode 100644 index 000000000..1e867510a --- /dev/null +++ b/src/codec_utils/SYSINFO/RACH-ConfigCommon.c @@ -0,0 +1,1286 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "RACH-ConfigCommon.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_four_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 16)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_eight_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sixteen_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 4)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_numberOfRA_PreamblesGroupA_constraint_85(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 64)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_l839_constraint_124(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 837)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_l139_constraint_124(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 137)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_totalNumberOfRA_Preambles_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_oneEighth_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_oneEighth_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_oneFourth_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_oneFourth_constr_22 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_oneHalf_constr_39 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_oneHalf_constr_39 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_one_constr_56 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_one_constr_56 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_two_constr_73 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_two_constr_73 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_four_constr_82 CC_NOTUSED = { + { 1, 1 } /* (1..16) */, + -1}; +static asn_per_constraints_t asn_PER_memb_four_constr_82 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (1..16) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_eight_constr_83 CC_NOTUSED = { + { 1, 1 } /* (1..8) */, + -1}; +static asn_per_constraints_t asn_PER_memb_eight_constr_83 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (1..8) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sixteen_constr_84 CC_NOTUSED = { + { 1, 1 } /* (1..4) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sixteen_constr_84 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (1..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ra_Msg3SizeGroupA_constr_86 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ra_Msg3SizeGroupA_constr_86 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_messagePowerOffsetGroupB_constr_103 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_messagePowerOffsetGroupB_constr_103 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_numberOfRA_PreamblesGroupA_constr_112 CC_NOTUSED = { + { 1, 1 } /* (1..64) */, + -1}; +static asn_per_constraints_t asn_PER_memb_numberOfRA_PreamblesGroupA_constr_112 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (1..64) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ra_ContentionResolutionTimer_constr_113 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ra_ContentionResolutionTimer_constr_113 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_l839_constr_125 CC_NOTUSED = { + { 2, 1 } /* (0..837) */, + -1}; +static asn_per_constraints_t asn_PER_memb_l839_constr_125 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 837 } /* (0..837) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_l139_constr_126 CC_NOTUSED = { + { 1, 1 } /* (0..137) */, + -1}; +static asn_per_constraints_t asn_PER_memb_l139_constr_126 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 137 } /* (0..137) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_prach_RootSequenceIndex_constr_124 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_prach_RootSequenceIndex_constr_124 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_restrictedSetConfig_constr_128 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_restrictedSetConfig_constr_128 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_msg3_transformPrecoder_constr_132 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_msg3_transformPrecoder_constr_132 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_totalNumberOfRA_Preambles_constr_3 CC_NOTUSED = { + { 1, 1 } /* (1..63) */, + -1}; +static asn_per_constraints_t asn_PER_memb_totalNumberOfRA_Preambles_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 1, 63 } /* (1..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_oneEighth_value2enum_5[] = { + { 0, 2, "n4" }, + { 1, 2, "n8" }, + { 2, 3, "n12" }, + { 3, 3, "n16" }, + { 4, 3, "n20" }, + { 5, 3, "n24" }, + { 6, 3, "n28" }, + { 7, 3, "n32" }, + { 8, 3, "n36" }, + { 9, 3, "n40" }, + { 10, 3, "n44" }, + { 11, 3, "n48" }, + { 12, 3, "n52" }, + { 13, 3, "n56" }, + { 14, 3, "n60" }, + { 15, 3, "n64" } +}; +static const unsigned int asn_MAP_oneEighth_enum2value_5[] = { + 2, /* n12(2) */ + 3, /* n16(3) */ + 4, /* n20(4) */ + 5, /* n24(5) */ + 6, /* n28(6) */ + 7, /* n32(7) */ + 8, /* n36(8) */ + 0, /* n4(0) */ + 9, /* n40(9) */ + 10, /* n44(10) */ + 11, /* n48(11) */ + 12, /* n52(12) */ + 13, /* n56(13) */ + 14, /* n60(14) */ + 15, /* n64(15) */ + 1 /* n8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_oneEighth_specs_5 = { + asn_MAP_oneEighth_value2enum_5, /* "tag" => N; sorted by tag */ + asn_MAP_oneEighth_enum2value_5, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_oneEighth_tags_5[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_oneEighth_5 = { + "oneEighth", + "oneEighth", + &asn_OP_NativeEnumerated, + asn_DEF_oneEighth_tags_5, + sizeof(asn_DEF_oneEighth_tags_5) + /sizeof(asn_DEF_oneEighth_tags_5[0]) - 1, /* 1 */ + asn_DEF_oneEighth_tags_5, /* Same as above */ + sizeof(asn_DEF_oneEighth_tags_5) + /sizeof(asn_DEF_oneEighth_tags_5[0]), /* 2 */ + { &asn_OER_type_oneEighth_constr_5, &asn_PER_type_oneEighth_constr_5, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_oneEighth_specs_5 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_oneFourth_value2enum_22[] = { + { 0, 2, "n4" }, + { 1, 2, "n8" }, + { 2, 3, "n12" }, + { 3, 3, "n16" }, + { 4, 3, "n20" }, + { 5, 3, "n24" }, + { 6, 3, "n28" }, + { 7, 3, "n32" }, + { 8, 3, "n36" }, + { 9, 3, "n40" }, + { 10, 3, "n44" }, + { 11, 3, "n48" }, + { 12, 3, "n52" }, + { 13, 3, "n56" }, + { 14, 3, "n60" }, + { 15, 3, "n64" } +}; +static const unsigned int asn_MAP_oneFourth_enum2value_22[] = { + 2, /* n12(2) */ + 3, /* n16(3) */ + 4, /* n20(4) */ + 5, /* n24(5) */ + 6, /* n28(6) */ + 7, /* n32(7) */ + 8, /* n36(8) */ + 0, /* n4(0) */ + 9, /* n40(9) */ + 10, /* n44(10) */ + 11, /* n48(11) */ + 12, /* n52(12) */ + 13, /* n56(13) */ + 14, /* n60(14) */ + 15, /* n64(15) */ + 1 /* n8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_oneFourth_specs_22 = { + asn_MAP_oneFourth_value2enum_22, /* "tag" => N; sorted by tag */ + asn_MAP_oneFourth_enum2value_22, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_oneFourth_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_oneFourth_22 = { + "oneFourth", + "oneFourth", + &asn_OP_NativeEnumerated, + asn_DEF_oneFourth_tags_22, + sizeof(asn_DEF_oneFourth_tags_22) + /sizeof(asn_DEF_oneFourth_tags_22[0]) - 1, /* 1 */ + asn_DEF_oneFourth_tags_22, /* Same as above */ + sizeof(asn_DEF_oneFourth_tags_22) + /sizeof(asn_DEF_oneFourth_tags_22[0]), /* 2 */ + { &asn_OER_type_oneFourth_constr_22, &asn_PER_type_oneFourth_constr_22, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_oneFourth_specs_22 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_oneHalf_value2enum_39[] = { + { 0, 2, "n4" }, + { 1, 2, "n8" }, + { 2, 3, "n12" }, + { 3, 3, "n16" }, + { 4, 3, "n20" }, + { 5, 3, "n24" }, + { 6, 3, "n28" }, + { 7, 3, "n32" }, + { 8, 3, "n36" }, + { 9, 3, "n40" }, + { 10, 3, "n44" }, + { 11, 3, "n48" }, + { 12, 3, "n52" }, + { 13, 3, "n56" }, + { 14, 3, "n60" }, + { 15, 3, "n64" } +}; +static const unsigned int asn_MAP_oneHalf_enum2value_39[] = { + 2, /* n12(2) */ + 3, /* n16(3) */ + 4, /* n20(4) */ + 5, /* n24(5) */ + 6, /* n28(6) */ + 7, /* n32(7) */ + 8, /* n36(8) */ + 0, /* n4(0) */ + 9, /* n40(9) */ + 10, /* n44(10) */ + 11, /* n48(11) */ + 12, /* n52(12) */ + 13, /* n56(13) */ + 14, /* n60(14) */ + 15, /* n64(15) */ + 1 /* n8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_oneHalf_specs_39 = { + asn_MAP_oneHalf_value2enum_39, /* "tag" => N; sorted by tag */ + asn_MAP_oneHalf_enum2value_39, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_oneHalf_tags_39[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_oneHalf_39 = { + "oneHalf", + "oneHalf", + &asn_OP_NativeEnumerated, + asn_DEF_oneHalf_tags_39, + sizeof(asn_DEF_oneHalf_tags_39) + /sizeof(asn_DEF_oneHalf_tags_39[0]) - 1, /* 1 */ + asn_DEF_oneHalf_tags_39, /* Same as above */ + sizeof(asn_DEF_oneHalf_tags_39) + /sizeof(asn_DEF_oneHalf_tags_39[0]), /* 2 */ + { &asn_OER_type_oneHalf_constr_39, &asn_PER_type_oneHalf_constr_39, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_oneHalf_specs_39 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_one_value2enum_56[] = { + { 0, 2, "n4" }, + { 1, 2, "n8" }, + { 2, 3, "n12" }, + { 3, 3, "n16" }, + { 4, 3, "n20" }, + { 5, 3, "n24" }, + { 6, 3, "n28" }, + { 7, 3, "n32" }, + { 8, 3, "n36" }, + { 9, 3, "n40" }, + { 10, 3, "n44" }, + { 11, 3, "n48" }, + { 12, 3, "n52" }, + { 13, 3, "n56" }, + { 14, 3, "n60" }, + { 15, 3, "n64" } +}; +static const unsigned int asn_MAP_one_enum2value_56[] = { + 2, /* n12(2) */ + 3, /* n16(3) */ + 4, /* n20(4) */ + 5, /* n24(5) */ + 6, /* n28(6) */ + 7, /* n32(7) */ + 8, /* n36(8) */ + 0, /* n4(0) */ + 9, /* n40(9) */ + 10, /* n44(10) */ + 11, /* n48(11) */ + 12, /* n52(12) */ + 13, /* n56(13) */ + 14, /* n60(14) */ + 15, /* n64(15) */ + 1 /* n8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_one_specs_56 = { + asn_MAP_one_value2enum_56, /* "tag" => N; sorted by tag */ + asn_MAP_one_enum2value_56, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_one_tags_56[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_one_56 = { + "one", + "one", + &asn_OP_NativeEnumerated, + asn_DEF_one_tags_56, + sizeof(asn_DEF_one_tags_56) + /sizeof(asn_DEF_one_tags_56[0]) - 1, /* 1 */ + asn_DEF_one_tags_56, /* Same as above */ + sizeof(asn_DEF_one_tags_56) + /sizeof(asn_DEF_one_tags_56[0]), /* 2 */ + { &asn_OER_type_one_constr_56, &asn_PER_type_one_constr_56, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_one_specs_56 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_two_value2enum_73[] = { + { 0, 2, "n4" }, + { 1, 2, "n8" }, + { 2, 3, "n12" }, + { 3, 3, "n16" }, + { 4, 3, "n20" }, + { 5, 3, "n24" }, + { 6, 3, "n28" }, + { 7, 3, "n32" } +}; +static const unsigned int asn_MAP_two_enum2value_73[] = { + 2, /* n12(2) */ + 3, /* n16(3) */ + 4, /* n20(4) */ + 5, /* n24(5) */ + 6, /* n28(6) */ + 7, /* n32(7) */ + 0, /* n4(0) */ + 1 /* n8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_two_specs_73 = { + asn_MAP_two_value2enum_73, /* "tag" => N; sorted by tag */ + asn_MAP_two_enum2value_73, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_two_tags_73[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_two_73 = { + "two", + "two", + &asn_OP_NativeEnumerated, + asn_DEF_two_tags_73, + sizeof(asn_DEF_two_tags_73) + /sizeof(asn_DEF_two_tags_73[0]) - 1, /* 1 */ + asn_DEF_two_tags_73, /* Same as above */ + sizeof(asn_DEF_two_tags_73) + /sizeof(asn_DEF_two_tags_73[0]), /* 2 */ + { &asn_OER_type_two_constr_73, &asn_PER_type_two_constr_73, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_two_specs_73 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_4[] = { + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.oneEighth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_oneEighth_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "oneEighth" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.oneFourth), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_oneFourth_22, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "oneFourth" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.oneHalf), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_oneHalf_39, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "oneHalf" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.one), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_one_56, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "one" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.two), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_two_73, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "two" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.four), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_four_constr_82, &asn_PER_memb_four_constr_82, memb_four_constraint_4 }, + 0, 0, /* No default value */ + "four" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.eight), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_eight_constr_83, &asn_PER_memb_eight_constr_83, memb_eight_constraint_4 }, + 0, 0, /* No default value */ + "eight" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, choice.sixteen), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sixteen_constr_84, &asn_PER_memb_sixteen_constr_84, memb_sixteen_constraint_4 }, + 0, 0, /* No default value */ + "sixteen" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_tag2el_4[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* oneEighth */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* oneFourth */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* oneHalf */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* one */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* two */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* four */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* eight */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* sixteen */ +}; +static asn_CHOICE_specifics_t asn_SPC_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_specs_4 = { + sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB), + offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, _asn_ctx), + offsetof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB, present), + sizeof(((struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB *)0)->present), + asn_MAP_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_tag2el_4, + 8, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_4 = { + "ssb-perRACH-OccasionAndCB-PreamblesPerSSB", + "ssb-perRACH-OccasionAndCB-PreamblesPerSSB", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_constr_4, &asn_PER_type_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_constr_4, CHOICE_constraint }, + asn_MBR_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_4, + 8, /* Elements count */ + &asn_SPC_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_specs_4 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ra_Msg3SizeGroupA_value2enum_86[] = { + { 0, 3, "b56" }, + { 1, 4, "b144" }, + { 2, 4, "b208" }, + { 3, 4, "b256" }, + { 4, 4, "b282" }, + { 5, 4, "b480" }, + { 6, 4, "b640" }, + { 7, 4, "b800" }, + { 8, 5, "b1000" }, + { 9, 3, "b72" }, + { 10, 6, "spare6" }, + { 11, 6, "spare5" }, + { 12, 6, "spare4" }, + { 13, 6, "spare3" }, + { 14, 6, "spare2" }, + { 15, 6, "spare1" } +}; +static const unsigned int asn_MAP_ra_Msg3SizeGroupA_enum2value_86[] = { + 8, /* b1000(8) */ + 1, /* b144(1) */ + 2, /* b208(2) */ + 3, /* b256(3) */ + 4, /* b282(4) */ + 5, /* b480(5) */ + 0, /* b56(0) */ + 6, /* b640(6) */ + 9, /* b72(9) */ + 7, /* b800(7) */ + 15, /* spare1(15) */ + 14, /* spare2(14) */ + 13, /* spare3(13) */ + 12, /* spare4(12) */ + 11, /* spare5(11) */ + 10 /* spare6(10) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ra_Msg3SizeGroupA_specs_86 = { + asn_MAP_ra_Msg3SizeGroupA_value2enum_86, /* "tag" => N; sorted by tag */ + asn_MAP_ra_Msg3SizeGroupA_enum2value_86, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ra_Msg3SizeGroupA_tags_86[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ra_Msg3SizeGroupA_86 = { + "ra-Msg3SizeGroupA", + "ra-Msg3SizeGroupA", + &asn_OP_NativeEnumerated, + asn_DEF_ra_Msg3SizeGroupA_tags_86, + sizeof(asn_DEF_ra_Msg3SizeGroupA_tags_86) + /sizeof(asn_DEF_ra_Msg3SizeGroupA_tags_86[0]) - 1, /* 1 */ + asn_DEF_ra_Msg3SizeGroupA_tags_86, /* Same as above */ + sizeof(asn_DEF_ra_Msg3SizeGroupA_tags_86) + /sizeof(asn_DEF_ra_Msg3SizeGroupA_tags_86[0]), /* 2 */ + { &asn_OER_type_ra_Msg3SizeGroupA_constr_86, &asn_PER_type_ra_Msg3SizeGroupA_constr_86, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ra_Msg3SizeGroupA_specs_86 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_messagePowerOffsetGroupB_value2enum_103[] = { + { 0, 13, "minusinfinity" }, + { 1, 3, "dB0" }, + { 2, 3, "dB5" }, + { 3, 3, "dB8" }, + { 4, 4, "dB10" }, + { 5, 4, "dB12" }, + { 6, 4, "dB15" }, + { 7, 4, "dB18" } +}; +static const unsigned int asn_MAP_messagePowerOffsetGroupB_enum2value_103[] = { + 1, /* dB0(1) */ + 4, /* dB10(4) */ + 5, /* dB12(5) */ + 6, /* dB15(6) */ + 7, /* dB18(7) */ + 2, /* dB5(2) */ + 3, /* dB8(3) */ + 0 /* minusinfinity(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_messagePowerOffsetGroupB_specs_103 = { + asn_MAP_messagePowerOffsetGroupB_value2enum_103, /* "tag" => N; sorted by tag */ + asn_MAP_messagePowerOffsetGroupB_enum2value_103, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_messagePowerOffsetGroupB_tags_103[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_messagePowerOffsetGroupB_103 = { + "messagePowerOffsetGroupB", + "messagePowerOffsetGroupB", + &asn_OP_NativeEnumerated, + asn_DEF_messagePowerOffsetGroupB_tags_103, + sizeof(asn_DEF_messagePowerOffsetGroupB_tags_103) + /sizeof(asn_DEF_messagePowerOffsetGroupB_tags_103[0]) - 1, /* 1 */ + asn_DEF_messagePowerOffsetGroupB_tags_103, /* Same as above */ + sizeof(asn_DEF_messagePowerOffsetGroupB_tags_103) + /sizeof(asn_DEF_messagePowerOffsetGroupB_tags_103[0]), /* 2 */ + { &asn_OER_type_messagePowerOffsetGroupB_constr_103, &asn_PER_type_messagePowerOffsetGroupB_constr_103, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_messagePowerOffsetGroupB_specs_103 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_groupBconfigured_85[] = { + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__groupBconfigured, ra_Msg3SizeGroupA), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ra_Msg3SizeGroupA_86, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ra-Msg3SizeGroupA" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__groupBconfigured, messagePowerOffsetGroupB), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_messagePowerOffsetGroupB_103, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "messagePowerOffsetGroupB" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__groupBconfigured, numberOfRA_PreamblesGroupA), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_numberOfRA_PreamblesGroupA_constr_112, &asn_PER_memb_numberOfRA_PreamblesGroupA_constr_112, memb_numberOfRA_PreamblesGroupA_constraint_85 }, + 0, 0, /* No default value */ + "numberOfRA-PreamblesGroupA" + }, +}; +static const ber_tlv_tag_t asn_DEF_groupBconfigured_tags_85[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_groupBconfigured_tag2el_85[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ra-Msg3SizeGroupA */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* messagePowerOffsetGroupB */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* numberOfRA-PreamblesGroupA */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_groupBconfigured_specs_85 = { + sizeof(struct RACH_ConfigCommon__groupBconfigured), + offsetof(struct RACH_ConfigCommon__groupBconfigured, _asn_ctx), + asn_MAP_groupBconfigured_tag2el_85, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_groupBconfigured_85 = { + "groupBconfigured", + "groupBconfigured", + &asn_OP_SEQUENCE, + asn_DEF_groupBconfigured_tags_85, + sizeof(asn_DEF_groupBconfigured_tags_85) + /sizeof(asn_DEF_groupBconfigured_tags_85[0]) - 1, /* 1 */ + asn_DEF_groupBconfigured_tags_85, /* Same as above */ + sizeof(asn_DEF_groupBconfigured_tags_85) + /sizeof(asn_DEF_groupBconfigured_tags_85[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_groupBconfigured_85, + 3, /* Elements count */ + &asn_SPC_groupBconfigured_specs_85 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ra_ContentionResolutionTimer_value2enum_113[] = { + { 0, 3, "sf8" }, + { 1, 4, "sf16" }, + { 2, 4, "sf24" }, + { 3, 4, "sf32" }, + { 4, 4, "sf40" }, + { 5, 4, "sf48" }, + { 6, 4, "sf56" }, + { 7, 4, "sf64" } +}; +static const unsigned int asn_MAP_ra_ContentionResolutionTimer_enum2value_113[] = { + 1, /* sf16(1) */ + 2, /* sf24(2) */ + 3, /* sf32(3) */ + 4, /* sf40(4) */ + 5, /* sf48(5) */ + 6, /* sf56(6) */ + 7, /* sf64(7) */ + 0 /* sf8(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ra_ContentionResolutionTimer_specs_113 = { + asn_MAP_ra_ContentionResolutionTimer_value2enum_113, /* "tag" => N; sorted by tag */ + asn_MAP_ra_ContentionResolutionTimer_enum2value_113, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ra_ContentionResolutionTimer_tags_113[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ra_ContentionResolutionTimer_113 = { + "ra-ContentionResolutionTimer", + "ra-ContentionResolutionTimer", + &asn_OP_NativeEnumerated, + asn_DEF_ra_ContentionResolutionTimer_tags_113, + sizeof(asn_DEF_ra_ContentionResolutionTimer_tags_113) + /sizeof(asn_DEF_ra_ContentionResolutionTimer_tags_113[0]) - 1, /* 1 */ + asn_DEF_ra_ContentionResolutionTimer_tags_113, /* Same as above */ + sizeof(asn_DEF_ra_ContentionResolutionTimer_tags_113) + /sizeof(asn_DEF_ra_ContentionResolutionTimer_tags_113[0]), /* 2 */ + { &asn_OER_type_ra_ContentionResolutionTimer_constr_113, &asn_PER_type_ra_ContentionResolutionTimer_constr_113, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ra_ContentionResolutionTimer_specs_113 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_prach_RootSequenceIndex_124[] = { + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__prach_RootSequenceIndex, choice.l839), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_l839_constr_125, &asn_PER_memb_l839_constr_125, memb_l839_constraint_124 }, + 0, 0, /* No default value */ + "l839" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon__prach_RootSequenceIndex, choice.l139), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_l139_constr_126, &asn_PER_memb_l139_constr_126, memb_l139_constraint_124 }, + 0, 0, /* No default value */ + "l139" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_prach_RootSequenceIndex_tag2el_124[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* l839 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* l139 */ +}; +static asn_CHOICE_specifics_t asn_SPC_prach_RootSequenceIndex_specs_124 = { + sizeof(struct RACH_ConfigCommon__prach_RootSequenceIndex), + offsetof(struct RACH_ConfigCommon__prach_RootSequenceIndex, _asn_ctx), + offsetof(struct RACH_ConfigCommon__prach_RootSequenceIndex, present), + sizeof(((struct RACH_ConfigCommon__prach_RootSequenceIndex *)0)->present), + asn_MAP_prach_RootSequenceIndex_tag2el_124, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_prach_RootSequenceIndex_124 = { + "prach-RootSequenceIndex", + "prach-RootSequenceIndex", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_prach_RootSequenceIndex_constr_124, &asn_PER_type_prach_RootSequenceIndex_constr_124, CHOICE_constraint }, + asn_MBR_prach_RootSequenceIndex_124, + 2, /* Elements count */ + &asn_SPC_prach_RootSequenceIndex_specs_124 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_restrictedSetConfig_value2enum_128[] = { + { 0, 15, "unrestrictedSet" }, + { 1, 18, "restrictedSetTypeA" }, + { 2, 18, "restrictedSetTypeB" } +}; +static const unsigned int asn_MAP_restrictedSetConfig_enum2value_128[] = { + 1, /* restrictedSetTypeA(1) */ + 2, /* restrictedSetTypeB(2) */ + 0 /* unrestrictedSet(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_restrictedSetConfig_specs_128 = { + asn_MAP_restrictedSetConfig_value2enum_128, /* "tag" => N; sorted by tag */ + asn_MAP_restrictedSetConfig_enum2value_128, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_restrictedSetConfig_tags_128[] = { + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_restrictedSetConfig_128 = { + "restrictedSetConfig", + "restrictedSetConfig", + &asn_OP_NativeEnumerated, + asn_DEF_restrictedSetConfig_tags_128, + sizeof(asn_DEF_restrictedSetConfig_tags_128) + /sizeof(asn_DEF_restrictedSetConfig_tags_128[0]) - 1, /* 1 */ + asn_DEF_restrictedSetConfig_tags_128, /* Same as above */ + sizeof(asn_DEF_restrictedSetConfig_tags_128) + /sizeof(asn_DEF_restrictedSetConfig_tags_128[0]), /* 2 */ + { &asn_OER_type_restrictedSetConfig_constr_128, &asn_PER_type_restrictedSetConfig_constr_128, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_restrictedSetConfig_specs_128 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_msg3_transformPrecoder_value2enum_132[] = { + { 0, 7, "enabled" } +}; +static const unsigned int asn_MAP_msg3_transformPrecoder_enum2value_132[] = { + 0 /* enabled(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_msg3_transformPrecoder_specs_132 = { + asn_MAP_msg3_transformPrecoder_value2enum_132, /* "tag" => N; sorted by tag */ + asn_MAP_msg3_transformPrecoder_enum2value_132, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_msg3_transformPrecoder_tags_132[] = { + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_msg3_transformPrecoder_132 = { + "msg3-transformPrecoder", + "msg3-transformPrecoder", + &asn_OP_NativeEnumerated, + asn_DEF_msg3_transformPrecoder_tags_132, + sizeof(asn_DEF_msg3_transformPrecoder_tags_132) + /sizeof(asn_DEF_msg3_transformPrecoder_tags_132[0]) - 1, /* 1 */ + asn_DEF_msg3_transformPrecoder_tags_132, /* Same as above */ + sizeof(asn_DEF_msg3_transformPrecoder_tags_132) + /sizeof(asn_DEF_msg3_transformPrecoder_tags_132[0]), /* 2 */ + { &asn_OER_type_msg3_transformPrecoder_constr_132, &asn_PER_type_msg3_transformPrecoder_constr_132, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_msg3_transformPrecoder_specs_132 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_RACH_ConfigCommon_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon, rach_ConfigGeneric), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RACH_ConfigGeneric, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rach-ConfigGeneric" + }, + { ATF_POINTER, 3, offsetof(struct RACH_ConfigCommon, totalNumberOfRA_Preambles), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_totalNumberOfRA_Preambles_constr_3, &asn_PER_memb_totalNumberOfRA_Preambles_constr_3, memb_totalNumberOfRA_Preambles_constraint_1 }, + 0, 0, /* No default value */ + "totalNumberOfRA-Preambles" + }, + { ATF_POINTER, 2, offsetof(struct RACH_ConfigCommon, ssb_perRACH_OccasionAndCB_PreamblesPerSSB), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_4, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ssb-perRACH-OccasionAndCB-PreamblesPerSSB" + }, + { ATF_POINTER, 1, offsetof(struct RACH_ConfigCommon, groupBconfigured), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_groupBconfigured_85, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "groupBconfigured" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon, ra_ContentionResolutionTimer), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ra_ContentionResolutionTimer_113, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ra-ContentionResolutionTimer" + }, + { ATF_POINTER, 2, offsetof(struct RACH_ConfigCommon, rsrp_ThresholdSSB), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RSRP_Range, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rsrp-ThresholdSSB" + }, + { ATF_POINTER, 1, offsetof(struct RACH_ConfigCommon, rsrp_ThresholdSSB_SUL), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RSRP_Range, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rsrp-ThresholdSSB-SUL" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon, prach_RootSequenceIndex), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_prach_RootSequenceIndex_124, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "prach-RootSequenceIndex" + }, + { ATF_POINTER, 1, offsetof(struct RACH_ConfigCommon, msg1_SubcarrierSpacing), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SubcarrierSpacing, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "msg1-SubcarrierSpacing" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigCommon, restrictedSetConfig), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_restrictedSetConfig_128, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "restrictedSetConfig" + }, + { ATF_POINTER, 1, offsetof(struct RACH_ConfigCommon, msg3_transformPrecoder), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_msg3_transformPrecoder_132, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "msg3-transformPrecoder" + }, +}; +static const int asn_MAP_RACH_ConfigCommon_oms_1[] = { 1, 2, 3, 5, 6, 8, 10 }; +static const ber_tlv_tag_t asn_DEF_RACH_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_RACH_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rach-ConfigGeneric */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* totalNumberOfRA-Preambles */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ssb-perRACH-OccasionAndCB-PreamblesPerSSB */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* groupBconfigured */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ra-ContentionResolutionTimer */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* rsrp-ThresholdSSB */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* rsrp-ThresholdSSB-SUL */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* prach-RootSequenceIndex */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* msg1-SubcarrierSpacing */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* restrictedSetConfig */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 } /* msg3-transformPrecoder */ +}; +asn_SEQUENCE_specifics_t asn_SPC_RACH_ConfigCommon_specs_1 = { + sizeof(struct RACH_ConfigCommon), + offsetof(struct RACH_ConfigCommon, _asn_ctx), + asn_MAP_RACH_ConfigCommon_tag2el_1, + 11, /* Count of tags in the map */ + asn_MAP_RACH_ConfigCommon_oms_1, /* Optional members */ + 7, 0, /* Root/Additions */ + 11, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_RACH_ConfigCommon = { + "RACH-ConfigCommon", + "RACH-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_RACH_ConfigCommon_tags_1, + sizeof(asn_DEF_RACH_ConfigCommon_tags_1) + /sizeof(asn_DEF_RACH_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_RACH_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_RACH_ConfigCommon_tags_1) + /sizeof(asn_DEF_RACH_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_RACH_ConfigCommon_1, + 11, /* Elements count */ + &asn_SPC_RACH_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/RACH-ConfigCommon.h b/src/codec_utils/SYSINFO/RACH-ConfigCommon.h new file mode 100644 index 000000000..e9ad1b54c --- /dev/null +++ b/src/codec_utils/SYSINFO/RACH-ConfigCommon.h @@ -0,0 +1,246 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _RACH_ConfigCommon_H_ +#define _RACH_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include "RACH-ConfigGeneric.h" +#include +#include +#include "RSRP-Range.h" +#include "SubcarrierSpacing.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING, /* No components present */ + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen +} RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR; +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n4 = 0, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n8 = 1, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n12 = 2, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n16 = 3, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n20 = 4, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n24 = 5, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n28 = 6, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n32 = 7, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n36 = 8, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n40 = 9, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n44 = 10, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n48 = 11, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n52 = 12, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n56 = 13, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n60 = 14, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n64 = 15 +} e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth; +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n4 = 0, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n8 = 1, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n12 = 2, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n16 = 3, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n20 = 4, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n24 = 5, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n28 = 6, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n32 = 7, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n36 = 8, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n40 = 9, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n44 = 10, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n48 = 11, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n52 = 12, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n56 = 13, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n60 = 14, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n64 = 15 +} e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth; +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n4 = 0, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n8 = 1, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n12 = 2, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n16 = 3, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n20 = 4, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n24 = 5, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n28 = 6, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n32 = 7, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n36 = 8, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n40 = 9, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n44 = 10, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n48 = 11, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n52 = 12, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n56 = 13, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n60 = 14, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n64 = 15 +} e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf; +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n4 = 0, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n8 = 1, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n12 = 2, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n16 = 3, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n20 = 4, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n24 = 5, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n28 = 6, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n32 = 7, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n36 = 8, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n40 = 9, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n44 = 10, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n48 = 11, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n52 = 12, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n56 = 13, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n60 = 14, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n64 = 15 +} e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one; +typedef enum RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n4 = 0, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n8 = 1, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n12 = 2, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n16 = 3, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n20 = 4, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n24 = 5, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n28 = 6, + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n32 = 7 +} e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two; +typedef enum RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA { + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b56 = 0, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b144 = 1, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b208 = 2, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b256 = 3, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b282 = 4, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b480 = 5, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b640 = 6, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b800 = 7, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b1000 = 8, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b72 = 9, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare6 = 10, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare5 = 11, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare4 = 12, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare3 = 13, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare2 = 14, + RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_spare1 = 15 +} e_RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA; +typedef enum RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB { + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_minusinfinity = 0, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB0 = 1, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB5 = 2, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB8 = 3, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB10 = 4, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB12 = 5, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB15 = 6, + RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB18 = 7 +} e_RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB; +typedef enum RACH_ConfigCommon__ra_ContentionResolutionTimer { + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf8 = 0, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf16 = 1, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf24 = 2, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf32 = 3, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf40 = 4, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf48 = 5, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf56 = 6, + RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64 = 7 +} e_RACH_ConfigCommon__ra_ContentionResolutionTimer; +typedef enum RACH_ConfigCommon__prach_RootSequenceIndex_PR { + RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING, /* No components present */ + RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839, + RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139 +} RACH_ConfigCommon__prach_RootSequenceIndex_PR; +typedef enum RACH_ConfigCommon__restrictedSetConfig { + RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet = 0, + RACH_ConfigCommon__restrictedSetConfig_restrictedSetTypeA = 1, + RACH_ConfigCommon__restrictedSetConfig_restrictedSetTypeB = 2 +} e_RACH_ConfigCommon__restrictedSetConfig; +typedef enum RACH_ConfigCommon__msg3_transformPrecoder { + RACH_ConfigCommon__msg3_transformPrecoder_enabled = 0 +} e_RACH_ConfigCommon__msg3_transformPrecoder; + +/* RACH-ConfigCommon */ +typedef struct RACH_ConfigCommon { + RACH_ConfigGeneric_t rach_ConfigGeneric; + long *totalNumberOfRA_Preambles; /* OPTIONAL */ + struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB { + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR present; + union RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_u { + long oneEighth; + long oneFourth; + long oneHalf; + long one; + long two; + long four; + long eight; + long sixteen; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *ssb_perRACH_OccasionAndCB_PreamblesPerSSB; + struct RACH_ConfigCommon__groupBconfigured { + long ra_Msg3SizeGroupA; + long messagePowerOffsetGroupB; + long numberOfRA_PreamblesGroupA; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *groupBconfigured; + long ra_ContentionResolutionTimer; + RSRP_Range_t *rsrp_ThresholdSSB; /* OPTIONAL */ + RSRP_Range_t *rsrp_ThresholdSSB_SUL; /* OPTIONAL */ + struct RACH_ConfigCommon__prach_RootSequenceIndex { + RACH_ConfigCommon__prach_RootSequenceIndex_PR present; + union RACH_ConfigCommon__prach_RootSequenceIndex_u { + long l839; + long l139; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } prach_RootSequenceIndex; + SubcarrierSpacing_t *msg1_SubcarrierSpacing; /* OPTIONAL */ + long restrictedSetConfig; + long *msg3_transformPrecoder; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RACH_ConfigCommon_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_oneEighth_5; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_oneFourth_22; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_oneHalf_39; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_one_56; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_two_73; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_ra_Msg3SizeGroupA_86; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_messagePowerOffsetGroupB_103; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_ra_ContentionResolutionTimer_113; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_restrictedSetConfig_128; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_msg3_transformPrecoder_132; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_RACH_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_RACH_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_RACH_ConfigCommon_1[11]; + +#ifdef __cplusplus +} +#endif + +#endif /* _RACH_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/RACH-ConfigGeneric.c b/src/codec_utils/SYSINFO/RACH-ConfigGeneric.c new file mode 100644 index 000000000..550eddc51 --- /dev/null +++ b/src/codec_utils/SYSINFO/RACH-ConfigGeneric.c @@ -0,0 +1,486 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "RACH-ConfigGeneric.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_prach_ConfigurationIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_msg1_FrequencyStart_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 274)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_zeroCorrelationZoneConfig_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_preambleReceivedTargetPower_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -202 && value <= -60)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_msg1_FDM_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_msg1_FDM_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_preambleTransMax_constr_11 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_preambleTransMax_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_powerRampingStep_constr_23 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_powerRampingStep_constr_23 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ra_ResponseWindow_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ra_ResponseWindow_constr_28 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_prach_ConfigurationIndex_constr_2 CC_NOTUSED = { + { 1, 1 } /* (0..255) */, + -1}; +static asn_per_constraints_t asn_PER_memb_prach_ConfigurationIndex_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_msg1_FrequencyStart_constr_8 CC_NOTUSED = { + { 2, 1 } /* (0..274) */, + -1}; +static asn_per_constraints_t asn_PER_memb_msg1_FrequencyStart_constr_8 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 274 } /* (0..274) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_zeroCorrelationZoneConfig_constr_9 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_zeroCorrelationZoneConfig_constr_9 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_preambleReceivedTargetPower_constr_10 CC_NOTUSED = { + { 2, 0 } /* (-202..-60) */, + -1}; +static asn_per_constraints_t asn_PER_memb_preambleReceivedTargetPower_constr_10 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, -202, -60 } /* (-202..-60) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_msg1_FDM_value2enum_3[] = { + { 0, 3, "one" }, + { 1, 3, "two" }, + { 2, 4, "four" }, + { 3, 5, "eight" } +}; +static const unsigned int asn_MAP_msg1_FDM_enum2value_3[] = { + 3, /* eight(3) */ + 2, /* four(2) */ + 0, /* one(0) */ + 1 /* two(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_msg1_FDM_specs_3 = { + asn_MAP_msg1_FDM_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_msg1_FDM_enum2value_3, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_msg1_FDM_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_msg1_FDM_3 = { + "msg1-FDM", + "msg1-FDM", + &asn_OP_NativeEnumerated, + asn_DEF_msg1_FDM_tags_3, + sizeof(asn_DEF_msg1_FDM_tags_3) + /sizeof(asn_DEF_msg1_FDM_tags_3[0]) - 1, /* 1 */ + asn_DEF_msg1_FDM_tags_3, /* Same as above */ + sizeof(asn_DEF_msg1_FDM_tags_3) + /sizeof(asn_DEF_msg1_FDM_tags_3[0]), /* 2 */ + { &asn_OER_type_msg1_FDM_constr_3, &asn_PER_type_msg1_FDM_constr_3, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_msg1_FDM_specs_3 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_preambleTransMax_value2enum_11[] = { + { 0, 2, "n3" }, + { 1, 2, "n4" }, + { 2, 2, "n5" }, + { 3, 2, "n6" }, + { 4, 2, "n7" }, + { 5, 2, "n8" }, + { 6, 3, "n10" }, + { 7, 3, "n20" }, + { 8, 3, "n50" }, + { 9, 4, "n100" }, + { 10, 4, "n200" } +}; +static const unsigned int asn_MAP_preambleTransMax_enum2value_11[] = { + 6, /* n10(6) */ + 9, /* n100(9) */ + 7, /* n20(7) */ + 10, /* n200(10) */ + 0, /* n3(0) */ + 1, /* n4(1) */ + 2, /* n5(2) */ + 8, /* n50(8) */ + 3, /* n6(3) */ + 4, /* n7(4) */ + 5 /* n8(5) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_preambleTransMax_specs_11 = { + asn_MAP_preambleTransMax_value2enum_11, /* "tag" => N; sorted by tag */ + asn_MAP_preambleTransMax_enum2value_11, /* N => "tag"; sorted by N */ + 11, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_preambleTransMax_tags_11[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_preambleTransMax_11 = { + "preambleTransMax", + "preambleTransMax", + &asn_OP_NativeEnumerated, + asn_DEF_preambleTransMax_tags_11, + sizeof(asn_DEF_preambleTransMax_tags_11) + /sizeof(asn_DEF_preambleTransMax_tags_11[0]) - 1, /* 1 */ + asn_DEF_preambleTransMax_tags_11, /* Same as above */ + sizeof(asn_DEF_preambleTransMax_tags_11) + /sizeof(asn_DEF_preambleTransMax_tags_11[0]), /* 2 */ + { &asn_OER_type_preambleTransMax_constr_11, &asn_PER_type_preambleTransMax_constr_11, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_preambleTransMax_specs_11 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_powerRampingStep_value2enum_23[] = { + { 0, 3, "dB0" }, + { 1, 3, "dB2" }, + { 2, 3, "dB4" }, + { 3, 3, "dB6" } +}; +static const unsigned int asn_MAP_powerRampingStep_enum2value_23[] = { + 0, /* dB0(0) */ + 1, /* dB2(1) */ + 2, /* dB4(2) */ + 3 /* dB6(3) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_powerRampingStep_specs_23 = { + asn_MAP_powerRampingStep_value2enum_23, /* "tag" => N; sorted by tag */ + asn_MAP_powerRampingStep_enum2value_23, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_powerRampingStep_tags_23[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_powerRampingStep_23 = { + "powerRampingStep", + "powerRampingStep", + &asn_OP_NativeEnumerated, + asn_DEF_powerRampingStep_tags_23, + sizeof(asn_DEF_powerRampingStep_tags_23) + /sizeof(asn_DEF_powerRampingStep_tags_23[0]) - 1, /* 1 */ + asn_DEF_powerRampingStep_tags_23, /* Same as above */ + sizeof(asn_DEF_powerRampingStep_tags_23) + /sizeof(asn_DEF_powerRampingStep_tags_23[0]), /* 2 */ + { &asn_OER_type_powerRampingStep_constr_23, &asn_PER_type_powerRampingStep_constr_23, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_powerRampingStep_specs_23 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ra_ResponseWindow_value2enum_28[] = { + { 0, 3, "sl1" }, + { 1, 3, "sl2" }, + { 2, 3, "sl4" }, + { 3, 3, "sl8" }, + { 4, 4, "sl10" }, + { 5, 4, "sl20" }, + { 6, 4, "sl40" }, + { 7, 4, "sl80" } +}; +static const unsigned int asn_MAP_ra_ResponseWindow_enum2value_28[] = { + 0, /* sl1(0) */ + 4, /* sl10(4) */ + 1, /* sl2(1) */ + 5, /* sl20(5) */ + 2, /* sl4(2) */ + 6, /* sl40(6) */ + 3, /* sl8(3) */ + 7 /* sl80(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ra_ResponseWindow_specs_28 = { + asn_MAP_ra_ResponseWindow_value2enum_28, /* "tag" => N; sorted by tag */ + asn_MAP_ra_ResponseWindow_enum2value_28, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ra_ResponseWindow_tags_28[] = { + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ra_ResponseWindow_28 = { + "ra-ResponseWindow", + "ra-ResponseWindow", + &asn_OP_NativeEnumerated, + asn_DEF_ra_ResponseWindow_tags_28, + sizeof(asn_DEF_ra_ResponseWindow_tags_28) + /sizeof(asn_DEF_ra_ResponseWindow_tags_28[0]) - 1, /* 1 */ + asn_DEF_ra_ResponseWindow_tags_28, /* Same as above */ + sizeof(asn_DEF_ra_ResponseWindow_tags_28) + /sizeof(asn_DEF_ra_ResponseWindow_tags_28[0]), /* 2 */ + { &asn_OER_type_ra_ResponseWindow_constr_28, &asn_PER_type_ra_ResponseWindow_constr_28, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ra_ResponseWindow_specs_28 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_RACH_ConfigGeneric_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, prach_ConfigurationIndex), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_prach_ConfigurationIndex_constr_2, &asn_PER_memb_prach_ConfigurationIndex_constr_2, memb_prach_ConfigurationIndex_constraint_1 }, + 0, 0, /* No default value */ + "prach-ConfigurationIndex" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, msg1_FDM), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_msg1_FDM_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "msg1-FDM" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, msg1_FrequencyStart), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_msg1_FrequencyStart_constr_8, &asn_PER_memb_msg1_FrequencyStart_constr_8, memb_msg1_FrequencyStart_constraint_1 }, + 0, 0, /* No default value */ + "msg1-FrequencyStart" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, zeroCorrelationZoneConfig), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_zeroCorrelationZoneConfig_constr_9, &asn_PER_memb_zeroCorrelationZoneConfig_constr_9, memb_zeroCorrelationZoneConfig_constraint_1 }, + 0, 0, /* No default value */ + "zeroCorrelationZoneConfig" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, preambleReceivedTargetPower), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_preambleReceivedTargetPower_constr_10, &asn_PER_memb_preambleReceivedTargetPower_constr_10, memb_preambleReceivedTargetPower_constraint_1 }, + 0, 0, /* No default value */ + "preambleReceivedTargetPower" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, preambleTransMax), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_preambleTransMax_11, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "preambleTransMax" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, powerRampingStep), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_powerRampingStep_23, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "powerRampingStep" + }, + { ATF_NOFLAGS, 0, offsetof(struct RACH_ConfigGeneric, ra_ResponseWindow), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ra_ResponseWindow_28, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ra-ResponseWindow" + }, +}; +static const ber_tlv_tag_t asn_DEF_RACH_ConfigGeneric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_RACH_ConfigGeneric_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* prach-ConfigurationIndex */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msg1-FDM */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msg1-FrequencyStart */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* zeroCorrelationZoneConfig */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* preambleReceivedTargetPower */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* preambleTransMax */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* powerRampingStep */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* ra-ResponseWindow */ +}; +asn_SEQUENCE_specifics_t asn_SPC_RACH_ConfigGeneric_specs_1 = { + sizeof(struct RACH_ConfigGeneric), + offsetof(struct RACH_ConfigGeneric, _asn_ctx), + asn_MAP_RACH_ConfigGeneric_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 8, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_RACH_ConfigGeneric = { + "RACH-ConfigGeneric", + "RACH-ConfigGeneric", + &asn_OP_SEQUENCE, + asn_DEF_RACH_ConfigGeneric_tags_1, + sizeof(asn_DEF_RACH_ConfigGeneric_tags_1) + /sizeof(asn_DEF_RACH_ConfigGeneric_tags_1[0]), /* 1 */ + asn_DEF_RACH_ConfigGeneric_tags_1, /* Same as above */ + sizeof(asn_DEF_RACH_ConfigGeneric_tags_1) + /sizeof(asn_DEF_RACH_ConfigGeneric_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_RACH_ConfigGeneric_1, + 8, /* Elements count */ + &asn_SPC_RACH_ConfigGeneric_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/RACH-ConfigGeneric.h b/src/codec_utils/SYSINFO/RACH-ConfigGeneric.h new file mode 100644 index 000000000..ac2120978 --- /dev/null +++ b/src/codec_utils/SYSINFO/RACH-ConfigGeneric.h @@ -0,0 +1,93 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _RACH_ConfigGeneric_H_ +#define _RACH_ConfigGeneric_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum RACH_ConfigGeneric__msg1_FDM { + RACH_ConfigGeneric__msg1_FDM_one = 0, + RACH_ConfigGeneric__msg1_FDM_two = 1, + RACH_ConfigGeneric__msg1_FDM_four = 2, + RACH_ConfigGeneric__msg1_FDM_eight = 3 +} e_RACH_ConfigGeneric__msg1_FDM; +typedef enum RACH_ConfigGeneric__preambleTransMax { + RACH_ConfigGeneric__preambleTransMax_n3 = 0, + RACH_ConfigGeneric__preambleTransMax_n4 = 1, + RACH_ConfigGeneric__preambleTransMax_n5 = 2, + RACH_ConfigGeneric__preambleTransMax_n6 = 3, + RACH_ConfigGeneric__preambleTransMax_n7 = 4, + RACH_ConfigGeneric__preambleTransMax_n8 = 5, + RACH_ConfigGeneric__preambleTransMax_n10 = 6, + RACH_ConfigGeneric__preambleTransMax_n20 = 7, + RACH_ConfigGeneric__preambleTransMax_n50 = 8, + RACH_ConfigGeneric__preambleTransMax_n100 = 9, + RACH_ConfigGeneric__preambleTransMax_n200 = 10 +} e_RACH_ConfigGeneric__preambleTransMax; +typedef enum RACH_ConfigGeneric__powerRampingStep { + RACH_ConfigGeneric__powerRampingStep_dB0 = 0, + RACH_ConfigGeneric__powerRampingStep_dB2 = 1, + RACH_ConfigGeneric__powerRampingStep_dB4 = 2, + RACH_ConfigGeneric__powerRampingStep_dB6 = 3 +} e_RACH_ConfigGeneric__powerRampingStep; +typedef enum RACH_ConfigGeneric__ra_ResponseWindow { + RACH_ConfigGeneric__ra_ResponseWindow_sl1 = 0, + RACH_ConfigGeneric__ra_ResponseWindow_sl2 = 1, + RACH_ConfigGeneric__ra_ResponseWindow_sl4 = 2, + RACH_ConfigGeneric__ra_ResponseWindow_sl8 = 3, + RACH_ConfigGeneric__ra_ResponseWindow_sl10 = 4, + RACH_ConfigGeneric__ra_ResponseWindow_sl20 = 5, + RACH_ConfigGeneric__ra_ResponseWindow_sl40 = 6, + RACH_ConfigGeneric__ra_ResponseWindow_sl80 = 7 +} e_RACH_ConfigGeneric__ra_ResponseWindow; + +/* RACH-ConfigGeneric */ +typedef struct RACH_ConfigGeneric { + long prach_ConfigurationIndex; + long msg1_FDM; + long msg1_FrequencyStart; + long zeroCorrelationZoneConfig; + long preambleReceivedTargetPower; + long preambleTransMax; + long powerRampingStep; + long ra_ResponseWindow; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RACH_ConfigGeneric_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_msg1_FDM_3; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_preambleTransMax_11; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_powerRampingStep_23; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_ra_ResponseWindow_28; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_RACH_ConfigGeneric; +extern asn_SEQUENCE_specifics_t asn_SPC_RACH_ConfigGeneric_specs_1; +extern asn_TYPE_member_t asn_MBR_RACH_ConfigGeneric_1[8]; + +#ifdef __cplusplus +} +#endif + +#endif /* _RACH_ConfigGeneric_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/RAN-AreaCode.c b/src/codec_utils/SYSINFO/RAN-AreaCode.c new file mode 100644 index 000000000..e5daef50c --- /dev/null +++ b/src/codec_utils/SYSINFO/RAN-AreaCode.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "RAN-AreaCode.h" + +int +RAN_AreaCode_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_RAN_AreaCode_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..255) */, + -1}; +asn_per_constraints_t asn_PER_type_RAN_AreaCode_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_RAN_AreaCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RAN_AreaCode = { + "RAN-AreaCode", + "RAN-AreaCode", + &asn_OP_NativeInteger, + asn_DEF_RAN_AreaCode_tags_1, + sizeof(asn_DEF_RAN_AreaCode_tags_1) + /sizeof(asn_DEF_RAN_AreaCode_tags_1[0]), /* 1 */ + asn_DEF_RAN_AreaCode_tags_1, /* Same as above */ + sizeof(asn_DEF_RAN_AreaCode_tags_1) + /sizeof(asn_DEF_RAN_AreaCode_tags_1[0]), /* 1 */ + { &asn_OER_type_RAN_AreaCode_constr_1, &asn_PER_type_RAN_AreaCode_constr_1, RAN_AreaCode_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/RAN-AreaCode.h b/src/codec_utils/SYSINFO/RAN-AreaCode.h new file mode 100644 index 000000000..39f311461 --- /dev/null +++ b/src/codec_utils/SYSINFO/RAN-AreaCode.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _RAN_AreaCode_H_ +#define _RAN_AreaCode_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RAN-AreaCode */ +typedef long RAN_AreaCode_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_RAN_AreaCode_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_RAN_AreaCode; +asn_struct_free_f RAN_AreaCode_free; +asn_struct_print_f RAN_AreaCode_print; +asn_constr_check_f RAN_AreaCode_constraint; +ber_type_decoder_f RAN_AreaCode_decode_ber; +der_type_encoder_f RAN_AreaCode_encode_der; +xer_type_decoder_f RAN_AreaCode_decode_xer; +xer_type_encoder_f RAN_AreaCode_encode_xer; +oer_type_decoder_f RAN_AreaCode_decode_oer; +oer_type_encoder_f RAN_AreaCode_encode_oer; +per_type_decoder_f RAN_AreaCode_decode_uper; +per_type_encoder_f RAN_AreaCode_encode_uper; +per_type_decoder_f RAN_AreaCode_decode_aper; +per_type_encoder_f RAN_AreaCode_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RAN_AreaCode_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/RSRP-Range.c b/src/codec_utils/SYSINFO/RSRP-Range.c new file mode 100644 index 000000000..ac3a96b6d --- /dev/null +++ b/src/codec_utils/SYSINFO/RSRP-Range.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "RSRP-Range.h" + +int +RSRP_Range_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_RSRP_Range_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..127) */, + -1}; +asn_per_constraints_t asn_PER_type_RSRP_Range_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_RSRP_Range_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RSRP_Range = { + "RSRP-Range", + "RSRP-Range", + &asn_OP_NativeInteger, + asn_DEF_RSRP_Range_tags_1, + sizeof(asn_DEF_RSRP_Range_tags_1) + /sizeof(asn_DEF_RSRP_Range_tags_1[0]), /* 1 */ + asn_DEF_RSRP_Range_tags_1, /* Same as above */ + sizeof(asn_DEF_RSRP_Range_tags_1) + /sizeof(asn_DEF_RSRP_Range_tags_1[0]), /* 1 */ + { &asn_OER_type_RSRP_Range_constr_1, &asn_PER_type_RSRP_Range_constr_1, RSRP_Range_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/RSRP-Range.h b/src/codec_utils/SYSINFO/RSRP-Range.h new file mode 100644 index 000000000..c80f36055 --- /dev/null +++ b/src/codec_utils/SYSINFO/RSRP-Range.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _RSRP_Range_H_ +#define _RSRP_Range_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RSRP-Range */ +typedef long RSRP_Range_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_RSRP_Range_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_RSRP_Range; +asn_struct_free_f RSRP_Range_free; +asn_struct_print_f RSRP_Range_print; +asn_constr_check_f RSRP_Range_constraint; +ber_type_decoder_f RSRP_Range_decode_ber; +der_type_encoder_f RSRP_Range_encode_der; +xer_type_decoder_f RSRP_Range_decode_xer; +xer_type_encoder_f RSRP_Range_encode_xer; +oer_type_decoder_f RSRP_Range_decode_oer; +oer_type_encoder_f RSRP_Range_encode_oer; +per_type_decoder_f RSRP_Range_decode_uper; +per_type_encoder_f RSRP_Range_encode_uper; +per_type_decoder_f RSRP_Range_decode_aper; +per_type_encoder_f RSRP_Range_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RSRP_Range_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SCS-SpecificCarrier.c b/src/codec_utils/SYSINFO/SCS-SpecificCarrier.c new file mode 100644 index 000000000..ae0d86555 --- /dev/null +++ b/src/codec_utils/SYSINFO/SCS-SpecificCarrier.c @@ -0,0 +1,226 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SCS-SpecificCarrier.h" + +static int +memb_txDirectCurrentLocation_v1530_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4095)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_offsetToCarrier_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2199)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_carrierBandwidth_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 275)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_memb_txDirectCurrentLocation_v1530_constr_7 CC_NOTUSED = { + { 2, 1 } /* (0..4095) */, + -1}; +static asn_per_constraints_t asn_PER_memb_txDirectCurrentLocation_v1530_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_offsetToCarrier_constr_2 CC_NOTUSED = { + { 2, 1 } /* (0..2199) */, + -1}; +static asn_per_constraints_t asn_PER_memb_offsetToCarrier_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2199 } /* (0..2199) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_carrierBandwidth_constr_4 CC_NOTUSED = { + { 2, 1 } /* (1..275) */, + -1}; +static asn_per_constraints_t asn_PER_memb_carrierBandwidth_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 1, 275 } /* (1..275) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_ext1_6[] = { + { ATF_POINTER, 1, offsetof(struct SCS_SpecificCarrier__ext1, txDirectCurrentLocation_v1530), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_txDirectCurrentLocation_v1530_constr_7, &asn_PER_memb_txDirectCurrentLocation_v1530_constr_7, memb_txDirectCurrentLocation_v1530_constraint_6 }, + 0, 0, /* No default value */ + "txDirectCurrentLocation-v1530" + }, +}; +static const int asn_MAP_ext1_oms_6[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_ext1_tags_6[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ext1_tag2el_6[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* txDirectCurrentLocation-v1530 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ext1_specs_6 = { + sizeof(struct SCS_SpecificCarrier__ext1), + offsetof(struct SCS_SpecificCarrier__ext1, _asn_ctx), + asn_MAP_ext1_tag2el_6, + 1, /* Count of tags in the map */ + asn_MAP_ext1_oms_6, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ext1_6 = { + "ext1", + "ext1", + &asn_OP_SEQUENCE, + asn_DEF_ext1_tags_6, + sizeof(asn_DEF_ext1_tags_6) + /sizeof(asn_DEF_ext1_tags_6[0]) - 1, /* 1 */ + asn_DEF_ext1_tags_6, /* Same as above */ + sizeof(asn_DEF_ext1_tags_6) + /sizeof(asn_DEF_ext1_tags_6[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ext1_6, + 1, /* Elements count */ + &asn_SPC_ext1_specs_6 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SCS_SpecificCarrier_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SCS_SpecificCarrier, offsetToCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_offsetToCarrier_constr_2, &asn_PER_memb_offsetToCarrier_constr_2, memb_offsetToCarrier_constraint_1 }, + 0, 0, /* No default value */ + "offsetToCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct SCS_SpecificCarrier, subcarrierSpacing), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SubcarrierSpacing, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "subcarrierSpacing" + }, + { ATF_NOFLAGS, 0, offsetof(struct SCS_SpecificCarrier, carrierBandwidth), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_carrierBandwidth_constr_4, &asn_PER_memb_carrierBandwidth_constr_4, memb_carrierBandwidth_constraint_1 }, + 0, 0, /* No default value */ + "carrierBandwidth" + }, + { ATF_POINTER, 1, offsetof(struct SCS_SpecificCarrier, ext1), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_ext1_6, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ext1" + }, +}; +static const int asn_MAP_SCS_SpecificCarrier_oms_1[] = { 3 }; +static const ber_tlv_tag_t asn_DEF_SCS_SpecificCarrier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SCS_SpecificCarrier_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* offsetToCarrier */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* subcarrierSpacing */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* carrierBandwidth */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ext1 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SCS_SpecificCarrier_specs_1 = { + sizeof(struct SCS_SpecificCarrier), + offsetof(struct SCS_SpecificCarrier, _asn_ctx), + asn_MAP_SCS_SpecificCarrier_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_SCS_SpecificCarrier_oms_1, /* Optional members */ + 0, 1, /* Root/Additions */ + 3, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SCS_SpecificCarrier = { + "SCS-SpecificCarrier", + "SCS-SpecificCarrier", + &asn_OP_SEQUENCE, + asn_DEF_SCS_SpecificCarrier_tags_1, + sizeof(asn_DEF_SCS_SpecificCarrier_tags_1) + /sizeof(asn_DEF_SCS_SpecificCarrier_tags_1[0]), /* 1 */ + asn_DEF_SCS_SpecificCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_SCS_SpecificCarrier_tags_1) + /sizeof(asn_DEF_SCS_SpecificCarrier_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SCS_SpecificCarrier_1, + 4, /* Elements count */ + &asn_SPC_SCS_SpecificCarrier_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SCS-SpecificCarrier.h b/src/codec_utils/SYSINFO/SCS-SpecificCarrier.h new file mode 100644 index 000000000..58176e266 --- /dev/null +++ b/src/codec_utils/SYSINFO/SCS-SpecificCarrier.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SCS_SpecificCarrier_H_ +#define _SCS_SpecificCarrier_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SubcarrierSpacing.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SCS-SpecificCarrier */ +typedef struct SCS_SpecificCarrier { + long offsetToCarrier; + SubcarrierSpacing_t subcarrierSpacing; + long carrierBandwidth; + /* + * This type is extensible, + * possible extensions are below. + */ + struct SCS_SpecificCarrier__ext1 { + long *txDirectCurrentLocation_v1530; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *ext1; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SCS_SpecificCarrier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SCS_SpecificCarrier; +extern asn_SEQUENCE_specifics_t asn_SPC_SCS_SpecificCarrier_specs_1; +extern asn_TYPE_member_t asn_MBR_SCS_SpecificCarrier_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SCS_SpecificCarrier_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SI-RequestConfig.c b/src/codec_utils/SYSINFO/SI-RequestConfig.c new file mode 100644 index 000000000..3b4633873 --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-RequestConfig.c @@ -0,0 +1,327 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SI-RequestConfig.h" + +#include "SI-RequestResources.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_si_RequestResources_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 32)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_ssb_perRACH_Occasion_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ssb_perRACH_Occasion_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_si_RequestPeriod_constr_13 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_si_RequestPeriod_constr_13 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_si_RequestResources_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..32)) */}; +static asn_per_constraints_t asn_PER_type_si_RequestResources_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_si_RequestResources_constr_22 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..32)) */}; +static asn_per_constraints_t asn_PER_memb_si_RequestResources_constr_22 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_ssb_perRACH_Occasion_value2enum_4[] = { + { 0, 9, "oneEighth" }, + { 1, 9, "oneFourth" }, + { 2, 7, "oneHalf" }, + { 3, 3, "one" }, + { 4, 3, "two" }, + { 5, 4, "four" }, + { 6, 5, "eight" }, + { 7, 7, "sixteen" } +}; +static const unsigned int asn_MAP_ssb_perRACH_Occasion_enum2value_4[] = { + 6, /* eight(6) */ + 5, /* four(5) */ + 3, /* one(3) */ + 0, /* oneEighth(0) */ + 1, /* oneFourth(1) */ + 2, /* oneHalf(2) */ + 7, /* sixteen(7) */ + 4 /* two(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ssb_perRACH_Occasion_specs_4 = { + asn_MAP_ssb_perRACH_Occasion_value2enum_4, /* "tag" => N; sorted by tag */ + asn_MAP_ssb_perRACH_Occasion_enum2value_4, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ssb_perRACH_Occasion_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ssb_perRACH_Occasion_4 = { + "ssb-perRACH-Occasion", + "ssb-perRACH-Occasion", + &asn_OP_NativeEnumerated, + asn_DEF_ssb_perRACH_Occasion_tags_4, + sizeof(asn_DEF_ssb_perRACH_Occasion_tags_4) + /sizeof(asn_DEF_ssb_perRACH_Occasion_tags_4[0]) - 1, /* 1 */ + asn_DEF_ssb_perRACH_Occasion_tags_4, /* Same as above */ + sizeof(asn_DEF_ssb_perRACH_Occasion_tags_4) + /sizeof(asn_DEF_ssb_perRACH_Occasion_tags_4[0]), /* 2 */ + { &asn_OER_type_ssb_perRACH_Occasion_constr_4, &asn_PER_type_ssb_perRACH_Occasion_constr_4, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ssb_perRACH_Occasion_specs_4 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_rach_OccasionsSI_2[] = { + { ATF_NOFLAGS, 0, offsetof(struct SI_RequestConfig__rach_OccasionsSI, rach_ConfigSI), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RACH_ConfigGeneric, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rach-ConfigSI" + }, + { ATF_NOFLAGS, 0, offsetof(struct SI_RequestConfig__rach_OccasionsSI, ssb_perRACH_Occasion), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ssb_perRACH_Occasion_4, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ssb-perRACH-Occasion" + }, +}; +static const ber_tlv_tag_t asn_DEF_rach_OccasionsSI_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_rach_OccasionsSI_tag2el_2[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rach-ConfigSI */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ssb-perRACH-Occasion */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_rach_OccasionsSI_specs_2 = { + sizeof(struct SI_RequestConfig__rach_OccasionsSI), + offsetof(struct SI_RequestConfig__rach_OccasionsSI, _asn_ctx), + asn_MAP_rach_OccasionsSI_tag2el_2, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_rach_OccasionsSI_2 = { + "rach-OccasionsSI", + "rach-OccasionsSI", + &asn_OP_SEQUENCE, + asn_DEF_rach_OccasionsSI_tags_2, + sizeof(asn_DEF_rach_OccasionsSI_tags_2) + /sizeof(asn_DEF_rach_OccasionsSI_tags_2[0]) - 1, /* 1 */ + asn_DEF_rach_OccasionsSI_tags_2, /* Same as above */ + sizeof(asn_DEF_rach_OccasionsSI_tags_2) + /sizeof(asn_DEF_rach_OccasionsSI_tags_2[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_rach_OccasionsSI_2, + 2, /* Elements count */ + &asn_SPC_rach_OccasionsSI_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_si_RequestPeriod_value2enum_13[] = { + { 0, 3, "one" }, + { 1, 3, "two" }, + { 2, 4, "four" }, + { 3, 3, "six" }, + { 4, 5, "eight" }, + { 5, 3, "ten" }, + { 6, 6, "twelve" }, + { 7, 7, "sixteen" } +}; +static const unsigned int asn_MAP_si_RequestPeriod_enum2value_13[] = { + 4, /* eight(4) */ + 2, /* four(2) */ + 0, /* one(0) */ + 3, /* six(3) */ + 7, /* sixteen(7) */ + 5, /* ten(5) */ + 6, /* twelve(6) */ + 1 /* two(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_si_RequestPeriod_specs_13 = { + asn_MAP_si_RequestPeriod_value2enum_13, /* "tag" => N; sorted by tag */ + asn_MAP_si_RequestPeriod_enum2value_13, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_si_RequestPeriod_tags_13[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_si_RequestPeriod_13 = { + "si-RequestPeriod", + "si-RequestPeriod", + &asn_OP_NativeEnumerated, + asn_DEF_si_RequestPeriod_tags_13, + sizeof(asn_DEF_si_RequestPeriod_tags_13) + /sizeof(asn_DEF_si_RequestPeriod_tags_13[0]) - 1, /* 1 */ + asn_DEF_si_RequestPeriod_tags_13, /* Same as above */ + sizeof(asn_DEF_si_RequestPeriod_tags_13) + /sizeof(asn_DEF_si_RequestPeriod_tags_13[0]), /* 2 */ + { &asn_OER_type_si_RequestPeriod_constr_13, &asn_PER_type_si_RequestPeriod_constr_13, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_si_RequestPeriod_specs_13 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_si_RequestResources_22[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SI_RequestResources, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_si_RequestResources_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_si_RequestResources_specs_22 = { + sizeof(struct SI_RequestConfig__si_RequestResources), + offsetof(struct SI_RequestConfig__si_RequestResources, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_si_RequestResources_22 = { + "si-RequestResources", + "si-RequestResources", + &asn_OP_SEQUENCE_OF, + asn_DEF_si_RequestResources_tags_22, + sizeof(asn_DEF_si_RequestResources_tags_22) + /sizeof(asn_DEF_si_RequestResources_tags_22[0]) - 1, /* 1 */ + asn_DEF_si_RequestResources_tags_22, /* Same as above */ + sizeof(asn_DEF_si_RequestResources_tags_22) + /sizeof(asn_DEF_si_RequestResources_tags_22[0]), /* 2 */ + { &asn_OER_type_si_RequestResources_constr_22, &asn_PER_type_si_RequestResources_constr_22, SEQUENCE_OF_constraint }, + asn_MBR_si_RequestResources_22, + 1, /* Single element */ + &asn_SPC_si_RequestResources_specs_22 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SI_RequestConfig_1[] = { + { ATF_POINTER, 2, offsetof(struct SI_RequestConfig, rach_OccasionsSI), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_rach_OccasionsSI_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "rach-OccasionsSI" + }, + { ATF_POINTER, 1, offsetof(struct SI_RequestConfig, si_RequestPeriod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_si_RequestPeriod_13, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-RequestPeriod" + }, + { ATF_NOFLAGS, 0, offsetof(struct SI_RequestConfig, si_RequestResources), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_si_RequestResources_22, + 0, + { &asn_OER_memb_si_RequestResources_constr_22, &asn_PER_memb_si_RequestResources_constr_22, memb_si_RequestResources_constraint_1 }, + 0, 0, /* No default value */ + "si-RequestResources" + }, +}; +static const int asn_MAP_SI_RequestConfig_oms_1[] = { 0, 1 }; +static const ber_tlv_tag_t asn_DEF_SI_RequestConfig_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SI_RequestConfig_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rach-OccasionsSI */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* si-RequestPeriod */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* si-RequestResources */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SI_RequestConfig_specs_1 = { + sizeof(struct SI_RequestConfig), + offsetof(struct SI_RequestConfig, _asn_ctx), + asn_MAP_SI_RequestConfig_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SI_RequestConfig_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SI_RequestConfig = { + "SI-RequestConfig", + "SI-RequestConfig", + &asn_OP_SEQUENCE, + asn_DEF_SI_RequestConfig_tags_1, + sizeof(asn_DEF_SI_RequestConfig_tags_1) + /sizeof(asn_DEF_SI_RequestConfig_tags_1[0]), /* 1 */ + asn_DEF_SI_RequestConfig_tags_1, /* Same as above */ + sizeof(asn_DEF_SI_RequestConfig_tags_1) + /sizeof(asn_DEF_SI_RequestConfig_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SI_RequestConfig_1, + 3, /* Elements count */ + &asn_SPC_SI_RequestConfig_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SI-RequestConfig.h b/src/codec_utils/SYSINFO/SI-RequestConfig.h new file mode 100644 index 000000000..0ea983efe --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-RequestConfig.h @@ -0,0 +1,83 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SI_RequestConfig_H_ +#define _SI_RequestConfig_H_ + + +#include + +/* Including external dependencies */ +#include +#include "RACH-ConfigGeneric.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion { + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_oneEighth = 0, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_oneFourth = 1, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_oneHalf = 2, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_one = 3, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_two = 4, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_four = 5, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_eight = 6, + SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion_sixteen = 7 +} e_SI_RequestConfig__rach_OccasionsSI__ssb_perRACH_Occasion; +typedef enum SI_RequestConfig__si_RequestPeriod { + SI_RequestConfig__si_RequestPeriod_one = 0, + SI_RequestConfig__si_RequestPeriod_two = 1, + SI_RequestConfig__si_RequestPeriod_four = 2, + SI_RequestConfig__si_RequestPeriod_six = 3, + SI_RequestConfig__si_RequestPeriod_eight = 4, + SI_RequestConfig__si_RequestPeriod_ten = 5, + SI_RequestConfig__si_RequestPeriod_twelve = 6, + SI_RequestConfig__si_RequestPeriod_sixteen = 7 +} e_SI_RequestConfig__si_RequestPeriod; + +/* Forward declarations */ +struct SI_RequestResources; + +/* SI-RequestConfig */ +typedef struct SI_RequestConfig { + struct SI_RequestConfig__rach_OccasionsSI { + RACH_ConfigGeneric_t rach_ConfigSI; + long ssb_perRACH_Occasion; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *rach_OccasionsSI; + long *si_RequestPeriod; /* OPTIONAL */ + struct SI_RequestConfig__si_RequestResources { + A_SEQUENCE_OF(struct SI_RequestResources) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } si_RequestResources; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SI_RequestConfig_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_ssb_perRACH_Occasion_4; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_si_RequestPeriod_13; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SI_RequestConfig; +extern asn_SEQUENCE_specifics_t asn_SPC_SI_RequestConfig_specs_1; +extern asn_TYPE_member_t asn_MBR_SI_RequestConfig_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SI_RequestConfig_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SI-RequestResources.c b/src/codec_utils/SYSINFO/SI-RequestResources.c new file mode 100644 index 000000000..5dad14270 --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-RequestResources.c @@ -0,0 +1,171 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SI-RequestResources.h" + +static int +memb_ra_PreambleStartIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ra_AssociationPeriodIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ra_ssb_OccasionMaskIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_memb_ra_PreambleStartIndex_constr_2 CC_NOTUSED = { + { 1, 1 } /* (0..63) */, + -1}; +static asn_per_constraints_t asn_PER_memb_ra_PreambleStartIndex_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_ra_AssociationPeriodIndex_constr_3 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_ra_AssociationPeriodIndex_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_ra_ssb_OccasionMaskIndex_constr_4 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_ra_ssb_OccasionMaskIndex_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_SI_RequestResources_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SI_RequestResources, ra_PreambleStartIndex), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_ra_PreambleStartIndex_constr_2, &asn_PER_memb_ra_PreambleStartIndex_constr_2, memb_ra_PreambleStartIndex_constraint_1 }, + 0, 0, /* No default value */ + "ra-PreambleStartIndex" + }, + { ATF_POINTER, 2, offsetof(struct SI_RequestResources, ra_AssociationPeriodIndex), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_ra_AssociationPeriodIndex_constr_3, &asn_PER_memb_ra_AssociationPeriodIndex_constr_3, memb_ra_AssociationPeriodIndex_constraint_1 }, + 0, 0, /* No default value */ + "ra-AssociationPeriodIndex" + }, + { ATF_POINTER, 1, offsetof(struct SI_RequestResources, ra_ssb_OccasionMaskIndex), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_ra_ssb_OccasionMaskIndex_constr_4, &asn_PER_memb_ra_ssb_OccasionMaskIndex_constr_4, memb_ra_ssb_OccasionMaskIndex_constraint_1 }, + 0, 0, /* No default value */ + "ra-ssb-OccasionMaskIndex" + }, +}; +static const int asn_MAP_SI_RequestResources_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_SI_RequestResources_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SI_RequestResources_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ra-PreambleStartIndex */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ra-AssociationPeriodIndex */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ra-ssb-OccasionMaskIndex */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SI_RequestResources_specs_1 = { + sizeof(struct SI_RequestResources), + offsetof(struct SI_RequestResources, _asn_ctx), + asn_MAP_SI_RequestResources_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SI_RequestResources_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SI_RequestResources = { + "SI-RequestResources", + "SI-RequestResources", + &asn_OP_SEQUENCE, + asn_DEF_SI_RequestResources_tags_1, + sizeof(asn_DEF_SI_RequestResources_tags_1) + /sizeof(asn_DEF_SI_RequestResources_tags_1[0]), /* 1 */ + asn_DEF_SI_RequestResources_tags_1, /* Same as above */ + sizeof(asn_DEF_SI_RequestResources_tags_1) + /sizeof(asn_DEF_SI_RequestResources_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SI_RequestResources_1, + 3, /* Elements count */ + &asn_SPC_SI_RequestResources_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SI-RequestResources.h b/src/codec_utils/SYSINFO/SI-RequestResources.h new file mode 100644 index 000000000..b1794fe11 --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-RequestResources.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SI_RequestResources_H_ +#define _SI_RequestResources_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SI-RequestResources */ +typedef struct SI_RequestResources { + long ra_PreambleStartIndex; + long *ra_AssociationPeriodIndex; /* OPTIONAL */ + long *ra_ssb_OccasionMaskIndex; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SI_RequestResources_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SI_RequestResources; +extern asn_SEQUENCE_specifics_t asn_SPC_SI_RequestResources_specs_1; +extern asn_TYPE_member_t asn_MBR_SI_RequestResources_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SI_RequestResources_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SI-SchedulingInfo.c b/src/codec_utils/SYSINFO/SI-SchedulingInfo.c new file mode 100644 index 000000000..7c5a1e266 --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-SchedulingInfo.c @@ -0,0 +1,275 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SI-SchedulingInfo.h" + +#include "SI-RequestConfig.h" +#include "SchedulingInfo.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_schedulingInfoList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 32)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_systemInformationAreaID_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 24)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_schedulingInfoList_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..32)) */}; +static asn_per_constraints_t asn_PER_type_schedulingInfoList_constr_2 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_si_WindowLength_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_si_WindowLength_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 8 } /* (0..8) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_schedulingInfoList_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..32)) */}; +static asn_per_constraints_t asn_PER_memb_schedulingInfoList_constr_2 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_systemInformationAreaID_constr_16 CC_NOTUSED = { + { 0, 0 }, + 24 /* (SIZE(24..24)) */}; +static asn_per_constraints_t asn_PER_memb_systemInformationAreaID_constr_16 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 24, 24 } /* (SIZE(24..24)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_schedulingInfoList_2[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SchedulingInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_schedulingInfoList_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_schedulingInfoList_specs_2 = { + sizeof(struct SI_SchedulingInfo__schedulingInfoList), + offsetof(struct SI_SchedulingInfo__schedulingInfoList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_schedulingInfoList_2 = { + "schedulingInfoList", + "schedulingInfoList", + &asn_OP_SEQUENCE_OF, + asn_DEF_schedulingInfoList_tags_2, + sizeof(asn_DEF_schedulingInfoList_tags_2) + /sizeof(asn_DEF_schedulingInfoList_tags_2[0]) - 1, /* 1 */ + asn_DEF_schedulingInfoList_tags_2, /* Same as above */ + sizeof(asn_DEF_schedulingInfoList_tags_2) + /sizeof(asn_DEF_schedulingInfoList_tags_2[0]), /* 2 */ + { &asn_OER_type_schedulingInfoList_constr_2, &asn_PER_type_schedulingInfoList_constr_2, SEQUENCE_OF_constraint }, + asn_MBR_schedulingInfoList_2, + 1, /* Single element */ + &asn_SPC_schedulingInfoList_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_si_WindowLength_value2enum_4[] = { + { 0, 2, "s5" }, + { 1, 3, "s10" }, + { 2, 3, "s20" }, + { 3, 3, "s40" }, + { 4, 3, "s80" }, + { 5, 4, "s160" }, + { 6, 4, "s320" }, + { 7, 4, "s640" }, + { 8, 5, "s1280" } +}; +static const unsigned int asn_MAP_si_WindowLength_enum2value_4[] = { + 1, /* s10(1) */ + 8, /* s1280(8) */ + 5, /* s160(5) */ + 2, /* s20(2) */ + 6, /* s320(6) */ + 3, /* s40(3) */ + 0, /* s5(0) */ + 7, /* s640(7) */ + 4 /* s80(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_si_WindowLength_specs_4 = { + asn_MAP_si_WindowLength_value2enum_4, /* "tag" => N; sorted by tag */ + asn_MAP_si_WindowLength_enum2value_4, /* N => "tag"; sorted by N */ + 9, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_si_WindowLength_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_si_WindowLength_4 = { + "si-WindowLength", + "si-WindowLength", + &asn_OP_NativeEnumerated, + asn_DEF_si_WindowLength_tags_4, + sizeof(asn_DEF_si_WindowLength_tags_4) + /sizeof(asn_DEF_si_WindowLength_tags_4[0]) - 1, /* 1 */ + asn_DEF_si_WindowLength_tags_4, /* Same as above */ + sizeof(asn_DEF_si_WindowLength_tags_4) + /sizeof(asn_DEF_si_WindowLength_tags_4[0]), /* 2 */ + { &asn_OER_type_si_WindowLength_constr_4, &asn_PER_type_si_WindowLength_constr_4, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_si_WindowLength_specs_4 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SI_SchedulingInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SI_SchedulingInfo, schedulingInfoList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_schedulingInfoList_2, + 0, + { &asn_OER_memb_schedulingInfoList_constr_2, &asn_PER_memb_schedulingInfoList_constr_2, memb_schedulingInfoList_constraint_1 }, + 0, 0, /* No default value */ + "schedulingInfoList" + }, + { ATF_NOFLAGS, 0, offsetof(struct SI_SchedulingInfo, si_WindowLength), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_si_WindowLength_4, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-WindowLength" + }, + { ATF_POINTER, 3, offsetof(struct SI_SchedulingInfo, si_RequestConfig), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SI_RequestConfig, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-RequestConfig" + }, + { ATF_POINTER, 2, offsetof(struct SI_SchedulingInfo, si_RequestConfigSUL), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SI_RequestConfig, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-RequestConfigSUL" + }, + { ATF_POINTER, 1, offsetof(struct SI_SchedulingInfo, systemInformationAreaID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_systemInformationAreaID_constr_16, &asn_PER_memb_systemInformationAreaID_constr_16, memb_systemInformationAreaID_constraint_1 }, + 0, 0, /* No default value */ + "systemInformationAreaID" + }, +}; +static const int asn_MAP_SI_SchedulingInfo_oms_1[] = { 2, 3, 4 }; +static const ber_tlv_tag_t asn_DEF_SI_SchedulingInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SI_SchedulingInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* schedulingInfoList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* si-WindowLength */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* si-RequestConfig */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* si-RequestConfigSUL */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* systemInformationAreaID */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SI_SchedulingInfo_specs_1 = { + sizeof(struct SI_SchedulingInfo), + offsetof(struct SI_SchedulingInfo, _asn_ctx), + asn_MAP_SI_SchedulingInfo_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_SI_SchedulingInfo_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 5, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SI_SchedulingInfo = { + "SI-SchedulingInfo", + "SI-SchedulingInfo", + &asn_OP_SEQUENCE, + asn_DEF_SI_SchedulingInfo_tags_1, + sizeof(asn_DEF_SI_SchedulingInfo_tags_1) + /sizeof(asn_DEF_SI_SchedulingInfo_tags_1[0]), /* 1 */ + asn_DEF_SI_SchedulingInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_SI_SchedulingInfo_tags_1) + /sizeof(asn_DEF_SI_SchedulingInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SI_SchedulingInfo_1, + 5, /* Elements count */ + &asn_SPC_SI_SchedulingInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SI-SchedulingInfo.h b/src/codec_utils/SYSINFO/SI-SchedulingInfo.h new file mode 100644 index 000000000..717b3e109 --- /dev/null +++ b/src/codec_utils/SYSINFO/SI-SchedulingInfo.h @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SI_SchedulingInfo_H_ +#define _SI_SchedulingInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SI_SchedulingInfo__si_WindowLength { + SI_SchedulingInfo__si_WindowLength_s5 = 0, + SI_SchedulingInfo__si_WindowLength_s10 = 1, + SI_SchedulingInfo__si_WindowLength_s20 = 2, + SI_SchedulingInfo__si_WindowLength_s40 = 3, + SI_SchedulingInfo__si_WindowLength_s80 = 4, + SI_SchedulingInfo__si_WindowLength_s160 = 5, + SI_SchedulingInfo__si_WindowLength_s320 = 6, + SI_SchedulingInfo__si_WindowLength_s640 = 7, + SI_SchedulingInfo__si_WindowLength_s1280 = 8 +} e_SI_SchedulingInfo__si_WindowLength; + +/* Forward declarations */ +struct SI_RequestConfig; +struct SchedulingInfo; + +/* SI-SchedulingInfo */ +typedef struct SI_SchedulingInfo { + struct SI_SchedulingInfo__schedulingInfoList { + A_SEQUENCE_OF(struct SchedulingInfo) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } schedulingInfoList; + long si_WindowLength; + struct SI_RequestConfig *si_RequestConfig; /* OPTIONAL */ + struct SI_RequestConfig *si_RequestConfigSUL; /* OPTIONAL */ + BIT_STRING_t *systemInformationAreaID; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SI_SchedulingInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_si_WindowLength_4; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SI_SchedulingInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_SI_SchedulingInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_SI_SchedulingInfo_1[5]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SI_SchedulingInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SIB-Mapping.c b/src/codec_utils/SYSINFO/SIB-Mapping.c new file mode 100644 index 000000000..f088dfa23 --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB-Mapping.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SIB-Mapping.h" + +#include "SIB-TypeInfo.h" +static asn_oer_constraints_t asn_OER_type_SIB_Mapping_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..32)) */}; +asn_per_constraints_t asn_PER_type_SIB_Mapping_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_SIB_Mapping_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SIB_TypeInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_SIB_Mapping_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_SIB_Mapping_specs_1 = { + sizeof(struct SIB_Mapping), + offsetof(struct SIB_Mapping, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SIB_Mapping = { + "SIB-Mapping", + "SIB-Mapping", + &asn_OP_SEQUENCE_OF, + asn_DEF_SIB_Mapping_tags_1, + sizeof(asn_DEF_SIB_Mapping_tags_1) + /sizeof(asn_DEF_SIB_Mapping_tags_1[0]), /* 1 */ + asn_DEF_SIB_Mapping_tags_1, /* Same as above */ + sizeof(asn_DEF_SIB_Mapping_tags_1) + /sizeof(asn_DEF_SIB_Mapping_tags_1[0]), /* 1 */ + { &asn_OER_type_SIB_Mapping_constr_1, &asn_PER_type_SIB_Mapping_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_SIB_Mapping_1, + 1, /* Single element */ + &asn_SPC_SIB_Mapping_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SIB-Mapping.h b/src/codec_utils/SYSINFO/SIB-Mapping.h new file mode 100644 index 000000000..fb7110a3e --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB-Mapping.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SIB_Mapping_H_ +#define _SIB_Mapping_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SIB_TypeInfo; + +/* SIB-Mapping */ +typedef struct SIB_Mapping { + A_SEQUENCE_OF(struct SIB_TypeInfo) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SIB_Mapping_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SIB_Mapping; +extern asn_SET_OF_specifics_t asn_SPC_SIB_Mapping_specs_1; +extern asn_TYPE_member_t asn_MBR_SIB_Mapping_1[1]; +extern asn_per_constraints_t asn_PER_type_SIB_Mapping_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _SIB_Mapping_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SIB-TypeInfo.c b/src/codec_utils/SYSINFO/SIB-TypeInfo.c new file mode 100644 index 000000000..7808c2aba --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB-TypeInfo.c @@ -0,0 +1,231 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SIB-TypeInfo.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_valueTag_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_type_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_type_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 15 } /* (0..15,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_areaScope_constr_21 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_areaScope_constr_21 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_valueTag_constr_20 CC_NOTUSED = { + { 1, 1 } /* (0..31) */, + -1}; +static asn_per_constraints_t asn_PER_memb_valueTag_constr_20 CC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_type_value2enum_2[] = { + { 0, 8, "sibType2" }, + { 1, 8, "sibType3" }, + { 2, 8, "sibType4" }, + { 3, 8, "sibType5" }, + { 4, 8, "sibType6" }, + { 5, 8, "sibType7" }, + { 6, 8, "sibType8" }, + { 7, 8, "sibType9" }, + { 8, 6, "spare8" }, + { 9, 6, "spare7" }, + { 10, 6, "spare6" }, + { 11, 6, "spare5" }, + { 12, 6, "spare4" }, + { 13, 6, "spare3" }, + { 14, 6, "spare2" }, + { 15, 6, "spare1" } + /* This list is extensible */ +}; +static const unsigned int asn_MAP_type_enum2value_2[] = { + 0, /* sibType2(0) */ + 1, /* sibType3(1) */ + 2, /* sibType4(2) */ + 3, /* sibType5(3) */ + 4, /* sibType6(4) */ + 5, /* sibType7(5) */ + 6, /* sibType8(6) */ + 7, /* sibType9(7) */ + 15, /* spare1(15) */ + 14, /* spare2(14) */ + 13, /* spare3(13) */ + 12, /* spare4(12) */ + 11, /* spare5(11) */ + 10, /* spare6(10) */ + 9, /* spare7(9) */ + 8 /* spare8(8) */ + /* This list is extensible */ +}; +static const asn_INTEGER_specifics_t asn_SPC_type_specs_2 = { + asn_MAP_type_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_type_enum2value_2, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 17, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_type_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_type_2 = { + "type", + "type", + &asn_OP_NativeEnumerated, + asn_DEF_type_tags_2, + sizeof(asn_DEF_type_tags_2) + /sizeof(asn_DEF_type_tags_2[0]) - 1, /* 1 */ + asn_DEF_type_tags_2, /* Same as above */ + sizeof(asn_DEF_type_tags_2) + /sizeof(asn_DEF_type_tags_2[0]), /* 2 */ + { &asn_OER_type_type_constr_2, &asn_PER_type_type_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_type_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_areaScope_value2enum_21[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_areaScope_enum2value_21[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_areaScope_specs_21 = { + asn_MAP_areaScope_value2enum_21, /* "tag" => N; sorted by tag */ + asn_MAP_areaScope_enum2value_21, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_areaScope_tags_21[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_areaScope_21 = { + "areaScope", + "areaScope", + &asn_OP_NativeEnumerated, + asn_DEF_areaScope_tags_21, + sizeof(asn_DEF_areaScope_tags_21) + /sizeof(asn_DEF_areaScope_tags_21[0]) - 1, /* 1 */ + asn_DEF_areaScope_tags_21, /* Same as above */ + sizeof(asn_DEF_areaScope_tags_21) + /sizeof(asn_DEF_areaScope_tags_21[0]), /* 2 */ + { &asn_OER_type_areaScope_constr_21, &asn_PER_type_areaScope_constr_21, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_areaScope_specs_21 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SIB_TypeInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SIB_TypeInfo, type), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_type_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "type" + }, + { ATF_POINTER, 2, offsetof(struct SIB_TypeInfo, valueTag), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_valueTag_constr_20, &asn_PER_memb_valueTag_constr_20, memb_valueTag_constraint_1 }, + 0, 0, /* No default value */ + "valueTag" + }, + { ATF_POINTER, 1, offsetof(struct SIB_TypeInfo, areaScope), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_areaScope_21, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "areaScope" + }, +}; +static const int asn_MAP_SIB_TypeInfo_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_SIB_TypeInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SIB_TypeInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* valueTag */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* areaScope */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SIB_TypeInfo_specs_1 = { + sizeof(struct SIB_TypeInfo), + offsetof(struct SIB_TypeInfo, _asn_ctx), + asn_MAP_SIB_TypeInfo_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SIB_TypeInfo_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SIB_TypeInfo = { + "SIB-TypeInfo", + "SIB-TypeInfo", + &asn_OP_SEQUENCE, + asn_DEF_SIB_TypeInfo_tags_1, + sizeof(asn_DEF_SIB_TypeInfo_tags_1) + /sizeof(asn_DEF_SIB_TypeInfo_tags_1[0]), /* 1 */ + asn_DEF_SIB_TypeInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_SIB_TypeInfo_tags_1) + /sizeof(asn_DEF_SIB_TypeInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SIB_TypeInfo_1, + 3, /* Elements count */ + &asn_SPC_SIB_TypeInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SIB-TypeInfo.h b/src/codec_utils/SYSINFO/SIB-TypeInfo.h new file mode 100644 index 000000000..be600722d --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB-TypeInfo.h @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SIB_TypeInfo_H_ +#define _SIB_TypeInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SIB_TypeInfo__type { + SIB_TypeInfo__type_sibType2 = 0, + SIB_TypeInfo__type_sibType3 = 1, + SIB_TypeInfo__type_sibType4 = 2, + SIB_TypeInfo__type_sibType5 = 3, + SIB_TypeInfo__type_sibType6 = 4, + SIB_TypeInfo__type_sibType7 = 5, + SIB_TypeInfo__type_sibType8 = 6, + SIB_TypeInfo__type_sibType9 = 7, + SIB_TypeInfo__type_spare8 = 8, + SIB_TypeInfo__type_spare7 = 9, + SIB_TypeInfo__type_spare6 = 10, + SIB_TypeInfo__type_spare5 = 11, + SIB_TypeInfo__type_spare4 = 12, + SIB_TypeInfo__type_spare3 = 13, + SIB_TypeInfo__type_spare2 = 14, + SIB_TypeInfo__type_spare1 = 15 + /* + * Enumeration is extensible + */ +} e_SIB_TypeInfo__type; +typedef enum SIB_TypeInfo__areaScope { + SIB_TypeInfo__areaScope_true = 0 +} e_SIB_TypeInfo__areaScope; + +/* SIB-TypeInfo */ +typedef struct SIB_TypeInfo { + long type; + long *valueTag; /* OPTIONAL */ + long *areaScope; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SIB_TypeInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_type_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_areaScope_21; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SIB_TypeInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_SIB_TypeInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_SIB_TypeInfo_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SIB_TypeInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SIB1.c b/src/codec_utils/SYSINFO/SIB1.c new file mode 100644 index 000000000..8f444e0da --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB1.c @@ -0,0 +1,699 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SIB1.h" + +#include "ConnEstFailureControl.h" +#include "SI-SchedulingInfo.h" +#include "ServingCellConfigCommonSIB.h" +#include "UE-TimersAndConstants.h" +#include "UAC-BarringPerCatList.h" +#include "UAC-BarringPerPLMN-List.h" +static int +memb_q_RxLevMinOffset_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_q_QualMinOffset_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_individualPLMNList_constraint_21(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 2 && size <= 12)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_memb_q_RxLevMinOffset_constr_4 CC_NOTUSED = { + { 1, 1 } /* (1..8) */, + -1}; +static asn_per_constraints_t asn_PER_memb_q_RxLevMinOffset_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (1..8) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_q_QualMinOffset_constr_7 CC_NOTUSED = { + { 1, 1 } /* (1..8) */, + -1}; +static asn_per_constraints_t asn_PER_memb_q_QualMinOffset_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (1..8) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ims_EmergencySupport_constr_12 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ims_EmergencySupport_constr_12 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_eCallOverIMS_Support_constr_14 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_eCallOverIMS_Support_constr_14 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_individualPLMNList_constr_23 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(2..12)) */}; +static asn_per_constraints_t asn_PER_type_individualPLMNList_constr_23 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 2, 12 } /* (SIZE(2..12)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_individualPLMNList_constr_23 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(2..12)) */}; +static asn_per_constraints_t asn_PER_memb_individualPLMNList_constr_23 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 2, 12 } /* (SIZE(2..12)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_uac_AccessCategory1_SelectionAssistanceInfo_constr_21 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_uac_AccessCategory1_SelectionAssistanceInfo_constr_21 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_useFullResumeID_constr_25 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_useFullResumeID_constr_25 CC_NOTUSED = { + { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_cellSelectionInfo_2[] = { + { ATF_NOFLAGS, 0, offsetof(struct SIB1__cellSelectionInfo, q_RxLevMin), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Q_RxLevMin, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "q-RxLevMin" + }, + { ATF_POINTER, 4, offsetof(struct SIB1__cellSelectionInfo, q_RxLevMinOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_q_RxLevMinOffset_constr_4, &asn_PER_memb_q_RxLevMinOffset_constr_4, memb_q_RxLevMinOffset_constraint_2 }, + 0, 0, /* No default value */ + "q-RxLevMinOffset" + }, + { ATF_POINTER, 3, offsetof(struct SIB1__cellSelectionInfo, q_RxLevMinSUL), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Q_RxLevMin, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "q-RxLevMinSUL" + }, + { ATF_POINTER, 2, offsetof(struct SIB1__cellSelectionInfo, q_QualMin), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Q_QualMin, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "q-QualMin" + }, + { ATF_POINTER, 1, offsetof(struct SIB1__cellSelectionInfo, q_QualMinOffset), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_q_QualMinOffset_constr_7, &asn_PER_memb_q_QualMinOffset_constr_7, memb_q_QualMinOffset_constraint_2 }, + 0, 0, /* No default value */ + "q-QualMinOffset" + }, +}; +static const int asn_MAP_cellSelectionInfo_oms_2[] = { 1, 2, 3, 4 }; +static const ber_tlv_tag_t asn_DEF_cellSelectionInfo_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_cellSelectionInfo_tag2el_2[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* q-RxLevMin */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* q-RxLevMinOffset */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* q-RxLevMinSUL */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* q-QualMin */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* q-QualMinOffset */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_cellSelectionInfo_specs_2 = { + sizeof(struct SIB1__cellSelectionInfo), + offsetof(struct SIB1__cellSelectionInfo, _asn_ctx), + asn_MAP_cellSelectionInfo_tag2el_2, + 5, /* Count of tags in the map */ + asn_MAP_cellSelectionInfo_oms_2, /* Optional members */ + 4, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cellSelectionInfo_2 = { + "cellSelectionInfo", + "cellSelectionInfo", + &asn_OP_SEQUENCE, + asn_DEF_cellSelectionInfo_tags_2, + sizeof(asn_DEF_cellSelectionInfo_tags_2) + /sizeof(asn_DEF_cellSelectionInfo_tags_2[0]) - 1, /* 1 */ + asn_DEF_cellSelectionInfo_tags_2, /* Same as above */ + sizeof(asn_DEF_cellSelectionInfo_tags_2) + /sizeof(asn_DEF_cellSelectionInfo_tags_2[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_cellSelectionInfo_2, + 5, /* Elements count */ + &asn_SPC_cellSelectionInfo_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ims_EmergencySupport_value2enum_12[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_ims_EmergencySupport_enum2value_12[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ims_EmergencySupport_specs_12 = { + asn_MAP_ims_EmergencySupport_value2enum_12, /* "tag" => N; sorted by tag */ + asn_MAP_ims_EmergencySupport_enum2value_12, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ims_EmergencySupport_tags_12[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ims_EmergencySupport_12 = { + "ims-EmergencySupport", + "ims-EmergencySupport", + &asn_OP_NativeEnumerated, + asn_DEF_ims_EmergencySupport_tags_12, + sizeof(asn_DEF_ims_EmergencySupport_tags_12) + /sizeof(asn_DEF_ims_EmergencySupport_tags_12[0]) - 1, /* 1 */ + asn_DEF_ims_EmergencySupport_tags_12, /* Same as above */ + sizeof(asn_DEF_ims_EmergencySupport_tags_12) + /sizeof(asn_DEF_ims_EmergencySupport_tags_12[0]), /* 2 */ + { &asn_OER_type_ims_EmergencySupport_constr_12, &asn_PER_type_ims_EmergencySupport_constr_12, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ims_EmergencySupport_specs_12 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_eCallOverIMS_Support_value2enum_14[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_eCallOverIMS_Support_enum2value_14[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_eCallOverIMS_Support_specs_14 = { + asn_MAP_eCallOverIMS_Support_value2enum_14, /* "tag" => N; sorted by tag */ + asn_MAP_eCallOverIMS_Support_enum2value_14, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_eCallOverIMS_Support_tags_14[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_eCallOverIMS_Support_14 = { + "eCallOverIMS-Support", + "eCallOverIMS-Support", + &asn_OP_NativeEnumerated, + asn_DEF_eCallOverIMS_Support_tags_14, + sizeof(asn_DEF_eCallOverIMS_Support_tags_14) + /sizeof(asn_DEF_eCallOverIMS_Support_tags_14[0]) - 1, /* 1 */ + asn_DEF_eCallOverIMS_Support_tags_14, /* Same as above */ + sizeof(asn_DEF_eCallOverIMS_Support_tags_14) + /sizeof(asn_DEF_eCallOverIMS_Support_tags_14[0]), /* 2 */ + { &asn_OER_type_eCallOverIMS_Support_constr_14, &asn_PER_type_eCallOverIMS_Support_constr_14, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_eCallOverIMS_Support_specs_14 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_individualPLMNList_23[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_individualPLMNList_tags_23[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_individualPLMNList_specs_23 = { + sizeof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo__individualPLMNList), + offsetof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo__individualPLMNList, _asn_ctx), + 1, /* XER encoding is XMLValueList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_individualPLMNList_23 = { + "individualPLMNList", + "individualPLMNList", + &asn_OP_SEQUENCE_OF, + asn_DEF_individualPLMNList_tags_23, + sizeof(asn_DEF_individualPLMNList_tags_23) + /sizeof(asn_DEF_individualPLMNList_tags_23[0]) - 1, /* 1 */ + asn_DEF_individualPLMNList_tags_23, /* Same as above */ + sizeof(asn_DEF_individualPLMNList_tags_23) + /sizeof(asn_DEF_individualPLMNList_tags_23[0]), /* 2 */ + { &asn_OER_type_individualPLMNList_constr_23, &asn_PER_type_individualPLMNList_constr_23, SEQUENCE_OF_constraint }, + asn_MBR_individualPLMNList_23, + 1, /* Single element */ + &asn_SPC_individualPLMNList_specs_23 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_uac_AccessCategory1_SelectionAssistanceInfo_21[] = { + { ATF_NOFLAGS, 0, offsetof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo, choice.plmnCommon), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "plmnCommon" + }, + { ATF_POINTER, 0, offsetof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo, choice.individualPLMNList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_individualPLMNList_23, + 0, + { &asn_OER_memb_individualPLMNList_constr_23, &asn_PER_memb_individualPLMNList_constr_23, memb_individualPLMNList_constraint_21 }, + 0, 0, /* No default value */ + "individualPLMNList" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_uac_AccessCategory1_SelectionAssistanceInfo_tag2el_21[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmnCommon */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* individualPLMNList */ +}; +static asn_CHOICE_specifics_t asn_SPC_uac_AccessCategory1_SelectionAssistanceInfo_specs_21 = { + sizeof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo), + offsetof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo, _asn_ctx), + offsetof(struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo, present), + sizeof(((struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo *)0)->present), + asn_MAP_uac_AccessCategory1_SelectionAssistanceInfo_tag2el_21, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_AccessCategory1_SelectionAssistanceInfo_21 = { + "uac-AccessCategory1-SelectionAssistanceInfo", + "uac-AccessCategory1-SelectionAssistanceInfo", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_uac_AccessCategory1_SelectionAssistanceInfo_constr_21, &asn_PER_type_uac_AccessCategory1_SelectionAssistanceInfo_constr_21, CHOICE_constraint }, + asn_MBR_uac_AccessCategory1_SelectionAssistanceInfo_21, + 2, /* Elements count */ + &asn_SPC_uac_AccessCategory1_SelectionAssistanceInfo_specs_21 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_uac_BarringInfo_17[] = { + { ATF_POINTER, 2, offsetof(struct SIB1__uac_BarringInfo, uac_BarringForCommon), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_BarringPerCatList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringForCommon" + }, + { ATF_POINTER, 1, offsetof(struct SIB1__uac_BarringInfo, uac_BarringPerPLMN_List), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_BarringPerPLMN_List, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringPerPLMN-List" + }, + { ATF_NOFLAGS, 0, offsetof(struct SIB1__uac_BarringInfo, uac_BarringInfoSetList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_BarringInfoSetList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringInfoSetList" + }, + { ATF_POINTER, 1, offsetof(struct SIB1__uac_BarringInfo, uac_AccessCategory1_SelectionAssistanceInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_uac_AccessCategory1_SelectionAssistanceInfo_21, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-AccessCategory1-SelectionAssistanceInfo" + }, +}; +static const int asn_MAP_uac_BarringInfo_oms_17[] = { 0, 1, 3 }; +static const ber_tlv_tag_t asn_DEF_uac_BarringInfo_tags_17[] = { + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_uac_BarringInfo_tag2el_17[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uac-BarringForCommon */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uac-BarringPerPLMN-List */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* uac-BarringInfoSetList */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* uac-AccessCategory1-SelectionAssistanceInfo */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_uac_BarringInfo_specs_17 = { + sizeof(struct SIB1__uac_BarringInfo), + offsetof(struct SIB1__uac_BarringInfo, _asn_ctx), + asn_MAP_uac_BarringInfo_tag2el_17, + 4, /* Count of tags in the map */ + asn_MAP_uac_BarringInfo_oms_17, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_BarringInfo_17 = { + "uac-BarringInfo", + "uac-BarringInfo", + &asn_OP_SEQUENCE, + asn_DEF_uac_BarringInfo_tags_17, + sizeof(asn_DEF_uac_BarringInfo_tags_17) + /sizeof(asn_DEF_uac_BarringInfo_tags_17[0]) - 1, /* 1 */ + asn_DEF_uac_BarringInfo_tags_17, /* Same as above */ + sizeof(asn_DEF_uac_BarringInfo_tags_17) + /sizeof(asn_DEF_uac_BarringInfo_tags_17[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_uac_BarringInfo_17, + 4, /* Elements count */ + &asn_SPC_uac_BarringInfo_specs_17 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_useFullResumeID_value2enum_25[] = { + { 0, 4, "true" } +}; +static const unsigned int asn_MAP_useFullResumeID_enum2value_25[] = { + 0 /* true(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_useFullResumeID_specs_25 = { + asn_MAP_useFullResumeID_value2enum_25, /* "tag" => N; sorted by tag */ + asn_MAP_useFullResumeID_enum2value_25, /* N => "tag"; sorted by N */ + 1, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_useFullResumeID_tags_25[] = { + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_useFullResumeID_25 = { + "useFullResumeID", + "useFullResumeID", + &asn_OP_NativeEnumerated, + asn_DEF_useFullResumeID_tags_25, + sizeof(asn_DEF_useFullResumeID_tags_25) + /sizeof(asn_DEF_useFullResumeID_tags_25[0]) - 1, /* 1 */ + asn_DEF_useFullResumeID_tags_25, /* Same as above */ + sizeof(asn_DEF_useFullResumeID_tags_25) + /sizeof(asn_DEF_useFullResumeID_tags_25[0]), /* 2 */ + { &asn_OER_type_useFullResumeID_constr_25, &asn_PER_type_useFullResumeID_constr_25, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_useFullResumeID_specs_25 /* Additional specs */ +}; + +static const ber_tlv_tag_t asn_DEF_nonCriticalExtension_tags_28[] = { + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SEQUENCE_specifics_t asn_SPC_nonCriticalExtension_specs_28 = { + sizeof(struct SIB1__nonCriticalExtension), + offsetof(struct SIB1__nonCriticalExtension, _asn_ctx), + 0, /* No top level tags */ + 0, /* No tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_nonCriticalExtension_28 = { + "nonCriticalExtension", + "nonCriticalExtension", + &asn_OP_SEQUENCE, + asn_DEF_nonCriticalExtension_tags_28, + sizeof(asn_DEF_nonCriticalExtension_tags_28) + /sizeof(asn_DEF_nonCriticalExtension_tags_28[0]) - 1, /* 1 */ + asn_DEF_nonCriticalExtension_tags_28, /* Same as above */ + sizeof(asn_DEF_nonCriticalExtension_tags_28) + /sizeof(asn_DEF_nonCriticalExtension_tags_28[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + 0, 0, /* No members */ + &asn_SPC_nonCriticalExtension_specs_28 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_SIB1_1[] = { + { ATF_POINTER, 1, offsetof(struct SIB1, cellSelectionInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_cellSelectionInfo_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellSelectionInfo" + }, + { ATF_NOFLAGS, 0, offsetof(struct SIB1, cellAccessRelatedInfo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellAccessRelatedInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "cellAccessRelatedInfo" + }, + { ATF_POINTER, 10, offsetof(struct SIB1, connEstFailureControl), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ConnEstFailureControl, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "connEstFailureControl" + }, + { ATF_POINTER, 9, offsetof(struct SIB1, si_SchedulingInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SI_SchedulingInfo, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-SchedulingInfo" + }, + { ATF_POINTER, 8, offsetof(struct SIB1, servingCellConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ServingCellConfigCommonSIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "servingCellConfigCommon" + }, + { ATF_POINTER, 7, offsetof(struct SIB1, ims_EmergencySupport), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ims_EmergencySupport_12, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ims-EmergencySupport" + }, + { ATF_POINTER, 6, offsetof(struct SIB1, eCallOverIMS_Support), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_eCallOverIMS_Support_14, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "eCallOverIMS-Support" + }, + { ATF_POINTER, 5, offsetof(struct SIB1, ue_TimersAndConstants), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UE_TimersAndConstants, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ue-TimersAndConstants" + }, + { ATF_POINTER, 4, offsetof(struct SIB1, uac_BarringInfo), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + 0, + &asn_DEF_uac_BarringInfo_17, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringInfo" + }, + { ATF_POINTER, 3, offsetof(struct SIB1, useFullResumeID), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_useFullResumeID_25, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "useFullResumeID" + }, + { ATF_POINTER, 2, offsetof(struct SIB1, lateNonCriticalExtension), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "lateNonCriticalExtension" + }, + { ATF_POINTER, 1, offsetof(struct SIB1, nonCriticalExtension), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + 0, + &asn_DEF_nonCriticalExtension_28, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nonCriticalExtension" + }, +}; +static const int asn_MAP_SIB1_oms_1[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; +static const ber_tlv_tag_t asn_DEF_SIB1_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SIB1_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellSelectionInfo */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cellAccessRelatedInfo */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* connEstFailureControl */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* si-SchedulingInfo */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* servingCellConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ims-EmergencySupport */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* eCallOverIMS-Support */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ue-TimersAndConstants */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* uac-BarringInfo */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* useFullResumeID */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* lateNonCriticalExtension */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 } /* nonCriticalExtension */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SIB1_specs_1 = { + sizeof(struct SIB1), + offsetof(struct SIB1, _asn_ctx), + asn_MAP_SIB1_tag2el_1, + 12, /* Count of tags in the map */ + asn_MAP_SIB1_oms_1, /* Optional members */ + 11, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SIB1 = { + "SIB1", + "SIB1", + &asn_OP_SEQUENCE, + asn_DEF_SIB1_tags_1, + sizeof(asn_DEF_SIB1_tags_1) + /sizeof(asn_DEF_SIB1_tags_1[0]), /* 1 */ + asn_DEF_SIB1_tags_1, /* Same as above */ + sizeof(asn_DEF_SIB1_tags_1) + /sizeof(asn_DEF_SIB1_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SIB1_1, + 12, /* Elements count */ + &asn_SPC_SIB1_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SIB1.h b/src/codec_utils/SYSINFO/SIB1.h new file mode 100644 index 000000000..279a8b932 --- /dev/null +++ b/src/codec_utils/SYSINFO/SIB1.h @@ -0,0 +1,121 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SIB1_H_ +#define _SIB1_H_ + + +#include + +/* Including external dependencies */ +#include "CellAccessRelatedInfo.h" +#include +#include +#include "Q-RxLevMin.h" +#include +#include "Q-QualMin.h" +#include +#include "UAC-BarringInfoSetList.h" +#include "UAC-AccessCategory1-SelectionAssistanceInfo.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SIB1__ims_EmergencySupport { + SIB1__ims_EmergencySupport_true = 0 +} e_SIB1__ims_EmergencySupport; +typedef enum SIB1__eCallOverIMS_Support { + SIB1__eCallOverIMS_Support_true = 0 +} e_SIB1__eCallOverIMS_Support; +typedef enum SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR { + SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR_NOTHING, /* No components present */ + SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR_plmnCommon, + SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR_individualPLMNList +} SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR; +typedef enum SIB1__useFullResumeID { + SIB1__useFullResumeID_true = 0 +} e_SIB1__useFullResumeID; + +/* Forward declarations */ +struct ConnEstFailureControl; +struct SI_SchedulingInfo; +struct ServingCellConfigCommonSIB; +struct UE_TimersAndConstants; +struct UAC_BarringPerCatList; +struct UAC_BarringPerPLMN_List; + +/* SIB1 */ +typedef struct SIB1 { + struct SIB1__cellSelectionInfo { + Q_RxLevMin_t q_RxLevMin; + long *q_RxLevMinOffset; /* OPTIONAL */ + Q_RxLevMin_t *q_RxLevMinSUL; /* OPTIONAL */ + Q_QualMin_t *q_QualMin; /* OPTIONAL */ + long *q_QualMinOffset; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *cellSelectionInfo; + CellAccessRelatedInfo_t cellAccessRelatedInfo; + struct ConnEstFailureControl *connEstFailureControl; /* OPTIONAL */ + struct SI_SchedulingInfo *si_SchedulingInfo; /* OPTIONAL */ + struct ServingCellConfigCommonSIB *servingCellConfigCommon; /* OPTIONAL */ + long *ims_EmergencySupport; /* OPTIONAL */ + long *eCallOverIMS_Support; /* OPTIONAL */ + struct UE_TimersAndConstants *ue_TimersAndConstants; /* OPTIONAL */ + struct SIB1__uac_BarringInfo { + struct UAC_BarringPerCatList *uac_BarringForCommon; /* OPTIONAL */ + struct UAC_BarringPerPLMN_List *uac_BarringPerPLMN_List; /* OPTIONAL */ + UAC_BarringInfoSetList_t uac_BarringInfoSetList; + struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo { + SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_PR present; + union SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo_u { + UAC_AccessCategory1_SelectionAssistanceInfo_t plmnCommon; + struct SIB1__uac_BarringInfo__uac_AccessCategory1_SelectionAssistanceInfo__individualPLMNList { + A_SEQUENCE_OF(UAC_AccessCategory1_SelectionAssistanceInfo_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *individualPLMNList; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *uac_AccessCategory1_SelectionAssistanceInfo; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *uac_BarringInfo; + long *useFullResumeID; /* OPTIONAL */ + OCTET_STRING_t *lateNonCriticalExtension; /* OPTIONAL */ + struct SIB1__nonCriticalExtension { + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *nonCriticalExtension; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SIB1_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_ims_EmergencySupport_12; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_eCallOverIMS_Support_14; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_useFullResumeID_25; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SIB1; + +#ifdef __cplusplus +} +#endif + +#endif /* _SIB1_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SchedulingInfo.c b/src/codec_utils/SYSINFO/SchedulingInfo.c new file mode 100644 index 000000000..cb693a56a --- /dev/null +++ b/src/codec_utils/SYSINFO/SchedulingInfo.c @@ -0,0 +1,178 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SchedulingInfo.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_si_BroadcastStatus_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_si_BroadcastStatus_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_si_Periodicity_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_si_Periodicity_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 6 } /* (0..6) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_si_BroadcastStatus_value2enum_2[] = { + { 0, 12, "broadcasting" }, + { 1, 15, "notBroadcasting" } +}; +static const unsigned int asn_MAP_si_BroadcastStatus_enum2value_2[] = { + 0, /* broadcasting(0) */ + 1 /* notBroadcasting(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_si_BroadcastStatus_specs_2 = { + asn_MAP_si_BroadcastStatus_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_si_BroadcastStatus_enum2value_2, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_si_BroadcastStatus_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_si_BroadcastStatus_2 = { + "si-BroadcastStatus", + "si-BroadcastStatus", + &asn_OP_NativeEnumerated, + asn_DEF_si_BroadcastStatus_tags_2, + sizeof(asn_DEF_si_BroadcastStatus_tags_2) + /sizeof(asn_DEF_si_BroadcastStatus_tags_2[0]) - 1, /* 1 */ + asn_DEF_si_BroadcastStatus_tags_2, /* Same as above */ + sizeof(asn_DEF_si_BroadcastStatus_tags_2) + /sizeof(asn_DEF_si_BroadcastStatus_tags_2[0]), /* 2 */ + { &asn_OER_type_si_BroadcastStatus_constr_2, &asn_PER_type_si_BroadcastStatus_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_si_BroadcastStatus_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_si_Periodicity_value2enum_5[] = { + { 0, 3, "rf8" }, + { 1, 4, "rf16" }, + { 2, 4, "rf32" }, + { 3, 4, "rf64" }, + { 4, 5, "rf128" }, + { 5, 5, "rf256" }, + { 6, 5, "rf512" } +}; +static const unsigned int asn_MAP_si_Periodicity_enum2value_5[] = { + 4, /* rf128(4) */ + 1, /* rf16(1) */ + 5, /* rf256(5) */ + 2, /* rf32(2) */ + 6, /* rf512(6) */ + 3, /* rf64(3) */ + 0 /* rf8(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_si_Periodicity_specs_5 = { + asn_MAP_si_Periodicity_value2enum_5, /* "tag" => N; sorted by tag */ + asn_MAP_si_Periodicity_enum2value_5, /* N => "tag"; sorted by N */ + 7, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_si_Periodicity_tags_5[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_si_Periodicity_5 = { + "si-Periodicity", + "si-Periodicity", + &asn_OP_NativeEnumerated, + asn_DEF_si_Periodicity_tags_5, + sizeof(asn_DEF_si_Periodicity_tags_5) + /sizeof(asn_DEF_si_Periodicity_tags_5[0]) - 1, /* 1 */ + asn_DEF_si_Periodicity_tags_5, /* Same as above */ + sizeof(asn_DEF_si_Periodicity_tags_5) + /sizeof(asn_DEF_si_Periodicity_tags_5[0]), /* 2 */ + { &asn_OER_type_si_Periodicity_constr_5, &asn_PER_type_si_Periodicity_constr_5, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_si_Periodicity_specs_5 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SchedulingInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SchedulingInfo, si_BroadcastStatus), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_si_BroadcastStatus_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-BroadcastStatus" + }, + { ATF_NOFLAGS, 0, offsetof(struct SchedulingInfo, si_Periodicity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_si_Periodicity_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "si-Periodicity" + }, + { ATF_NOFLAGS, 0, offsetof(struct SchedulingInfo, sib_MappingInfo), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SIB_Mapping, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "sib-MappingInfo" + }, +}; +static const ber_tlv_tag_t asn_DEF_SchedulingInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SchedulingInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* si-BroadcastStatus */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* si-Periodicity */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* sib-MappingInfo */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SchedulingInfo_specs_1 = { + sizeof(struct SchedulingInfo), + offsetof(struct SchedulingInfo, _asn_ctx), + asn_MAP_SchedulingInfo_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SchedulingInfo = { + "SchedulingInfo", + "SchedulingInfo", + &asn_OP_SEQUENCE, + asn_DEF_SchedulingInfo_tags_1, + sizeof(asn_DEF_SchedulingInfo_tags_1) + /sizeof(asn_DEF_SchedulingInfo_tags_1[0]), /* 1 */ + asn_DEF_SchedulingInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_SchedulingInfo_tags_1) + /sizeof(asn_DEF_SchedulingInfo_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SchedulingInfo_1, + 3, /* Elements count */ + &asn_SPC_SchedulingInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SchedulingInfo.h b/src/codec_utils/SYSINFO/SchedulingInfo.h new file mode 100644 index 000000000..6efe241a2 --- /dev/null +++ b/src/codec_utils/SYSINFO/SchedulingInfo.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SchedulingInfo_H_ +#define _SchedulingInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SIB-Mapping.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SchedulingInfo__si_BroadcastStatus { + SchedulingInfo__si_BroadcastStatus_broadcasting = 0, + SchedulingInfo__si_BroadcastStatus_notBroadcasting = 1 +} e_SchedulingInfo__si_BroadcastStatus; +typedef enum SchedulingInfo__si_Periodicity { + SchedulingInfo__si_Periodicity_rf8 = 0, + SchedulingInfo__si_Periodicity_rf16 = 1, + SchedulingInfo__si_Periodicity_rf32 = 2, + SchedulingInfo__si_Periodicity_rf64 = 3, + SchedulingInfo__si_Periodicity_rf128 = 4, + SchedulingInfo__si_Periodicity_rf256 = 5, + SchedulingInfo__si_Periodicity_rf512 = 6 +} e_SchedulingInfo__si_Periodicity; + +/* SchedulingInfo */ +typedef struct SchedulingInfo { + long si_BroadcastStatus; + long si_Periodicity; + SIB_Mapping_t sib_MappingInfo; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SchedulingInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_si_BroadcastStatus_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_si_Periodicity_5; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SchedulingInfo; +extern asn_SEQUENCE_specifics_t asn_SPC_SchedulingInfo_specs_1; +extern asn_TYPE_member_t asn_MBR_SchedulingInfo_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SchedulingInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SearchSpace.c b/src/codec_utils/SYSINFO/SearchSpace.c new file mode 100644 index 000000000..b01389aeb --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpace.c @@ -0,0 +1,2077 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SearchSpace.h" + +static int +memb_sl2_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl4_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl5_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl8_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl10_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 9)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl16_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl20_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 19)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl40_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 39)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl80_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 79)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl160_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 159)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl320_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 319)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl640_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 639)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl1280_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1279)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sl2560_constraint_4(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2559)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_duration_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 2 && value <= 2559)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_monitoringSymbolsWithinSlot_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 14)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_memb_sl2_constr_6 CC_NOTUSED = { + { 1, 1 } /* (0..1) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl2_constr_6 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl4_constr_7 CC_NOTUSED = { + { 1, 1 } /* (0..3) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl4_constr_7 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl5_constr_8 CC_NOTUSED = { + { 1, 1 } /* (0..4) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl5_constr_8 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl8_constr_9 CC_NOTUSED = { + { 1, 1 } /* (0..7) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl8_constr_9 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl10_constr_10 CC_NOTUSED = { + { 1, 1 } /* (0..9) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl10_constr_10 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 9 } /* (0..9) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl16_constr_11 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl16_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl20_constr_12 CC_NOTUSED = { + { 1, 1 } /* (0..19) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl20_constr_12 CC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 0, 19 } /* (0..19) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl40_constr_13 CC_NOTUSED = { + { 1, 1 } /* (0..39) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl40_constr_13 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 39 } /* (0..39) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl80_constr_14 CC_NOTUSED = { + { 1, 1 } /* (0..79) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl80_constr_14 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 79 } /* (0..79) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl160_constr_15 CC_NOTUSED = { + { 1, 1 } /* (0..159) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl160_constr_15 CC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 159 } /* (0..159) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl320_constr_16 CC_NOTUSED = { + { 2, 1 } /* (0..319) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl320_constr_16 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 319 } /* (0..319) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl640_constr_17 CC_NOTUSED = { + { 2, 1 } /* (0..639) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl640_constr_17 CC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 639 } /* (0..639) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl1280_constr_18 CC_NOTUSED = { + { 2, 1 } /* (0..1279) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl1280_constr_18 CC_NOTUSED = { + { APC_CONSTRAINED, 11, 11, 0, 1279 } /* (0..1279) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_sl2560_constr_19 CC_NOTUSED = { + { 2, 1 } /* (0..2559) */, + -1}; +static asn_per_constraints_t asn_PER_memb_sl2560_constr_19 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2559 } /* (0..2559) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_monitoringSlotPeriodicityAndOffset_constr_4 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_monitoringSlotPeriodicityAndOffset_constr_4 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 14 } /* (0..14) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel1_constr_23 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel1_constr_23 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel2_constr_32 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel2_constr_32 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel4_constr_41 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel4_constr_41 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel8_constr_50 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel8_constr_50 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel16_constr_59 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel16_constr_59 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel1_constr_74 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel1_constr_74 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel2_constr_77 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel2_constr_77 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel4_constr_80 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel4_constr_80 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel8_constr_83 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel8_constr_83 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_aggregationLevel16_constr_86 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_aggregationLevel16_constr_86 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_dummy1_constr_95 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dummy1_constr_95 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_dummy2_constr_104 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dummy2_constr_104 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_dci_Formats_constr_109 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dci_Formats_constr_109 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_searchSpaceType_constr_68 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_searchSpaceType_constr_68 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_duration_constr_20 CC_NOTUSED = { + { 2, 1 } /* (2..2559) */, + -1}; +static asn_per_constraints_t asn_PER_memb_duration_constr_20 CC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 2, 2559 } /* (2..2559) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_monitoringSymbolsWithinSlot_constr_21 CC_NOTUSED = { + { 0, 0 }, + 14 /* (SIZE(14..14)) */}; +static asn_per_constraints_t asn_PER_memb_monitoringSymbolsWithinSlot_constr_21 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 14, 14 } /* (SIZE(14..14)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_monitoringSlotPeriodicityAndOffset_4[] = { + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "sl1" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl2_constr_6, &asn_PER_memb_sl2_constr_6, memb_sl2_constraint_4 }, + 0, 0, /* No default value */ + "sl2" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl4), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl4_constr_7, &asn_PER_memb_sl4_constr_7, memb_sl4_constraint_4 }, + 0, 0, /* No default value */ + "sl4" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl5), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl5_constr_8, &asn_PER_memb_sl5_constr_8, memb_sl5_constraint_4 }, + 0, 0, /* No default value */ + "sl5" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl8), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl8_constr_9, &asn_PER_memb_sl8_constr_9, memb_sl8_constraint_4 }, + 0, 0, /* No default value */ + "sl8" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl10), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl10_constr_10, &asn_PER_memb_sl10_constr_10, memb_sl10_constraint_4 }, + 0, 0, /* No default value */ + "sl10" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl16), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl16_constr_11, &asn_PER_memb_sl16_constr_11, memb_sl16_constraint_4 }, + 0, 0, /* No default value */ + "sl16" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl20), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl20_constr_12, &asn_PER_memb_sl20_constr_12, memb_sl20_constraint_4 }, + 0, 0, /* No default value */ + "sl20" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl40), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl40_constr_13, &asn_PER_memb_sl40_constr_13, memb_sl40_constraint_4 }, + 0, 0, /* No default value */ + "sl40" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl80), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl80_constr_14, &asn_PER_memb_sl80_constr_14, memb_sl80_constraint_4 }, + 0, 0, /* No default value */ + "sl80" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl160), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl160_constr_15, &asn_PER_memb_sl160_constr_15, memb_sl160_constraint_4 }, + 0, 0, /* No default value */ + "sl160" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl320), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl320_constr_16, &asn_PER_memb_sl320_constr_16, memb_sl320_constraint_4 }, + 0, 0, /* No default value */ + "sl320" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl640), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl640_constr_17, &asn_PER_memb_sl640_constr_17, memb_sl640_constraint_4 }, + 0, 0, /* No default value */ + "sl640" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl1280), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl1280_constr_18, &asn_PER_memb_sl1280_constr_18, memb_sl1280_constraint_4 }, + 0, 0, /* No default value */ + "sl1280" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, choice.sl2560), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_sl2560_constr_19, &asn_PER_memb_sl2560_constr_19, memb_sl2560_constraint_4 }, + 0, 0, /* No default value */ + "sl2560" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_monitoringSlotPeriodicityAndOffset_tag2el_4[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sl1 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sl2 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sl4 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sl5 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sl8 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* sl10 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* sl16 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* sl20 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* sl40 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* sl80 */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* sl160 */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* sl320 */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* sl640 */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* sl1280 */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 } /* sl2560 */ +}; +static asn_CHOICE_specifics_t asn_SPC_monitoringSlotPeriodicityAndOffset_specs_4 = { + sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset), + offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, _asn_ctx), + offsetof(struct SearchSpace__monitoringSlotPeriodicityAndOffset, present), + sizeof(((struct SearchSpace__monitoringSlotPeriodicityAndOffset *)0)->present), + asn_MAP_monitoringSlotPeriodicityAndOffset_tag2el_4, + 15, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_monitoringSlotPeriodicityAndOffset_4 = { + "monitoringSlotPeriodicityAndOffset", + "monitoringSlotPeriodicityAndOffset", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_monitoringSlotPeriodicityAndOffset_constr_4, &asn_PER_type_monitoringSlotPeriodicityAndOffset_constr_4, CHOICE_constraint }, + asn_MBR_monitoringSlotPeriodicityAndOffset_4, + 15, /* Elements count */ + &asn_SPC_monitoringSlotPeriodicityAndOffset_specs_4 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel1_value2enum_23[] = { + { 0, 2, "n0" }, + { 1, 2, "n1" }, + { 2, 2, "n2" }, + { 3, 2, "n3" }, + { 4, 2, "n4" }, + { 5, 2, "n5" }, + { 6, 2, "n6" }, + { 7, 2, "n8" } +}; +static const unsigned int asn_MAP_aggregationLevel1_enum2value_23[] = { + 0, /* n0(0) */ + 1, /* n1(1) */ + 2, /* n2(2) */ + 3, /* n3(3) */ + 4, /* n4(4) */ + 5, /* n5(5) */ + 6, /* n6(6) */ + 7 /* n8(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel1_specs_23 = { + asn_MAP_aggregationLevel1_value2enum_23, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel1_enum2value_23, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel1_tags_23[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel1_23 = { + "aggregationLevel1", + "aggregationLevel1", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel1_tags_23, + sizeof(asn_DEF_aggregationLevel1_tags_23) + /sizeof(asn_DEF_aggregationLevel1_tags_23[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel1_tags_23, /* Same as above */ + sizeof(asn_DEF_aggregationLevel1_tags_23) + /sizeof(asn_DEF_aggregationLevel1_tags_23[0]), /* 2 */ + { &asn_OER_type_aggregationLevel1_constr_23, &asn_PER_type_aggregationLevel1_constr_23, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel1_specs_23 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel2_value2enum_32[] = { + { 0, 2, "n0" }, + { 1, 2, "n1" }, + { 2, 2, "n2" }, + { 3, 2, "n3" }, + { 4, 2, "n4" }, + { 5, 2, "n5" }, + { 6, 2, "n6" }, + { 7, 2, "n8" } +}; +static const unsigned int asn_MAP_aggregationLevel2_enum2value_32[] = { + 0, /* n0(0) */ + 1, /* n1(1) */ + 2, /* n2(2) */ + 3, /* n3(3) */ + 4, /* n4(4) */ + 5, /* n5(5) */ + 6, /* n6(6) */ + 7 /* n8(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel2_specs_32 = { + asn_MAP_aggregationLevel2_value2enum_32, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel2_enum2value_32, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel2_tags_32[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel2_32 = { + "aggregationLevel2", + "aggregationLevel2", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel2_tags_32, + sizeof(asn_DEF_aggregationLevel2_tags_32) + /sizeof(asn_DEF_aggregationLevel2_tags_32[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel2_tags_32, /* Same as above */ + sizeof(asn_DEF_aggregationLevel2_tags_32) + /sizeof(asn_DEF_aggregationLevel2_tags_32[0]), /* 2 */ + { &asn_OER_type_aggregationLevel2_constr_32, &asn_PER_type_aggregationLevel2_constr_32, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel2_specs_32 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel4_value2enum_41[] = { + { 0, 2, "n0" }, + { 1, 2, "n1" }, + { 2, 2, "n2" }, + { 3, 2, "n3" }, + { 4, 2, "n4" }, + { 5, 2, "n5" }, + { 6, 2, "n6" }, + { 7, 2, "n8" } +}; +static const unsigned int asn_MAP_aggregationLevel4_enum2value_41[] = { + 0, /* n0(0) */ + 1, /* n1(1) */ + 2, /* n2(2) */ + 3, /* n3(3) */ + 4, /* n4(4) */ + 5, /* n5(5) */ + 6, /* n6(6) */ + 7 /* n8(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel4_specs_41 = { + asn_MAP_aggregationLevel4_value2enum_41, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel4_enum2value_41, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel4_tags_41[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel4_41 = { + "aggregationLevel4", + "aggregationLevel4", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel4_tags_41, + sizeof(asn_DEF_aggregationLevel4_tags_41) + /sizeof(asn_DEF_aggregationLevel4_tags_41[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel4_tags_41, /* Same as above */ + sizeof(asn_DEF_aggregationLevel4_tags_41) + /sizeof(asn_DEF_aggregationLevel4_tags_41[0]), /* 2 */ + { &asn_OER_type_aggregationLevel4_constr_41, &asn_PER_type_aggregationLevel4_constr_41, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel4_specs_41 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel8_value2enum_50[] = { + { 0, 2, "n0" }, + { 1, 2, "n1" }, + { 2, 2, "n2" }, + { 3, 2, "n3" }, + { 4, 2, "n4" }, + { 5, 2, "n5" }, + { 6, 2, "n6" }, + { 7, 2, "n8" } +}; +static const unsigned int asn_MAP_aggregationLevel8_enum2value_50[] = { + 0, /* n0(0) */ + 1, /* n1(1) */ + 2, /* n2(2) */ + 3, /* n3(3) */ + 4, /* n4(4) */ + 5, /* n5(5) */ + 6, /* n6(6) */ + 7 /* n8(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel8_specs_50 = { + asn_MAP_aggregationLevel8_value2enum_50, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel8_enum2value_50, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel8_tags_50[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel8_50 = { + "aggregationLevel8", + "aggregationLevel8", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel8_tags_50, + sizeof(asn_DEF_aggregationLevel8_tags_50) + /sizeof(asn_DEF_aggregationLevel8_tags_50[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel8_tags_50, /* Same as above */ + sizeof(asn_DEF_aggregationLevel8_tags_50) + /sizeof(asn_DEF_aggregationLevel8_tags_50[0]), /* 2 */ + { &asn_OER_type_aggregationLevel8_constr_50, &asn_PER_type_aggregationLevel8_constr_50, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel8_specs_50 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel16_value2enum_59[] = { + { 0, 2, "n0" }, + { 1, 2, "n1" }, + { 2, 2, "n2" }, + { 3, 2, "n3" }, + { 4, 2, "n4" }, + { 5, 2, "n5" }, + { 6, 2, "n6" }, + { 7, 2, "n8" } +}; +static const unsigned int asn_MAP_aggregationLevel16_enum2value_59[] = { + 0, /* n0(0) */ + 1, /* n1(1) */ + 2, /* n2(2) */ + 3, /* n3(3) */ + 4, /* n4(4) */ + 5, /* n5(5) */ + 6, /* n6(6) */ + 7 /* n8(7) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel16_specs_59 = { + asn_MAP_aggregationLevel16_value2enum_59, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel16_enum2value_59, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel16_tags_59[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel16_59 = { + "aggregationLevel16", + "aggregationLevel16", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel16_tags_59, + sizeof(asn_DEF_aggregationLevel16_tags_59) + /sizeof(asn_DEF_aggregationLevel16_tags_59[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel16_tags_59, /* Same as above */ + sizeof(asn_DEF_aggregationLevel16_tags_59) + /sizeof(asn_DEF_aggregationLevel16_tags_59[0]), /* 2 */ + { &asn_OER_type_aggregationLevel16_constr_59, &asn_PER_type_aggregationLevel16_constr_59, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel16_specs_59 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_nrofCandidates_22[] = { + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__nrofCandidates, aggregationLevel1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel1_23, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel1" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__nrofCandidates, aggregationLevel2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel2_32, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel2" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__nrofCandidates, aggregationLevel4), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel4_41, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel4" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__nrofCandidates, aggregationLevel8), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel8_50, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel8" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__nrofCandidates, aggregationLevel16), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel16_59, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel16" + }, +}; +static const ber_tlv_tag_t asn_DEF_nrofCandidates_tags_22[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_nrofCandidates_tag2el_22[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aggregationLevel1 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aggregationLevel2 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* aggregationLevel4 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* aggregationLevel8 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* aggregationLevel16 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_nrofCandidates_specs_22 = { + sizeof(struct SearchSpace__nrofCandidates), + offsetof(struct SearchSpace__nrofCandidates, _asn_ctx), + asn_MAP_nrofCandidates_tag2el_22, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_nrofCandidates_22 = { + "nrofCandidates", + "nrofCandidates", + &asn_OP_SEQUENCE, + asn_DEF_nrofCandidates_tags_22, + sizeof(asn_DEF_nrofCandidates_tags_22) + /sizeof(asn_DEF_nrofCandidates_tags_22[0]) - 1, /* 1 */ + asn_DEF_nrofCandidates_tags_22, /* Same as above */ + sizeof(asn_DEF_nrofCandidates_tags_22) + /sizeof(asn_DEF_nrofCandidates_tags_22[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_nrofCandidates_22, + 5, /* Elements count */ + &asn_SPC_nrofCandidates_specs_22 /* Additional specs */ +}; + +static const ber_tlv_tag_t asn_DEF_dci_Format0_0_AndFormat1_0_tags_70[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SEQUENCE_specifics_t asn_SPC_dci_Format0_0_AndFormat1_0_specs_70 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0, _asn_ctx), + 0, /* No top level tags */ + 0, /* No tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Format0_0_AndFormat1_0_70 = { + "dci-Format0-0-AndFormat1-0", + "dci-Format0-0-AndFormat1-0", + &asn_OP_SEQUENCE, + asn_DEF_dci_Format0_0_AndFormat1_0_tags_70, + sizeof(asn_DEF_dci_Format0_0_AndFormat1_0_tags_70) + /sizeof(asn_DEF_dci_Format0_0_AndFormat1_0_tags_70[0]) - 1, /* 1 */ + asn_DEF_dci_Format0_0_AndFormat1_0_tags_70, /* Same as above */ + sizeof(asn_DEF_dci_Format0_0_AndFormat1_0_tags_70) + /sizeof(asn_DEF_dci_Format0_0_AndFormat1_0_tags_70[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + 0, 0, /* No members */ + &asn_SPC_dci_Format0_0_AndFormat1_0_specs_70 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel1_value2enum_74[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_aggregationLevel1_enum2value_74[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel1_specs_74 = { + asn_MAP_aggregationLevel1_value2enum_74, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel1_enum2value_74, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel1_tags_74[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel1_74 = { + "aggregationLevel1", + "aggregationLevel1", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel1_tags_74, + sizeof(asn_DEF_aggregationLevel1_tags_74) + /sizeof(asn_DEF_aggregationLevel1_tags_74[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel1_tags_74, /* Same as above */ + sizeof(asn_DEF_aggregationLevel1_tags_74) + /sizeof(asn_DEF_aggregationLevel1_tags_74[0]), /* 2 */ + { &asn_OER_type_aggregationLevel1_constr_74, &asn_PER_type_aggregationLevel1_constr_74, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel1_specs_74 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel2_value2enum_77[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_aggregationLevel2_enum2value_77[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel2_specs_77 = { + asn_MAP_aggregationLevel2_value2enum_77, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel2_enum2value_77, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel2_tags_77[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel2_77 = { + "aggregationLevel2", + "aggregationLevel2", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel2_tags_77, + sizeof(asn_DEF_aggregationLevel2_tags_77) + /sizeof(asn_DEF_aggregationLevel2_tags_77[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel2_tags_77, /* Same as above */ + sizeof(asn_DEF_aggregationLevel2_tags_77) + /sizeof(asn_DEF_aggregationLevel2_tags_77[0]), /* 2 */ + { &asn_OER_type_aggregationLevel2_constr_77, &asn_PER_type_aggregationLevel2_constr_77, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel2_specs_77 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel4_value2enum_80[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_aggregationLevel4_enum2value_80[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel4_specs_80 = { + asn_MAP_aggregationLevel4_value2enum_80, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel4_enum2value_80, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel4_tags_80[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel4_80 = { + "aggregationLevel4", + "aggregationLevel4", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel4_tags_80, + sizeof(asn_DEF_aggregationLevel4_tags_80) + /sizeof(asn_DEF_aggregationLevel4_tags_80[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel4_tags_80, /* Same as above */ + sizeof(asn_DEF_aggregationLevel4_tags_80) + /sizeof(asn_DEF_aggregationLevel4_tags_80[0]), /* 2 */ + { &asn_OER_type_aggregationLevel4_constr_80, &asn_PER_type_aggregationLevel4_constr_80, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel4_specs_80 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel8_value2enum_83[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_aggregationLevel8_enum2value_83[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel8_specs_83 = { + asn_MAP_aggregationLevel8_value2enum_83, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel8_enum2value_83, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel8_tags_83[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel8_83 = { + "aggregationLevel8", + "aggregationLevel8", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel8_tags_83, + sizeof(asn_DEF_aggregationLevel8_tags_83) + /sizeof(asn_DEF_aggregationLevel8_tags_83[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel8_tags_83, /* Same as above */ + sizeof(asn_DEF_aggregationLevel8_tags_83) + /sizeof(asn_DEF_aggregationLevel8_tags_83[0]), /* 2 */ + { &asn_OER_type_aggregationLevel8_constr_83, &asn_PER_type_aggregationLevel8_constr_83, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel8_specs_83 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_aggregationLevel16_value2enum_86[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_aggregationLevel16_enum2value_86[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_aggregationLevel16_specs_86 = { + asn_MAP_aggregationLevel16_value2enum_86, /* "tag" => N; sorted by tag */ + asn_MAP_aggregationLevel16_enum2value_86, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_aggregationLevel16_tags_86[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_aggregationLevel16_86 = { + "aggregationLevel16", + "aggregationLevel16", + &asn_OP_NativeEnumerated, + asn_DEF_aggregationLevel16_tags_86, + sizeof(asn_DEF_aggregationLevel16_tags_86) + /sizeof(asn_DEF_aggregationLevel16_tags_86[0]) - 1, /* 1 */ + asn_DEF_aggregationLevel16_tags_86, /* Same as above */ + sizeof(asn_DEF_aggregationLevel16_tags_86) + /sizeof(asn_DEF_aggregationLevel16_tags_86[0]), /* 2 */ + { &asn_OER_type_aggregationLevel16_constr_86, &asn_PER_type_aggregationLevel16_constr_86, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_aggregationLevel16_specs_86 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_nrofCandidates_SFI_73[] = { + { ATF_POINTER, 5, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, aggregationLevel1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel1_74, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel1" + }, + { ATF_POINTER, 4, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, aggregationLevel2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel2_77, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel2" + }, + { ATF_POINTER, 3, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, aggregationLevel4), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel4_80, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel4" + }, + { ATF_POINTER, 2, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, aggregationLevel8), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel8_83, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel8" + }, + { ATF_POINTER, 1, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, aggregationLevel16), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_aggregationLevel16_86, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "aggregationLevel16" + }, +}; +static const int asn_MAP_nrofCandidates_SFI_oms_73[] = { 0, 1, 2, 3, 4 }; +static const ber_tlv_tag_t asn_DEF_nrofCandidates_SFI_tags_73[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_nrofCandidates_SFI_tag2el_73[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aggregationLevel1 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aggregationLevel2 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* aggregationLevel4 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* aggregationLevel8 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* aggregationLevel16 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_nrofCandidates_SFI_specs_73 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI, _asn_ctx), + asn_MAP_nrofCandidates_SFI_tag2el_73, + 5, /* Count of tags in the map */ + asn_MAP_nrofCandidates_SFI_oms_73, /* Optional members */ + 5, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_nrofCandidates_SFI_73 = { + "nrofCandidates-SFI", + "nrofCandidates-SFI", + &asn_OP_SEQUENCE, + asn_DEF_nrofCandidates_SFI_tags_73, + sizeof(asn_DEF_nrofCandidates_SFI_tags_73) + /sizeof(asn_DEF_nrofCandidates_SFI_tags_73[0]) - 1, /* 1 */ + asn_DEF_nrofCandidates_SFI_tags_73, /* Same as above */ + sizeof(asn_DEF_nrofCandidates_SFI_tags_73) + /sizeof(asn_DEF_nrofCandidates_SFI_tags_73[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_nrofCandidates_SFI_73, + 5, /* Elements count */ + &asn_SPC_nrofCandidates_SFI_specs_73 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_dci_Format2_0_72[] = { + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0, nrofCandidates_SFI), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_nrofCandidates_SFI_73, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nrofCandidates-SFI" + }, +}; +static const ber_tlv_tag_t asn_DEF_dci_Format2_0_tags_72[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_dci_Format2_0_tag2el_72[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* nrofCandidates-SFI */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_dci_Format2_0_specs_72 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_0), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_0, _asn_ctx), + asn_MAP_dci_Format2_0_tag2el_72, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Format2_0_72 = { + "dci-Format2-0", + "dci-Format2-0", + &asn_OP_SEQUENCE, + asn_DEF_dci_Format2_0_tags_72, + sizeof(asn_DEF_dci_Format2_0_tags_72) + /sizeof(asn_DEF_dci_Format2_0_tags_72[0]) - 1, /* 1 */ + asn_DEF_dci_Format2_0_tags_72, /* Same as above */ + sizeof(asn_DEF_dci_Format2_0_tags_72) + /sizeof(asn_DEF_dci_Format2_0_tags_72[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_dci_Format2_0_72, + 1, /* Elements count */ + &asn_SPC_dci_Format2_0_specs_72 /* Additional specs */ +}; + +static const ber_tlv_tag_t asn_DEF_dci_Format2_1_tags_90[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SEQUENCE_specifics_t asn_SPC_dci_Format2_1_specs_90 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_1), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_1, _asn_ctx), + 0, /* No top level tags */ + 0, /* No tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Format2_1_90 = { + "dci-Format2-1", + "dci-Format2-1", + &asn_OP_SEQUENCE, + asn_DEF_dci_Format2_1_tags_90, + sizeof(asn_DEF_dci_Format2_1_tags_90) + /sizeof(asn_DEF_dci_Format2_1_tags_90[0]) - 1, /* 1 */ + asn_DEF_dci_Format2_1_tags_90, /* Same as above */ + sizeof(asn_DEF_dci_Format2_1_tags_90) + /sizeof(asn_DEF_dci_Format2_1_tags_90[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + 0, 0, /* No members */ + &asn_SPC_dci_Format2_1_specs_90 /* Additional specs */ +}; + +static const ber_tlv_tag_t asn_DEF_dci_Format2_2_tags_92[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SEQUENCE_specifics_t asn_SPC_dci_Format2_2_specs_92 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_2), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_2, _asn_ctx), + 0, /* No top level tags */ + 0, /* No tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Format2_2_92 = { + "dci-Format2-2", + "dci-Format2-2", + &asn_OP_SEQUENCE, + asn_DEF_dci_Format2_2_tags_92, + sizeof(asn_DEF_dci_Format2_2_tags_92) + /sizeof(asn_DEF_dci_Format2_2_tags_92[0]) - 1, /* 1 */ + asn_DEF_dci_Format2_2_tags_92, /* Same as above */ + sizeof(asn_DEF_dci_Format2_2_tags_92) + /sizeof(asn_DEF_dci_Format2_2_tags_92[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + 0, 0, /* No members */ + &asn_SPC_dci_Format2_2_specs_92 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_dummy1_value2enum_95[] = { + { 0, 3, "sl1" }, + { 1, 3, "sl2" }, + { 2, 3, "sl4" }, + { 3, 3, "sl5" }, + { 4, 3, "sl8" }, + { 5, 4, "sl10" }, + { 6, 4, "sl16" }, + { 7, 4, "sl20" } +}; +static const unsigned int asn_MAP_dummy1_enum2value_95[] = { + 0, /* sl1(0) */ + 5, /* sl10(5) */ + 6, /* sl16(6) */ + 1, /* sl2(1) */ + 7, /* sl20(7) */ + 2, /* sl4(2) */ + 3, /* sl5(3) */ + 4 /* sl8(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dummy1_specs_95 = { + asn_MAP_dummy1_value2enum_95, /* "tag" => N; sorted by tag */ + asn_MAP_dummy1_enum2value_95, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dummy1_tags_95[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dummy1_95 = { + "dummy1", + "dummy1", + &asn_OP_NativeEnumerated, + asn_DEF_dummy1_tags_95, + sizeof(asn_DEF_dummy1_tags_95) + /sizeof(asn_DEF_dummy1_tags_95[0]) - 1, /* 1 */ + asn_DEF_dummy1_tags_95, /* Same as above */ + sizeof(asn_DEF_dummy1_tags_95) + /sizeof(asn_DEF_dummy1_tags_95[0]), /* 2 */ + { &asn_OER_type_dummy1_constr_95, &asn_PER_type_dummy1_constr_95, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dummy1_specs_95 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_dummy2_value2enum_104[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" } +}; +static const unsigned int asn_MAP_dummy2_enum2value_104[] = { + 0, /* n1(0) */ + 1 /* n2(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dummy2_specs_104 = { + asn_MAP_dummy2_value2enum_104, /* "tag" => N; sorted by tag */ + asn_MAP_dummy2_enum2value_104, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dummy2_tags_104[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dummy2_104 = { + "dummy2", + "dummy2", + &asn_OP_NativeEnumerated, + asn_DEF_dummy2_tags_104, + sizeof(asn_DEF_dummy2_tags_104) + /sizeof(asn_DEF_dummy2_tags_104[0]) - 1, /* 1 */ + asn_DEF_dummy2_tags_104, /* Same as above */ + sizeof(asn_DEF_dummy2_tags_104) + /sizeof(asn_DEF_dummy2_tags_104[0]), /* 2 */ + { &asn_OER_type_dummy2_constr_104, &asn_PER_type_dummy2_constr_104, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dummy2_specs_104 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_dci_Format2_3_94[] = { + { ATF_POINTER, 1, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_3, dummy1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dummy1_95, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dummy1" + }, + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_3, dummy2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dummy2_104, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dummy2" + }, +}; +static const int asn_MAP_dci_Format2_3_oms_94[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_dci_Format2_3_tags_94[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_dci_Format2_3_tag2el_94[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dummy1 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* dummy2 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_dci_Format2_3_specs_94 = { + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_3), + offsetof(struct SearchSpace__searchSpaceType__common__dci_Format2_3, _asn_ctx), + asn_MAP_dci_Format2_3_tag2el_94, + 2, /* Count of tags in the map */ + asn_MAP_dci_Format2_3_oms_94, /* Optional members */ + 1, 0, /* Root/Additions */ + 2, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Format2_3_94 = { + "dci-Format2-3", + "dci-Format2-3", + &asn_OP_SEQUENCE, + asn_DEF_dci_Format2_3_tags_94, + sizeof(asn_DEF_dci_Format2_3_tags_94) + /sizeof(asn_DEF_dci_Format2_3_tags_94[0]) - 1, /* 1 */ + asn_DEF_dci_Format2_3_tags_94, /* Same as above */ + sizeof(asn_DEF_dci_Format2_3_tags_94) + /sizeof(asn_DEF_dci_Format2_3_tags_94[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_dci_Format2_3_94, + 2, /* Elements count */ + &asn_SPC_dci_Format2_3_specs_94 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_common_69[] = { + { ATF_POINTER, 5, offsetof(struct SearchSpace__searchSpaceType__common, dci_Format0_0_AndFormat1_0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_dci_Format0_0_AndFormat1_0_70, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Format0-0-AndFormat1-0" + }, + { ATF_POINTER, 4, offsetof(struct SearchSpace__searchSpaceType__common, dci_Format2_0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_dci_Format2_0_72, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Format2-0" + }, + { ATF_POINTER, 3, offsetof(struct SearchSpace__searchSpaceType__common, dci_Format2_1), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + 0, + &asn_DEF_dci_Format2_1_90, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Format2-1" + }, + { ATF_POINTER, 2, offsetof(struct SearchSpace__searchSpaceType__common, dci_Format2_2), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_dci_Format2_2_92, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Format2-2" + }, + { ATF_POINTER, 1, offsetof(struct SearchSpace__searchSpaceType__common, dci_Format2_3), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + 0, + &asn_DEF_dci_Format2_3_94, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Format2-3" + }, +}; +static const int asn_MAP_common_oms_69[] = { 0, 1, 2, 3, 4 }; +static const ber_tlv_tag_t asn_DEF_common_tags_69[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_common_tag2el_69[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dci-Format0-0-AndFormat1-0 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dci-Format2-0 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dci-Format2-1 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* dci-Format2-2 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* dci-Format2-3 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_common_specs_69 = { + sizeof(struct SearchSpace__searchSpaceType__common), + offsetof(struct SearchSpace__searchSpaceType__common, _asn_ctx), + asn_MAP_common_tag2el_69, + 5, /* Count of tags in the map */ + asn_MAP_common_oms_69, /* Optional members */ + 5, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_common_69 = { + "common", + "common", + &asn_OP_SEQUENCE, + asn_DEF_common_tags_69, + sizeof(asn_DEF_common_tags_69) + /sizeof(asn_DEF_common_tags_69[0]) - 1, /* 1 */ + asn_DEF_common_tags_69, /* Same as above */ + sizeof(asn_DEF_common_tags_69) + /sizeof(asn_DEF_common_tags_69[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_common_69, + 5, /* Elements count */ + &asn_SPC_common_specs_69 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_dci_Formats_value2enum_109[] = { + { 0, 18, "formats0-0-And-1-0" }, + { 1, 18, "formats0-1-And-1-1" } +}; +static const unsigned int asn_MAP_dci_Formats_enum2value_109[] = { + 0, /* formats0-0-And-1-0(0) */ + 1 /* formats0-1-And-1-1(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dci_Formats_specs_109 = { + asn_MAP_dci_Formats_value2enum_109, /* "tag" => N; sorted by tag */ + asn_MAP_dci_Formats_enum2value_109, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dci_Formats_tags_109[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dci_Formats_109 = { + "dci-Formats", + "dci-Formats", + &asn_OP_NativeEnumerated, + asn_DEF_dci_Formats_tags_109, + sizeof(asn_DEF_dci_Formats_tags_109) + /sizeof(asn_DEF_dci_Formats_tags_109[0]) - 1, /* 1 */ + asn_DEF_dci_Formats_tags_109, /* Same as above */ + sizeof(asn_DEF_dci_Formats_tags_109) + /sizeof(asn_DEF_dci_Formats_tags_109[0]), /* 2 */ + { &asn_OER_type_dci_Formats_constr_109, &asn_PER_type_dci_Formats_constr_109, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dci_Formats_specs_109 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_ue_Specific_108[] = { + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace__searchSpaceType__ue_Specific, dci_Formats), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dci_Formats_109, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dci-Formats" + }, +}; +static const ber_tlv_tag_t asn_DEF_ue_Specific_tags_108[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ue_Specific_tag2el_108[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* dci-Formats */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ue_Specific_specs_108 = { + sizeof(struct SearchSpace__searchSpaceType__ue_Specific), + offsetof(struct SearchSpace__searchSpaceType__ue_Specific, _asn_ctx), + asn_MAP_ue_Specific_tag2el_108, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ue_Specific_108 = { + "ue-Specific", + "ue-Specific", + &asn_OP_SEQUENCE, + asn_DEF_ue_Specific_tags_108, + sizeof(asn_DEF_ue_Specific_tags_108) + /sizeof(asn_DEF_ue_Specific_tags_108[0]) - 1, /* 1 */ + asn_DEF_ue_Specific_tags_108, /* Same as above */ + sizeof(asn_DEF_ue_Specific_tags_108) + /sizeof(asn_DEF_ue_Specific_tags_108[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ue_Specific_108, + 1, /* Elements count */ + &asn_SPC_ue_Specific_specs_108 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_searchSpaceType_68[] = { + { ATF_POINTER, 0, offsetof(struct SearchSpace__searchSpaceType, choice.common), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_common_69, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "common" + }, + { ATF_POINTER, 0, offsetof(struct SearchSpace__searchSpaceType, choice.ue_Specific), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_ue_Specific_108, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ue-Specific" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_searchSpaceType_tag2el_68[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* common */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ue-Specific */ +}; +static asn_CHOICE_specifics_t asn_SPC_searchSpaceType_specs_68 = { + sizeof(struct SearchSpace__searchSpaceType), + offsetof(struct SearchSpace__searchSpaceType, _asn_ctx), + offsetof(struct SearchSpace__searchSpaceType, present), + sizeof(((struct SearchSpace__searchSpaceType *)0)->present), + asn_MAP_searchSpaceType_tag2el_68, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_searchSpaceType_68 = { + "searchSpaceType", + "searchSpaceType", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_searchSpaceType_constr_68, &asn_PER_type_searchSpaceType_constr_68, CHOICE_constraint }, + asn_MBR_searchSpaceType_68, + 2, /* Elements count */ + &asn_SPC_searchSpaceType_specs_68 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_SearchSpace_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SearchSpace, searchSpaceId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SearchSpaceId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceId" + }, + { ATF_POINTER, 6, offsetof(struct SearchSpace, controlResourceSetId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlResourceSetId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "controlResourceSetId" + }, + { ATF_POINTER, 5, offsetof(struct SearchSpace, monitoringSlotPeriodicityAndOffset), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_monitoringSlotPeriodicityAndOffset_4, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "monitoringSlotPeriodicityAndOffset" + }, + { ATF_POINTER, 4, offsetof(struct SearchSpace, duration), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_duration_constr_20, &asn_PER_memb_duration_constr_20, memb_duration_constraint_1 }, + 0, 0, /* No default value */ + "duration" + }, + { ATF_POINTER, 3, offsetof(struct SearchSpace, monitoringSymbolsWithinSlot), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_monitoringSymbolsWithinSlot_constr_21, &asn_PER_memb_monitoringSymbolsWithinSlot_constr_21, memb_monitoringSymbolsWithinSlot_constraint_1 }, + 0, 0, /* No default value */ + "monitoringSymbolsWithinSlot" + }, + { ATF_POINTER, 2, offsetof(struct SearchSpace, nrofCandidates), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + 0, + &asn_DEF_nrofCandidates_22, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "nrofCandidates" + }, + { ATF_POINTER, 1, offsetof(struct SearchSpace, searchSpaceType), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_searchSpaceType_68, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "searchSpaceType" + }, +}; +static const int asn_MAP_SearchSpace_oms_1[] = { 1, 2, 3, 4, 5, 6 }; +static const ber_tlv_tag_t asn_DEF_SearchSpace_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SearchSpace_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* searchSpaceId */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* controlResourceSetId */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* monitoringSlotPeriodicityAndOffset */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* duration */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* monitoringSymbolsWithinSlot */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* nrofCandidates */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* searchSpaceType */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SearchSpace_specs_1 = { + sizeof(struct SearchSpace), + offsetof(struct SearchSpace, _asn_ctx), + asn_MAP_SearchSpace_tag2el_1, + 7, /* Count of tags in the map */ + asn_MAP_SearchSpace_oms_1, /* Optional members */ + 6, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SearchSpace = { + "SearchSpace", + "SearchSpace", + &asn_OP_SEQUENCE, + asn_DEF_SearchSpace_tags_1, + sizeof(asn_DEF_SearchSpace_tags_1) + /sizeof(asn_DEF_SearchSpace_tags_1[0]), /* 1 */ + asn_DEF_SearchSpace_tags_1, /* Same as above */ + sizeof(asn_DEF_SearchSpace_tags_1) + /sizeof(asn_DEF_SearchSpace_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SearchSpace_1, + 7, /* Elements count */ + &asn_SPC_SearchSpace_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SearchSpace.h b/src/codec_utils/SYSINFO/SearchSpace.h new file mode 100644 index 000000000..42e5ca724 --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpace.h @@ -0,0 +1,288 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SearchSpace_H_ +#define _SearchSpace_H_ + + +#include + +/* Including external dependencies */ +#include "SearchSpaceId.h" +#include "ControlResourceSetId.h" +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SearchSpace__monitoringSlotPeriodicityAndOffset_PR { + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_NOTHING, /* No components present */ + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280, + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560 +} SearchSpace__monitoringSlotPeriodicityAndOffset_PR; +typedef enum SearchSpace__nrofCandidates__aggregationLevel1 { + SearchSpace__nrofCandidates__aggregationLevel1_n0 = 0, + SearchSpace__nrofCandidates__aggregationLevel1_n1 = 1, + SearchSpace__nrofCandidates__aggregationLevel1_n2 = 2, + SearchSpace__nrofCandidates__aggregationLevel1_n3 = 3, + SearchSpace__nrofCandidates__aggregationLevel1_n4 = 4, + SearchSpace__nrofCandidates__aggregationLevel1_n5 = 5, + SearchSpace__nrofCandidates__aggregationLevel1_n6 = 6, + SearchSpace__nrofCandidates__aggregationLevel1_n8 = 7 +} e_SearchSpace__nrofCandidates__aggregationLevel1; +typedef enum SearchSpace__nrofCandidates__aggregationLevel2 { + SearchSpace__nrofCandidates__aggregationLevel2_n0 = 0, + SearchSpace__nrofCandidates__aggregationLevel2_n1 = 1, + SearchSpace__nrofCandidates__aggregationLevel2_n2 = 2, + SearchSpace__nrofCandidates__aggregationLevel2_n3 = 3, + SearchSpace__nrofCandidates__aggregationLevel2_n4 = 4, + SearchSpace__nrofCandidates__aggregationLevel2_n5 = 5, + SearchSpace__nrofCandidates__aggregationLevel2_n6 = 6, + SearchSpace__nrofCandidates__aggregationLevel2_n8 = 7 +} e_SearchSpace__nrofCandidates__aggregationLevel2; +typedef enum SearchSpace__nrofCandidates__aggregationLevel4 { + SearchSpace__nrofCandidates__aggregationLevel4_n0 = 0, + SearchSpace__nrofCandidates__aggregationLevel4_n1 = 1, + SearchSpace__nrofCandidates__aggregationLevel4_n2 = 2, + SearchSpace__nrofCandidates__aggregationLevel4_n3 = 3, + SearchSpace__nrofCandidates__aggregationLevel4_n4 = 4, + SearchSpace__nrofCandidates__aggregationLevel4_n5 = 5, + SearchSpace__nrofCandidates__aggregationLevel4_n6 = 6, + SearchSpace__nrofCandidates__aggregationLevel4_n8 = 7 +} e_SearchSpace__nrofCandidates__aggregationLevel4; +typedef enum SearchSpace__nrofCandidates__aggregationLevel8 { + SearchSpace__nrofCandidates__aggregationLevel8_n0 = 0, + SearchSpace__nrofCandidates__aggregationLevel8_n1 = 1, + SearchSpace__nrofCandidates__aggregationLevel8_n2 = 2, + SearchSpace__nrofCandidates__aggregationLevel8_n3 = 3, + SearchSpace__nrofCandidates__aggregationLevel8_n4 = 4, + SearchSpace__nrofCandidates__aggregationLevel8_n5 = 5, + SearchSpace__nrofCandidates__aggregationLevel8_n6 = 6, + SearchSpace__nrofCandidates__aggregationLevel8_n8 = 7 +} e_SearchSpace__nrofCandidates__aggregationLevel8; +typedef enum SearchSpace__nrofCandidates__aggregationLevel16 { + SearchSpace__nrofCandidates__aggregationLevel16_n0 = 0, + SearchSpace__nrofCandidates__aggregationLevel16_n1 = 1, + SearchSpace__nrofCandidates__aggregationLevel16_n2 = 2, + SearchSpace__nrofCandidates__aggregationLevel16_n3 = 3, + SearchSpace__nrofCandidates__aggregationLevel16_n4 = 4, + SearchSpace__nrofCandidates__aggregationLevel16_n5 = 5, + SearchSpace__nrofCandidates__aggregationLevel16_n6 = 6, + SearchSpace__nrofCandidates__aggregationLevel16_n8 = 7 +} e_SearchSpace__nrofCandidates__aggregationLevel16; +typedef enum SearchSpace__searchSpaceType_PR { + SearchSpace__searchSpaceType_PR_NOTHING, /* No components present */ + SearchSpace__searchSpaceType_PR_common, + SearchSpace__searchSpaceType_PR_ue_Specific +} SearchSpace__searchSpaceType_PR; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1 { + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2 { + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4 { + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8 { + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16 { + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1 { + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl2 = 1, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl4 = 2, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl5 = 3, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl8 = 4, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl10 = 5, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl16 = 6, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1_sl20 = 7 +} e_SearchSpace__searchSpaceType__common__dci_Format2_3__dummy1; +typedef enum SearchSpace__searchSpaceType__common__dci_Format2_3__dummy2 { + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy2_n1 = 0, + SearchSpace__searchSpaceType__common__dci_Format2_3__dummy2_n2 = 1 +} e_SearchSpace__searchSpaceType__common__dci_Format2_3__dummy2; +typedef enum SearchSpace__searchSpaceType__ue_Specific__dci_Formats { + SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0 = 0, + SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1 = 1 +} e_SearchSpace__searchSpaceType__ue_Specific__dci_Formats; + +/* SearchSpace */ +typedef struct SearchSpace { + SearchSpaceId_t searchSpaceId; + ControlResourceSetId_t *controlResourceSetId; /* OPTIONAL */ + struct SearchSpace__monitoringSlotPeriodicityAndOffset { + SearchSpace__monitoringSlotPeriodicityAndOffset_PR present; + union SearchSpace__monitoringSlotPeriodicityAndOffset_u { + NULL_t sl1; + long sl2; + long sl4; + long sl5; + long sl8; + long sl10; + long sl16; + long sl20; + long sl40; + long sl80; + long sl160; + long sl320; + long sl640; + long sl1280; + long sl2560; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *monitoringSlotPeriodicityAndOffset; + long *duration; /* OPTIONAL */ + BIT_STRING_t *monitoringSymbolsWithinSlot; /* OPTIONAL */ + struct SearchSpace__nrofCandidates { + long aggregationLevel1; + long aggregationLevel2; + long aggregationLevel4; + long aggregationLevel8; + long aggregationLevel16; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *nrofCandidates; + struct SearchSpace__searchSpaceType { + SearchSpace__searchSpaceType_PR present; + union SearchSpace__searchSpaceType_u { + struct SearchSpace__searchSpaceType__common { + struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0 { + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *dci_Format0_0_AndFormat1_0; + struct SearchSpace__searchSpaceType__common__dci_Format2_0 { + struct SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI { + long *aggregationLevel1; /* OPTIONAL */ + long *aggregationLevel2; /* OPTIONAL */ + long *aggregationLevel4; /* OPTIONAL */ + long *aggregationLevel8; /* OPTIONAL */ + long *aggregationLevel16; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } nrofCandidates_SFI; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *dci_Format2_0; + struct SearchSpace__searchSpaceType__common__dci_Format2_1 { + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *dci_Format2_1; + struct SearchSpace__searchSpaceType__common__dci_Format2_2 { + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *dci_Format2_2; + struct SearchSpace__searchSpaceType__common__dci_Format2_3 { + long *dummy1; /* OPTIONAL */ + long dummy2; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *dci_Format2_3; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *common; + struct SearchSpace__searchSpaceType__ue_Specific { + long dci_Formats; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *ue_Specific; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *searchSpaceType; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SearchSpace_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel1_23; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel2_32; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel4_41; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel8_50; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel16_59; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel1_74; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel2_77; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel4_80; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel8_83; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_aggregationLevel16_86; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_dummy1_95; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_dummy2_104; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_dci_Formats_109; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_SearchSpace; +extern asn_SEQUENCE_specifics_t asn_SPC_SearchSpace_specs_1; +extern asn_TYPE_member_t asn_MBR_SearchSpace_1[7]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SearchSpace_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SearchSpaceId.c b/src/codec_utils/SYSINFO/SearchSpaceId.c new file mode 100644 index 000000000..0436161e3 --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpaceId.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SearchSpaceId.h" + +int +SearchSpaceId_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 39)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_SearchSpaceId_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..39) */, + -1}; +asn_per_constraints_t asn_PER_type_SearchSpaceId_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 39 } /* (0..39) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_SearchSpaceId_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SearchSpaceId = { + "SearchSpaceId", + "SearchSpaceId", + &asn_OP_NativeInteger, + asn_DEF_SearchSpaceId_tags_1, + sizeof(asn_DEF_SearchSpaceId_tags_1) + /sizeof(asn_DEF_SearchSpaceId_tags_1[0]), /* 1 */ + asn_DEF_SearchSpaceId_tags_1, /* Same as above */ + sizeof(asn_DEF_SearchSpaceId_tags_1) + /sizeof(asn_DEF_SearchSpaceId_tags_1[0]), /* 1 */ + { &asn_OER_type_SearchSpaceId_constr_1, &asn_PER_type_SearchSpaceId_constr_1, SearchSpaceId_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/SearchSpaceId.h b/src/codec_utils/SYSINFO/SearchSpaceId.h new file mode 100644 index 000000000..8d8dd100b --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpaceId.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SearchSpaceId_H_ +#define _SearchSpaceId_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SearchSpaceId */ +typedef long SearchSpaceId_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_SearchSpaceId_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_SearchSpaceId; +asn_struct_free_f SearchSpaceId_free; +asn_struct_print_f SearchSpaceId_print; +asn_constr_check_f SearchSpaceId_constraint; +ber_type_decoder_f SearchSpaceId_decode_ber; +der_type_encoder_f SearchSpaceId_encode_der; +xer_type_decoder_f SearchSpaceId_decode_xer; +xer_type_encoder_f SearchSpaceId_encode_xer; +oer_type_decoder_f SearchSpaceId_decode_oer; +oer_type_encoder_f SearchSpaceId_encode_oer; +per_type_decoder_f SearchSpaceId_decode_uper; +per_type_encoder_f SearchSpaceId_encode_uper; +per_type_decoder_f SearchSpaceId_decode_aper; +per_type_encoder_f SearchSpaceId_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SearchSpaceId_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SearchSpaceZero.c b/src/codec_utils/SYSINFO/SearchSpaceZero.c new file mode 100644 index 000000000..fb25770df --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpaceZero.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SearchSpaceZero.h" + +int +SearchSpaceZero_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_SearchSpaceZero_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..15) */, + -1}; +asn_per_constraints_t asn_PER_type_SearchSpaceZero_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_SearchSpaceZero_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SearchSpaceZero = { + "SearchSpaceZero", + "SearchSpaceZero", + &asn_OP_NativeInteger, + asn_DEF_SearchSpaceZero_tags_1, + sizeof(asn_DEF_SearchSpaceZero_tags_1) + /sizeof(asn_DEF_SearchSpaceZero_tags_1[0]), /* 1 */ + asn_DEF_SearchSpaceZero_tags_1, /* Same as above */ + sizeof(asn_DEF_SearchSpaceZero_tags_1) + /sizeof(asn_DEF_SearchSpaceZero_tags_1[0]), /* 1 */ + { &asn_OER_type_SearchSpaceZero_constr_1, &asn_PER_type_SearchSpaceZero_constr_1, SearchSpaceZero_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/SearchSpaceZero.h b/src/codec_utils/SYSINFO/SearchSpaceZero.h new file mode 100644 index 000000000..3f94d725b --- /dev/null +++ b/src/codec_utils/SYSINFO/SearchSpaceZero.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SearchSpaceZero_H_ +#define _SearchSpaceZero_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SearchSpaceZero */ +typedef long SearchSpaceZero_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_SearchSpaceZero_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_SearchSpaceZero; +asn_struct_free_f SearchSpaceZero_free; +asn_struct_print_f SearchSpaceZero_print; +asn_constr_check_f SearchSpaceZero_constraint; +ber_type_decoder_f SearchSpaceZero_decode_ber; +der_type_encoder_f SearchSpaceZero_encode_der; +xer_type_decoder_f SearchSpaceZero_decode_xer; +xer_type_encoder_f SearchSpaceZero_encode_xer; +oer_type_decoder_f SearchSpaceZero_decode_oer; +oer_type_encoder_f SearchSpaceZero_encode_oer; +per_type_decoder_f SearchSpaceZero_decode_uper; +per_type_encoder_f SearchSpaceZero_encode_uper; +per_type_decoder_f SearchSpaceZero_decode_aper; +per_type_encoder_f SearchSpaceZero_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SearchSpaceZero_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.c b/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.c new file mode 100644 index 000000000..50f1aca49 --- /dev/null +++ b/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.c @@ -0,0 +1,398 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "ServingCellConfigCommonSIB.h" + +#include "UplinkConfigCommonSIB.h" +#include "TDD-UL-DL-ConfigCommon.h" +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_inOneGroup_constraint_9(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_groupPresence_constraint_9(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_ss_PBCH_BlockPower_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -60 && value <= 50)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_n_TimingAdvanceOffset_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_n_TimingAdvanceOffset_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_inOneGroup_constr_10 CC_NOTUSED = { + { 0, 0 }, + 8 /* (SIZE(8..8)) */}; +static asn_per_constraints_t asn_PER_memb_inOneGroup_constr_10 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_groupPresence_constr_11 CC_NOTUSED = { + { 0, 0 }, + 8 /* (SIZE(8..8)) */}; +static asn_per_constraints_t asn_PER_memb_groupPresence_constr_11 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_ssb_PeriodicityServingCell_constr_12 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_ssb_PeriodicityServingCell_constr_12 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 5 } /* (0..5) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_ss_PBCH_BlockPower_constr_20 CC_NOTUSED = { + { 1, 0 } /* (-60..50) */, + -1}; +static asn_per_constraints_t asn_PER_memb_ss_PBCH_BlockPower_constr_20 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, -60, 50 } /* (-60..50) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_n_TimingAdvanceOffset_value2enum_5[] = { + { 0, 2, "n0" }, + { 1, 6, "n25600" }, + { 2, 6, "n39936" } +}; +static const unsigned int asn_MAP_n_TimingAdvanceOffset_enum2value_5[] = { + 0, /* n0(0) */ + 1, /* n25600(1) */ + 2 /* n39936(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_n_TimingAdvanceOffset_specs_5 = { + asn_MAP_n_TimingAdvanceOffset_value2enum_5, /* "tag" => N; sorted by tag */ + asn_MAP_n_TimingAdvanceOffset_enum2value_5, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_n_TimingAdvanceOffset_tags_5[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_n_TimingAdvanceOffset_5 = { + "n-TimingAdvanceOffset", + "n-TimingAdvanceOffset", + &asn_OP_NativeEnumerated, + asn_DEF_n_TimingAdvanceOffset_tags_5, + sizeof(asn_DEF_n_TimingAdvanceOffset_tags_5) + /sizeof(asn_DEF_n_TimingAdvanceOffset_tags_5[0]) - 1, /* 1 */ + asn_DEF_n_TimingAdvanceOffset_tags_5, /* Same as above */ + sizeof(asn_DEF_n_TimingAdvanceOffset_tags_5) + /sizeof(asn_DEF_n_TimingAdvanceOffset_tags_5[0]), /* 2 */ + { &asn_OER_type_n_TimingAdvanceOffset_constr_5, &asn_PER_type_n_TimingAdvanceOffset_constr_5, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_n_TimingAdvanceOffset_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_ssb_PositionsInBurst_9[] = { + { ATF_NOFLAGS, 0, offsetof(struct ServingCellConfigCommonSIB__ssb_PositionsInBurst, inOneGroup), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_inOneGroup_constr_10, &asn_PER_memb_inOneGroup_constr_10, memb_inOneGroup_constraint_9 }, + 0, 0, /* No default value */ + "inOneGroup" + }, + { ATF_POINTER, 1, offsetof(struct ServingCellConfigCommonSIB__ssb_PositionsInBurst, groupPresence), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_groupPresence_constr_11, &asn_PER_memb_groupPresence_constr_11, memb_groupPresence_constraint_9 }, + 0, 0, /* No default value */ + "groupPresence" + }, +}; +static const int asn_MAP_ssb_PositionsInBurst_oms_9[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_ssb_PositionsInBurst_tags_9[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ssb_PositionsInBurst_tag2el_9[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* inOneGroup */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* groupPresence */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ssb_PositionsInBurst_specs_9 = { + sizeof(struct ServingCellConfigCommonSIB__ssb_PositionsInBurst), + offsetof(struct ServingCellConfigCommonSIB__ssb_PositionsInBurst, _asn_ctx), + asn_MAP_ssb_PositionsInBurst_tag2el_9, + 2, /* Count of tags in the map */ + asn_MAP_ssb_PositionsInBurst_oms_9, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ssb_PositionsInBurst_9 = { + "ssb-PositionsInBurst", + "ssb-PositionsInBurst", + &asn_OP_SEQUENCE, + asn_DEF_ssb_PositionsInBurst_tags_9, + sizeof(asn_DEF_ssb_PositionsInBurst_tags_9) + /sizeof(asn_DEF_ssb_PositionsInBurst_tags_9[0]) - 1, /* 1 */ + asn_DEF_ssb_PositionsInBurst_tags_9, /* Same as above */ + sizeof(asn_DEF_ssb_PositionsInBurst_tags_9) + /sizeof(asn_DEF_ssb_PositionsInBurst_tags_9[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ssb_PositionsInBurst_9, + 2, /* Elements count */ + &asn_SPC_ssb_PositionsInBurst_specs_9 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_ssb_PeriodicityServingCell_value2enum_12[] = { + { 0, 3, "ms5" }, + { 1, 4, "ms10" }, + { 2, 4, "ms20" }, + { 3, 4, "ms40" }, + { 4, 4, "ms80" }, + { 5, 5, "ms160" } +}; +static const unsigned int asn_MAP_ssb_PeriodicityServingCell_enum2value_12[] = { + 1, /* ms10(1) */ + 5, /* ms160(5) */ + 2, /* ms20(2) */ + 3, /* ms40(3) */ + 0, /* ms5(0) */ + 4 /* ms80(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ssb_PeriodicityServingCell_specs_12 = { + asn_MAP_ssb_PeriodicityServingCell_value2enum_12, /* "tag" => N; sorted by tag */ + asn_MAP_ssb_PeriodicityServingCell_enum2value_12, /* N => "tag"; sorted by N */ + 6, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_ssb_PeriodicityServingCell_tags_12[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ssb_PeriodicityServingCell_12 = { + "ssb-PeriodicityServingCell", + "ssb-PeriodicityServingCell", + &asn_OP_NativeEnumerated, + asn_DEF_ssb_PeriodicityServingCell_tags_12, + sizeof(asn_DEF_ssb_PeriodicityServingCell_tags_12) + /sizeof(asn_DEF_ssb_PeriodicityServingCell_tags_12[0]) - 1, /* 1 */ + asn_DEF_ssb_PeriodicityServingCell_tags_12, /* Same as above */ + sizeof(asn_DEF_ssb_PeriodicityServingCell_tags_12) + /sizeof(asn_DEF_ssb_PeriodicityServingCell_tags_12[0]), /* 2 */ + { &asn_OER_type_ssb_PeriodicityServingCell_constr_12, &asn_PER_type_ssb_PeriodicityServingCell_constr_12, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ssb_PeriodicityServingCell_specs_12 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_ServingCellConfigCommonSIB_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ServingCellConfigCommonSIB, downlinkConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_DownlinkConfigCommonSIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "downlinkConfigCommon" + }, + { ATF_POINTER, 3, offsetof(struct ServingCellConfigCommonSIB, uplinkConfigCommon), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UplinkConfigCommonSIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uplinkConfigCommon" + }, + { ATF_POINTER, 2, offsetof(struct ServingCellConfigCommonSIB, supplementaryUplink), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UplinkConfigCommonSIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "supplementaryUplink" + }, + { ATF_POINTER, 1, offsetof(struct ServingCellConfigCommonSIB, n_TimingAdvanceOffset), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_n_TimingAdvanceOffset_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "n-TimingAdvanceOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct ServingCellConfigCommonSIB, ssb_PositionsInBurst), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + 0, + &asn_DEF_ssb_PositionsInBurst_9, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ssb-PositionsInBurst" + }, + { ATF_NOFLAGS, 0, offsetof(struct ServingCellConfigCommonSIB, ssb_PeriodicityServingCell), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ssb_PeriodicityServingCell_12, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ssb-PeriodicityServingCell" + }, + { ATF_POINTER, 1, offsetof(struct ServingCellConfigCommonSIB, tdd_UL_DL_ConfigurationCommon), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TDD_UL_DL_ConfigCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "tdd-UL-DL-ConfigurationCommon" + }, + { ATF_NOFLAGS, 0, offsetof(struct ServingCellConfigCommonSIB, ss_PBCH_BlockPower), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_ss_PBCH_BlockPower_constr_20, &asn_PER_memb_ss_PBCH_BlockPower_constr_20, memb_ss_PBCH_BlockPower_constraint_1 }, + 0, 0, /* No default value */ + "ss-PBCH-BlockPower" + }, +}; +static const int asn_MAP_ServingCellConfigCommonSIB_oms_1[] = { 1, 2, 3, 6 }; +static const ber_tlv_tag_t asn_DEF_ServingCellConfigCommonSIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ServingCellConfigCommonSIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* downlinkConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uplinkConfigCommon */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* supplementaryUplink */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* n-TimingAdvanceOffset */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ssb-PositionsInBurst */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ssb-PeriodicityServingCell */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* tdd-UL-DL-ConfigurationCommon */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* ss-PBCH-BlockPower */ +}; +asn_SEQUENCE_specifics_t asn_SPC_ServingCellConfigCommonSIB_specs_1 = { + sizeof(struct ServingCellConfigCommonSIB), + offsetof(struct ServingCellConfigCommonSIB, _asn_ctx), + asn_MAP_ServingCellConfigCommonSIB_tag2el_1, + 8, /* Count of tags in the map */ + asn_MAP_ServingCellConfigCommonSIB_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + 8, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_ServingCellConfigCommonSIB = { + "ServingCellConfigCommonSIB", + "ServingCellConfigCommonSIB", + &asn_OP_SEQUENCE, + asn_DEF_ServingCellConfigCommonSIB_tags_1, + sizeof(asn_DEF_ServingCellConfigCommonSIB_tags_1) + /sizeof(asn_DEF_ServingCellConfigCommonSIB_tags_1[0]), /* 1 */ + asn_DEF_ServingCellConfigCommonSIB_tags_1, /* Same as above */ + sizeof(asn_DEF_ServingCellConfigCommonSIB_tags_1) + /sizeof(asn_DEF_ServingCellConfigCommonSIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ServingCellConfigCommonSIB_1, + 8, /* Elements count */ + &asn_SPC_ServingCellConfigCommonSIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.h b/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.h new file mode 100644 index 000000000..1c8367a06 --- /dev/null +++ b/src/codec_utils/SYSINFO/ServingCellConfigCommonSIB.h @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _ServingCellConfigCommonSIB_H_ +#define _ServingCellConfigCommonSIB_H_ + + +#include + +/* Including external dependencies */ +#include "DownlinkConfigCommonSIB.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ServingCellConfigCommonSIB__n_TimingAdvanceOffset { + ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n0 = 0, + ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n25600 = 1, + ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n39936 = 2 +} e_ServingCellConfigCommonSIB__n_TimingAdvanceOffset; +typedef enum ServingCellConfigCommonSIB__ssb_PeriodicityServingCell { + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5 = 0, + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10 = 1, + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20 = 2, + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40 = 3, + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80 = 4, + ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160 = 5 +} e_ServingCellConfigCommonSIB__ssb_PeriodicityServingCell; + +/* Forward declarations */ +struct UplinkConfigCommonSIB; +struct TDD_UL_DL_ConfigCommon; + +/* ServingCellConfigCommonSIB */ +typedef struct ServingCellConfigCommonSIB { + DownlinkConfigCommonSIB_t downlinkConfigCommon; + struct UplinkConfigCommonSIB *uplinkConfigCommon; /* OPTIONAL */ + struct UplinkConfigCommonSIB *supplementaryUplink; /* OPTIONAL */ + long *n_TimingAdvanceOffset; /* OPTIONAL */ + struct ServingCellConfigCommonSIB__ssb_PositionsInBurst { + BIT_STRING_t inOneGroup; + BIT_STRING_t *groupPresence; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } ssb_PositionsInBurst; + long ssb_PeriodicityServingCell; + struct TDD_UL_DL_ConfigCommon *tdd_UL_DL_ConfigurationCommon; /* OPTIONAL */ + long ss_PBCH_BlockPower; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ServingCellConfigCommonSIB_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_n_TimingAdvanceOffset_5; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_ssb_PeriodicityServingCell_12; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_ServingCellConfigCommonSIB; +extern asn_SEQUENCE_specifics_t asn_SPC_ServingCellConfigCommonSIB_specs_1; +extern asn_TYPE_member_t asn_MBR_ServingCellConfigCommonSIB_1[8]; + +#ifdef __cplusplus +} +#endif + +#endif /* _ServingCellConfigCommonSIB_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/SubcarrierSpacing.c b/src/codec_utils/SYSINFO/SubcarrierSpacing.c new file mode 100644 index 000000000..381a55c0e --- /dev/null +++ b/src/codec_utils/SYSINFO/SubcarrierSpacing.c @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "SubcarrierSpacing.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_SubcarrierSpacing_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +asn_per_constraints_t asn_PER_type_SubcarrierSpacing_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_SubcarrierSpacing_value2enum_1[] = { + { 0, 5, "kHz15" }, + { 1, 5, "kHz30" }, + { 2, 5, "kHz60" }, + { 3, 6, "kHz120" }, + { 4, 6, "kHz240" }, + { 5, 6, "spare3" }, + { 6, 6, "spare2" }, + { 7, 6, "spare1" } +}; +static const unsigned int asn_MAP_SubcarrierSpacing_enum2value_1[] = { + 3, /* kHz120(3) */ + 0, /* kHz15(0) */ + 4, /* kHz240(4) */ + 1, /* kHz30(1) */ + 2, /* kHz60(2) */ + 7, /* spare1(7) */ + 6, /* spare2(6) */ + 5 /* spare3(5) */ +}; +const asn_INTEGER_specifics_t asn_SPC_SubcarrierSpacing_specs_1 = { + asn_MAP_SubcarrierSpacing_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_SubcarrierSpacing_enum2value_1, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_SubcarrierSpacing_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SubcarrierSpacing = { + "SubcarrierSpacing", + "SubcarrierSpacing", + &asn_OP_NativeEnumerated, + asn_DEF_SubcarrierSpacing_tags_1, + sizeof(asn_DEF_SubcarrierSpacing_tags_1) + /sizeof(asn_DEF_SubcarrierSpacing_tags_1[0]), /* 1 */ + asn_DEF_SubcarrierSpacing_tags_1, /* Same as above */ + sizeof(asn_DEF_SubcarrierSpacing_tags_1) + /sizeof(asn_DEF_SubcarrierSpacing_tags_1[0]), /* 1 */ + { &asn_OER_type_SubcarrierSpacing_constr_1, &asn_PER_type_SubcarrierSpacing_constr_1, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_SubcarrierSpacing_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/SubcarrierSpacing.h b/src/codec_utils/SYSINFO/SubcarrierSpacing.h new file mode 100644 index 000000000..378a11501 --- /dev/null +++ b/src/codec_utils/SYSINFO/SubcarrierSpacing.h @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _SubcarrierSpacing_H_ +#define _SubcarrierSpacing_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SubcarrierSpacing { + SubcarrierSpacing_kHz15 = 0, + SubcarrierSpacing_kHz30 = 1, + SubcarrierSpacing_kHz60 = 2, + SubcarrierSpacing_kHz120 = 3, + SubcarrierSpacing_kHz240 = 4, + SubcarrierSpacing_spare3 = 5, + SubcarrierSpacing_spare2 = 6, + SubcarrierSpacing_spare1 = 7 +} e_SubcarrierSpacing; + +/* SubcarrierSpacing */ +typedef long SubcarrierSpacing_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_SubcarrierSpacing_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_SubcarrierSpacing; +extern const asn_INTEGER_specifics_t asn_SPC_SubcarrierSpacing_specs_1; +asn_struct_free_f SubcarrierSpacing_free; +asn_struct_print_f SubcarrierSpacing_print; +asn_constr_check_f SubcarrierSpacing_constraint; +ber_type_decoder_f SubcarrierSpacing_decode_ber; +der_type_encoder_f SubcarrierSpacing_encode_der; +xer_type_decoder_f SubcarrierSpacing_decode_xer; +xer_type_encoder_f SubcarrierSpacing_encode_xer; +oer_type_decoder_f SubcarrierSpacing_decode_oer; +oer_type_encoder_f SubcarrierSpacing_encode_oer; +per_type_decoder_f SubcarrierSpacing_decode_uper; +per_type_encoder_f SubcarrierSpacing_encode_uper; +per_type_decoder_f SubcarrierSpacing_decode_aper; +per_type_encoder_f SubcarrierSpacing_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SubcarrierSpacing_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/TCI-StateId.c b/src/codec_utils/SYSINFO/TCI-StateId.c new file mode 100644 index 000000000..b2a4bb316 --- /dev/null +++ b/src/codec_utils/SYSINFO/TCI-StateId.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "TCI-StateId.h" + +int +TCI_StateId_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_TCI_StateId_constr_1 CC_NOTUSED = { + { 1, 1 } /* (0..127) */, + -1}; +asn_per_constraints_t asn_PER_type_TCI_StateId_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_TCI_StateId_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TCI_StateId = { + "TCI-StateId", + "TCI-StateId", + &asn_OP_NativeInteger, + asn_DEF_TCI_StateId_tags_1, + sizeof(asn_DEF_TCI_StateId_tags_1) + /sizeof(asn_DEF_TCI_StateId_tags_1[0]), /* 1 */ + asn_DEF_TCI_StateId_tags_1, /* Same as above */ + sizeof(asn_DEF_TCI_StateId_tags_1) + /sizeof(asn_DEF_TCI_StateId_tags_1[0]), /* 1 */ + { &asn_OER_type_TCI_StateId_constr_1, &asn_PER_type_TCI_StateId_constr_1, TCI_StateId_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/TCI-StateId.h b/src/codec_utils/SYSINFO/TCI-StateId.h new file mode 100644 index 000000000..828547df4 --- /dev/null +++ b/src/codec_utils/SYSINFO/TCI-StateId.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _TCI_StateId_H_ +#define _TCI_StateId_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TCI-StateId */ +typedef long TCI_StateId_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_TCI_StateId_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_TCI_StateId; +asn_struct_free_f TCI_StateId_free; +asn_struct_print_f TCI_StateId_print; +asn_constr_check_f TCI_StateId_constraint; +ber_type_decoder_f TCI_StateId_decode_ber; +der_type_encoder_f TCI_StateId_encode_der; +xer_type_decoder_f TCI_StateId_decode_xer; +xer_type_encoder_f TCI_StateId_encode_xer; +oer_type_decoder_f TCI_StateId_decode_oer; +oer_type_encoder_f TCI_StateId_encode_oer; +per_type_decoder_f TCI_StateId_decode_uper; +per_type_encoder_f TCI_StateId_encode_uper; +per_type_decoder_f TCI_StateId_decode_aper; +per_type_encoder_f TCI_StateId_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TCI_StateId_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.c b/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.c new file mode 100644 index 000000000..2bebebcbd --- /dev/null +++ b/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.c @@ -0,0 +1,73 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "TDD-UL-DL-ConfigCommon.h" + +#include "TDD-UL-DL-Pattern.h" +asn_TYPE_member_t asn_MBR_TDD_UL_DL_ConfigCommon_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_ConfigCommon, referenceSubcarrierSpacing), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SubcarrierSpacing, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "referenceSubcarrierSpacing" + }, + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_ConfigCommon, pattern1), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TDD_UL_DL_Pattern, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pattern1" + }, + { ATF_POINTER, 1, offsetof(struct TDD_UL_DL_ConfigCommon, pattern2), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TDD_UL_DL_Pattern, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "pattern2" + }, +}; +static const int asn_MAP_TDD_UL_DL_ConfigCommon_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_TDD_UL_DL_ConfigCommon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_TDD_UL_DL_ConfigCommon_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceSubcarrierSpacing */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pattern1 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* pattern2 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_TDD_UL_DL_ConfigCommon_specs_1 = { + sizeof(struct TDD_UL_DL_ConfigCommon), + offsetof(struct TDD_UL_DL_ConfigCommon, _asn_ctx), + asn_MAP_TDD_UL_DL_ConfigCommon_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_TDD_UL_DL_ConfigCommon_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 3, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_TDD_UL_DL_ConfigCommon = { + "TDD-UL-DL-ConfigCommon", + "TDD-UL-DL-ConfigCommon", + &asn_OP_SEQUENCE, + asn_DEF_TDD_UL_DL_ConfigCommon_tags_1, + sizeof(asn_DEF_TDD_UL_DL_ConfigCommon_tags_1) + /sizeof(asn_DEF_TDD_UL_DL_ConfigCommon_tags_1[0]), /* 1 */ + asn_DEF_TDD_UL_DL_ConfigCommon_tags_1, /* Same as above */ + sizeof(asn_DEF_TDD_UL_DL_ConfigCommon_tags_1) + /sizeof(asn_DEF_TDD_UL_DL_ConfigCommon_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_TDD_UL_DL_ConfigCommon_1, + 3, /* Elements count */ + &asn_SPC_TDD_UL_DL_ConfigCommon_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.h b/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.h new file mode 100644 index 000000000..c1586535a --- /dev/null +++ b/src/codec_utils/SYSINFO/TDD-UL-DL-ConfigCommon.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _TDD_UL_DL_ConfigCommon_H_ +#define _TDD_UL_DL_ConfigCommon_H_ + + +#include + +/* Including external dependencies */ +#include "SubcarrierSpacing.h" +#include "TDD-UL-DL-Pattern.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct TDD_UL_DL_Pattern; + +/* TDD-UL-DL-ConfigCommon */ +typedef struct TDD_UL_DL_ConfigCommon { + SubcarrierSpacing_t referenceSubcarrierSpacing; + TDD_UL_DL_Pattern_t pattern1; + struct TDD_UL_DL_Pattern *pattern2; /* OPTIONAL */ + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} TDD_UL_DL_ConfigCommon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TDD_UL_DL_ConfigCommon; +extern asn_SEQUENCE_specifics_t asn_SPC_TDD_UL_DL_ConfigCommon_specs_1; +extern asn_TYPE_member_t asn_MBR_TDD_UL_DL_ConfigCommon_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _TDD_UL_DL_ConfigCommon_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.c b/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.c new file mode 100644 index 000000000..d32954839 --- /dev/null +++ b/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.c @@ -0,0 +1,389 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "TDD-UL-DL-Pattern.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_nrofDownlinkSlots_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 320)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nrofDownlinkSymbols_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 13)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nrofUplinkSlots_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 320)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nrofUplinkSymbols_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 13)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_dl_UL_TransmissionPeriodicity_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dl_UL_TransmissionPeriodicity_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_dl_UL_TransmissionPeriodicity_v1530_constr_17 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_dl_UL_TransmissionPeriodicity_v1530_constr_17 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_nrofDownlinkSlots_constr_11 CC_NOTUSED = { + { 2, 1 } /* (0..320) */, + -1}; +static asn_per_constraints_t asn_PER_memb_nrofDownlinkSlots_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 320 } /* (0..320) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_nrofDownlinkSymbols_constr_12 CC_NOTUSED = { + { 1, 1 } /* (0..13) */, + -1}; +static asn_per_constraints_t asn_PER_memb_nrofDownlinkSymbols_constr_12 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 13 } /* (0..13) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_nrofUplinkSlots_constr_13 CC_NOTUSED = { + { 2, 1 } /* (0..320) */, + -1}; +static asn_per_constraints_t asn_PER_memb_nrofUplinkSlots_constr_13 CC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 320 } /* (0..320) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_nrofUplinkSymbols_constr_14 CC_NOTUSED = { + { 1, 1 } /* (0..13) */, + -1}; +static asn_per_constraints_t asn_PER_memb_nrofUplinkSymbols_constr_14 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 13 } /* (0..13) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_dl_UL_TransmissionPeriodicity_value2enum_2[] = { + { 0, 5, "ms0p5" }, + { 1, 7, "ms0p625" }, + { 2, 3, "ms1" }, + { 3, 6, "ms1p25" }, + { 4, 3, "ms2" }, + { 5, 5, "ms2p5" }, + { 6, 3, "ms5" }, + { 7, 4, "ms10" } +}; +static const unsigned int asn_MAP_dl_UL_TransmissionPeriodicity_enum2value_2[] = { + 0, /* ms0p5(0) */ + 1, /* ms0p625(1) */ + 2, /* ms1(2) */ + 7, /* ms10(7) */ + 3, /* ms1p25(3) */ + 4, /* ms2(4) */ + 5, /* ms2p5(5) */ + 6 /* ms5(6) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dl_UL_TransmissionPeriodicity_specs_2 = { + asn_MAP_dl_UL_TransmissionPeriodicity_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_dl_UL_TransmissionPeriodicity_enum2value_2, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dl_UL_TransmissionPeriodicity_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dl_UL_TransmissionPeriodicity_2 = { + "dl-UL-TransmissionPeriodicity", + "dl-UL-TransmissionPeriodicity", + &asn_OP_NativeEnumerated, + asn_DEF_dl_UL_TransmissionPeriodicity_tags_2, + sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_tags_2) + /sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_tags_2[0]) - 1, /* 1 */ + asn_DEF_dl_UL_TransmissionPeriodicity_tags_2, /* Same as above */ + sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_tags_2) + /sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_tags_2[0]), /* 2 */ + { &asn_OER_type_dl_UL_TransmissionPeriodicity_constr_2, &asn_PER_type_dl_UL_TransmissionPeriodicity_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dl_UL_TransmissionPeriodicity_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_dl_UL_TransmissionPeriodicity_v1530_value2enum_17[] = { + { 0, 3, "ms3" }, + { 1, 3, "ms4" } +}; +static const unsigned int asn_MAP_dl_UL_TransmissionPeriodicity_v1530_enum2value_17[] = { + 0, /* ms3(0) */ + 1 /* ms4(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_dl_UL_TransmissionPeriodicity_v1530_specs_17 = { + asn_MAP_dl_UL_TransmissionPeriodicity_v1530_value2enum_17, /* "tag" => N; sorted by tag */ + asn_MAP_dl_UL_TransmissionPeriodicity_v1530_enum2value_17, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_dl_UL_TransmissionPeriodicity_v1530_17 = { + "dl-UL-TransmissionPeriodicity-v1530", + "dl-UL-TransmissionPeriodicity-v1530", + &asn_OP_NativeEnumerated, + asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17, + sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17) + /sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17[0]) - 1, /* 1 */ + asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17, /* Same as above */ + sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17) + /sizeof(asn_DEF_dl_UL_TransmissionPeriodicity_v1530_tags_17[0]), /* 2 */ + { &asn_OER_type_dl_UL_TransmissionPeriodicity_v1530_constr_17, &asn_PER_type_dl_UL_TransmissionPeriodicity_v1530_constr_17, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_dl_UL_TransmissionPeriodicity_v1530_specs_17 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_ext1_16[] = { + { ATF_POINTER, 1, offsetof(struct TDD_UL_DL_Pattern__ext1, dl_UL_TransmissionPeriodicity_v1530), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dl_UL_TransmissionPeriodicity_v1530_17, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dl-UL-TransmissionPeriodicity-v1530" + }, +}; +static const int asn_MAP_ext1_oms_16[] = { 0 }; +static const ber_tlv_tag_t asn_DEF_ext1_tags_16[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ext1_tag2el_16[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* dl-UL-TransmissionPeriodicity-v1530 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ext1_specs_16 = { + sizeof(struct TDD_UL_DL_Pattern__ext1), + offsetof(struct TDD_UL_DL_Pattern__ext1, _asn_ctx), + asn_MAP_ext1_tag2el_16, + 1, /* Count of tags in the map */ + asn_MAP_ext1_oms_16, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ext1_16 = { + "ext1", + "ext1", + &asn_OP_SEQUENCE, + asn_DEF_ext1_tags_16, + sizeof(asn_DEF_ext1_tags_16) + /sizeof(asn_DEF_ext1_tags_16[0]) - 1, /* 1 */ + asn_DEF_ext1_tags_16, /* Same as above */ + sizeof(asn_DEF_ext1_tags_16) + /sizeof(asn_DEF_ext1_tags_16[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_ext1_16, + 1, /* Elements count */ + &asn_SPC_ext1_specs_16 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_TDD_UL_DL_Pattern_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_Pattern, dl_UL_TransmissionPeriodicity), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_dl_UL_TransmissionPeriodicity_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "dl-UL-TransmissionPeriodicity" + }, + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_Pattern, nrofDownlinkSlots), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_nrofDownlinkSlots_constr_11, &asn_PER_memb_nrofDownlinkSlots_constr_11, memb_nrofDownlinkSlots_constraint_1 }, + 0, 0, /* No default value */ + "nrofDownlinkSlots" + }, + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_Pattern, nrofDownlinkSymbols), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_nrofDownlinkSymbols_constr_12, &asn_PER_memb_nrofDownlinkSymbols_constr_12, memb_nrofDownlinkSymbols_constraint_1 }, + 0, 0, /* No default value */ + "nrofDownlinkSymbols" + }, + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_Pattern, nrofUplinkSlots), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_nrofUplinkSlots_constr_13, &asn_PER_memb_nrofUplinkSlots_constr_13, memb_nrofUplinkSlots_constraint_1 }, + 0, 0, /* No default value */ + "nrofUplinkSlots" + }, + { ATF_NOFLAGS, 0, offsetof(struct TDD_UL_DL_Pattern, nrofUplinkSymbols), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_nrofUplinkSymbols_constr_14, &asn_PER_memb_nrofUplinkSymbols_constr_14, memb_nrofUplinkSymbols_constraint_1 }, + 0, 0, /* No default value */ + "nrofUplinkSymbols" + }, + { ATF_POINTER, 1, offsetof(struct TDD_UL_DL_Pattern, ext1), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + 0, + &asn_DEF_ext1_16, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ext1" + }, +}; +static const int asn_MAP_TDD_UL_DL_Pattern_oms_1[] = { 5 }; +static const ber_tlv_tag_t asn_DEF_TDD_UL_DL_Pattern_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_TDD_UL_DL_Pattern_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dl-UL-TransmissionPeriodicity */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nrofDownlinkSlots */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* nrofDownlinkSymbols */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* nrofUplinkSlots */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* nrofUplinkSymbols */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* ext1 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_TDD_UL_DL_Pattern_specs_1 = { + sizeof(struct TDD_UL_DL_Pattern), + offsetof(struct TDD_UL_DL_Pattern, _asn_ctx), + asn_MAP_TDD_UL_DL_Pattern_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_TDD_UL_DL_Pattern_oms_1, /* Optional members */ + 0, 1, /* Root/Additions */ + 5, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_TDD_UL_DL_Pattern = { + "TDD-UL-DL-Pattern", + "TDD-UL-DL-Pattern", + &asn_OP_SEQUENCE, + asn_DEF_TDD_UL_DL_Pattern_tags_1, + sizeof(asn_DEF_TDD_UL_DL_Pattern_tags_1) + /sizeof(asn_DEF_TDD_UL_DL_Pattern_tags_1[0]), /* 1 */ + asn_DEF_TDD_UL_DL_Pattern_tags_1, /* Same as above */ + sizeof(asn_DEF_TDD_UL_DL_Pattern_tags_1) + /sizeof(asn_DEF_TDD_UL_DL_Pattern_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_TDD_UL_DL_Pattern_1, + 6, /* Elements count */ + &asn_SPC_TDD_UL_DL_Pattern_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.h b/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.h new file mode 100644 index 000000000..894af4ad7 --- /dev/null +++ b/src/codec_utils/SYSINFO/TDD-UL-DL-Pattern.h @@ -0,0 +1,73 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _TDD_UL_DL_Pattern_H_ +#define _TDD_UL_DL_Pattern_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity { + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p5 = 0, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p625 = 1, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1 = 2, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1p25 = 3, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2 = 4, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2p5 = 5, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5 = 6, + TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms10 = 7 +} e_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity; +typedef enum TDD_UL_DL_Pattern__ext1__dl_UL_TransmissionPeriodicity_v1530 { + TDD_UL_DL_Pattern__ext1__dl_UL_TransmissionPeriodicity_v1530_ms3 = 0, + TDD_UL_DL_Pattern__ext1__dl_UL_TransmissionPeriodicity_v1530_ms4 = 1 +} e_TDD_UL_DL_Pattern__ext1__dl_UL_TransmissionPeriodicity_v1530; + +/* TDD-UL-DL-Pattern */ +typedef struct TDD_UL_DL_Pattern { + long dl_UL_TransmissionPeriodicity; + long nrofDownlinkSlots; + long nrofDownlinkSymbols; + long nrofUplinkSlots; + long nrofUplinkSymbols; + /* + * This type is extensible, + * possible extensions are below. + */ + struct TDD_UL_DL_Pattern__ext1 { + long *dl_UL_TransmissionPeriodicity_v1530; /* OPTIONAL */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *ext1; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} TDD_UL_DL_Pattern_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_dl_UL_TransmissionPeriodicity_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_dl_UL_TransmissionPeriodicity_v1530_17; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_TDD_UL_DL_Pattern; +extern asn_SEQUENCE_specifics_t asn_SPC_TDD_UL_DL_Pattern_specs_1; +extern asn_TYPE_member_t asn_MBR_TDD_UL_DL_Pattern_1[6]; + +#ifdef __cplusplus +} +#endif + +#endif /* _TDD_UL_DL_Pattern_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/TimeAlignmentTimer.c b/src/codec_utils/SYSINFO/TimeAlignmentTimer.c new file mode 100644 index 000000000..9d3f1337b --- /dev/null +++ b/src/codec_utils/SYSINFO/TimeAlignmentTimer.c @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "TimeAlignmentTimer.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_TimeAlignmentTimer_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +asn_per_constraints_t asn_PER_type_TimeAlignmentTimer_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_TimeAlignmentTimer_value2enum_1[] = { + { 0, 5, "ms500" }, + { 1, 5, "ms750" }, + { 2, 6, "ms1280" }, + { 3, 6, "ms1920" }, + { 4, 6, "ms2560" }, + { 5, 6, "ms5120" }, + { 6, 7, "ms10240" }, + { 7, 8, "infinity" } +}; +static const unsigned int asn_MAP_TimeAlignmentTimer_enum2value_1[] = { + 7, /* infinity(7) */ + 6, /* ms10240(6) */ + 2, /* ms1280(2) */ + 3, /* ms1920(3) */ + 4, /* ms2560(4) */ + 0, /* ms500(0) */ + 5, /* ms5120(5) */ + 1 /* ms750(1) */ +}; +const asn_INTEGER_specifics_t asn_SPC_TimeAlignmentTimer_specs_1 = { + asn_MAP_TimeAlignmentTimer_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_TimeAlignmentTimer_enum2value_1, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_TimeAlignmentTimer_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TimeAlignmentTimer = { + "TimeAlignmentTimer", + "TimeAlignmentTimer", + &asn_OP_NativeEnumerated, + asn_DEF_TimeAlignmentTimer_tags_1, + sizeof(asn_DEF_TimeAlignmentTimer_tags_1) + /sizeof(asn_DEF_TimeAlignmentTimer_tags_1[0]), /* 1 */ + asn_DEF_TimeAlignmentTimer_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeAlignmentTimer_tags_1) + /sizeof(asn_DEF_TimeAlignmentTimer_tags_1[0]), /* 1 */ + { &asn_OER_type_TimeAlignmentTimer_constr_1, &asn_PER_type_TimeAlignmentTimer_constr_1, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_TimeAlignmentTimer_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/TimeAlignmentTimer.h b/src/codec_utils/SYSINFO/TimeAlignmentTimer.h new file mode 100644 index 000000000..71dd27183 --- /dev/null +++ b/src/codec_utils/SYSINFO/TimeAlignmentTimer.h @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _TimeAlignmentTimer_H_ +#define _TimeAlignmentTimer_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum TimeAlignmentTimer { + TimeAlignmentTimer_ms500 = 0, + TimeAlignmentTimer_ms750 = 1, + TimeAlignmentTimer_ms1280 = 2, + TimeAlignmentTimer_ms1920 = 3, + TimeAlignmentTimer_ms2560 = 4, + TimeAlignmentTimer_ms5120 = 5, + TimeAlignmentTimer_ms10240 = 6, + TimeAlignmentTimer_infinity = 7 +} e_TimeAlignmentTimer; + +/* TimeAlignmentTimer */ +typedef long TimeAlignmentTimer_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_TimeAlignmentTimer_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_TimeAlignmentTimer; +extern const asn_INTEGER_specifics_t asn_SPC_TimeAlignmentTimer_specs_1; +asn_struct_free_f TimeAlignmentTimer_free; +asn_struct_print_f TimeAlignmentTimer_print; +asn_constr_check_f TimeAlignmentTimer_constraint; +ber_type_decoder_f TimeAlignmentTimer_decode_ber; +der_type_encoder_f TimeAlignmentTimer_encode_der; +xer_type_decoder_f TimeAlignmentTimer_decode_xer; +xer_type_encoder_f TimeAlignmentTimer_encode_xer; +oer_type_decoder_f TimeAlignmentTimer_decode_oer; +oer_type_encoder_f TimeAlignmentTimer_encode_oer; +per_type_decoder_f TimeAlignmentTimer_decode_uper; +per_type_encoder_f TimeAlignmentTimer_encode_uper; +per_type_decoder_f TimeAlignmentTimer_decode_aper; +per_type_encoder_f TimeAlignmentTimer_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TimeAlignmentTimer_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/TrackingAreaCode.c b/src/codec_utils/SYSINFO/TrackingAreaCode.c new file mode 100644 index 000000000..fd113ff80 --- /dev/null +++ b/src/codec_utils/SYSINFO/TrackingAreaCode.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "TrackingAreaCode.h" + +int +TrackingAreaCode_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 24)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_TrackingAreaCode_constr_1 CC_NOTUSED = { + { 0, 0 }, + 24 /* (SIZE(24..24)) */}; +asn_per_constraints_t asn_PER_type_TrackingAreaCode_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 24, 24 } /* (SIZE(24..24)) */, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_TrackingAreaCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TrackingAreaCode = { + "TrackingAreaCode", + "TrackingAreaCode", + &asn_OP_BIT_STRING, + asn_DEF_TrackingAreaCode_tags_1, + sizeof(asn_DEF_TrackingAreaCode_tags_1) + /sizeof(asn_DEF_TrackingAreaCode_tags_1[0]), /* 1 */ + asn_DEF_TrackingAreaCode_tags_1, /* Same as above */ + sizeof(asn_DEF_TrackingAreaCode_tags_1) + /sizeof(asn_DEF_TrackingAreaCode_tags_1[0]), /* 1 */ + { &asn_OER_type_TrackingAreaCode_constr_1, &asn_PER_type_TrackingAreaCode_constr_1, TrackingAreaCode_constraint }, + 0, 0, /* No members */ + &asn_SPC_BIT_STRING_specs /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/TrackingAreaCode.h b/src/codec_utils/SYSINFO/TrackingAreaCode.h new file mode 100644 index 000000000..7ae23dbba --- /dev/null +++ b/src/codec_utils/SYSINFO/TrackingAreaCode.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _TrackingAreaCode_H_ +#define _TrackingAreaCode_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TrackingAreaCode */ +typedef BIT_STRING_t TrackingAreaCode_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_TrackingAreaCode_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_TrackingAreaCode; +asn_struct_free_f TrackingAreaCode_free; +asn_struct_print_f TrackingAreaCode_print; +asn_constr_check_f TrackingAreaCode_constraint; +ber_type_decoder_f TrackingAreaCode_decode_ber; +der_type_encoder_f TrackingAreaCode_encode_der; +xer_type_decoder_f TrackingAreaCode_decode_xer; +xer_type_encoder_f TrackingAreaCode_encode_xer; +oer_type_decoder_f TrackingAreaCode_decode_oer; +oer_type_encoder_f TrackingAreaCode_encode_oer; +per_type_decoder_f TrackingAreaCode_decode_uper; +per_type_encoder_f TrackingAreaCode_encode_uper; +per_type_decoder_f TrackingAreaCode_decode_aper; +per_type_encoder_f TrackingAreaCode_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TrackingAreaCode_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.c b/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.c new file mode 100644 index 000000000..b397a6765 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-AccessCategory1-SelectionAssistanceInfo.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_UAC_AccessCategory1_SelectionAssistanceInfo_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +asn_per_constraints_t asn_PER_type_UAC_AccessCategory1_SelectionAssistanceInfo_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_UAC_AccessCategory1_SelectionAssistanceInfo_value2enum_1[] = { + { 0, 1, "a" }, + { 1, 1, "b" }, + { 2, 1, "c" } +}; +static const unsigned int asn_MAP_UAC_AccessCategory1_SelectionAssistanceInfo_enum2value_1[] = { + 0, /* a(0) */ + 1, /* b(1) */ + 2 /* c(2) */ +}; +const asn_INTEGER_specifics_t asn_SPC_UAC_AccessCategory1_SelectionAssistanceInfo_specs_1 = { + asn_MAP_UAC_AccessCategory1_SelectionAssistanceInfo_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_UAC_AccessCategory1_SelectionAssistanceInfo_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo = { + "UAC-AccessCategory1-SelectionAssistanceInfo", + "UAC-AccessCategory1-SelectionAssistanceInfo", + &asn_OP_NativeEnumerated, + asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1, + sizeof(asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1) + /sizeof(asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1[0]), /* 1 */ + asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1) + /sizeof(asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo_tags_1[0]), /* 1 */ + { &asn_OER_type_UAC_AccessCategory1_SelectionAssistanceInfo_constr_1, &asn_PER_type_UAC_AccessCategory1_SelectionAssistanceInfo_constr_1, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_UAC_AccessCategory1_SelectionAssistanceInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.h b/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.h new file mode 100644 index 000000000..3dcc79da8 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-AccessCategory1-SelectionAssistanceInfo.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_AccessCategory1_SelectionAssistanceInfo_H_ +#define _UAC_AccessCategory1_SelectionAssistanceInfo_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UAC_AccessCategory1_SelectionAssistanceInfo { + UAC_AccessCategory1_SelectionAssistanceInfo_a = 0, + UAC_AccessCategory1_SelectionAssistanceInfo_b = 1, + UAC_AccessCategory1_SelectionAssistanceInfo_c = 2 +} e_UAC_AccessCategory1_SelectionAssistanceInfo; + +/* UAC-AccessCategory1-SelectionAssistanceInfo */ +typedef long UAC_AccessCategory1_SelectionAssistanceInfo_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_UAC_AccessCategory1_SelectionAssistanceInfo_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_UAC_AccessCategory1_SelectionAssistanceInfo; +extern const asn_INTEGER_specifics_t asn_SPC_UAC_AccessCategory1_SelectionAssistanceInfo_specs_1; +asn_struct_free_f UAC_AccessCategory1_SelectionAssistanceInfo_free; +asn_struct_print_f UAC_AccessCategory1_SelectionAssistanceInfo_print; +asn_constr_check_f UAC_AccessCategory1_SelectionAssistanceInfo_constraint; +ber_type_decoder_f UAC_AccessCategory1_SelectionAssistanceInfo_decode_ber; +der_type_encoder_f UAC_AccessCategory1_SelectionAssistanceInfo_encode_der; +xer_type_decoder_f UAC_AccessCategory1_SelectionAssistanceInfo_decode_xer; +xer_type_encoder_f UAC_AccessCategory1_SelectionAssistanceInfo_encode_xer; +oer_type_decoder_f UAC_AccessCategory1_SelectionAssistanceInfo_decode_oer; +oer_type_encoder_f UAC_AccessCategory1_SelectionAssistanceInfo_encode_oer; +per_type_decoder_f UAC_AccessCategory1_SelectionAssistanceInfo_decode_uper; +per_type_encoder_f UAC_AccessCategory1_SelectionAssistanceInfo_encode_uper; +per_type_decoder_f UAC_AccessCategory1_SelectionAssistanceInfo_decode_aper; +per_type_encoder_f UAC_AccessCategory1_SelectionAssistanceInfo_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_AccessCategory1_SelectionAssistanceInfo_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSet.c b/src/codec_utils/SYSINFO/UAC-BarringInfoSet.c new file mode 100644 index 000000000..c20460abe --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSet.c @@ -0,0 +1,247 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringInfoSet.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static int +memb_uac_BarringForAccessIdentity_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 7)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_uac_BarringFactor_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_uac_BarringFactor_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_uac_BarringTime_constr_19 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_uac_BarringTime_constr_19 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_uac_BarringForAccessIdentity_constr_28 CC_NOTUSED = { + { 0, 0 }, + 7 /* (SIZE(7..7)) */}; +static asn_per_constraints_t asn_PER_memb_uac_BarringForAccessIdentity_constr_28 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 7, 7 } /* (SIZE(7..7)) */, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_uac_BarringFactor_value2enum_2[] = { + { 0, 3, "p00" }, + { 1, 3, "p05" }, + { 2, 3, "p10" }, + { 3, 3, "p15" }, + { 4, 3, "p20" }, + { 5, 3, "p25" }, + { 6, 3, "p30" }, + { 7, 3, "p40" }, + { 8, 3, "p50" }, + { 9, 3, "p60" }, + { 10, 3, "p70" }, + { 11, 3, "p75" }, + { 12, 3, "p80" }, + { 13, 3, "p85" }, + { 14, 3, "p90" }, + { 15, 3, "p95" } +}; +static const unsigned int asn_MAP_uac_BarringFactor_enum2value_2[] = { + 0, /* p00(0) */ + 1, /* p05(1) */ + 2, /* p10(2) */ + 3, /* p15(3) */ + 4, /* p20(4) */ + 5, /* p25(5) */ + 6, /* p30(6) */ + 7, /* p40(7) */ + 8, /* p50(8) */ + 9, /* p60(9) */ + 10, /* p70(10) */ + 11, /* p75(11) */ + 12, /* p80(12) */ + 13, /* p85(13) */ + 14, /* p90(14) */ + 15 /* p95(15) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_uac_BarringFactor_specs_2 = { + asn_MAP_uac_BarringFactor_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_uac_BarringFactor_enum2value_2, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_uac_BarringFactor_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_BarringFactor_2 = { + "uac-BarringFactor", + "uac-BarringFactor", + &asn_OP_NativeEnumerated, + asn_DEF_uac_BarringFactor_tags_2, + sizeof(asn_DEF_uac_BarringFactor_tags_2) + /sizeof(asn_DEF_uac_BarringFactor_tags_2[0]) - 1, /* 1 */ + asn_DEF_uac_BarringFactor_tags_2, /* Same as above */ + sizeof(asn_DEF_uac_BarringFactor_tags_2) + /sizeof(asn_DEF_uac_BarringFactor_tags_2[0]), /* 2 */ + { &asn_OER_type_uac_BarringFactor_constr_2, &asn_PER_type_uac_BarringFactor_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_uac_BarringFactor_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_uac_BarringTime_value2enum_19[] = { + { 0, 2, "s4" }, + { 1, 2, "s8" }, + { 2, 3, "s16" }, + { 3, 3, "s32" }, + { 4, 3, "s64" }, + { 5, 4, "s128" }, + { 6, 4, "s256" }, + { 7, 4, "s512" } +}; +static const unsigned int asn_MAP_uac_BarringTime_enum2value_19[] = { + 5, /* s128(5) */ + 2, /* s16(2) */ + 6, /* s256(6) */ + 3, /* s32(3) */ + 0, /* s4(0) */ + 7, /* s512(7) */ + 4, /* s64(4) */ + 1 /* s8(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_uac_BarringTime_specs_19 = { + asn_MAP_uac_BarringTime_value2enum_19, /* "tag" => N; sorted by tag */ + asn_MAP_uac_BarringTime_enum2value_19, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_uac_BarringTime_tags_19[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_BarringTime_19 = { + "uac-BarringTime", + "uac-BarringTime", + &asn_OP_NativeEnumerated, + asn_DEF_uac_BarringTime_tags_19, + sizeof(asn_DEF_uac_BarringTime_tags_19) + /sizeof(asn_DEF_uac_BarringTime_tags_19[0]) - 1, /* 1 */ + asn_DEF_uac_BarringTime_tags_19, /* Same as above */ + sizeof(asn_DEF_uac_BarringTime_tags_19) + /sizeof(asn_DEF_uac_BarringTime_tags_19[0]), /* 2 */ + { &asn_OER_type_uac_BarringTime_constr_19, &asn_PER_type_uac_BarringTime_constr_19, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_uac_BarringTime_specs_19 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_UAC_BarringInfoSet_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringInfoSet, uac_BarringFactor), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_uac_BarringFactor_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringFactor" + }, + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringInfoSet, uac_BarringTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_uac_BarringTime_19, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-BarringTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringInfoSet, uac_BarringForAccessIdentity), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { &asn_OER_memb_uac_BarringForAccessIdentity_constr_28, &asn_PER_memb_uac_BarringForAccessIdentity_constr_28, memb_uac_BarringForAccessIdentity_constraint_1 }, + 0, 0, /* No default value */ + "uac-BarringForAccessIdentity" + }, +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringInfoSet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_UAC_BarringInfoSet_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uac-BarringFactor */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uac-BarringTime */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* uac-BarringForAccessIdentity */ +}; +asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringInfoSet_specs_1 = { + sizeof(struct UAC_BarringInfoSet), + offsetof(struct UAC_BarringInfoSet, _asn_ctx), + asn_MAP_UAC_BarringInfoSet_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSet = { + "UAC-BarringInfoSet", + "UAC-BarringInfoSet", + &asn_OP_SEQUENCE, + asn_DEF_UAC_BarringInfoSet_tags_1, + sizeof(asn_DEF_UAC_BarringInfoSet_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSet_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringInfoSet_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringInfoSet_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSet_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_UAC_BarringInfoSet_1, + 3, /* Elements count */ + &asn_SPC_UAC_BarringInfoSet_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSet.h b/src/codec_utils/SYSINFO/UAC-BarringInfoSet.h new file mode 100644 index 000000000..290a24667 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSet.h @@ -0,0 +1,75 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringInfoSet_H_ +#define _UAC_BarringInfoSet_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UAC_BarringInfoSet__uac_BarringFactor { + UAC_BarringInfoSet__uac_BarringFactor_p00 = 0, + UAC_BarringInfoSet__uac_BarringFactor_p05 = 1, + UAC_BarringInfoSet__uac_BarringFactor_p10 = 2, + UAC_BarringInfoSet__uac_BarringFactor_p15 = 3, + UAC_BarringInfoSet__uac_BarringFactor_p20 = 4, + UAC_BarringInfoSet__uac_BarringFactor_p25 = 5, + UAC_BarringInfoSet__uac_BarringFactor_p30 = 6, + UAC_BarringInfoSet__uac_BarringFactor_p40 = 7, + UAC_BarringInfoSet__uac_BarringFactor_p50 = 8, + UAC_BarringInfoSet__uac_BarringFactor_p60 = 9, + UAC_BarringInfoSet__uac_BarringFactor_p70 = 10, + UAC_BarringInfoSet__uac_BarringFactor_p75 = 11, + UAC_BarringInfoSet__uac_BarringFactor_p80 = 12, + UAC_BarringInfoSet__uac_BarringFactor_p85 = 13, + UAC_BarringInfoSet__uac_BarringFactor_p90 = 14, + UAC_BarringInfoSet__uac_BarringFactor_p95 = 15 +} e_UAC_BarringInfoSet__uac_BarringFactor; +typedef enum UAC_BarringInfoSet__uac_BarringTime { + UAC_BarringInfoSet__uac_BarringTime_s4 = 0, + UAC_BarringInfoSet__uac_BarringTime_s8 = 1, + UAC_BarringInfoSet__uac_BarringTime_s16 = 2, + UAC_BarringInfoSet__uac_BarringTime_s32 = 3, + UAC_BarringInfoSet__uac_BarringTime_s64 = 4, + UAC_BarringInfoSet__uac_BarringTime_s128 = 5, + UAC_BarringInfoSet__uac_BarringTime_s256 = 6, + UAC_BarringInfoSet__uac_BarringTime_s512 = 7 +} e_UAC_BarringInfoSet__uac_BarringTime; + +/* UAC-BarringInfoSet */ +typedef struct UAC_BarringInfoSet { + long uac_BarringFactor; + long uac_BarringTime; + BIT_STRING_t uac_BarringForAccessIdentity; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringInfoSet_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_uac_BarringFactor_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_uac_BarringTime_19; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSet; +extern asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringInfoSet_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringInfoSet_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringInfoSet_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.c b/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.c new file mode 100644 index 000000000..5c9cecdd6 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.c @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringInfoSetIndex.h" + +int +UAC_BarringInfoSetIndex_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 8)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_UAC_BarringInfoSetIndex_constr_1 CC_NOTUSED = { + { 1, 1 } /* (1..8) */, + -1}; +asn_per_constraints_t asn_PER_type_UAC_BarringInfoSetIndex_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (1..8) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringInfoSetIndex_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSetIndex = { + "UAC-BarringInfoSetIndex", + "UAC-BarringInfoSetIndex", + &asn_OP_NativeInteger, + asn_DEF_UAC_BarringInfoSetIndex_tags_1, + sizeof(asn_DEF_UAC_BarringInfoSetIndex_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSetIndex_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringInfoSetIndex_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringInfoSetIndex_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSetIndex_tags_1[0]), /* 1 */ + { &asn_OER_type_UAC_BarringInfoSetIndex_constr_1, &asn_PER_type_UAC_BarringInfoSetIndex_constr_1, UAC_BarringInfoSetIndex_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.h b/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.h new file mode 100644 index 000000000..1a1c96f73 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSetIndex.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringInfoSetIndex_H_ +#define _UAC_BarringInfoSetIndex_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UAC-BarringInfoSetIndex */ +typedef long UAC_BarringInfoSetIndex_t; + +/* Implementation */ +extern asn_per_constraints_t asn_PER_type_UAC_BarringInfoSetIndex_constr_1; +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSetIndex; +asn_struct_free_f UAC_BarringInfoSetIndex_free; +asn_struct_print_f UAC_BarringInfoSetIndex_print; +asn_constr_check_f UAC_BarringInfoSetIndex_constraint; +ber_type_decoder_f UAC_BarringInfoSetIndex_decode_ber; +der_type_encoder_f UAC_BarringInfoSetIndex_encode_der; +xer_type_decoder_f UAC_BarringInfoSetIndex_decode_xer; +xer_type_encoder_f UAC_BarringInfoSetIndex_encode_xer; +oer_type_decoder_f UAC_BarringInfoSetIndex_decode_oer; +oer_type_encoder_f UAC_BarringInfoSetIndex_encode_oer; +per_type_decoder_f UAC_BarringInfoSetIndex_decode_uper; +per_type_encoder_f UAC_BarringInfoSetIndex_encode_uper; +per_type_decoder_f UAC_BarringInfoSetIndex_decode_aper; +per_type_encoder_f UAC_BarringInfoSetIndex_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringInfoSetIndex_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.c b/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.c new file mode 100644 index 000000000..6f2f78940 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringInfoSetList.h" + +#include "UAC-BarringInfoSet.h" +static asn_oer_constraints_t asn_OER_type_UAC_BarringInfoSetList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..8)) */}; +asn_per_constraints_t asn_PER_type_UAC_BarringInfoSetList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_UAC_BarringInfoSetList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_UAC_BarringInfoSet, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringInfoSetList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_UAC_BarringInfoSetList_specs_1 = { + sizeof(struct UAC_BarringInfoSetList), + offsetof(struct UAC_BarringInfoSetList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSetList = { + "UAC-BarringInfoSetList", + "UAC-BarringInfoSetList", + &asn_OP_SEQUENCE_OF, + asn_DEF_UAC_BarringInfoSetList_tags_1, + sizeof(asn_DEF_UAC_BarringInfoSetList_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSetList_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringInfoSetList_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringInfoSetList_tags_1) + /sizeof(asn_DEF_UAC_BarringInfoSetList_tags_1[0]), /* 1 */ + { &asn_OER_type_UAC_BarringInfoSetList_constr_1, &asn_PER_type_UAC_BarringInfoSetList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_UAC_BarringInfoSetList_1, + 1, /* Single element */ + &asn_SPC_UAC_BarringInfoSetList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.h b/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.h new file mode 100644 index 000000000..f1d2ad8f0 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringInfoSetList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringInfoSetList_H_ +#define _UAC_BarringInfoSetList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct UAC_BarringInfoSet; + +/* UAC-BarringInfoSetList */ +typedef struct UAC_BarringInfoSetList { + A_SEQUENCE_OF(struct UAC_BarringInfoSet) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringInfoSetList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringInfoSetList; +extern asn_SET_OF_specifics_t asn_SPC_UAC_BarringInfoSetList_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringInfoSetList_1[1]; +extern asn_per_constraints_t asn_PER_type_UAC_BarringInfoSetList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringInfoSetList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerCat.c b/src/codec_utils/SYSINFO/UAC-BarringPerCat.c new file mode 100644 index 000000000..14a629bd2 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerCat.c @@ -0,0 +1,93 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringPerCat.h" + +static int +memb_accessCategory_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_memb_accessCategory_constr_2 CC_NOTUSED = { + { 1, 1 } /* (1..63) */, + -1}; +static asn_per_constraints_t asn_PER_memb_accessCategory_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 1, 63 } /* (1..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_UAC_BarringPerCat_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringPerCat, accessCategory), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_accessCategory_constr_2, &asn_PER_memb_accessCategory_constr_2, memb_accessCategory_constraint_1 }, + 0, 0, /* No default value */ + "accessCategory" + }, + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringPerCat, uac_barringInfoSetIndex), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_BarringInfoSetIndex, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-barringInfoSetIndex" + }, +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringPerCat_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_UAC_BarringPerCat_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* accessCategory */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* uac-barringInfoSetIndex */ +}; +asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringPerCat_specs_1 = { + sizeof(struct UAC_BarringPerCat), + offsetof(struct UAC_BarringPerCat, _asn_ctx), + asn_MAP_UAC_BarringPerCat_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerCat = { + "UAC-BarringPerCat", + "UAC-BarringPerCat", + &asn_OP_SEQUENCE, + asn_DEF_UAC_BarringPerCat_tags_1, + sizeof(asn_DEF_UAC_BarringPerCat_tags_1) + /sizeof(asn_DEF_UAC_BarringPerCat_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringPerCat_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringPerCat_tags_1) + /sizeof(asn_DEF_UAC_BarringPerCat_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_UAC_BarringPerCat_1, + 2, /* Elements count */ + &asn_SPC_UAC_BarringPerCat_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerCat.h b/src/codec_utils/SYSINFO/UAC-BarringPerCat.h new file mode 100644 index 000000000..b97bebbbb --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerCat.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringPerCat_H_ +#define _UAC_BarringPerCat_H_ + + +#include + +/* Including external dependencies */ +#include +#include "UAC-BarringInfoSetIndex.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UAC-BarringPerCat */ +typedef struct UAC_BarringPerCat { + long accessCategory; + UAC_BarringInfoSetIndex_t uac_barringInfoSetIndex; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringPerCat_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerCat; +extern asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringPerCat_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringPerCat_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringPerCat_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerCatList.c b/src/codec_utils/SYSINFO/UAC-BarringPerCatList.c new file mode 100644 index 000000000..d28ac1fd4 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerCatList.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringPerCatList.h" + +#include "UAC-BarringPerCat.h" +static asn_oer_constraints_t asn_OER_type_UAC_BarringPerCatList_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..63)) */}; +asn_per_constraints_t asn_PER_type_UAC_BarringPerCatList_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 63 } /* (SIZE(1..63)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_UAC_BarringPerCatList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_UAC_BarringPerCat, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringPerCatList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_UAC_BarringPerCatList_specs_1 = { + sizeof(struct UAC_BarringPerCatList), + offsetof(struct UAC_BarringPerCatList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerCatList = { + "UAC-BarringPerCatList", + "UAC-BarringPerCatList", + &asn_OP_SEQUENCE_OF, + asn_DEF_UAC_BarringPerCatList_tags_1, + sizeof(asn_DEF_UAC_BarringPerCatList_tags_1) + /sizeof(asn_DEF_UAC_BarringPerCatList_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringPerCatList_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringPerCatList_tags_1) + /sizeof(asn_DEF_UAC_BarringPerCatList_tags_1[0]), /* 1 */ + { &asn_OER_type_UAC_BarringPerCatList_constr_1, &asn_PER_type_UAC_BarringPerCatList_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_UAC_BarringPerCatList_1, + 1, /* Single element */ + &asn_SPC_UAC_BarringPerCatList_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerCatList.h b/src/codec_utils/SYSINFO/UAC-BarringPerCatList.h new file mode 100644 index 000000000..610913525 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerCatList.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringPerCatList_H_ +#define _UAC_BarringPerCatList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct UAC_BarringPerCat; + +/* UAC-BarringPerCatList */ +typedef struct UAC_BarringPerCatList { + A_SEQUENCE_OF(struct UAC_BarringPerCat) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringPerCatList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerCatList; +extern asn_SET_OF_specifics_t asn_SPC_UAC_BarringPerCatList_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringPerCatList_1[1]; +extern asn_per_constraints_t asn_PER_type_UAC_BarringPerCatList_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringPerCatList_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.c b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.c new file mode 100644 index 000000000..4ca3cbe28 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.c @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringPerPLMN-List.h" + +#include "UAC-BarringPerPLMN.h" +static asn_oer_constraints_t asn_OER_type_UAC_BarringPerPLMN_List_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1 /* (SIZE(1..12)) */}; +asn_per_constraints_t asn_PER_type_UAC_BarringPerPLMN_List_constr_1 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, + 0, 0 /* No PER value map */ +}; +asn_TYPE_member_t asn_MBR_UAC_BarringPerPLMN_List_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_UAC_BarringPerPLMN, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_UAC_BarringPerPLMN_List_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_SET_OF_specifics_t asn_SPC_UAC_BarringPerPLMN_List_specs_1 = { + sizeof(struct UAC_BarringPerPLMN_List), + offsetof(struct UAC_BarringPerPLMN_List, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerPLMN_List = { + "UAC-BarringPerPLMN-List", + "UAC-BarringPerPLMN-List", + &asn_OP_SEQUENCE_OF, + asn_DEF_UAC_BarringPerPLMN_List_tags_1, + sizeof(asn_DEF_UAC_BarringPerPLMN_List_tags_1) + /sizeof(asn_DEF_UAC_BarringPerPLMN_List_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringPerPLMN_List_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringPerPLMN_List_tags_1) + /sizeof(asn_DEF_UAC_BarringPerPLMN_List_tags_1[0]), /* 1 */ + { &asn_OER_type_UAC_BarringPerPLMN_List_constr_1, &asn_PER_type_UAC_BarringPerPLMN_List_constr_1, SEQUENCE_OF_constraint }, + asn_MBR_UAC_BarringPerPLMN_List_1, + 1, /* Single element */ + &asn_SPC_UAC_BarringPerPLMN_List_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.h b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.h new file mode 100644 index 000000000..e95c167bb --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN-List.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringPerPLMN_List_H_ +#define _UAC_BarringPerPLMN_List_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct UAC_BarringPerPLMN; + +/* UAC-BarringPerPLMN-List */ +typedef struct UAC_BarringPerPLMN_List { + A_SEQUENCE_OF(struct UAC_BarringPerPLMN) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringPerPLMN_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerPLMN_List; +extern asn_SET_OF_specifics_t asn_SPC_UAC_BarringPerPLMN_List_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringPerPLMN_List_1[1]; +extern asn_per_constraints_t asn_PER_type_UAC_BarringPerPLMN_List_constr_1; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringPerPLMN_List_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.c b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.c new file mode 100644 index 000000000..74792f565 --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.c @@ -0,0 +1,232 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UAC-BarringPerPLMN.h" + +#include "UAC-BarringPerCatList.h" +static int +memb_uac_ImplicitACBarringList_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size == 63)) { + /* Perform validation of the inner elements */ + return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_plmn_IdentityIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 12)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_oer_constraints_t asn_OER_type_uac_ImplicitACBarringList_constr_4 CC_NOTUSED = { + { 0, 0 }, + 63 /* (SIZE(63..63)) */}; +static asn_per_constraints_t asn_PER_type_uac_ImplicitACBarringList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 63, 63 } /* (SIZE(63..63)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_uac_ImplicitACBarringList_constr_4 CC_NOTUSED = { + { 0, 0 }, + 63 /* (SIZE(63..63)) */}; +static asn_per_constraints_t asn_PER_memb_uac_ImplicitACBarringList_constr_4 CC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 63, 63 } /* (SIZE(63..63)) */, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_uac_ACBarringListType_constr_3 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_uac_ACBarringListType_constr_3 CC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_memb_plmn_IdentityIndex_constr_2 CC_NOTUSED = { + { 1, 1 } /* (1..12) */, + -1}; +static asn_per_constraints_t asn_PER_memb_plmn_IdentityIndex_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (1..12) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_uac_ImplicitACBarringList_4[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_UAC_BarringInfoSetIndex, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_uac_ImplicitACBarringList_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_uac_ImplicitACBarringList_specs_4 = { + sizeof(struct UAC_BarringPerPLMN__uac_ACBarringListType__uac_ImplicitACBarringList), + offsetof(struct UAC_BarringPerPLMN__uac_ACBarringListType__uac_ImplicitACBarringList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_ImplicitACBarringList_4 = { + "uac-ImplicitACBarringList", + "uac-ImplicitACBarringList", + &asn_OP_SEQUENCE_OF, + asn_DEF_uac_ImplicitACBarringList_tags_4, + sizeof(asn_DEF_uac_ImplicitACBarringList_tags_4) + /sizeof(asn_DEF_uac_ImplicitACBarringList_tags_4[0]) - 1, /* 1 */ + asn_DEF_uac_ImplicitACBarringList_tags_4, /* Same as above */ + sizeof(asn_DEF_uac_ImplicitACBarringList_tags_4) + /sizeof(asn_DEF_uac_ImplicitACBarringList_tags_4[0]), /* 2 */ + { &asn_OER_type_uac_ImplicitACBarringList_constr_4, &asn_PER_type_uac_ImplicitACBarringList_constr_4, SEQUENCE_OF_constraint }, + asn_MBR_uac_ImplicitACBarringList_4, + 1, /* Single element */ + &asn_SPC_uac_ImplicitACBarringList_specs_4 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_uac_ACBarringListType_3[] = { + { ATF_POINTER, 0, offsetof(struct UAC_BarringPerPLMN__uac_ACBarringListType, choice.uac_ImplicitACBarringList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_uac_ImplicitACBarringList_4, + 0, + { &asn_OER_memb_uac_ImplicitACBarringList_constr_4, &asn_PER_memb_uac_ImplicitACBarringList_constr_4, memb_uac_ImplicitACBarringList_constraint_3 }, + 0, 0, /* No default value */ + "uac-ImplicitACBarringList" + }, + { ATF_POINTER, 0, offsetof(struct UAC_BarringPerPLMN__uac_ACBarringListType, choice.uac_ExplicitACBarringList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UAC_BarringPerCatList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-ExplicitACBarringList" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_uac_ACBarringListType_tag2el_3[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uac-ImplicitACBarringList */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* uac-ExplicitACBarringList */ +}; +static asn_CHOICE_specifics_t asn_SPC_uac_ACBarringListType_specs_3 = { + sizeof(struct UAC_BarringPerPLMN__uac_ACBarringListType), + offsetof(struct UAC_BarringPerPLMN__uac_ACBarringListType, _asn_ctx), + offsetof(struct UAC_BarringPerPLMN__uac_ACBarringListType, present), + sizeof(((struct UAC_BarringPerPLMN__uac_ACBarringListType *)0)->present), + asn_MAP_uac_ACBarringListType_tag2el_3, + 2, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uac_ACBarringListType_3 = { + "uac-ACBarringListType", + "uac-ACBarringListType", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_uac_ACBarringListType_constr_3, &asn_PER_type_uac_ACBarringListType_constr_3, CHOICE_constraint }, + asn_MBR_uac_ACBarringListType_3, + 2, /* Elements count */ + &asn_SPC_uac_ACBarringListType_specs_3 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_UAC_BarringPerPLMN_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UAC_BarringPerPLMN, plmn_IdentityIndex), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + 0, + { &asn_OER_memb_plmn_IdentityIndex_constr_2, &asn_PER_memb_plmn_IdentityIndex_constr_2, memb_plmn_IdentityIndex_constraint_1 }, + 0, 0, /* No default value */ + "plmn-IdentityIndex" + }, + { ATF_POINTER, 1, offsetof(struct UAC_BarringPerPLMN, uac_ACBarringListType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_uac_ACBarringListType_3, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "uac-ACBarringListType" + }, +}; +static const int asn_MAP_UAC_BarringPerPLMN_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_UAC_BarringPerPLMN_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_UAC_BarringPerPLMN_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmn-IdentityIndex */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* uac-ACBarringListType */ +}; +asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringPerPLMN_specs_1 = { + sizeof(struct UAC_BarringPerPLMN), + offsetof(struct UAC_BarringPerPLMN, _asn_ctx), + asn_MAP_UAC_BarringPerPLMN_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_UAC_BarringPerPLMN_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerPLMN = { + "UAC-BarringPerPLMN", + "UAC-BarringPerPLMN", + &asn_OP_SEQUENCE, + asn_DEF_UAC_BarringPerPLMN_tags_1, + sizeof(asn_DEF_UAC_BarringPerPLMN_tags_1) + /sizeof(asn_DEF_UAC_BarringPerPLMN_tags_1[0]), /* 1 */ + asn_DEF_UAC_BarringPerPLMN_tags_1, /* Same as above */ + sizeof(asn_DEF_UAC_BarringPerPLMN_tags_1) + /sizeof(asn_DEF_UAC_BarringPerPLMN_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_UAC_BarringPerPLMN_1, + 2, /* Elements count */ + &asn_SPC_UAC_BarringPerPLMN_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.h b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.h new file mode 100644 index 000000000..28762f85a --- /dev/null +++ b/src/codec_utils/SYSINFO/UAC-BarringPerPLMN.h @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UAC_BarringPerPLMN_H_ +#define _UAC_BarringPerPLMN_H_ + + +#include + +/* Including external dependencies */ +#include +#include "UAC-BarringInfoSetIndex.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UAC_BarringPerPLMN__uac_ACBarringListType_PR { + UAC_BarringPerPLMN__uac_ACBarringListType_PR_NOTHING, /* No components present */ + UAC_BarringPerPLMN__uac_ACBarringListType_PR_uac_ImplicitACBarringList, + UAC_BarringPerPLMN__uac_ACBarringListType_PR_uac_ExplicitACBarringList +} UAC_BarringPerPLMN__uac_ACBarringListType_PR; + +/* Forward declarations */ +struct UAC_BarringPerCatList; + +/* UAC-BarringPerPLMN */ +typedef struct UAC_BarringPerPLMN { + long plmn_IdentityIndex; + struct UAC_BarringPerPLMN__uac_ACBarringListType { + UAC_BarringPerPLMN__uac_ACBarringListType_PR present; + union UAC_BarringPerPLMN__uac_ACBarringListType_u { + struct UAC_BarringPerPLMN__uac_ACBarringListType__uac_ImplicitACBarringList { + A_SEQUENCE_OF(UAC_BarringInfoSetIndex_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *uac_ImplicitACBarringList; + struct UAC_BarringPerCatList *uac_ExplicitACBarringList; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *uac_ACBarringListType; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UAC_BarringPerPLMN_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UAC_BarringPerPLMN; +extern asn_SEQUENCE_specifics_t asn_SPC_UAC_BarringPerPLMN_specs_1; +extern asn_TYPE_member_t asn_MBR_UAC_BarringPerPLMN_1[2]; + +#ifdef __cplusplus +} +#endif + +#endif /* _UAC_BarringPerPLMN_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UE-TimersAndConstants.c b/src/codec_utils/SYSINFO/UE-TimersAndConstants.c new file mode 100644 index 000000000..d12fcaa2c --- /dev/null +++ b/src/codec_utils/SYSINFO/UE-TimersAndConstants.c @@ -0,0 +1,533 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UE-TimersAndConstants.h" + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static asn_oer_constraints_t asn_OER_type_t300_constr_2 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_t300_constr_2 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_t301_constr_11 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_t301_constr_11 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_t310_constr_20 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_t310_constr_20 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 6 } /* (0..6) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_n310_constr_28 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_n310_constr_28 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_t311_constr_37 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_t311_constr_37 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 6 } /* (0..6) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_n311_constr_45 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_n311_constr_45 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_oer_constraints_t asn_OER_type_t319_constr_54 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_t319_constr_54 CC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_t300_value2enum_2[] = { + { 0, 5, "ms100" }, + { 1, 5, "ms200" }, + { 2, 5, "ms300" }, + { 3, 5, "ms400" }, + { 4, 5, "ms600" }, + { 5, 6, "ms1000" }, + { 6, 6, "ms1500" }, + { 7, 6, "ms2000" } +}; +static const unsigned int asn_MAP_t300_enum2value_2[] = { + 0, /* ms100(0) */ + 5, /* ms1000(5) */ + 6, /* ms1500(6) */ + 1, /* ms200(1) */ + 7, /* ms2000(7) */ + 2, /* ms300(2) */ + 3, /* ms400(3) */ + 4 /* ms600(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_t300_specs_2 = { + asn_MAP_t300_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_t300_enum2value_2, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_t300_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_t300_2 = { + "t300", + "t300", + &asn_OP_NativeEnumerated, + asn_DEF_t300_tags_2, + sizeof(asn_DEF_t300_tags_2) + /sizeof(asn_DEF_t300_tags_2[0]) - 1, /* 1 */ + asn_DEF_t300_tags_2, /* Same as above */ + sizeof(asn_DEF_t300_tags_2) + /sizeof(asn_DEF_t300_tags_2[0]), /* 2 */ + { &asn_OER_type_t300_constr_2, &asn_PER_type_t300_constr_2, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_t300_specs_2 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_t301_value2enum_11[] = { + { 0, 5, "ms100" }, + { 1, 5, "ms200" }, + { 2, 5, "ms300" }, + { 3, 5, "ms400" }, + { 4, 5, "ms600" }, + { 5, 6, "ms1000" }, + { 6, 6, "ms1500" }, + { 7, 6, "ms2000" } +}; +static const unsigned int asn_MAP_t301_enum2value_11[] = { + 0, /* ms100(0) */ + 5, /* ms1000(5) */ + 6, /* ms1500(6) */ + 1, /* ms200(1) */ + 7, /* ms2000(7) */ + 2, /* ms300(2) */ + 3, /* ms400(3) */ + 4 /* ms600(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_t301_specs_11 = { + asn_MAP_t301_value2enum_11, /* "tag" => N; sorted by tag */ + asn_MAP_t301_enum2value_11, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_t301_tags_11[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_t301_11 = { + "t301", + "t301", + &asn_OP_NativeEnumerated, + asn_DEF_t301_tags_11, + sizeof(asn_DEF_t301_tags_11) + /sizeof(asn_DEF_t301_tags_11[0]) - 1, /* 1 */ + asn_DEF_t301_tags_11, /* Same as above */ + sizeof(asn_DEF_t301_tags_11) + /sizeof(asn_DEF_t301_tags_11[0]), /* 2 */ + { &asn_OER_type_t301_constr_11, &asn_PER_type_t301_constr_11, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_t301_specs_11 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_t310_value2enum_20[] = { + { 0, 3, "ms0" }, + { 1, 4, "ms50" }, + { 2, 5, "ms100" }, + { 3, 5, "ms200" }, + { 4, 5, "ms500" }, + { 5, 6, "ms1000" }, + { 6, 6, "ms2000" } +}; +static const unsigned int asn_MAP_t310_enum2value_20[] = { + 0, /* ms0(0) */ + 2, /* ms100(2) */ + 5, /* ms1000(5) */ + 3, /* ms200(3) */ + 6, /* ms2000(6) */ + 1, /* ms50(1) */ + 4 /* ms500(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_t310_specs_20 = { + asn_MAP_t310_value2enum_20, /* "tag" => N; sorted by tag */ + asn_MAP_t310_enum2value_20, /* N => "tag"; sorted by N */ + 7, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_t310_tags_20[] = { + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_t310_20 = { + "t310", + "t310", + &asn_OP_NativeEnumerated, + asn_DEF_t310_tags_20, + sizeof(asn_DEF_t310_tags_20) + /sizeof(asn_DEF_t310_tags_20[0]) - 1, /* 1 */ + asn_DEF_t310_tags_20, /* Same as above */ + sizeof(asn_DEF_t310_tags_20) + /sizeof(asn_DEF_t310_tags_20[0]), /* 2 */ + { &asn_OER_type_t310_constr_20, &asn_PER_type_t310_constr_20, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_t310_specs_20 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_n310_value2enum_28[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" }, + { 2, 2, "n3" }, + { 3, 2, "n4" }, + { 4, 2, "n6" }, + { 5, 2, "n8" }, + { 6, 3, "n10" }, + { 7, 3, "n20" } +}; +static const unsigned int asn_MAP_n310_enum2value_28[] = { + 0, /* n1(0) */ + 6, /* n10(6) */ + 1, /* n2(1) */ + 7, /* n20(7) */ + 2, /* n3(2) */ + 3, /* n4(3) */ + 4, /* n6(4) */ + 5 /* n8(5) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_n310_specs_28 = { + asn_MAP_n310_value2enum_28, /* "tag" => N; sorted by tag */ + asn_MAP_n310_enum2value_28, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_n310_tags_28[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_n310_28 = { + "n310", + "n310", + &asn_OP_NativeEnumerated, + asn_DEF_n310_tags_28, + sizeof(asn_DEF_n310_tags_28) + /sizeof(asn_DEF_n310_tags_28[0]) - 1, /* 1 */ + asn_DEF_n310_tags_28, /* Same as above */ + sizeof(asn_DEF_n310_tags_28) + /sizeof(asn_DEF_n310_tags_28[0]), /* 2 */ + { &asn_OER_type_n310_constr_28, &asn_PER_type_n310_constr_28, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_n310_specs_28 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_t311_value2enum_37[] = { + { 0, 6, "ms1000" }, + { 1, 6, "ms3000" }, + { 2, 6, "ms5000" }, + { 3, 7, "ms10000" }, + { 4, 7, "ms15000" }, + { 5, 7, "ms20000" }, + { 6, 7, "ms30000" } +}; +static const unsigned int asn_MAP_t311_enum2value_37[] = { + 0, /* ms1000(0) */ + 3, /* ms10000(3) */ + 4, /* ms15000(4) */ + 5, /* ms20000(5) */ + 1, /* ms3000(1) */ + 6, /* ms30000(6) */ + 2 /* ms5000(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_t311_specs_37 = { + asn_MAP_t311_value2enum_37, /* "tag" => N; sorted by tag */ + asn_MAP_t311_enum2value_37, /* N => "tag"; sorted by N */ + 7, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_t311_tags_37[] = { + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_t311_37 = { + "t311", + "t311", + &asn_OP_NativeEnumerated, + asn_DEF_t311_tags_37, + sizeof(asn_DEF_t311_tags_37) + /sizeof(asn_DEF_t311_tags_37[0]) - 1, /* 1 */ + asn_DEF_t311_tags_37, /* Same as above */ + sizeof(asn_DEF_t311_tags_37) + /sizeof(asn_DEF_t311_tags_37[0]), /* 2 */ + { &asn_OER_type_t311_constr_37, &asn_PER_type_t311_constr_37, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_t311_specs_37 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_n311_value2enum_45[] = { + { 0, 2, "n1" }, + { 1, 2, "n2" }, + { 2, 2, "n3" }, + { 3, 2, "n4" }, + { 4, 2, "n5" }, + { 5, 2, "n6" }, + { 6, 2, "n8" }, + { 7, 3, "n10" } +}; +static const unsigned int asn_MAP_n311_enum2value_45[] = { + 0, /* n1(0) */ + 7, /* n10(7) */ + 1, /* n2(1) */ + 2, /* n3(2) */ + 3, /* n4(3) */ + 4, /* n5(4) */ + 5, /* n6(5) */ + 6 /* n8(6) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_n311_specs_45 = { + asn_MAP_n311_value2enum_45, /* "tag" => N; sorted by tag */ + asn_MAP_n311_enum2value_45, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_n311_tags_45[] = { + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_n311_45 = { + "n311", + "n311", + &asn_OP_NativeEnumerated, + asn_DEF_n311_tags_45, + sizeof(asn_DEF_n311_tags_45) + /sizeof(asn_DEF_n311_tags_45[0]) - 1, /* 1 */ + asn_DEF_n311_tags_45, /* Same as above */ + sizeof(asn_DEF_n311_tags_45) + /sizeof(asn_DEF_n311_tags_45[0]), /* 2 */ + { &asn_OER_type_n311_constr_45, &asn_PER_type_n311_constr_45, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_n311_specs_45 /* Additional specs */ +}; + +static const asn_INTEGER_enum_map_t asn_MAP_t319_value2enum_54[] = { + { 0, 5, "ms100" }, + { 1, 5, "ms200" }, + { 2, 5, "ms300" }, + { 3, 5, "ms400" }, + { 4, 5, "ms600" }, + { 5, 6, "ms1000" }, + { 6, 6, "ms1500" }, + { 7, 6, "ms2000" } +}; +static const unsigned int asn_MAP_t319_enum2value_54[] = { + 0, /* ms100(0) */ + 5, /* ms1000(5) */ + 6, /* ms1500(6) */ + 1, /* ms200(1) */ + 7, /* ms2000(7) */ + 2, /* ms300(2) */ + 3, /* ms400(3) */ + 4 /* ms600(4) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_t319_specs_54 = { + asn_MAP_t319_value2enum_54, /* "tag" => N; sorted by tag */ + asn_MAP_t319_enum2value_54, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_t319_tags_54[] = { + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_t319_54 = { + "t319", + "t319", + &asn_OP_NativeEnumerated, + asn_DEF_t319_tags_54, + sizeof(asn_DEF_t319_tags_54) + /sizeof(asn_DEF_t319_tags_54[0]) - 1, /* 1 */ + asn_DEF_t319_tags_54, /* Same as above */ + sizeof(asn_DEF_t319_tags_54) + /sizeof(asn_DEF_t319_tags_54[0]), /* 2 */ + { &asn_OER_type_t319_constr_54, &asn_PER_type_t319_constr_54, NativeEnumerated_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_t319_specs_54 /* Additional specs */ +}; + +asn_TYPE_member_t asn_MBR_UE_TimersAndConstants_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, t300), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_t300_2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "t300" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, t301), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_t301_11, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "t301" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, t310), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_t310_20, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "t310" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, n310), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_n310_28, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "n310" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, t311), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_t311_37, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "t311" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, n311), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_n311_45, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "n311" + }, + { ATF_NOFLAGS, 0, offsetof(struct UE_TimersAndConstants, t319), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_t319_54, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "t319" + }, +}; +static const ber_tlv_tag_t asn_DEF_UE_TimersAndConstants_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_UE_TimersAndConstants_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* t300 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* t301 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* t310 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* n310 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* t311 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* n311 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* t319 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_UE_TimersAndConstants_specs_1 = { + sizeof(struct UE_TimersAndConstants), + offsetof(struct UE_TimersAndConstants, _asn_ctx), + asn_MAP_UE_TimersAndConstants_tag2el_1, + 7, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 7, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_UE_TimersAndConstants = { + "UE-TimersAndConstants", + "UE-TimersAndConstants", + &asn_OP_SEQUENCE, + asn_DEF_UE_TimersAndConstants_tags_1, + sizeof(asn_DEF_UE_TimersAndConstants_tags_1) + /sizeof(asn_DEF_UE_TimersAndConstants_tags_1[0]), /* 1 */ + asn_DEF_UE_TimersAndConstants_tags_1, /* Same as above */ + sizeof(asn_DEF_UE_TimersAndConstants_tags_1) + /sizeof(asn_DEF_UE_TimersAndConstants_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_UE_TimersAndConstants_1, + 7, /* Elements count */ + &asn_SPC_UE_TimersAndConstants_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UE-TimersAndConstants.h b/src/codec_utils/SYSINFO/UE-TimersAndConstants.h new file mode 100644 index 000000000..88fe3d798 --- /dev/null +++ b/src/codec_utils/SYSINFO/UE-TimersAndConstants.h @@ -0,0 +1,127 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UE_TimersAndConstants_H_ +#define _UE_TimersAndConstants_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UE_TimersAndConstants__t300 { + UE_TimersAndConstants__t300_ms100 = 0, + UE_TimersAndConstants__t300_ms200 = 1, + UE_TimersAndConstants__t300_ms300 = 2, + UE_TimersAndConstants__t300_ms400 = 3, + UE_TimersAndConstants__t300_ms600 = 4, + UE_TimersAndConstants__t300_ms1000 = 5, + UE_TimersAndConstants__t300_ms1500 = 6, + UE_TimersAndConstants__t300_ms2000 = 7 +} e_UE_TimersAndConstants__t300; +typedef enum UE_TimersAndConstants__t301 { + UE_TimersAndConstants__t301_ms100 = 0, + UE_TimersAndConstants__t301_ms200 = 1, + UE_TimersAndConstants__t301_ms300 = 2, + UE_TimersAndConstants__t301_ms400 = 3, + UE_TimersAndConstants__t301_ms600 = 4, + UE_TimersAndConstants__t301_ms1000 = 5, + UE_TimersAndConstants__t301_ms1500 = 6, + UE_TimersAndConstants__t301_ms2000 = 7 +} e_UE_TimersAndConstants__t301; +typedef enum UE_TimersAndConstants__t310 { + UE_TimersAndConstants__t310_ms0 = 0, + UE_TimersAndConstants__t310_ms50 = 1, + UE_TimersAndConstants__t310_ms100 = 2, + UE_TimersAndConstants__t310_ms200 = 3, + UE_TimersAndConstants__t310_ms500 = 4, + UE_TimersAndConstants__t310_ms1000 = 5, + UE_TimersAndConstants__t310_ms2000 = 6 +} e_UE_TimersAndConstants__t310; +typedef enum UE_TimersAndConstants__n310 { + UE_TimersAndConstants__n310_n1 = 0, + UE_TimersAndConstants__n310_n2 = 1, + UE_TimersAndConstants__n310_n3 = 2, + UE_TimersAndConstants__n310_n4 = 3, + UE_TimersAndConstants__n310_n6 = 4, + UE_TimersAndConstants__n310_n8 = 5, + UE_TimersAndConstants__n310_n10 = 6, + UE_TimersAndConstants__n310_n20 = 7 +} e_UE_TimersAndConstants__n310; +typedef enum UE_TimersAndConstants__t311 { + UE_TimersAndConstants__t311_ms1000 = 0, + UE_TimersAndConstants__t311_ms3000 = 1, + UE_TimersAndConstants__t311_ms5000 = 2, + UE_TimersAndConstants__t311_ms10000 = 3, + UE_TimersAndConstants__t311_ms15000 = 4, + UE_TimersAndConstants__t311_ms20000 = 5, + UE_TimersAndConstants__t311_ms30000 = 6 +} e_UE_TimersAndConstants__t311; +typedef enum UE_TimersAndConstants__n311 { + UE_TimersAndConstants__n311_n1 = 0, + UE_TimersAndConstants__n311_n2 = 1, + UE_TimersAndConstants__n311_n3 = 2, + UE_TimersAndConstants__n311_n4 = 3, + UE_TimersAndConstants__n311_n5 = 4, + UE_TimersAndConstants__n311_n6 = 5, + UE_TimersAndConstants__n311_n8 = 6, + UE_TimersAndConstants__n311_n10 = 7 +} e_UE_TimersAndConstants__n311; +typedef enum UE_TimersAndConstants__t319 { + UE_TimersAndConstants__t319_ms100 = 0, + UE_TimersAndConstants__t319_ms200 = 1, + UE_TimersAndConstants__t319_ms300 = 2, + UE_TimersAndConstants__t319_ms400 = 3, + UE_TimersAndConstants__t319_ms600 = 4, + UE_TimersAndConstants__t319_ms1000 = 5, + UE_TimersAndConstants__t319_ms1500 = 6, + UE_TimersAndConstants__t319_ms2000 = 7 +} e_UE_TimersAndConstants__t319; + +/* UE-TimersAndConstants */ +typedef struct UE_TimersAndConstants { + long t300; + long t301; + long t310; + long n310; + long t311; + long n311; + long t319; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UE_TimersAndConstants_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_t300_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_t301_11; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_t310_20; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_n310_28; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_t311_37; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_n311_45; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_t319_54; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_UE_TimersAndConstants; +extern asn_SEQUENCE_specifics_t asn_SPC_UE_TimersAndConstants_specs_1; +extern asn_TYPE_member_t asn_MBR_UE_TimersAndConstants_1[7]; + +#ifdef __cplusplus +} +#endif + +#endif /* _UE_TimersAndConstants_H_ */ +#include diff --git a/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.c b/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.c new file mode 100644 index 000000000..91a002b59 --- /dev/null +++ b/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#include "UplinkConfigCommonSIB.h" + +asn_TYPE_member_t asn_MBR_UplinkConfigCommonSIB_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UplinkConfigCommonSIB, frequencyInfoUL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoUL_SIB, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "frequencyInfoUL" + }, + { ATF_NOFLAGS, 0, offsetof(struct UplinkConfigCommonSIB, initialUplinkBWP), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BWP_UplinkCommon, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "initialUplinkBWP" + }, + { ATF_NOFLAGS, 0, offsetof(struct UplinkConfigCommonSIB, timeAlignmentTimerCommon), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeAlignmentTimer, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "timeAlignmentTimerCommon" + }, +}; +static const ber_tlv_tag_t asn_DEF_UplinkConfigCommonSIB_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_UplinkConfigCommonSIB_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyInfoUL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* initialUplinkBWP */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* timeAlignmentTimerCommon */ +}; +asn_SEQUENCE_specifics_t asn_SPC_UplinkConfigCommonSIB_specs_1 = { + sizeof(struct UplinkConfigCommonSIB), + offsetof(struct UplinkConfigCommonSIB, _asn_ctx), + asn_MAP_UplinkConfigCommonSIB_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_UplinkConfigCommonSIB = { + "UplinkConfigCommonSIB", + "UplinkConfigCommonSIB", + &asn_OP_SEQUENCE, + asn_DEF_UplinkConfigCommonSIB_tags_1, + sizeof(asn_DEF_UplinkConfigCommonSIB_tags_1) + /sizeof(asn_DEF_UplinkConfigCommonSIB_tags_1[0]), /* 1 */ + asn_DEF_UplinkConfigCommonSIB_tags_1, /* Same as above */ + sizeof(asn_DEF_UplinkConfigCommonSIB_tags_1) + /sizeof(asn_DEF_UplinkConfigCommonSIB_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_UplinkConfigCommonSIB_1, + 3, /* Elements count */ + &asn_SPC_UplinkConfigCommonSIB_specs_1 /* Additional specs */ +}; + diff --git a/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.h b/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.h new file mode 100644 index 000000000..de903ead2 --- /dev/null +++ b/src/codec_utils/SYSINFO/UplinkConfigCommonSIB.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "NR-RRC-Definitions" + * found in "../../mib_sib1.asn1" + * `asn1c -D ./mib_sib_out/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` + */ + +#ifndef _UplinkConfigCommonSIB_H_ +#define _UplinkConfigCommonSIB_H_ + + +#include + +/* Including external dependencies */ +#include "FrequencyInfoUL-SIB.h" +#include "BWP-UplinkCommon.h" +#include "TimeAlignmentTimer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UplinkConfigCommonSIB */ +typedef struct UplinkConfigCommonSIB { + FrequencyInfoUL_SIB_t frequencyInfoUL; + BWP_UplinkCommon_t initialUplinkBWP; + TimeAlignmentTimer_t timeAlignmentTimerCommon; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UplinkConfigCommonSIB_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UplinkConfigCommonSIB; +extern asn_SEQUENCE_specifics_t asn_SPC_UplinkConfigCommonSIB_specs_1; +extern asn_TYPE_member_t asn_MBR_UplinkConfigCommonSIB_1[3]; + +#ifdef __cplusplus +} +#endif + +#endif /* _UplinkConfigCommonSIB_H_ */ +#include diff --git a/src/codec_utils/common/BIT_STRING.c b/src/codec_utils/common/BIT_STRING.c new file mode 100755 index 000000000..a1185e22a --- /dev/null +++ b/src/codec_utils/common/BIT_STRING.c @@ -0,0 +1,686 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * BIT STRING basic type description. + */ +static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs = { + sizeof(BIT_STRING_t), + offsetof(BIT_STRING_t, _asn_ctx), + ASN_OSUBV_BIT +}; +asn_TYPE_operation_t asn_OP_BIT_STRING = { + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + BIT_STRING_print, + BIT_STRING_compare, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_xer_binary, + BIT_STRING_encode_xer, +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + BIT_STRING_decode_oer, + BIT_STRING_encode_oer, +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + BIT_STRING_decode_uper, /* Unaligned PER decoder */ + BIT_STRING_encode_uper, /* Unaligned PER encoder */ + OCTET_STRING_decode_aper, /* Aligned PER decoder */ + OCTET_STRING_encode_aper, /* Aligned PER encoder */ +#endif /* ASN_DISABLE_PER_SUPPORT */ + BIT_STRING_random_fill, + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { + "BIT STRING", + "BIT_STRING", + &asn_OP_BIT_STRING, + asn_DEF_BIT_STRING_tags, + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + { 0, 0, BIT_STRING_constraint }, + 0, 0, /* No members */ + &asn_SPC_BIT_STRING_specs +}; + +/* + * BIT STRING generic constraint. + */ +int +BIT_STRING_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + printf("Inside %s:%d\n", __FILE__,__LINE__); + + if(st && st->buf) { + if((st->size == 0 && st->bits_unused) + || st->bits_unused < 0 || st->bits_unused > 7) { + ASN__CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + +static const char *_bit_pattern[16] = { + "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", + "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" +}; + +asn_enc_rval_t +BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er = {0, 0, 0}; + char scratch[128]; + char *p = scratch; + char *scend = scratch + (sizeof(scratch) - 10); + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + int xcan = (flags & XER_F_CANONICAL); + uint8_t *buf; + uint8_t *end; + + if(!st || !st->buf) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + buf = st->buf; + end = buf + st->size - 1; /* Last byte is special */ + + /* + * Binary dump + */ + for(; buf < end; buf++) { + int v = *buf; + int nline = xcan?0:(((buf - st->buf) % 8) == 0); + if(p >= scend || nline) { + ASN__CALLBACK(scratch, p - scratch); + p = scratch; + if(nline) ASN__TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; + } + + if(!xcan && ((buf - st->buf) % 8) == 0) + ASN__TEXT_INDENT(1, ilevel); + ASN__CALLBACK(scratch, p - scratch); + p = scratch; + + if(buf == end) { + int v = *buf; + int ubits = st->bits_unused; + int i; + for(i = 7; i >= ubits; i--) + *p++ = (v & (1 << i)) ? 0x31 : 0x30; + ASN__CALLBACK(scratch, p - scratch); + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + + +/* + * BIT STRING specific contents printer. + */ +int +BIT_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const char * const h2c = "0123456789ABCDEF"; + char scratch[64]; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + uint8_t *buf; + uint8_t *end; + char *p = scratch; + + (void)td; /* Unused argument */ + + if(!st || !st->buf) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + ilevel++; + buf = st->buf; + end = buf + st->size; + + /* + * Hexadecimal dump. + */ + for(; buf < end; buf++) { + if((buf - st->buf) % 16 == 0 && (st->size > 16) + && buf != st->buf) { + _i_INDENT(1); + /* Dump the string */ + if(cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Eat the tailing space */ + + if((st->size > 16)) { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + if(st->bits_unused) { + int ret = snprintf(scratch, sizeof(scratch), " (%d bit%s unused)", + st->bits_unused, st->bits_unused == 1 ? "" : "s"); + assert(ret > 0 && ret < (ssize_t)sizeof(scratch)); + if(ret > 0 && ret < (ssize_t)sizeof(scratch) + && cb(scratch, ret, app_key) < 0) + return -1; + } + + return 0; +} + +/* + * Non-destructively remove the trailing 0-bits from the given bit string. + */ +static const BIT_STRING_t * +BIT_STRING__compactify(const BIT_STRING_t *st, BIT_STRING_t *tmp) { + const uint8_t *b; + union { + const uint8_t *c_buf; + uint8_t *nc_buf; + } unconst; + + if(st->size == 0) { + assert(st->bits_unused == 0); + return st; + } else { + for(b = &st->buf[st->size - 1]; b > st->buf && *b == 0; b--) { + ; + } + /* b points to the last byte which may contain data */ + if(*b) { + int unused = 7; + uint8_t v = *b; + v &= -(int8_t)v; + if(v & 0x0F) unused -= 4; + if(v & 0x33) unused -= 2; + if(v & 0x55) unused -= 1; + tmp->size = b-st->buf + 1; + tmp->bits_unused = unused; + } else { + tmp->size = b-st->buf; + tmp->bits_unused = 0; + } + + assert(b >= st->buf); + } + + unconst.c_buf = st->buf; + tmp->buf = unconst.nc_buf; + return tmp; +} + +/* + * Lexicographically compare the common prefix of both strings, + * and if it is the same return -1 for the smallest string. + */ +int +BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr, + const void *bptr) { + /* + * Remove information about trailing bits, since + * X.680 (08/2015) #22.7 "ensure that different semantics are not" + * "associated with [values that differ only in] the trailing 0 bits." + */ + BIT_STRING_t compact_a, compact_b; + const BIT_STRING_t *a = BIT_STRING__compactify(aptr, &compact_a); + const BIT_STRING_t *b = BIT_STRING__compactify(bptr, &compact_b); + const asn_OCTET_STRING_specifics_t *specs = td->specifics; + + assert(specs && specs->subvariant == ASN_OSUBV_BIT); + + if(a && b) { + size_t common_prefix_size = a->size <= b->size ? a->size : b->size; + int ret = memcmp(a->buf, b->buf, common_prefix_size); + if(ret == 0) { + /* Figure out which string with equal prefixes is longer. */ + if(a->size < b->size) { + return -1; + } else if(a->size > b->size) { + return 1; + } else { + /* Figure out how many unused bits */ + if(a->bits_unused > b->bits_unused) { + return -1; + } else if(a->bits_unused < b->bits_unused) { + return 1; + } else { + return 0; + } + } + } else { + return ret; + } + } else if(!a && !b) { + return 0; + } else if(!a) { + return -1; + } else { + return 1; + } +} + +#ifndef ASN_DISABLE_PER_SUPPORT + +#undef RETURN +#define RETURN(_code) \ + do { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } while(0) + +static asn_per_constraint_t asn_DEF_BIT_STRING_constraint_size = { + APC_SEMI_CONSTRAINED, -1, -1, 0, 0}; + +asn_dec_rval_t +BIT_STRING_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, void **sptr, + asn_per_data_t *pd) { + const asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (const asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_SPC_BIT_STRING_specs; + const asn_per_constraints_t *pc = + constraints ? constraints : td->encoding_constraints.per_constraints; + const asn_per_constraint_t *csiz; + asn_dec_rval_t rval = { RC_OK, 0 }; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + ssize_t consumed_myself = 0; + int repeat; + + (void)opt_codec_ctx; + + if(pc) { + csiz = &pc->size; + } else { + csiz = &asn_DEF_BIT_STRING_constraint_size; + } + + if(specs->subvariant != ASN_OSUBV_BIT) { + ASN_DEBUG("Subvariant %d is not BIT OSUBV_BIT", specs->subvariant); + RETURN(RC_FAIL); + } + + /* + * Allocate the string. + */ + if(!st) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) RETURN(RC_FAIL); + } + + ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + + if(csiz->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) RETURN(RC_WMORE); + if(inext) { + csiz = &asn_DEF_BIT_STRING_constraint_size; + } + } + + if(csiz->effective_bits >= 0) { + FREEMEM(st->buf); + st->size = (csiz->upper_bound + 7) >> 3; + st->buf = (uint8_t *)MALLOC(st->size + 1); + if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits == 0) { + int ret; + ASN_DEBUG("Encoding BIT STRING size %ld", csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, csiz->upper_bound); + if(ret < 0) RETURN(RC_WMORE); + consumed_myself += csiz->upper_bound; + st->buf[st->size] = 0; + st->bits_unused = (8 - (csiz->upper_bound & 0x7)) & 0x7; + RETURN(RC_OK); + } + + st->size = 0; + do { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; + + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, csiz->lower_bound, + &repeat); + if(raw_len < 0) RETURN(RC_WMORE); + if(raw_len == 0 && st->buf) break; + + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if(len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + p = REALLOC(st->buf, st->size + len_bytes + 1); + if(!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + ret = per_get_many_bits(pd, &st->buf[st->size], 0, len_bits); + if(ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; + } while(repeat); + st->buf[st->size] = 0; /* nul-terminate */ + + return rval; +} + +asn_enc_rval_t +BIT_STRING_encode_uper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, + const void *sptr, asn_per_outp_t *po) { + const asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_SPC_BIT_STRING_specs; + const asn_per_constraints_t *pc = + constraints ? constraints : td->encoding_constraints.per_constraints; + const asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + BIT_STRING_t compact_bstr; /* Do not modify this directly! */ + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + size_t size_in_bits; + const uint8_t *buf; + int ret; + int ct_extensible; + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + if(specs->subvariant == ASN_OSUBV_BIT) { + if((st->size == 0 && st->bits_unused) || (st->bits_unused & ~7)) +{ + ASN__ENCODE_FAILED; +} + } else { + ASN__ENCODE_FAILED; + } + + if(pc) { + csiz = &pc->size; + } else { + csiz = &asn_DEF_BIT_STRING_constraint_size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + /* Figure out the size without the trailing bits */ + st = BIT_STRING__compactify(st, &compact_bstr); + size_in_bits = 8 * st->size - st->bits_unused; + + ASN_DEBUG( + "Encoding %s into %" ASN_PRI_SIZE " bits" + " (%ld..%ld, effective %d)%s", + td->name, size_in_bits, csiz->lower_bound, csiz->upper_bound, + csiz->effective_bits, ct_extensible ? " EXT" : ""); + + /* Figure out whether size lies within PER visible constraint */ + + if(csiz->effective_bits >= 0) { + if((ssize_t)size_in_bits > csiz->upper_bound) { + if(ct_extensible) { + csiz = &asn_DEF_BIT_STRING_constraint_size; + inext = 1; + } else { + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); + ASN__ENCODE_FAILED; + } + } + } else { + inext = 0; + } + + if(ct_extensible) { + /* Declare whether length is [not] within extension root */ + if(per_put_few_bits(po, inext, 1)) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); + ASN__ENCODE_FAILED; +} + } + + if(csiz->effective_bits >= 0 && !inext) { + int add_trailer = (ssize_t)size_in_bits < csiz->lower_bound; + ASN_DEBUG( + "Encoding %" ASN_PRI_SIZE " bytes (%ld), length (in %d bits) trailer %d; actual " + "value %" ASN_PRI_SSIZE "", + st->size, size_in_bits - csiz->lower_bound, csiz->effective_bits, + add_trailer, + add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound); + ret = per_put_few_bits( + po, add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound, + csiz->effective_bits); + if(ret) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); +ASN__ENCODE_FAILED; +} + ret = per_put_many_bits(po, st->buf, size_in_bits); + if(ret) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); +ASN__ENCODE_FAILED; +} + if(add_trailer) { + static const uint8_t zeros[16]; + size_t trailing_zero_bits = csiz->lower_bound - size_in_bits; + while(trailing_zero_bits > 0) { + if(trailing_zero_bits > 8 * sizeof(zeros)) { + ret = per_put_many_bits(po, zeros, 8 * sizeof(zeros)); + trailing_zero_bits -= 8 * sizeof(zeros); + } else { + ret = per_put_many_bits(po, zeros, trailing_zero_bits); + trailing_zero_bits = 0; + } + if(ret) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); +ASN__ENCODE_FAILED; +} + } + } + ASN__ENCODED_OK(er); + } + + ASN_DEBUG("Encoding %" ASN_PRI_SIZE " bytes", st->size); + + buf = st->buf; + do { + int need_eom = 0; + ssize_t maySave = uper_put_length(po, size_in_bits, &need_eom); + if(maySave < 0) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); +ASN__ENCODE_FAILED; +} + + ASN_DEBUG("Encoding %" ASN_PRI_SSIZE " of %" ASN_PRI_SIZE "", maySave, size_in_bits); + + ret = per_put_many_bits(po, buf, maySave); + if(ret) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); +ASN__ENCODE_FAILED; +} + + buf += maySave >> 3; + size_in_bits -= maySave; + assert(!(maySave & 0x07) || !size_in_bits); + if(need_eom && uper_put_length(po, 0, 0)) +{ + printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); + ASN__ENCODE_FAILED; /* End of Message length */ +} + } while(size_in_bits); + + ASN__ENCODED_OK(er); +} + +#endif /* ASN_DISABLE_PER_SUPPORT */ + +asn_random_fill_result_t +BIT_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, + const asn_encoding_constraints_t *constraints, + size_t max_length) { + const asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_SPC_BIT_STRING_specs; + asn_random_fill_result_t result_ok = {ARFILL_OK, 1}; + asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0}; + asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0}; + static unsigned lengths[] = {0, 1, 2, 3, 4, 8, + 126, 127, 128, 16383, 16384, 16385, + 65534, 65535, 65536, 65537}; + uint8_t *buf; + uint8_t *bend; + uint8_t *b; + size_t rnd_bits, rnd_len; + BIT_STRING_t *st; + + if(max_length == 0) return result_skipped; + + switch(specs->subvariant) { + case ASN_OSUBV_ANY: + return result_failed; + case ASN_OSUBV_BIT: + break; + default: + break; + } + + /* Figure out how far we should go */ + rnd_bits = lengths[asn_random_between( + 0, sizeof(lengths) / sizeof(lengths[0]) - 1)]; + if(!constraints || !constraints->per_constraints) + constraints = &td->encoding_constraints; + if(constraints->per_constraints) { + const asn_per_constraint_t *pc = &constraints->per_constraints->size; + if(pc->flags & APC_CONSTRAINED) { + long suggested_upper_bound = pc->upper_bound < (ssize_t)max_length + ? pc->upper_bound + : (ssize_t)max_length; + if(max_length < (size_t)pc->lower_bound) { + return result_skipped; + } + if(pc->flags & APC_EXTENSIBLE) { + switch(asn_random_between(0, 5)) { + case 0: + if(pc->lower_bound > 0) { + rnd_bits = pc->lower_bound - 1; + break; + } + /* Fall through */ + case 1: + rnd_bits = pc->upper_bound + 1; + break; + case 2: + /* Keep rnd_bits from the table */ + if(rnd_bits < max_length) { + break; + } + /* Fall through */ + default: + rnd_bits = asn_random_between(pc->lower_bound, + suggested_upper_bound); + } + } else { + rnd_bits = + asn_random_between(pc->lower_bound, suggested_upper_bound); + } + } else { + rnd_bits = asn_random_between(0, max_length - 1); + } + } else if(rnd_bits >= max_length) { + rnd_bits = asn_random_between(0, max_length - 1); + } + + rnd_len = (rnd_bits + 7) / 8; + buf = CALLOC(1, rnd_len + 1); + if(!buf) return result_failed; + + bend = &buf[rnd_len]; + + for(b = buf; b < bend; b++) { + *(uint8_t *)b = asn_random_between(0, 255); + } + *b = 0; /* Zero-terminate just in case. */ + + if(*sptr) { + st = *sptr; + FREEMEM(st->buf); + } else { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) { + FREEMEM(buf); + return result_failed; + } + } + + st->buf = buf; + st->size = rnd_len; + st->bits_unused = (8 - (rnd_bits & 0x7)) & 0x7; + if(st->bits_unused) { + assert(st->size > 0); + st->buf[st->size-1] &= 0xff << st->bits_unused; + } + + result_ok.length = st->size; + return result_ok; +} diff --git a/src/du_app/F1AP/asn/BIT_STRING.h b/src/codec_utils/common/BIT_STRING.h similarity index 100% rename from src/du_app/F1AP/asn/BIT_STRING.h rename to src/codec_utils/common/BIT_STRING.h diff --git a/src/du_app/F1AP/asn/BIT_STRING_oer.c b/src/codec_utils/common/BIT_STRING_oer.c similarity index 100% rename from src/du_app/F1AP/asn/BIT_STRING_oer.c rename to src/codec_utils/common/BIT_STRING_oer.c diff --git a/src/du_app/F1AP/asn/BOOLEAN.c b/src/codec_utils/common/BOOLEAN.c similarity index 100% rename from src/du_app/F1AP/asn/BOOLEAN.c rename to src/codec_utils/common/BOOLEAN.c diff --git a/src/du_app/F1AP/asn/BOOLEAN.h b/src/codec_utils/common/BOOLEAN.h similarity index 100% rename from src/du_app/F1AP/asn/BOOLEAN.h rename to src/codec_utils/common/BOOLEAN.h diff --git a/src/du_app/F1AP/asn/INTEGER.c b/src/codec_utils/common/INTEGER.c similarity index 100% rename from src/du_app/F1AP/asn/INTEGER.c rename to src/codec_utils/common/INTEGER.c diff --git a/src/du_app/F1AP/asn/INTEGER.h b/src/codec_utils/common/INTEGER.h similarity index 100% rename from src/du_app/F1AP/asn/INTEGER.h rename to src/codec_utils/common/INTEGER.h diff --git a/src/du_app/F1AP/asn/INTEGER_oer.c b/src/codec_utils/common/INTEGER_oer.c similarity index 100% rename from src/du_app/F1AP/asn/INTEGER_oer.c rename to src/codec_utils/common/INTEGER_oer.c diff --git a/src/du_app/F1AP/asn/OCTET_STRING.c b/src/codec_utils/common/OCTET_STRING.c similarity index 100% rename from src/du_app/F1AP/asn/OCTET_STRING.c rename to src/codec_utils/common/OCTET_STRING.c diff --git a/src/du_app/F1AP/asn/OCTET_STRING.h b/src/codec_utils/common/OCTET_STRING.h similarity index 100% rename from src/du_app/F1AP/asn/OCTET_STRING.h rename to src/codec_utils/common/OCTET_STRING.h diff --git a/src/du_app/F1AP/asn/OCTET_STRING_oer.c b/src/codec_utils/common/OCTET_STRING_oer.c similarity index 100% rename from src/du_app/F1AP/asn/OCTET_STRING_oer.c rename to src/codec_utils/common/OCTET_STRING_oer.c diff --git a/src/du_app/F1AP/asn/OPEN_TYPE.c b/src/codec_utils/common/OPEN_TYPE.c similarity index 100% rename from src/du_app/F1AP/asn/OPEN_TYPE.c rename to src/codec_utils/common/OPEN_TYPE.c diff --git a/src/du_app/F1AP/asn/OPEN_TYPE.h b/src/codec_utils/common/OPEN_TYPE.h similarity index 100% rename from src/du_app/F1AP/asn/OPEN_TYPE.h rename to src/codec_utils/common/OPEN_TYPE.h diff --git a/src/du_app/F1AP/asn/OPEN_TYPE_oer.c b/src/codec_utils/common/OPEN_TYPE_oer.c similarity index 100% rename from src/du_app/F1AP/asn/OPEN_TYPE_oer.c rename to src/codec_utils/common/OPEN_TYPE_oer.c diff --git a/src/du_app/F1AP/asn/asn_SEQUENCE_OF.c b/src/codec_utils/common/asn_SEQUENCE_OF.c similarity index 100% rename from src/du_app/F1AP/asn/asn_SEQUENCE_OF.c rename to src/codec_utils/common/asn_SEQUENCE_OF.c diff --git a/src/du_app/F1AP/asn/asn_SEQUENCE_OF.h b/src/codec_utils/common/asn_SEQUENCE_OF.h similarity index 100% rename from src/du_app/F1AP/asn/asn_SEQUENCE_OF.h rename to src/codec_utils/common/asn_SEQUENCE_OF.h diff --git a/src/du_app/F1AP/asn/asn_SET_OF.c b/src/codec_utils/common/asn_SET_OF.c similarity index 100% rename from src/du_app/F1AP/asn/asn_SET_OF.c rename to src/codec_utils/common/asn_SET_OF.c diff --git a/src/du_app/F1AP/asn/asn_SET_OF.h b/src/codec_utils/common/asn_SET_OF.h similarity index 100% rename from src/du_app/F1AP/asn/asn_SET_OF.h rename to src/codec_utils/common/asn_SET_OF.h diff --git a/src/du_app/F1AP/asn/asn_application.c b/src/codec_utils/common/asn_application.c similarity index 100% rename from src/du_app/F1AP/asn/asn_application.c rename to src/codec_utils/common/asn_application.c diff --git a/src/du_app/F1AP/asn/asn_application.h b/src/codec_utils/common/asn_application.h similarity index 100% rename from src/du_app/F1AP/asn/asn_application.h rename to src/codec_utils/common/asn_application.h diff --git a/src/du_app/F1AP/asn/asn_bit_data.c b/src/codec_utils/common/asn_bit_data.c similarity index 100% rename from src/du_app/F1AP/asn/asn_bit_data.c rename to src/codec_utils/common/asn_bit_data.c diff --git a/src/du_app/F1AP/asn/asn_bit_data.h b/src/codec_utils/common/asn_bit_data.h similarity index 100% rename from src/du_app/F1AP/asn/asn_bit_data.h rename to src/codec_utils/common/asn_bit_data.h diff --git a/src/du_app/F1AP/asn/asn_codecs.h b/src/codec_utils/common/asn_codecs.h similarity index 100% rename from src/du_app/F1AP/asn/asn_codecs.h rename to src/codec_utils/common/asn_codecs.h diff --git a/src/du_app/F1AP/asn/asn_codecs_prim.c b/src/codec_utils/common/asn_codecs_prim.c similarity index 100% rename from src/du_app/F1AP/asn/asn_codecs_prim.c rename to src/codec_utils/common/asn_codecs_prim.c diff --git a/src/du_app/F1AP/asn/asn_codecs_prim.h b/src/codec_utils/common/asn_codecs_prim.h similarity index 100% rename from src/du_app/F1AP/asn/asn_codecs_prim.h rename to src/codec_utils/common/asn_codecs_prim.h diff --git a/src/du_app/F1AP/asn/asn_internal.c b/src/codec_utils/common/asn_internal.c similarity index 100% rename from src/du_app/F1AP/asn/asn_internal.c rename to src/codec_utils/common/asn_internal.c diff --git a/src/du_app/F1AP/asn/asn_internal.h b/src/codec_utils/common/asn_internal.h similarity index 100% rename from src/du_app/F1AP/asn/asn_internal.h rename to src/codec_utils/common/asn_internal.h diff --git a/src/du_app/F1AP/asn/asn_ioc.h b/src/codec_utils/common/asn_ioc.h similarity index 100% rename from src/du_app/F1AP/asn/asn_ioc.h rename to src/codec_utils/common/asn_ioc.h diff --git a/src/du_app/F1AP/asn/asn_random_fill.c b/src/codec_utils/common/asn_random_fill.c similarity index 100% rename from src/du_app/F1AP/asn/asn_random_fill.c rename to src/codec_utils/common/asn_random_fill.c diff --git a/src/du_app/F1AP/asn/asn_random_fill.h b/src/codec_utils/common/asn_random_fill.h similarity index 100% rename from src/du_app/F1AP/asn/asn_random_fill.h rename to src/codec_utils/common/asn_random_fill.h diff --git a/src/du_app/F1AP/asn/asn_system.h b/src/codec_utils/common/asn_system.h similarity index 100% rename from src/du_app/F1AP/asn/asn_system.h rename to src/codec_utils/common/asn_system.h diff --git a/src/du_app/F1AP/asn/ber_decoder.c b/src/codec_utils/common/ber_decoder.c similarity index 100% rename from src/du_app/F1AP/asn/ber_decoder.c rename to src/codec_utils/common/ber_decoder.c diff --git a/src/du_app/F1AP/asn/ber_decoder.h b/src/codec_utils/common/ber_decoder.h similarity index 100% rename from src/du_app/F1AP/asn/ber_decoder.h rename to src/codec_utils/common/ber_decoder.h diff --git a/src/du_app/F1AP/asn/ber_tlv_length.c b/src/codec_utils/common/ber_tlv_length.c similarity index 100% rename from src/du_app/F1AP/asn/ber_tlv_length.c rename to src/codec_utils/common/ber_tlv_length.c diff --git a/src/du_app/F1AP/asn/ber_tlv_length.h b/src/codec_utils/common/ber_tlv_length.h similarity index 100% rename from src/du_app/F1AP/asn/ber_tlv_length.h rename to src/codec_utils/common/ber_tlv_length.h diff --git a/src/du_app/F1AP/asn/ber_tlv_tag.c b/src/codec_utils/common/ber_tlv_tag.c similarity index 100% rename from src/du_app/F1AP/asn/ber_tlv_tag.c rename to src/codec_utils/common/ber_tlv_tag.c diff --git a/src/du_app/F1AP/asn/ber_tlv_tag.h b/src/codec_utils/common/ber_tlv_tag.h similarity index 100% rename from src/du_app/F1AP/asn/ber_tlv_tag.h rename to src/codec_utils/common/ber_tlv_tag.h diff --git a/src/du_app/F1AP/asn/constr_CHOICE.c b/src/codec_utils/common/constr_CHOICE.c similarity index 100% rename from src/du_app/F1AP/asn/constr_CHOICE.c rename to src/codec_utils/common/constr_CHOICE.c diff --git a/src/du_app/F1AP/asn/constr_CHOICE.h b/src/codec_utils/common/constr_CHOICE.h similarity index 100% rename from src/du_app/F1AP/asn/constr_CHOICE.h rename to src/codec_utils/common/constr_CHOICE.h diff --git a/src/du_app/F1AP/asn/constr_CHOICE_oer.c b/src/codec_utils/common/constr_CHOICE_oer.c similarity index 100% rename from src/du_app/F1AP/asn/constr_CHOICE_oer.c rename to src/codec_utils/common/constr_CHOICE_oer.c diff --git a/src/du_app/F1AP/asn/constr_SEQUENCE.c b/src/codec_utils/common/constr_SEQUENCE.c similarity index 100% rename from src/du_app/F1AP/asn/constr_SEQUENCE.c rename to src/codec_utils/common/constr_SEQUENCE.c diff --git a/src/du_app/F1AP/asn/constr_SEQUENCE.h b/src/codec_utils/common/constr_SEQUENCE.h similarity index 100% rename from src/du_app/F1AP/asn/constr_SEQUENCE.h rename to src/codec_utils/common/constr_SEQUENCE.h diff --git a/src/du_app/F1AP/asn/constr_SEQUENCE_OF.c b/src/codec_utils/common/constr_SEQUENCE_OF.c similarity index 100% rename from src/du_app/F1AP/asn/constr_SEQUENCE_OF.c rename to src/codec_utils/common/constr_SEQUENCE_OF.c diff --git a/src/du_app/F1AP/asn/constr_SEQUENCE_OF.h b/src/codec_utils/common/constr_SEQUENCE_OF.h similarity index 100% rename from src/du_app/F1AP/asn/constr_SEQUENCE_OF.h rename to src/codec_utils/common/constr_SEQUENCE_OF.h diff --git a/src/du_app/F1AP/asn/constr_SEQUENCE_oer.c b/src/codec_utils/common/constr_SEQUENCE_oer.c similarity index 100% rename from src/du_app/F1AP/asn/constr_SEQUENCE_oer.c rename to src/codec_utils/common/constr_SEQUENCE_oer.c diff --git a/src/du_app/F1AP/asn/constr_SET_OF.c b/src/codec_utils/common/constr_SET_OF.c similarity index 100% rename from src/du_app/F1AP/asn/constr_SET_OF.c rename to src/codec_utils/common/constr_SET_OF.c diff --git a/src/du_app/F1AP/asn/constr_SET_OF.h b/src/codec_utils/common/constr_SET_OF.h similarity index 100% rename from src/du_app/F1AP/asn/constr_SET_OF.h rename to src/codec_utils/common/constr_SET_OF.h diff --git a/src/du_app/F1AP/asn/constr_SET_OF_oer.c b/src/codec_utils/common/constr_SET_OF_oer.c similarity index 100% rename from src/du_app/F1AP/asn/constr_SET_OF_oer.c rename to src/codec_utils/common/constr_SET_OF_oer.c diff --git a/src/du_app/F1AP/asn/constr_TYPE.c b/src/codec_utils/common/constr_TYPE.c similarity index 100% rename from src/du_app/F1AP/asn/constr_TYPE.c rename to src/codec_utils/common/constr_TYPE.c diff --git a/src/du_app/F1AP/asn/constr_TYPE.h b/src/codec_utils/common/constr_TYPE.h similarity index 100% rename from src/du_app/F1AP/asn/constr_TYPE.h rename to src/codec_utils/common/constr_TYPE.h diff --git a/src/du_app/F1AP/asn/constraints.c b/src/codec_utils/common/constraints.c similarity index 100% rename from src/du_app/F1AP/asn/constraints.c rename to src/codec_utils/common/constraints.c diff --git a/src/du_app/F1AP/asn/constraints.h b/src/codec_utils/common/constraints.h similarity index 100% rename from src/du_app/F1AP/asn/constraints.h rename to src/codec_utils/common/constraints.h diff --git a/src/du_app/F1AP/asn/der_encoder.c b/src/codec_utils/common/der_encoder.c similarity index 100% rename from src/du_app/F1AP/asn/der_encoder.c rename to src/codec_utils/common/der_encoder.c diff --git a/src/du_app/F1AP/asn/der_encoder.h b/src/codec_utils/common/der_encoder.h similarity index 100% rename from src/du_app/F1AP/asn/der_encoder.h rename to src/codec_utils/common/der_encoder.h diff --git a/src/du_app/F1AP/asn/oer_decoder.c b/src/codec_utils/common/oer_decoder.c similarity index 100% rename from src/du_app/F1AP/asn/oer_decoder.c rename to src/codec_utils/common/oer_decoder.c diff --git a/src/du_app/F1AP/asn/oer_decoder.h b/src/codec_utils/common/oer_decoder.h similarity index 100% rename from src/du_app/F1AP/asn/oer_decoder.h rename to src/codec_utils/common/oer_decoder.h diff --git a/src/du_app/F1AP/asn/oer_encoder.c b/src/codec_utils/common/oer_encoder.c similarity index 100% rename from src/du_app/F1AP/asn/oer_encoder.c rename to src/codec_utils/common/oer_encoder.c diff --git a/src/du_app/F1AP/asn/oer_encoder.h b/src/codec_utils/common/oer_encoder.h similarity index 100% rename from src/du_app/F1AP/asn/oer_encoder.h rename to src/codec_utils/common/oer_encoder.h diff --git a/src/du_app/F1AP/asn/oer_support.c b/src/codec_utils/common/oer_support.c similarity index 100% rename from src/du_app/F1AP/asn/oer_support.c rename to src/codec_utils/common/oer_support.c diff --git a/src/du_app/F1AP/asn/oer_support.h b/src/codec_utils/common/oer_support.h similarity index 100% rename from src/du_app/F1AP/asn/oer_support.h rename to src/codec_utils/common/oer_support.h diff --git a/src/du_app/F1AP/asn/per_decoder.c b/src/codec_utils/common/per_decoder.c similarity index 100% rename from src/du_app/F1AP/asn/per_decoder.c rename to src/codec_utils/common/per_decoder.c diff --git a/src/du_app/F1AP/asn/per_decoder.h b/src/codec_utils/common/per_decoder.h similarity index 100% rename from src/du_app/F1AP/asn/per_decoder.h rename to src/codec_utils/common/per_decoder.h diff --git a/src/du_app/F1AP/asn/per_encoder.c b/src/codec_utils/common/per_encoder.c similarity index 100% rename from src/du_app/F1AP/asn/per_encoder.c rename to src/codec_utils/common/per_encoder.c diff --git a/src/du_app/F1AP/asn/per_encoder.h b/src/codec_utils/common/per_encoder.h similarity index 100% rename from src/du_app/F1AP/asn/per_encoder.h rename to src/codec_utils/common/per_encoder.h diff --git a/src/du_app/F1AP/asn/per_opentype.c b/src/codec_utils/common/per_opentype.c similarity index 100% rename from src/du_app/F1AP/asn/per_opentype.c rename to src/codec_utils/common/per_opentype.c diff --git a/src/du_app/F1AP/asn/per_opentype.h b/src/codec_utils/common/per_opentype.h similarity index 100% rename from src/du_app/F1AP/asn/per_opentype.h rename to src/codec_utils/common/per_opentype.h diff --git a/src/du_app/F1AP/asn/per_support.c b/src/codec_utils/common/per_support.c similarity index 100% rename from src/du_app/F1AP/asn/per_support.c rename to src/codec_utils/common/per_support.c diff --git a/src/du_app/F1AP/asn/per_support.h b/src/codec_utils/common/per_support.h similarity index 100% rename from src/du_app/F1AP/asn/per_support.h rename to src/codec_utils/common/per_support.h diff --git a/src/du_app/F1AP/asn/xer_decoder.c b/src/codec_utils/common/xer_decoder.c similarity index 100% rename from src/du_app/F1AP/asn/xer_decoder.c rename to src/codec_utils/common/xer_decoder.c diff --git a/src/du_app/F1AP/asn/xer_decoder.h b/src/codec_utils/common/xer_decoder.h similarity index 100% rename from src/du_app/F1AP/asn/xer_decoder.h rename to src/codec_utils/common/xer_decoder.h diff --git a/src/du_app/F1AP/asn/xer_encoder.c b/src/codec_utils/common/xer_encoder.c similarity index 100% rename from src/du_app/F1AP/asn/xer_encoder.c rename to src/codec_utils/common/xer_encoder.c diff --git a/src/du_app/F1AP/asn/xer_encoder.h b/src/codec_utils/common/xer_encoder.h similarity index 100% rename from src/du_app/F1AP/asn/xer_encoder.h rename to src/codec_utils/common/xer_encoder.h diff --git a/src/du_app/F1AP/asn/xer_support.c b/src/codec_utils/common/xer_support.c similarity index 100% rename from src/du_app/F1AP/asn/xer_support.c rename to src/codec_utils/common/xer_support.c diff --git a/src/du_app/F1AP/asn/xer_support.h b/src/codec_utils/common/xer_support.h similarity index 100% rename from src/du_app/F1AP/asn/xer_support.h rename to src/codec_utils/common/xer_support.h diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c new file mode 100644 index 000000000..55c95ca13 --- /dev/null +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -0,0 +1,1061 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains F1AP message handler functions */ + +#include "cu_stub_sctp.h" +#include "cu_f1ap_msg_hdl.h" + +char encBuf[ENC_BUF_MAX_LEN]; + +/******************************************************************* + * + * @brief Writes the encoded chunks into a buffer + * + * @details + * + * Function : PrepFinalEncBuf + * + * Functionality:Fills the encoded buffer + * + * @params[in] void *buffer,initial encoded data + * @params[in] size_t size,size of buffer + * @params[in] void *encodedBuf,final buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +static int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf) +{ + memcpy(encodedBuf + encBufSize, buffer, size); + encBufSize += size; + return 0; +} /* PrepFinalEncBuf */ + +/******************************************************************* +* +* @brief Sends F1 msg over SCTP +* +* @details +* +* Function : SendF1APMsg +* +* Functionality: Sends F1 msg over SCTP +* +* @params[in] Region region +* Pool pool +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +S16 SendF1APMsg(Region region, Pool pool) +{ + Buffer *mBuf; + + if(SGetMsg(region, pool, &mBuf) == ROK) + { + if(SAddPstMsgMult((Data *)encBuf, encBufSize, mBuf) == ROK) + { + SPrntMsg(mBuf, 0,0); + + if(sctpSend(mBuf) != ROK) + { + DU_LOG("\nF1AP : SCTP Send failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + } + else + { + DU_LOG("\nF1AP : SAddPstMsgMult failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + SPutMsg(mBuf); + } + else + { + DU_LOG("\nF1AP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* SendF1APMsg */ + + +void plmnBuildCU(Plmn plmn, OCTET_STRING_t *octe) +{ + U8 mncCnt; + mncCnt = 2; + octe->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0])); + if(mncCnt == 2) + { + octe->buf[1] = ((0xf0) | (plmn.mcc[2])); + octe->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0])); + } + else + { + octe->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2])); + octe->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1])); + } +} +/******************************************************************* + * + * @brief Builds and sends the F1SetupResponse + * + * @details + * + * Function : BuildAndSendF1SetupRsp + * + * Functionality: Constructs the F1SetupResponse message and sends + * it back to the DU through SCTP. + * + * @params[in] void **buf,Buffer to which encoded pattern is written into + * @params[in] int *size,size of buffer + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendF1SetupRsp() +{ + U8 idx,idy; + U8 elementCnt,cellCnt; + F1AP_PDU_t *f1apMsg = NULL; + F1SetupResponse_t *f1SetupRsp; + GNB_CU_Name_t *cuName; + Cells_to_be_Activated_List_t *cellToActivate; + RRC_Version_t *rrcVer; + asn_enc_rval_t encRetVal; + DU_LOG("\nF1AP : Building F1 Setup Response\n"); + + /* Allocate the memory for F1SetupRequest_t */ + CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + + CU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_F1Setup; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = \ + SuccessfulOutcome__value_PR_F1SetupResponse; + f1SetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse; + + elementCnt = 4; + f1SetupRsp->protocolIEs.list.count = elementCnt; + f1SetupRsp->protocolIEs.list.size = elementCnt*sizeof(F1SetupResponseIEs_t *); + + CU_ALLOC(f1SetupRsp->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + if(f1SetupRsp->protocolIEs.list.array == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1ResponseIEs failed"); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx], \ + sizeof(F1SetupResponseIEs_t)); + if(f1SetupRsp->protocolIEs.list.array[idx] == NULLP) + { + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, \ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + /*TransactionID*/ + idx = 0; + f1SetupRsp->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID; + f1SetupRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupRsp->protocolIEs.list.array[idx]->value.present = \ + F1SetupResponseIEs__value_PR_TransactionID; + f1SetupRsp->protocolIEs.list.array[idx]->value.choice.TransactionID =\ + TRANS_ID; + + /*CU Name*/ + idx++; + f1SetupRsp->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_CU_Name; + f1SetupRsp->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + f1SetupRsp->protocolIEs.list.array[idx]->value.present = \ + F1SetupResponseIEs__value_PR_GNB_CU_Name; + cuName = &f1SetupRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_Name; + cuName->size = sizeof(cuCfgParams.cuName); + + CU_ALLOC(cuName->buf, sizeof(cuName->size)); + if(cuName->buf == NULLP) + { + for(idy=0; idyprotocolIEs.list.array[idy],\ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome,\ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + strcpy((char*)cuName->buf, (char*)cuCfgParams.cuName); + + /*Cells to be activated list*/ + idx++; + f1SetupRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_Cells_to_be_Activated_List ; + f1SetupRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupRsp->protocolIEs.list.array[idx]->value.present = \ + F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; + cellToActivate = &f1SetupRsp->protocolIEs.list.array[idx]->value.choice.\ + Cells_to_be_Activated_List; + cellCnt=1; + cellToActivate->list.count = cellCnt; + cellToActivate->list.size = \ + cellCnt*sizeof(struct Cells_to_be_Activated_List_ItemIEs *); + CU_ALLOC(cellToActivate->list.array,\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs *)); + if(cellToActivate->list.array == NULLP) + { + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy],\ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for(idy=0; idylist.array[idy],\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs )); + if(cellToActivate->list.array[idy] == NULLP) + { + CU_FREE(cellToActivate->list.array,\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs *)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, \ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + cellToActivate->list.array[0]->id = \ + ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cellToActivate->list.array[0]->criticality = Criticality_ignore; + cellToActivate->list.array[0]->value.present = \ + Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\ + nRCGI.pLMN_Identity.size = 3*sizeof(uint8_t); + CU_ALLOC(cellToActivate->list.array[0]->\ + value.choice.Cells_to_be_Activated_List_Item.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(uint8_t)); + if(cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.pLMN_Identity.buf == NULLP) + { + + for(idy=0; idylist.array[idy],\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs )); + } + + CU_FREE(cellToActivate->list.array,\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs *)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, \ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + plmnBuildCU(cuCfgParams.plmn , &cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.pLMN_Identity); + cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\ + nRCGI.nRCellIdentity.size = 5*sizeof(uint8_t); + CU_ALLOC(cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + if(cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf == NULLP) + { + CU_FREE(cellToActivate->list.array[0]->\ + value.choice.Cells_to_be_Activated_List_Item.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(uint8_t)); + for(idy=0; idylist.array[idy],\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs )); + } + + CU_FREE(cellToActivate->list.array,\ + sizeof(struct Cells_to_be_Activated_List_ItemIEs *)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, \ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for (int tmp = 0 ; tmp < cellToActivate->list.array[0]->value.\ + choice.Cells_to_be_Activated_List_Item.\ + nRCGI.nRCellIdentity.size-1; tmp++) + { + cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf[tmp] = 0; + } + cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf[4] = 16; + cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\ + nRCGI.nRCellIdentity.bits_unused = 4; + + /* RRC Version */ + idx++; + f1SetupRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_GNB_CU_RRC_Version; + f1SetupRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupRsp->protocolIEs.list.array[idx]->value.present = \ + F1SetupResponseIEs__value_PR_RRC_Version; + rrcVer = &f1SetupRsp->protocolIEs.list.array[idx]->value.choice.RRC_Version; + rrcVer->latest_RRC_Version.size = RRC_SIZE; + + CU_ALLOC(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + if(rrcVer->latest_RRC_Version.buf == NULLP) + { + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + /* Need to check RRC Version */ + rrcVer->latest_RRC_Version.buf[0] = cuCfgParams.rrcVersion.rrcVer; + rrcVer->latest_RRC_Version.bits_unused = 5; //TODO: pick from cuCfgParam. If not present, add it + CU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t)); + if(rrcVer->iE_Extensions == NULLP) + { + CU_FREE(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + rrcVer->iE_Extensions->list.count = 1; + rrcVer->iE_Extensions->list.size = sizeof(struct RRC_Version_ExtIEs *); + CU_ALLOC(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + if(rrcVer->iE_Extensions->list.array == NULLP) + { + CU_FREE(rrcVer->iE_Extensions,\ + sizeof(ProtocolExtensionContainer_4624P81_t)); + CU_FREE(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + CU_ALLOC(rrcVer->iE_Extensions->list.array[0],\ + sizeof(struct RRC_Version_ExtIEs)); + if(rrcVer->iE_Extensions->list.array[0] == NULLP) + { + CU_FREE(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + CU_FREE(rrcVer->iE_Extensions,\ + sizeof(ProtocolExtensionContainer_4624P81_t)); + CU_FREE(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + rrcVer->iE_Extensions->list.array[0]->id = \ + ProtocolIE_ID_id_latest_RRC_Version_Enhanced; + rrcVer->iE_Extensions->list.array[0]->criticality = Criticality_reject; + rrcVer->iE_Extensions->list.array[0]->extensionValue.present = \ + RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced; + rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.size = 3*sizeof(U8); + CU_ALLOC(rrcVer->iE_Extensions->list.\ + array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf,\ + 3*sizeof(U8)); + if(rrcVer->iE_Extensions->list.\ + array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf == NULLP) + { + CU_FREE(rrcVer->iE_Extensions->list.array[0],\ + sizeof(struct RRC_Version_ExtIEs)); + CU_FREE(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + CU_FREE(rrcVer->iE_Extensions,\ + sizeof(ProtocolExtensionContainer_4624P81_t)); + CU_FREE(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idy=0; idyprotocolIEs.list.array[idy], \ + sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[0] = 0; + rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[1] = 5; + rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[2] = 15; + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as UPER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); + + /* Clean up */ + CU_FREE(rrcVer->latest_RRC_Version.buf, sizeof(U8)); + CU_FREE(cuName->buf, sizeof(cuName->size)); + for(idx=0; idxprotocolIEs.list.array[idx], sizeof(F1SetupResponseIEs_t)); + } + CU_FREE(f1SetupRsp->protocolIEs.list.array, elementCnt * sizeof(F1SetupResponseIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + + /* Check encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nF1AP : Could not encode F1SetupResponse structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\nF1AP : Created APER encoded buffer for F1SetupResponse\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK) + { + DU_LOG("\nF1AP : Sending F1 Setup Response failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendF1SetupRsp */ + +/******************************************************************* + * + * @brief Builds and sends the DUUpdateAcknowledge + * + * @details + * + * Function : BuildAndSendDUUpdateAck + * + * Functionality: Constructs the DU Update Acknowledge message and sends + * it to the DU through SCTP. + * + * @params[in] void **buf,Buffer to which encoded pattern is written into + * @params[in] int *size,size of buffer + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildAndSendDUUpdateAck() +{ + U8 idx; + U8 elementCnt; + F1AP_PDU_t *f1apMsg = NULL; + GNBDUConfigurationUpdateAcknowledge_t *gNBDuCfgAck; + asn_enc_rval_t enRetVal; /* Encoder return value */ + + DU_LOG("\nF1AP : Building GNB-DU Config Update Ack\n"); + + /* Allocate the memory for F1SetupRequest_t */ + CU_ALLOC(f1apMsg, (Size)sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + + CU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_gNBDUConfigurationUpdate; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge; + gNBDuCfgAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; + + elementCnt = 1; + gNBDuCfgAck->protocolIEs.list.count = elementCnt; + gNBDuCfgAck->protocolIEs.list.size = elementCnt*sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t); + + /* Initialize the F1Setup members */ + CU_ALLOC(gNBDuCfgAck->protocolIEs.list.array, elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); + if(gNBDuCfgAck->protocolIEs.list.array == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for DuUpdateAcknowledgeIEs failed"); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx], sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t)); + if(gNBDuCfgAck->protocolIEs.list.array[idx] == NULLP) + { + CU_FREE(gNBDuCfgAck->protocolIEs.list.array, elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + /*TransactionID*/ + idx = 0; + gNBDuCfgAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID ; + gNBDuCfgAck->protocolIEs.list.array[idx]->criticality = Criticality_reject; + gNBDuCfgAck->protocolIEs.list.array[idx]->value.present = GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID; + gNBDuCfgAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID; + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as UPER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + enRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); + + /* Clean up */ + for(idx=0; idxprotocolIEs.list.array[idx], sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t)); + } + CU_FREE(gNBDuCfgAck->protocolIEs.list.array, elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); + CU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + + /* Checking encode results */ + if(enRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nF1AP : Could not encode DUConfigUpdateAcknowledge structure (at %s)",enRetVal.failed_type ? enRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\nF1AP : Created APER encoded buffer for DuConfigUpdateAcknowledge\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK) + { + DU_LOG("\nF1AP : Sending GNB-DU Config Update Ack failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + +}/* End of BuildAndSendDUUpdateAck*/ + +/******************************************************************* + * + * @brief Builds and sends the DLRRCMessageTransfer + * + * @details + * + * Function : BuildAndSendDLRRCMessageTransfer + * + * Functionality: Constructs the DL RRC Message Transfer and sends + * it to the CU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendDLRRCMessageTransfer() +{ + S16 ret; + U8 elementCnt; + U8 ieId; + U8 idx; + F1AP_PDU_t *f1apMsg = NULL; + DLRRCMessageTransfer_t *dlRRCMsg; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\n F1AP : Building DL RRC Message Transfer Message\n"); + + CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + CU_ALLOC(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + CU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_DLRRCMessageTransfer; + f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_DLRRCMessageTransfer; + dlRRCMsg = + &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + elementCnt = 3; + dlRRCMsg->protocolIEs.list.count = elementCnt; + dlRRCMsg->protocolIEs.list.size = \ + elementCnt * sizeof(DLRRCMessageTransferIEs_t *); + + /* Initialize the F1Setup members */ + CU_ALLOC(dlRRCMsg->protocolIEs.list.array, \ + elementCnt * sizeof(DLRRCMessageTransferIEs_t *)); + if(dlRRCMsg->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for DL RRC MessageTransferIEs failed"); + CU_FREE(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + CU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(DLRRCMessageTransferIEs_t)); + if(dlRRCMsg->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0; ieIdprotocolIEs.list.array[ieId],\ + sizeof(DLRRCMessageTransferIEs_t)); + } + CU_FREE(dlRRCMsg->protocolIEs.list.array,\ + elementCnt * sizeof(DLRRCMessageTransferIEs_t *)); + CU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + CU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*GNB CU UE F1AP ID*/ + dlRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + dlRRCMsg->protocolIEs.list.array[idx]->value.present = \ + DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; + + /*GNB DU UE F1AP ID*/ + idx++; + dlRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + dlRRCMsg->protocolIEs.list.array[idx]->value.present = \ + DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; + + /*SRBID*/ + idx++; + dlRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SRBID; + dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + dlRRCMsg->protocolIEs.list.array[idx]->value.present = \ + DLRRCMessageTransferIEs__value_PR_SRBID; + dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = DL_SRBID; + + /*RRCContainer*/ + //YET TO FILL + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode DL RRC Message Transfer structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for DL RRC Message transfer\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending DL RRC Message Transfer Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendDLRRCMessageTransfer */ + + +/******************************************************************* + * + * @brief Builds and sends the UE Setup Response + * + * @details + * + * Function : BuildAndSendUESetRsp + * + * Functionality: Constructs the UE Setup Response and sends + * it to the DU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendUESetRsp() +{ + S16 ret; + U8 elementCnt; + U8 cellCnt; + U8 ieId; + U8 idx; + U8 drbCnt; + U8 drbId; + F1AP_PDU_t *f1apMsg = NULL; + UEContextSetupResponse_t *ueSetRsp; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\n F1AP : Building UE Context Setup Response\n"); + + CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + CU_ALLOC(f1apMsg->choice.successfulOutcome, + sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + CU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.successfulOutcome->procedureCode = \ + ProcedureCode_id_UEContextSetup; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = \ + SuccessfulOutcome__value_PR_UEContextSetupResponse; + ueSetRsp = + &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse; + elementCnt = 2; + ueSetRsp->protocolIEs.list.count = elementCnt; + ueSetRsp->protocolIEs.list.size = \ + elementCnt * sizeof(UEContextSetupResponse_t *); + + /* Initialize the UESetup members */ + CU_ALLOC(ueSetRsp->protocolIEs.list.array, \ + ueSetRsp->protocolIEs.list.size); + if(ueSetRsp->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for UE Setup Response failed"); + CU_FREE(f1apMsg->choice.successfulOutcome, + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupResponseIEs_t)); + if(ueSetRsp->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0; ieIdprotocolIEs.list.array[ieId],\ + sizeof(UEContextSetupResponseIEs_t)); + } + CU_FREE(ueSetRsp->protocolIEs.list.array,\ + ueSetRsp->protocolIEs.list.size); + CU_FREE(f1apMsg->choice.successfulOutcome,\ + sizeof(SuccessfulOutcome_t)); + CU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*GNB CU UE F1AP ID*/ + ueSetRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetRsp->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; + + /*GNB DU UE F1AP ID*/ + idx++; + ueSetRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetRsp->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; + + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending UE Context Setup Request Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendUESetRsp */ +/******************************************************************* +* +* @brief Handles received F1AP message and sends back response +* +* @details +* +* Function : F1APMsgHdlr +* +* Functionality: +* - Decodes received F1AP control message +* - Prepares response message, encodes and sends to SCTP +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void F1APMsgHdlr(Buffer *mBuf) +{ + int i; + char *recvBuf; + MsgLen copyCnt; + MsgLen recvBufLen; + F1AP_PDU_t *f1apMsg; + asn_dec_rval_t rval; /* Decoder return value */ + F1AP_PDU_t f1apasnmsg ; + + DU_LOG("\nF1AP : Received F1AP message buffer"); + SPrntMsg(mBuf, 0,0); + + /* Copy mBuf into char array to decode it */ + SFndLenMsg(mBuf, &recvBufLen); + if(SGetSBuf(DFLT_REGION, DFLT_POOL, (Data **)&recvBuf, (Size)recvBufLen) != ROK) + { + DU_LOG("\nF1AP : Memory allocation failed"); + return; + } + if(SCpyMsgFix(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK) + { + DU_LOG("\nF1AP : Failed while copying %d", copyCnt); + return; + } + + printf("\nF1AP : Received flat buffer to be decoded : "); + for(i=0; i< recvBufLen; i++) + { + printf("%x",recvBuf[i]); + } + + /* Decoding flat buffer into F1AP messsage */ + f1apMsg = &f1apasnmsg; + memset(f1apMsg, 0, sizeof(F1AP_PDU_t)); + + rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0); + SPutSBuf(DFLT_REGION, DFLT_POOL, (Data *)recvBuf, (Size)recvBufLen); + if(rval.code == RC_FAIL || rval.code == RC_WMORE) + { + DU_LOG("\nF1AP : ASN decode failed"); + return; + } + printf("\n"); + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + switch(f1apMsg->present) + { + case F1AP_PDU_PR_initiatingMessage: + { + switch(f1apMsg->choice.initiatingMessage->value.present) + { + case InitiatingMessage__value_PR_F1SetupRequest: + { + DU_LOG("\nF1AP : F1 setup request received"); + BuildAndSendF1SetupRsp(); + break; + } + + case InitiatingMessage__value_PR_GNBDUConfigurationUpdate: + { + DU_LOG("\nF1AP : GNB-DU config update received"); + BuildAndSendDUUpdateAck(); + break; + } + + default: + { + DU_LOG("\nF1AP : Invalid type of intiating message [%d]",f1apMsg->choice.initiatingMessage->value.present); + return; + } + }/* End of switch(initiatingMessage) */ + break; + } + + }/* End of switch(f1apMsg->present) */ + +} /* End of F1APMsgHdlr */ + +/********************************************************************** + End of file + **********************************************************************/ diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h new file mode 100644 index 000000000..7991de636 --- /dev/null +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -0,0 +1,85 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all F1AP message handler related functionality */ +#include +#include +#include +#include +#include "ProtocolExtensionField.h" +#include "F1AP-PDU.h" +#include "Cells-to-be-Activated-List.h" + +#include "envopt.h" /* Environment options */ +#include "envdep.h" /* Environment dependent */ +#include "envind.h" /* Environment independent */ +#include "gen.h" /* General */ +#include "ssi.h" /* System services */ +#include "ss_queue.h" +#include "ss_task.h" +#include "ss_msg.h" + +#include "gen.x" /* General */ +#include "ssi.x" /* System services */ +#include "ss_queue.x" +#include "ss_task.x" +#include "ss_msg.x" + +#include "du_log.h" + +#define ENCODE_FAIL -1 +#define TRANS_ID 1 +#define RRC_SIZE 1 +#define ENC_BUF_MAX_LEN 100 +#define SUL_BAND_COUNT 0 +#define UL_SRBID 1 +#define DL_SRBID 0 +#define DU_ID 1 +#define CU_ID 1 +#define CRNTI 17017 +#define CELL_INDEX 0 + + +/* allocate and zero out a static buffer */ +#define CU_ALLOC(_datPtr, _size) \ +{ \ + S16 _ret; \ + _ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \ + (Data **)&_datPtr, _size); \ + if(_ret == ROK) \ + cmMemset((U8*)_datPtr, 0, _size); \ + else \ + _datPtr = NULLP; \ +} + +/* free a static buffer */ +#define CU_FREE(_datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(CU_APP_MEM_REG, CU_POOL, \ + (Data *)_datPtr, _size); + + + +extern char encBuf[ENC_BUF_MAX_LEN]; +int encBufSize; + +void F1APMsgHdlr(Buffer *mBuf); + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index 00340e4d8..61867dfc5 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -20,6 +20,7 @@ #include "cu_stub.h" #include "cu_stub_sctp.h" +#include "cu_stub_egtp.h" #define CU_ID 1 #define CU_NAME "ORAN_OAM_CU" @@ -29,6 +30,16 @@ #define CU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011" #define DU_PORT 38472 #define CU_PORT 38472 +#define DU_EGTP_PORT 39001 +#define CU_EGTP_PORT 39002 +#define RRC_VER 0 +#define EXT_RRC_VER 5 +#define PLMN_MCC0 3 +#define PLMN_MCC1 1 +#define PLMN_MCC2 1 +#define PLMN_MNC0 4 +#define PLMN_MNC1 8 +#define PLMN_MNC2 0 /******************************************************************* * @@ -50,6 +61,10 @@ void sctpNtfyInd(CmInetSctpNotification *ntfy) //TODO } +void init_log() +{ + openlog("CU_STUB",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); +} /******************************************************************* * * @brief Main function of CU APP @@ -71,13 +86,17 @@ void sctpNtfyInd(CmInetSctpNotification *ntfy) S16 tst() { - printf("\nStarting cu_app"); - + init_log(); + DU_LOG("\nStarting CU_STUB"); /* Read CU configurations */ readCuCfg(); + /* Start CU-EGTP */ + egtpActvInit(); + egtpInitReq(); + /* Initializing SCTP global parameters */ - sctpActvInit(0, 0, 0, 0); + sctpActvInit(); /* Start CU-SCTP to listen on incoming connection */ sctpStartReq(); @@ -106,7 +125,7 @@ void readCuCfg() { U32 ipv4_du, ipv4_cu; - printf("\nReading CU configurations"); + DU_LOG("\nReading CU configurations"); cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du); cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu); @@ -128,7 +147,30 @@ void readCuCfg() cuCfgParams.sctpParams.cuIpAddr.ipV6Pres = false; //strcpy(cuCfgParams.sctpParams.cuIpAddr.ipV6Addr, DU_IP_V6_ADDR); cuCfgParams.sctpParams.cuPort = CU_PORT; - + + /*PLMN*/ + cuCfgParams.plmn.mcc[0] = PLMN_MCC0; + cuCfgParams.plmn.mcc[1] = PLMN_MCC1; + cuCfgParams.plmn.mcc[2] = PLMN_MCC2; + cuCfgParams.plmn.mnc[0] = PLMN_MNC0; + cuCfgParams.plmn.mnc[1] = PLMN_MNC1; + cuCfgParams.plmn.mnc[2] = PLMN_MNC2; + + /*RRC Version*/ + cuCfgParams.rrcVersion.rrcVer = RRC_VER; + cuCfgParams.rrcVersion.extRrcVer = EXT_RRC_VER; + + + /* EGTP Parameters */ + cuCfgParams.egtpParams.localIp.ipV4Pres = TRUE; + cuCfgParams.egtpParams.localIp.ipV4Addr = ipv4_cu; + cuCfgParams.egtpParams.localPort = CU_EGTP_PORT; + cuCfgParams.egtpParams.destIp.ipV4Pres = TRUE; + cuCfgParams.egtpParams.destIp.ipV4Addr = ipv4_du; + cuCfgParams.egtpParams.destPort = DU_EGTP_PORT; + cuCfgParams.egtpParams.minTunnelId = 0; + cuCfgParams.egtpParams.maxTunnelId = 10; + } /* End of readCuCfg */ /********************************************************************** End of file diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index b2b98adcc..b3a2e5800 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -35,6 +35,8 @@ #include "ss_task.h" #include "ss_msg.h" #include "cm_inet.h" +#include "cm_llist.h" /* Common link list defines */ +#include "cm_hash.h" /* Common hashlist defines */ #include "gen.x" /* General */ #include "ssi.x" /* System services */ @@ -43,13 +45,34 @@ #include "ss_msg.x" #include "cm_lib.x" #include "cm_inet.x" +#include "cm_llist.x" /* Common link list defines */ +#include "cm_hash.x" /* Common hashlist defines */ +#include "du_log.h" #define MAX_IPV6_LEN 16 -#define CU_DU_NAME_LEN_MAX 50 /* Max length of CU/DU name string */ +#define CU_DU_NAME_LEN_MAX 30 /* Max length of CU/DU name string */ #define CU_APP_MEM_REG 1 #define CU_POOL 1 +/* allocate and zero out a static buffer */ +#define CU_ALLOC(_datPtr, _size) \ +{ \ + S16 _ret; \ + _ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \ + (Data **)&_datPtr, _size); \ + if(_ret == ROK) \ + cmMemset((U8*)_datPtr, 0, _size); \ + else \ + _datPtr = NULLP; \ +} + +/* free a static buffer */ +#define CU_FREE(_datPtr, _size) \ + SPutSBuf(CU_APP_MEM_REG, CU_POOL, \ + (Data *)_datPtr, _size); + + typedef struct ipAddr { Bool ipV4Pres; @@ -64,6 +87,16 @@ typedef struct RrcVersion U32 extRrcVer; /* Latest RRC version extended */ }RrcVersion; +typedef struct egtpParams +{ + SctpIpAddr localIp; + U16 localPort; + SctpIpAddr destIp; + U16 destPort; + U32 minTunnelId; + U32 maxTunnelId; +}EgtpParams; + typedef struct sctpParams { SctpIpAddr duIpAddr; @@ -72,11 +105,20 @@ typedef struct sctpParams U16 cuPort; }SctpParams; +typedef struct fPLMN +{ + U8 mcc[3]; + U8 mnc[3]; +}Plmn; + + typedef struct cuCfgParams { U32 cuId; char cuName[CU_DU_NAME_LEN_MAX]; SctpParams sctpParams; + Plmn plmn; + EgtpParams egtpParams; RrcVersion rrcVersion; }CuCfgParams; CuCfgParams cuCfgParams; //global variable to hold all configs diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c new file mode 100644 index 000000000..b8a82dead --- /dev/null +++ b/src/cu_stub/cu_stub_egtp.c @@ -0,0 +1,842 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all EGTP related functionality */ + +#include +#include "cu_stub_egtp.h" + +/* Global variable declaration */ +EgtpGlobalCb egtpCb; + +/************************************************************************** + * @brief Task Initiation callback function. + * + * @details + * + * Function : egtpActvInit + * + * Functionality: + * This function is supplied as one of parameters during EGTP's + * task registration. SSI will invoke this function once, after + * it creates and attaches this TAPA Task to a system task. + * + * @param[in] Ent entity, the entity ID of this task. + * @param[in] Inst inst, the instance ID of this task. + * @param[in] Region region, the region ID registered for memory + * usage of this task. + * @param[in] Reason reason. + * @return ROK - success + * RFAILED - failure + ***************************************************************************/ +S16 egtpActvInit() +{ + DU_LOG("\n\nEGTP : Initializing"); + cmMemset ((U8 *)&egtpCb, 0, sizeof(EgtpGlobalCb)); + protType = CM_INET_PROTO_UDP; + RETVALUE(ROK); +} + + +/************************************************************************** + * @brief Task Activation callback function. + * + * @details + * + * Function : egtpActvTsk + * + * Functionality: + * This function handles all EGTP messages received + * This API is registered with SSI during the + * Task Registration of DU APP. + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf, Packed primitive parameters in the + * buffer. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 egtpInitReq() +{ + S16 ret = ROK; + EgtpTnlEvt tnlEvt; + + ret = cuEgtpCfgReq(); + if(ret != ROK) + { + DU_LOG("\nEGTP : Configuration failed"); + RETVALUE(ret); + } + + ret = cuEgtpSrvOpenReq(); + if(ret != ROK) + { + DU_LOG("\nEGTP : Transport server open request failed"); + RETVALUE(ret); + } + + tnlEvt.action = EGTP_TNL_MGMT_ADD; + tnlEvt.lclTeid = 10; + tnlEvt.remTeid = 1; + ret = cuEgtpTnlMgmtReq(tnlEvt); + if(ret != ROK) + { + DU_LOG("\n EGTP : Tunnel management request failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ret); + +} /* egtpInitReq */ + +/************************************************************************** + * @brief EGTP server configuration + * + * @details + * + * Function : egtpCfgReq + * + * Functionality: + * This function handles EGTP configuration request. + * + * @return ROK - success + * RFAILED - failure + * + * ***********************************************************************/ +S16 cuEgtpCfgReq() +{ + U8 ret; + + cmMemcpy((U8 *)&egtpCb.egtpCfg, (U8 *)&cuCfgParams.egtpParams, (PTR)sizeof(EgtpParams)); + + egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; + + egtpCb.dstCb.dstIp = CM_INET_NTOH_U32(egtpCb.egtpCfg.destIp.ipV4Addr); + egtpCb.dstCb.dstPort = egtpCb.egtpCfg.destPort; + egtpCb.dstCb.sendTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.dstCb.sendTptSrvr.addr.port = egtpCb.egtpCfg.localPort; + egtpCb.dstCb.numTunn = 0; + + ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_U32MOD, CU_APP_MEM_REG, CU_POOL); + + if(ret != ROK) + { + DU_LOG("\nEGTP : TeId hash list initialization failed"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\nEGTP : Configuration successful"); + } + + RETVALUE(ROK); +} /* cuEgtpCfgReq */ + +/************************************************************************** + * @brief EGTP server open request + * + * @details + * + * Function : egtpSrvOpenReq + * + * Functionality: + * This function handles EGTP open server request. + * It opens udp socket to receive/send msgs. + * + * @param[in] Pst *pst, post structure + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ + +S16 cuEgtpSrvOpenReq(Pst *pst) +{ + + U8 ret; + + DU_LOG("\nEGTP : Received open server request"); + + sockType = CM_INET_DGRAM; + if(ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType)) != ROK) + { + DU_LOG("\nEGTP : Failed to open UDP socket"); + RETVALUE(RFAILED); + } + + ret = cmInetBind(&(egtpCb.recvTptSrvr.sockFd), &(egtpCb.recvTptSrvr.addr)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Failed to bind socket"); + RETVALUE(RFAILED); + } + + if(ret = (cmInetSocket(sockType, &(egtpCb.dstCb.sendTptSrvr.sockFd), protType)) != ROK) + { + DU_LOG("\nEGTP : Failed to open UDP socket"); + RETVALUE(RFAILED); + } + + ret = cmInetBind(&(egtpCb.dstCb.sendTptSrvr.sockFd), &(egtpCb.dstCb.sendTptSrvr.addr)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Failed to bind socket"); + RETVALUE(RFAILED); + } + + /* TODO: set socket options */ + + DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); + RETVALUE(ROK); +} /* cuEgtpSrvOpenReq */ + + +/************************************************************************** + * @brief EGTP tunnel management request + * + * @details + * + * Function : cuEgtpTnlMgmtReq + * + * Functionality: + * This function handles EGTP tunnel managament request + * + * @param[in] Pst *pst, post structure + * Tunnel Eveny structure + * @return ROK - success + * RFAILED - failure + * + + * ***************************************************************************/ +S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt) +{ + S8 ret; + + DU_LOG("\nEGTP : Received tunnel management request"); + switch(tnlEvt.action) + { + case EGTP_TNL_MGMT_ADD: + { + ret = cuEgtpTnlAdd(tnlEvt); + break; + } + case EGTP_TNL_MGMT_MOD: + { + ret = cuEgtpTnlMod(tnlEvt); + break; + } + case EGTP_TNL_MGMT_DEL: + { + ret = cuEgtpTnlDel(tnlEvt); + break; + } + default: + { + DU_LOG("\nEGTP : Invalid tunnel management action[%d]", tnlEvt.action); + ret = RFAILED; + } + } + + RETVALUE(ret); +} + +/************************************************************************** + * @brief EGTP tunnel addition + * + * @details + * + * Function : cuEgtpTnlAdd + * + * Functionality: + * This function handles EGTP tunnel addition + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt) +{ + S16 ret; + EgtpTeIdCb *teidCb; + EgtpMsgHdr preDefHdr; /* pre-define header for this tunnel */ + + + DU_LOG("\nEGTP : Tunnel addition : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, (Data **)&teidCb, (Size)sizeof(EgtpTeIdCb)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Memory allocation failed"); + RETVALUE(RFAILED); + } + + + cmMemset((U8 *)teidCb, 0, sizeof(EgtpTeIdCb)); + teidCb->teId = tnlEvt.lclTeid; + teidCb->remTeId = tnlEvt.remTeid; + + ret = cmHashListInsert(&(egtpCb.dstCb.teIdLst), (PTR)teidCb, (U8 *)&(teidCb->teId), sizeof(U32)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Failed to insert in hash list"); + SPutSBuf(CU_APP_MEM_REG, CU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); + RETVALUE(RFAILED); + } + egtpCb.dstCb.numTunn++; + + /* Encoding pre-defined header */ + cmMemset((U8*)&preDefHdr, 0, sizeof(EgtpMsgHdr)); + preDefHdr.msgType = EGTPU_MSG_GPDU; + preDefHdr.teId = teidCb->remTeId; + preDefHdr.extHdr.pdcpNmb.pres = FALSE; + preDefHdr.extHdr.udpPort.pres = FALSE; + preDefHdr.nPdu.pres = FALSE; + + cuEgtpEncodeHdr((U8 *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); + +/* SPutSBuf(CU_APP_MEM_REG, CU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb));*/ + + RETVALUE(ROK); +} /* cuEgtpTnlAdd */ + +/************************************************************************** + * @brief EGTP tunnel modification + * + * @details + * + * Function : cuEgtpTnlMod + * + * Functionality: + * This function handles EGTP tunnel modification + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt) +{ +#if 0 + S16 ret; + EgtpTeIdCb *teidCb = NULLP; + + printf("\nTunnel modification : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.teId), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + printf("\nTunnel id not found"); + RETVALUE(RFAILED); + } + + teidCb->teId = tnlEvt.lclTeid; + teidCb->remTeId = tnlEvt.remTeid; +#endif + RETVALUE(ROK); +} + +/************************************************************************** + * @brief EGTP tunnel deletion + * + * @details + * + * Function : cuEgtpTnlDel + * + * Functionality: + * This function handles EGTP tunnel deletion + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt) +{ + EgtpTeIdCb *teidCb = NULLP; + + DU_LOG("\nEGTP : Tunnel deletion : Local Teid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.lclTeid), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + DU_LOG("\nEGTP : Tunnel id[%d] not configured", tnlEvt.lclTeid); + RETVALUE(RFAILED); + } + + cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb); + SPutSBuf(CU_APP_MEM_REG, CU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); + egtpCb.dstCb.numTunn--; + + RETVALUE(ROK); +} /* cuEgtpTnlDel */ + +/******************************************************************* + * + * @brief Encodes message header + * + * @details + * + * Function : cuEgtpEncodeHdr + * + * Functionality: + * Encodes EGTP message haeder + * + * @params[in] EGTP message + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 cuEgtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) +{ + U8 tmpByte = 0; /* Stores one byte of data for enc */ + U8 cnt = EGTP_MAX_HDR_LEN; /* Stores the position */ + Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + U16 nwWord = 0; + + /* Encoding header */ + tmpByte |= EGTP_MASK_BIT6; /* Setting 6th LSB of 1st byte as version */ + tmpByte |= EGTP_MASK_BIT5; /* Setting 5th LSB of 1st byte as protocol type */ + + if(preDefHdr->extHdr.udpPort.pres || preDefHdr->extHdr.pdcpNmb.pres) + { + tmpByte |= EGTP_MASK_BIT3; /* Setting 3rd LSB of 1st byte if Extension heaeder is present */ + } + + if(preDefHdr->seqNum.pres) + { + tmpByte |= EGTP_MASK_BIT2; + } + + if(preDefHdr->nPdu.pres) + { + tmpByte |= EGTP_MASK_BIT1; + } + + if((tmpByte & EGTP_MASK_BIT1) || (tmpByte & EGTP_MASK_BIT2)||(tmpByte & EGTP_MASK_BIT3)) + { + extPres = TRUE; + } + preEncodedHdr[--cnt] = tmpByte; + preEncodedHdr[--cnt] = preDefHdr->msgType; + + /* Encode Tunnel endpoint */ + preEncodedHdr[--cnt] = 0; + preEncodedHdr[--cnt] = 0; + nwWord = (U16)(GetHiWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); + nwWord = (U16)(GetLoWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); + + /* Encode sequence number */ + if(preDefHdr->seqNum.pres) + { + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->seqNum.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->seqNum.val); + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + preEncodedHdr[--cnt] = 0; + } + + if(preDefHdr->nPdu.pres) + { + preEncodedHdr[--cnt] = preDefHdr->nPdu.val; + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + } + + if(preDefHdr->extHdr.udpPort.pres) + { + preEncodedHdr[--cnt] = EGTP_EXT_HDR_UDP_TYPE; + preEncodedHdr[--cnt] = 1; + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->extHdr.udpPort.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->extHdr.udpPort.val); + } + + if(preDefHdr->extHdr.pdcpNmb.pres) + { + preEncodedHdr[--cnt] = EGTP_EXT_HDR_PDCP_TYPE; + preEncodedHdr[--cnt] = 1; + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->extHdr.pdcpNmb.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->extHdr.pdcpNmb.val); + } + + if(tmpByte & EGTP_MASK_BIT3) + { + preEncodedHdr[--cnt] = 0; + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + } + + *hdrIdx = cnt; + RETVALUE(ROK); + +} /* egtpEncodeHdr */ + +S16 cuEgtpHdlRecvMsg(Buffer *mBuf) +{ + /*Decoding of EGTP message header */ + cuEgtpDecodeHdr(mBuf); + + /* Start Pumping data from CU to DU */ + RETVALUE(cuEgtpDatReq()); + +} + +S16 cuEgtpDecodeHdr(Buffer *mBuf) +{ + EgtpMsg egtpMsg; + S16 retVal = ROK; /* Holds the return value */ + U8 tmpByte[5]; /* Holds one byte of data after Dec */ + U8 version = 0; /* Holds the version type, decoded */ + MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */ + MsgLen bufLen = 0; /* Holds the total buffer length */ + U8 extHdrType = 0; /* Holds the Extension hdr type */ + U8 extHdrLen = 0; /* Extension hdr length */ + Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + + SFndLenMsg(mBuf, &bufLen); + + /* Decode version */ + SRemPreMsg(&tmpByte[0], mBuf); + version = tmpByte[0] >> 5; + + /* Decode message type */ + SRemPreMsg((Data*)&(egtpMsg.msgHdr.msgType), mBuf); + + /* Decode message length */ + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + msgLen = (tmpByte[1] << 8) | tmpByte[2]; + + /* Decode tunnel id */ + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + SRemPreMsg(&tmpByte[3], mBuf); + SRemPreMsg(&tmpByte[4], mBuf); + egtpMsg.msgHdr.teId = (tmpByte[1] << 24) | (tmpByte[2] << 16) | (tmpByte[3] << 8) | tmpByte[4]; + + if((tmpByte[0] & EGTP_MASK_BIT1) || (tmpByte[0] & EGTP_MASK_BIT2)||(tmpByte[0] & EGTP_MASK_BIT3)) + { + extPres = TRUE; + } + + /* Decode sequence number */ + if ( tmpByte[0] & EGTP_MASK_BIT2 ) + { + egtpMsg.msgHdr.seqNum.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg.msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; + } + else if(extPres) + { + egtpMsg.msgHdr.seqNum.pres = 0; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg.msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; + } + + /* Decode N-PDU number */ + if ( tmpByte[0] & EGTP_MASK_BIT1 ) + { + egtpMsg.msgHdr.nPdu.pres = TRUE; + SRemPreMsg(&(egtpMsg.msgHdr.nPdu.val), mBuf); + } + else if(extPres) + { + egtpMsg.msgHdr.nPdu.pres = TRUE; + SRemPreMsg(&(egtpMsg.msgHdr.nPdu.val), mBuf); + } + + if(extPres & EGTP_MASK_BIT1) + { + SRemPreMsg(&extHdrType, mBuf); + while( 0 != extHdrType) + { + switch (extHdrType) + { + case EGTP_EXT_HDR_UDP_TYPE: + { + SRemPreMsg(&extHdrLen, mBuf); + if(extHdrLen == 0x01) + { + egtpMsg.msgHdr.extHdr.udpPort.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg.msgHdr.extHdr.udpPort.val = (tmpByte[1] << 8) | tmpByte[2]; + } + break; + } + + case EGTP_EXT_HDR_PDCP_TYPE: + { + SRemPreMsg(&extHdrLen, mBuf); + if(extHdrLen == 0x01) + { + egtpMsg.msgHdr.extHdr.pdcpNmb.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg.msgHdr.extHdr.pdcpNmb.val = (tmpByte[1] << 8) | tmpByte[2]; + } + break; + } + } /* End of switch */ + + SRemPreMsg(&extHdrType, mBuf); + + } /* End of while */ + } /* End of if(extPres & EGTP_MASK_BIT1) */ + else if(extPres) + { + SRemPreMsg(&extHdrType, mBuf); + } + + DU_LOG("\nEGTP : Message Buffer after decoding header "); + SPrntMsg(mBuf, 0, 0); + + RETVALUE(ROK); + +} /* End of cuEgtpDecodeHdr */ + +S16 cuEgtpDatReq() +{ + U8 cnt = 0; + EgtpMsg egtpMsg; + + /* Build Application message that is supposed to come from app to egtp */ + BuildAppMsg(&egtpMsg); + + /* Encode EGTP header to build final EGTP message */ + BuildEgtpMsg(&egtpMsg); + + /* Send Message to peer */ + while(cnt < 20) + { + DU_LOG("\nEGTP : Sending message[%d]", cnt+1); + cuEgtpSendMsg(egtpMsg.msg); + cnt++; + } + + SPutMsg(egtpMsg.msg); + + RETVALUE(ROK); +} + + +S16 BuildAppMsg(EgtpMsg *egtpMsg) +{ + char data[30] = "This is EGTP data from CU"; + int datSize = 30; + + Buffer *mBuf; + + if(SGetMsg(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK) + { + if(SAddPstMsgMult((Data *)data, datSize, mBuf) != ROK) + { + DU_LOG("\nEGTP : SAddPstMsgMult failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + } + else + { + DU_LOG("\nEGTP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + /* filling IPv4 header */ + CmIpv4Hdr ipv4Hdr; + MsgLen mLen; + + mLen = 0; + SFndLenMsg(mBuf, &mLen); + + cmMemset((U8 *)&ipv4Hdr, 0, sizeof(CmIpv4Hdr)); + ipv4Hdr.length = CM_IPV4_HDRLEN + mLen; + ipv4Hdr.hdrVer = 0x45; + ipv4Hdr.proto = 1; + ipv4Hdr.srcAddr = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + ipv4Hdr.destAddr = CM_INET_NTOH_U32(egtpCb.egtpCfg.destIp.ipV4Addr); + + /* Packing IPv4 header into buffer */ + S16 ret, cnt, idx; + Data revPkArray[CM_IPV4_HDRLEN]; + Data pkArray[CM_IPV4_HDRLEN]; + + /* initialize locals */ + cnt = 0; + cmMemset(revPkArray, 0, CM_IPV4_HDRLEN); + cmMemset(pkArray, 0, CM_IPV4_HDRLEN); + + /* Pack Header Version */ + pkArray[cnt++] = ipv4Hdr.hdrVer; + + /* Pack TOS */ + pkArray[cnt++] = ipv4Hdr.tos; + + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.length); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.length); + + /* Pack Id */ + pkArray[cnt++] = (Data) GetHiByte(ipv4Hdr.id); + pkArray[cnt++] = (Data) GetLoByte(ipv4Hdr.id); + + /* Pack Offset */ + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.off); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.off); + + /* Pack TTL */ + pkArray[cnt++] = ipv4Hdr.ttl; + + /* Pack Protocol */ + pkArray[cnt++] = ipv4Hdr.proto; + + /* Pack Checksum */ + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.chkSum); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.chkSum); + + /* Pack Source Address */ + pkArray[cnt++] = (Data)GetHiByte(GetHiWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetHiWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetHiByte(GetLoWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetLoWord(ipv4Hdr.srcAddr)); + + /* Pack Destination Address */ + pkArray[cnt++] = (Data)GetHiByte(GetHiWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetHiWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetHiByte(GetLoWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetLoWord(ipv4Hdr.destAddr)); + + for (idx = 0; idx < CM_IPV4_HDRLEN; idx++) + revPkArray[idx] = pkArray[CM_IPV4_HDRLEN - idx -1]; + + /* this function automatically reverses revPkArray */ + ret = SAddPreMsgMult(revPkArray, (MsgLen)cnt, mBuf); + + egtpMsg->msgHdr.msgType = EGTPU_MSG_GPDU; + egtpMsg->msgHdr.nPdu.pres = FALSE; + egtpMsg->msgHdr.seqNum.pres = FALSE; + egtpMsg->msgHdr.extHdr.udpPort.pres = FALSE; + egtpMsg->msgHdr.extHdr.pdcpNmb.pres = FALSE; + egtpMsg->msgHdr.teId = 10; + egtpMsg->msg = mBuf; + + RETVALUE(ROK); +} + + +S16 BuildEgtpMsg(EgtpMsg *egtpMsg) +{ + EgtpTeIdCb *teidCb = NULLP; + MsgLen tPduSize; + U8 hdrLen; + U32 msgLen; + EgtpMsgHdr *msgHdr; + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(egtpMsg->msgHdr.teId), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + DU_LOG("\nEGTP : Tunnel id[%d] not configured", egtpMsg->msgHdr.teId); + RETVALUE(LCM_REASON_INVALID_PAR_VAL); + } + + msgHdr = &(egtpMsg->msgHdr); + + hdrLen = teidCb->preEncodedHdr.cnt; + + if(msgHdr->extHdr.pdcpNmb.pres) + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= EGTP_MASK_BIT3; + teidCb->preEncodedHdr.hdr[hdrLen] = EGTP_EXT_HDR_PDCP_TYPE; + teidCb->preEncodedHdr.hdr[--hdrLen] = 1; + teidCb->preEncodedHdr.hdr[--hdrLen] = GetHiByte(msgHdr->extHdr.pdcpNmb.val); + teidCb->preEncodedHdr.hdr[--hdrLen] = GetLoByte(msgHdr->extHdr.pdcpNmb.val); + teidCb->preEncodedHdr.hdr[--hdrLen] = 0; + } + else + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT3); + } + + SFndLenMsg(egtpMsg->msg, &tPduSize); + + /*Adjust the header to fill the correct length*/ + msgLen = tPduSize + (EGTP_MAX_HDR_LEN - hdrLen) - 0x08; + + /*********************************************** + * Fill the length field of the message header * + ***********************************************/ + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 3] = (U8)GetHiByte(msgLen); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 4] = (U8)GetLoByte(msgLen); + + /*Update the sequence number*/ + if(egtpMsg->msgHdr.seqNum.pres) + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= (EGTP_MASK_BIT2); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 9] = (U8)GetHiByte(egtpMsg->msgHdr.seqNum.val); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 10] = (U8)GetLoByte(egtpMsg->msgHdr.seqNum.val); + } + else + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT2); + } + + SAddPreMsgMult(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg->msg); + + DU_LOG("\nEGTP : Sending message buffer"); + SPrntMsg(egtpMsg->msg, 0, 0); + + RETVALUE(ROK); +} + +S16 cuEgtpSendMsg(Buffer *mBuf) +{ + S16 ret; + MsgLen txLen; + CmInetMemInfo info; + CmInetAddr dstAddr; + + info.region = CU_APP_MEM_REG; + info.pool = CU_POOL; + + dstAddr.port = EGTP_DFLT_PORT; + dstAddr.address = egtpCb.dstCb.dstIp; + + ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, mBuf, &txLen, CM_INET_NO_FLAG); + if(ret != ROK && ret != RWOULDBLOCK) + { + DU_LOG("\nEGTP : Message send failure"); + RETVALUE(RFAILED); + } + + DU_LOG("\nEGTP : Message Sent"); + + RETVALUE(ROK); +} diff --git a/src/cu_stub/cu_stub_egtp.h b/src/cu_stub/cu_stub_egtp.h new file mode 100644 index 000000000..ba0c1316a --- /dev/null +++ b/src/cu_stub/cu_stub_egtp.h @@ -0,0 +1,144 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all SCTP related functionality */ + +#ifndef __CU_STUB_EGTP_H__ +#define __CU_STUB_EGTP_H__ + +#include "cu_stub.h" +#include "cm_inet.h" +#include "cm_tpt.h" + +#include "cm_inet.x" +#include "cm_tpt.x" + +#define EGTP_DFLT_PORT 2152 +#define EGTP_TNL_MGMT_ADD 1 +#define EGTP_TNL_MGMT_MOD 2 +#define EGTP_TNL_MGMT_DEL 3 + +#define EGTP_MAX_HDR_LEN 40 + +#define EGTP_EXT_HDR_UDP_TYPE 64 +#define EGTP_EXT_HDR_PDCP_TYPE 192 + +#define EGTP_MASK_BIT1 0x01 +#define EGTP_MASK_BIT2 0x02 +#define EGTP_MASK_BIT3 0x04 +#define EGTP_MASK_BIT4 0x08 +#define EGTP_MASK_BIT5 0x10 +#define EGTP_MASK_BIT6 0x20 +#define EGTP_MASK_BIT7 0x40 +#define EGTP_MASK_BIT8 0x80 + +U8 sockType; +U8 protType; + +typedef enum egtpMsgType +{ + EGTP_MSG_INVALID, + EGTPU_MSG_ECHO_REQ, + EGTPU_MSG_ECHO_RSP, + EGTPU_MSG_ERROR_IND = 26, + EGTPU_MSG_SUPP_EXT_HDR_NTF = 31, + EGTPU_MSG_END_MARKER = 254, + EGTPU_MSG_GPDU, + EGTP_MSG_MAX +}EgtpMsgType; + +/*Extension Header */ +typedef struct egtpExtHdr +{ + TknU16 udpPort; /**< UDP Port */ + TknU16 pdcpNmb; /**< PDCP Number */ +}EgtpExtHdr; + +/*Structure for MsgHdr */ +typedef struct egtpMsgHdr +{ + TknU8 nPdu; /**< N-PDU Number */ + TknU32 seqNum; /**< Sequence Number */ + EgtpExtHdr extHdr; /**< Extension headers present flag */ + U32 teId; /**< Tunnel Endpoint Id */ + U8 msgType; /**< eGTP-U Message Type */ +}EgtpMsgHdr; + +typedef struct egtpMsg +{ + EgtpMsgHdr msgHdr; + Buffer *msg; +}EgtpMsg; + +typedef struct egtpTnlEvt +{ + U8 action; + U32 lclTeid; + U32 remTeid; +}EgtpTnlEvt; + +typedef struct egtpTptSrvr +{ + CmInetAddr addr; + CmInetFd sockFd; /* Socket file descriptor */ +}EgtpTptSrvr; + +typedef struct EgtpTeIdCb +{ + U32 teId; /* Local tunnel id */ + U32 remTeId; /* Remote tunnel id */ + struct + { + U8 hdr[EGTP_MAX_HDR_LEN]; + U8 cnt; + }preEncodedHdr; /* Pre-encoded header for PDUs on this tunnel */ +}EgtpTeIdCb; + +typedef struct egtpDstCb +{ + CmInetIpAddr dstIp; /* destination IP */ + U16 dstPort; /* Remote port that sends data */ + EgtpTptSrvr sendTptSrvr; /* Transport server for sending UDP msg to */ + U32 numTunn; /* Number of tunnels */ + CmHashListCp teIdLst; /* Tunnel Id list for this destination */ +}EgtpDstCb; + +typedef struct egtpGlobalCb +{ + EgtpParams egtpCfg; /* EGTP configuration */ + EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */ + EgtpDstCb dstCb; /* Destination endpoint */ +}EgtpGlobalCb; +extern EgtpGlobalCb egtpCb; /* EGTP global control block */ + +S16 egtpActvInit(); +S16 cuEgtpCfgReq(); +S16 cuEgtpSrvOpenReq(); +S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt); +S16 cuEgtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx); +S16 cuEgtpHdlRecvMsg(Buffer *mBuf); +S16 cuEgtpDatReq(); +S16 BuildAppMsg(EgtpMsg *egtpMsg); +S16 BuildEgtpMsg(EgtpMsg *egtpMsg); +S16 cuEgtpSendMsg(Buffer *mBuf); +S16 cuEgtpDecodeHdr(Buffer *mBuf); + +#endif diff --git a/src/cu_stub/cu_stub_sctp.c b/src/cu_stub/cu_stub_sctp.c index c7a3eeb1c..f4452acec 100644 --- a/src/cu_stub/cu_stub_sctp.c +++ b/src/cu_stub/cu_stub_sctp.c @@ -19,21 +19,9 @@ /* This file contains all SCTP related functionality */ #include -#include "f1ap_msg_hdl.h" +#include "cu_f1ap_msg_hdl.h" #include "cu_stub_sctp.h" - -/* Global variable declaration */ -CmInetFd lstnSockFd; /* Listening Socket file descriptor */ -CmInetFd sockFd; /* Socket File descriptor */ -U8 socket_type; /* Socket type */ -Bool nonblocking; /* Blocking/Non-blocking socket */ -Bool connUp; /* Is connection up */ -int assocId; /* Assoc Id of connected assoc */ - -CmInetNetAddrLst localAddrLst; -CmInetNetAddrLst remoteAddrLst; - -SctpParams *sctpCfg; /* SCTP configurations at DU */ +#include "cu_stub_egtp.h" /************************************************************************** * @brief Task Initiation callback function. @@ -55,8 +43,9 @@ SctpParams *sctpCfg; /* SCTP configurations at DU */ * @return ROK - success * RFAILED - failure ***************************************************************************/ -S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason) +S16 sctpActvInit() { + DU_LOG("\n\nSCTP : Initializing"); connUp = FALSE; assocId = 0; nonblocking = FALSE; @@ -116,24 +105,24 @@ S16 openSctpEndp() socket_type = CM_INET_STREAM; do{ - ret = cmInetSocket(socket_type, &lstnSockFd, IPPROTO_SCTP,(sctpCfg->cuIpAddr.ipV4Pres ? AF_INET : AF_INET6)); + ret = cmInetSocket(socket_type, &lstnSockFd, IPPROTO_SCTP); if (ret != ROK) { numRetry++; if(numRetry >= MAX_RETRY) { - printf("\nAll attempts to open socket failed."); + DU_LOG("\nSCTP : All attempts to open socket failed."); /* Send indication to du_app */ RETVALUE(RFAILED); } else { - printf("\nRetrying socket opening"); + DU_LOG("\nSCTP : Retrying socket opening"); } } else { - printf("\nSocket[%d] opened successfully",lstnSockFd.fd); + DU_LOG("\nSCTP : Socket[%d] open",lstnSockFd.fd); break; } }while(numRetry < MAX_RETRY); @@ -189,19 +178,19 @@ S16 bindSctpEndp() numRetry++; if(numRetry >= MAX_RETRY) { - printf("\nAll attempts to bind socket failed."); + DU_LOG("\nSCTP : All attempts to bind socket failed."); cmInetClose(&lstnSockFd); /* Send indication to du_app */ RETVALUE(RFAILED); } else { - printf("\nRetrying socket binding"); + DU_LOG("\nSCTP : Retrying socket binding"); } } else { - printf("\nSocket bind successful"); + DU_LOG("\nSCTP : Socket bind successful"); break; } }while(numRetry < MAX_RETRY); @@ -264,14 +253,16 @@ S16 sctpAccept() { U8 ret; CmInetAddr peerAddr; - + ret = cmInetListen(&lstnSockFd, 1);; if (ret != ROK) { - printf("\nListening on socket failed"); + DU_LOG("\nSCTP : Listening on socket failed"); cmInetClose(&lstnSockFd); RETVALUE(RFAILED); } + + DU_LOG("\nSCTP : Connecting"); while(!connUp) { @@ -282,17 +273,17 @@ S16 sctpAccept() } else if(ret != ROK) { - printf("\nFailed to accept connection"); + DU_LOG("\nSCTP : Failed to accept connection"); RETVALUE(RFAILED); } else { connUp = TRUE; sctpSetSockOpts(); - printf("\nAccepted incoming connection"); break; } } + DU_LOG("\nSCTP : Connection established"); RETVALUE(ROK); }/* End of sctpAccept() */ @@ -319,55 +310,56 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) switch(ntfy->header.nType) { case CM_INET_SCTP_ASSOC_CHANGE : + DU_LOG("\nSCTP : Assoc change notification received"); switch(ntfy->u.assocChange.state) { case CM_INET_SCTP_COMM_UP: - printf("\nSCTP notify assocchange(comm up) received"); + DU_LOG("Event : COMMUNICATION UP"); connUp = TRUE; break; case CM_INET_SCTP_COMM_LOST: - printf("\nSCTP notify assocchange(comm lost) received"); + DU_LOG("Event : COMMUNICATION LOST"); connUp = FALSE; break; case CM_INET_SCTP_RESTART: - printf("\nSCTP notify assocchange(sctp restart) received"); + DU_LOG("Event : SCTP RESTART"); connUp = FALSE; break; case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */ - printf("\nSCTP notify assocchange(shutdown complete) received\n"); + DU_LOG("Event : SHUTDOWN COMPLETE"); connUp = FALSE; break; case CM_INET_SCTP_CANT_STR_ASSOC: - printf("\nSCTP notify assocchange(cant str assoc) received\n"); + DU_LOG("Event : CANT START ASSOC"); connUp = FALSE; break; default: - printf("\nInvalid event"); + DU_LOG("\nInvalid event"); break; } break; case CM_INET_SCTP_PEER_ADDR_CHANGE : - printf("\nSCTP notify peer addr change received"); + DU_LOG("\nSCTP : Peer Address Change notificarion received"); /* Need to add handler */ break; case CM_INET_SCTP_REMOTE_ERROR : - printf("\nSCTP notify remote error received"); + DU_LOG("\nSCTP : Remote Error notification received"); break; case CM_INET_SCTP_SEND_FAILED : - printf("\nSCTP notify send failed received\n"); + DU_LOG("\nSCTP : Send Failed notification received\n"); break; case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */ - printf("\nSCTP notify shutdown event received\n"); + DU_LOG("\nSCTP : Shutdown Event notification received\n"); connUp = FALSE; break; case CM_INET_SCTP_ADAPTATION_INDICATION : - printf("\nSCTP notify adaptation indication received\n"); + DU_LOG("\nSCTP : Adaptation Indication received\n"); break; case CM_INET_SCTP_PARTIAL_DELIVERY_EVENT: - printf("\nSCTP notify partial delivery received\n"); + DU_LOG("\nSCTP : Partial Delivery Event received\n"); break; default: - printf("\nInvalid sctp notification type\n"); + DU_LOG("\nSCTP : Invalid notification type\n"); break; } @@ -401,7 +393,10 @@ S16 sctpSockPoll() U32 *timeoutPtr; /* pointer to timeout */ U32 flag; Buffer *mBuf; + Buffer *egtpBuf; MsgLen bufLen; + MsgLen egtpBufLen; + CmInetAddr egtpFromAddr; /* Egtp data sender address */ CmInetMemInfo memInfo; /* buffer allocation info */ CmInetNetAddr addr; CmInetSctpSndRcvInfo info; @@ -420,10 +415,15 @@ S16 sctpSockPoll() } memInfo.region = CU_APP_MEM_REG; memInfo.pool = CU_POOL; + + egtpFromAddr.port = egtpCb.dstCb.dstPort; + egtpFromAddr.address = egtpCb.dstCb.dstIp; + CM_INET_FD_ZERO(&readFd); while(1) { + /* Receiving SCTP data */ CM_INET_FD_SET(&sockFd, &readFd); ret = cmInetSelect(&readFd, NULLP, timeoutPtr, &numFds); if (CM_INET_FD_ISSET(&sockFd, &readFd)) @@ -432,7 +432,7 @@ S16 sctpSockPoll() ret = cmInetSctpRecvMsg(&sockFd, &addr, &port, &memInfo, &mBuf, &bufLen, &info, &flag, &ntfy); if (ret != ROK) { - printf("\nFailed to receive sctp msg\n"); + DU_LOG("\nSCTP : Failed to receive sctp msg\n"); } else { @@ -441,12 +441,12 @@ S16 sctpSockPoll() ret = sctpNtfyHdlr(&ntfy); if(ret != ROK) { - printf("\nFailed to process sctp notify msg\n"); + DU_LOG("\nSCTP : Failed to process sctp notify msg\n"); } } else if(connUp) /* If data received */ { - F1InmsgHdlr(mBuf); + F1APMsgHdlr(mBuf); SPutMsg(mBuf); } else @@ -455,6 +455,17 @@ S16 sctpSockPoll() } } } + + /* Receiving EGTP data */ + egtpBufLen = -1; + ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG); + if(ret == ROK && egtpBuf != NULLP) + { + DU_LOG("\nEGTP : Received message \n"); + SPrntMsg(egtpBuf, 0 ,0); + cuEgtpHdlRecvMsg(egtpBuf); + + } }; RETVALUE(ROK); @@ -466,7 +477,7 @@ S16 sctpSockPoll() * * @details * - * Function : sctpOutMsgSend + * Function : sctpSend * * Functionality: * Send message on SCTP socket @@ -476,7 +487,7 @@ S16 sctpSockPoll() * RFAILED - failure * * ****************************************************************/ -S16 sctpOutMsgSend(Buffer *mBuf) +S16 sctpSend(Buffer *mBuf) { U8 ret; MsgLen len; /* number of actually sent octets */ @@ -508,12 +519,12 @@ S16 sctpOutMsgSend(Buffer *mBuf) ret = cmInetSctpSendMsg(&sockFd, dstAddr, sctpCfg->duPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); if(ret != ROK && ret != RWOULDBLOCK) { - printf("\nFailed sending the message"); + DU_LOG("\nSCTP : Send message failed"); RETVALUE(RFAILED); } RETVALUE(ROK); -} /* End of sctpOutMsgSend */ +} /* End of sctpSend */ /******************************************************************* * @@ -535,19 +546,19 @@ void sctpStartReq() { if(openSctpEndp() != ROK) { - printf("\nFailed while opening socket"); + DU_LOG("\nSCTP : Failed while opening socket"); } else if(bindSctpEndp() != ROK) { - printf("\nFailed while binding socket"); + DU_LOG("\nSCTP : Failed while binding socket"); } else if(sctpAccept() != ROK) { - printf("\nFailed while accepting connection"); + DU_LOG("\nSCTP : Failed while accepting connection"); } else if(sctpSockPoll() != ROK) { - printf("\nFailed while polling"); + DU_LOG("\nSCTP : Failed while polling"); } } /* End of sctpAssocReq */ diff --git a/src/cu_stub/cu_stub_sctp.h b/src/cu_stub/cu_stub_sctp.h index 4cd30bf78..03f273a67 100644 --- a/src/cu_stub/cu_stub_sctp.h +++ b/src/cu_stub/cu_stub_sctp.h @@ -30,10 +30,22 @@ #define MAX_RETRY 5 -EXTERN S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason); -EXTERN S16 sctpActvTsk(Pst *pst, Buffer *mBuf); +/* Global variable declaration */ +CmInetFd lstnSockFd; /* Listening Socket file descriptor */ +CmInetFd sockFd; /* Socket File descriptor */ +U8 socket_type; /* Socket type */ +Bool nonblocking; /* Blocking/Non-blocking socket */ +Bool connUp; /* Is connection up */ +int assocId; /* Assoc Id of connected assoc */ + +CmInetNetAddrLst localAddrLst; +CmInetNetAddrLst remoteAddrLst; + +SctpParams *sctpCfg; /* SCTP configurations at DU */ + +EXTERN S16 sctpActvInit(); EXTERN void sctpStartReq(); -EXTERN S16 sctpOutMsgSend(Buffer *mBuf); +EXTERN S16 sctpSend(Buffer *mBuf); #endif diff --git a/src/du_app/F1AP/asn/--help b/src/du_app/F1AP/asn/--help deleted file mode 100755 index b8f814ff9..000000000 Binary files a/src/du_app/F1AP/asn/--help and /dev/null differ diff --git a/src/du_app/F1AP/asn/.F1SetupRequest.h.swp b/src/du_app/F1AP/asn/.F1SetupRequest.h.swp deleted file mode 100755 index 6686feb46..000000000 Binary files a/src/du_app/F1AP/asn/.F1SetupRequest.h.swp and /dev/null differ diff --git a/src/du_app/F1AP/asn/BIT_STRING.c b/src/du_app/F1AP/asn/BIT_STRING.c deleted file mode 100755 index 6b9e29cbf..000000000 --- a/src/du_app/F1AP/asn/BIT_STRING.c +++ /dev/null @@ -1,686 +0,0 @@ -/*- - * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -#include -#include -#include - -/* - * BIT STRING basic type description. - */ -static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; -asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs = { - sizeof(BIT_STRING_t), - offsetof(BIT_STRING_t, _asn_ctx), - ASN_OSUBV_BIT -}; -asn_TYPE_operation_t asn_OP_BIT_STRING = { - OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ - BIT_STRING_print, - BIT_STRING_compare, - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ - OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ - OCTET_STRING_decode_xer_binary, - BIT_STRING_encode_xer, -#ifdef ASN_DISABLE_OER_SUPPORT - 0, - 0, -#else - BIT_STRING_decode_oer, - BIT_STRING_encode_oer, -#endif /* ASN_DISABLE_OER_SUPPORT */ -#ifdef ASN_DISABLE_PER_SUPPORT - 0, - 0, - 0, - 0, -#else - BIT_STRING_decode_uper, /* Unaligned PER decoder */ - BIT_STRING_encode_uper, /* Unaligned PER encoder */ - OCTET_STRING_decode_aper, /* Aligned PER decoder */ - OCTET_STRING_encode_aper, /* Aligned PER encoder */ -#endif /* ASN_DISABLE_PER_SUPPORT */ - BIT_STRING_random_fill, - 0 /* Use generic outmost tag fetcher */ -}; -asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { - "BIT STRING", - "BIT_STRING", - &asn_OP_BIT_STRING, - asn_DEF_BIT_STRING_tags, - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - asn_DEF_BIT_STRING_tags, /* Same as above */ - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - { 0, 0, BIT_STRING_constraint }, - 0, 0, /* No members */ - &asn_SPC_BIT_STRING_specs -}; - -/* - * BIT STRING generic constraint. - */ -int -BIT_STRING_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { - const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - printf("Inside %s:%d\n", __FILE__,__LINE__); - - if(st && st->buf) { - if((st->size == 0 && st->bits_unused) - || st->bits_unused < 0 || st->bits_unused > 7) { - ASN__CTFAIL(app_key, td, sptr, - "%s: invalid padding byte (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - } else { - ASN__CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - return 0; -} - -static const char *_bit_pattern[16] = { - "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", - "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" -}; - -asn_enc_rval_t -BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er = {0, 0, 0}; - char scratch[128]; - char *p = scratch; - char *scend = scratch + (sizeof(scratch) - 10); - const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - int xcan = (flags & XER_F_CANONICAL); - uint8_t *buf; - uint8_t *end; - - if(!st || !st->buf) - ASN__ENCODE_FAILED; - - er.encoded = 0; - - buf = st->buf; - end = buf + st->size - 1; /* Last byte is special */ - - /* - * Binary dump - */ - for(; buf < end; buf++) { - int v = *buf; - int nline = xcan?0:(((buf - st->buf) % 8) == 0); - if(p >= scend || nline) { - ASN__CALLBACK(scratch, p - scratch); - p = scratch; - if(nline) ASN__TEXT_INDENT(1, ilevel); - } - memcpy(p + 0, _bit_pattern[v >> 4], 4); - memcpy(p + 4, _bit_pattern[v & 0x0f], 4); - p += 8; - } - - if(!xcan && ((buf - st->buf) % 8) == 0) - ASN__TEXT_INDENT(1, ilevel); - ASN__CALLBACK(scratch, p - scratch); - p = scratch; - - if(buf == end) { - int v = *buf; - int ubits = st->bits_unused; - int i; - for(i = 7; i >= ubits; i--) - *p++ = (v & (1 << i)) ? 0x31 : 0x30; - ASN__CALLBACK(scratch, p - scratch); - } - - if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); - - ASN__ENCODED_OK(er); -cb_failed: - ASN__ENCODE_FAILED; -} - - -/* - * BIT STRING specific contents printer. - */ -int -BIT_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { - const char * const h2c = "0123456789ABCDEF"; - char scratch[64]; - const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - uint8_t *buf; - uint8_t *end; - char *p = scratch; - - (void)td; /* Unused argument */ - - if(!st || !st->buf) - return (cb("", 8, app_key) < 0) ? -1 : 0; - - ilevel++; - buf = st->buf; - end = buf + st->size; - - /* - * Hexadecimal dump. - */ - for(; buf < end; buf++) { - if((buf - st->buf) % 16 == 0 && (st->size > 16) - && buf != st->buf) { - _i_INDENT(1); - /* Dump the string */ - if(cb(scratch, p - scratch, app_key) < 0) return -1; - p = scratch; - } - *p++ = h2c[*buf >> 4]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - - if(p > scratch) { - p--; /* Eat the tailing space */ - - if((st->size > 16)) { - _i_INDENT(1); - } - - /* Dump the incomplete 16-bytes row */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - } - - if(st->bits_unused) { - int ret = snprintf(scratch, sizeof(scratch), " (%d bit%s unused)", - st->bits_unused, st->bits_unused == 1 ? "" : "s"); - assert(ret > 0 && ret < (ssize_t)sizeof(scratch)); - if(ret > 0 && ret < (ssize_t)sizeof(scratch) - && cb(scratch, ret, app_key) < 0) - return -1; - } - - return 0; -} - -/* - * Non-destructively remove the trailing 0-bits from the given bit string. - */ -static const BIT_STRING_t * -BIT_STRING__compactify(const BIT_STRING_t *st, BIT_STRING_t *tmp) { - const uint8_t *b; - union { - const uint8_t *c_buf; - uint8_t *nc_buf; - } unconst; - - if(st->size == 0) { - assert(st->bits_unused == 0); - return st; - } else { - for(b = &st->buf[st->size - 1]; b > st->buf && *b == 0; b--) { - ; - } - /* b points to the last byte which may contain data */ - if(*b) { - int unused = 7; - uint8_t v = *b; - v &= -(int8_t)v; - if(v & 0x0F) unused -= 4; - if(v & 0x33) unused -= 2; - if(v & 0x55) unused -= 1; - tmp->size = b-st->buf + 1; - tmp->bits_unused = unused; - } else { - tmp->size = b-st->buf; - tmp->bits_unused = 0; - } - - assert(b >= st->buf); - } - - unconst.c_buf = st->buf; - tmp->buf = unconst.nc_buf; - return tmp; -} - -/* - * Lexicographically compare the common prefix of both strings, - * and if it is the same return -1 for the smallest string. - */ -int -BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr, - const void *bptr) { - /* - * Remove information about trailing bits, since - * X.680 (08/2015) #22.7 "ensure that different semantics are not" - * "associated with [values that differ only in] the trailing 0 bits." - */ - BIT_STRING_t compact_a, compact_b; - const BIT_STRING_t *a = BIT_STRING__compactify(aptr, &compact_a); - const BIT_STRING_t *b = BIT_STRING__compactify(bptr, &compact_b); - const asn_OCTET_STRING_specifics_t *specs = td->specifics; - - assert(specs && specs->subvariant == ASN_OSUBV_BIT); - - if(a && b) { - size_t common_prefix_size = a->size <= b->size ? a->size : b->size; - int ret = memcmp(a->buf, b->buf, common_prefix_size); - if(ret == 0) { - /* Figure out which string with equal prefixes is longer. */ - if(a->size < b->size) { - return -1; - } else if(a->size > b->size) { - return 1; - } else { - /* Figure out how many unused bits */ - if(a->bits_unused > b->bits_unused) { - return -1; - } else if(a->bits_unused < b->bits_unused) { - return 1; - } else { - return 0; - } - } - } else { - return ret; - } - } else if(!a && !b) { - return 0; - } else if(!a) { - return -1; - } else { - return 1; - } -} - -#ifndef ASN_DISABLE_PER_SUPPORT - -#undef RETURN -#define RETURN(_code) \ - do { \ - asn_dec_rval_t tmprval; \ - tmprval.code = _code; \ - tmprval.consumed = consumed_myself; \ - return tmprval; \ - } while(0) - -static asn_per_constraint_t asn_DEF_BIT_STRING_constraint_size = { - APC_SEMI_CONSTRAINED, -1, -1, 0, 0}; - -asn_dec_rval_t -BIT_STRING_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, - const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, void **sptr, - asn_per_data_t *pd) { - const asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (const asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_SPC_BIT_STRING_specs; - const asn_per_constraints_t *pc = - constraints ? constraints : td->encoding_constraints.per_constraints; - const asn_per_constraint_t *csiz; - asn_dec_rval_t rval = { RC_OK, 0 }; - BIT_STRING_t *st = (BIT_STRING_t *)*sptr; - ssize_t consumed_myself = 0; - int repeat; - - (void)opt_codec_ctx; - - if(pc) { - csiz = &pc->size; - } else { - csiz = &asn_DEF_BIT_STRING_constraint_size; - } - - if(specs->subvariant != ASN_OSUBV_BIT) { - ASN_DEBUG("Subvariant %d is not BIT OSUBV_BIT", specs->subvariant); - RETURN(RC_FAIL); - } - - /* - * Allocate the string. - */ - if(!st) { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(!st) RETURN(RC_FAIL); - } - - ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", - csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", - csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); - - if(csiz->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) RETURN(RC_WMORE); - if(inext) { - csiz = &asn_DEF_BIT_STRING_constraint_size; - } - } - - if(csiz->effective_bits >= 0) { - FREEMEM(st->buf); - st->size = (csiz->upper_bound + 7) >> 3; - st->buf = (uint8_t *)MALLOC(st->size + 1); - if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } - } - - /* X.691, #16.5: zero-length encoding */ - /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ - /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ - if(csiz->effective_bits == 0) { - int ret; - ASN_DEBUG("Encoding BIT STRING size %ld", csiz->upper_bound); - ret = per_get_many_bits(pd, st->buf, 0, csiz->upper_bound); - if(ret < 0) RETURN(RC_WMORE); - consumed_myself += csiz->upper_bound; - st->buf[st->size] = 0; - st->bits_unused = (8 - (csiz->upper_bound & 0x7)) & 0x7; - RETURN(RC_OK); - } - - st->size = 0; - do { - ssize_t raw_len; - ssize_t len_bytes; - ssize_t len_bits; - void *p; - int ret; - - /* Get the PER length */ - raw_len = uper_get_length(pd, csiz->effective_bits, csiz->lower_bound, - &repeat); - if(raw_len < 0) RETURN(RC_WMORE); - if(raw_len == 0 && st->buf) break; - - ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", - (long)csiz->effective_bits, (long)raw_len, - repeat ? "repeat" : "once", td->name); - len_bits = raw_len; - len_bytes = (len_bits + 7) >> 3; - if(len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7); - /* len_bits be multiple of 16K if repeat is set */ - p = REALLOC(st->buf, st->size + len_bytes + 1); - if(!p) RETURN(RC_FAIL); - st->buf = (uint8_t *)p; - - ret = per_get_many_bits(pd, &st->buf[st->size], 0, len_bits); - if(ret < 0) RETURN(RC_WMORE); - st->size += len_bytes; - } while(repeat); - st->buf[st->size] = 0; /* nul-terminate */ - - return rval; -} - -asn_enc_rval_t -BIT_STRING_encode_uper(const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, - const void *sptr, asn_per_outp_t *po) { - const asn_OCTET_STRING_specifics_t *specs = - td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_SPC_BIT_STRING_specs; - const asn_per_constraints_t *pc = - constraints ? constraints : td->encoding_constraints.per_constraints; - const asn_per_constraint_t *csiz; - const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - BIT_STRING_t compact_bstr; /* Do not modify this directly! */ - asn_enc_rval_t er = { 0, 0, 0 }; - int inext = 0; /* Lies not within extension root */ - size_t size_in_bits; - const uint8_t *buf; - int ret; - int ct_extensible; - - if(!st || (!st->buf && st->size)) - ASN__ENCODE_FAILED; - - if(specs->subvariant == ASN_OSUBV_BIT) { - if((st->size == 0 && st->bits_unused) || (st->bits_unused & ~7)) -{ - ASN__ENCODE_FAILED; -} - } else { - ASN__ENCODE_FAILED; - } - - if(pc) { - csiz = &pc->size; - } else { - csiz = &asn_DEF_BIT_STRING_constraint_size; - } - ct_extensible = csiz->flags & APC_EXTENSIBLE; - - /* Figure out the size without the trailing bits */ - // st = BIT_STRING__compactify(st, &compact_bstr); - size_in_bits = 8 * st->size - st->bits_unused; - - ASN_DEBUG( - "Encoding %s into %" ASN_PRI_SIZE " bits" - " (%ld..%ld, effective %d)%s", - td->name, size_in_bits, csiz->lower_bound, csiz->upper_bound, - csiz->effective_bits, ct_extensible ? " EXT" : ""); - - /* Figure out whether size lies within PER visible constraint */ - - if(csiz->effective_bits >= 0) { - if((ssize_t)size_in_bits > csiz->upper_bound) { - if(ct_extensible) { - csiz = &asn_DEF_BIT_STRING_constraint_size; - inext = 1; - } else { - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); - ASN__ENCODE_FAILED; - } - } - } else { - inext = 0; - } - - if(ct_extensible) { - /* Declare whether length is [not] within extension root */ - if(per_put_few_bits(po, inext, 1)) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); - ASN__ENCODE_FAILED; -} - } - - if(csiz->effective_bits >= 0 && !inext) { - int add_trailer = (ssize_t)size_in_bits < csiz->lower_bound; - ASN_DEBUG( - "Encoding %" ASN_PRI_SIZE " bytes (%ld), length (in %d bits) trailer %d; actual " - "value %" ASN_PRI_SSIZE "", - st->size, size_in_bits - csiz->lower_bound, csiz->effective_bits, - add_trailer, - add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound); - ret = per_put_few_bits( - po, add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound, - csiz->effective_bits); - if(ret) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); -ASN__ENCODE_FAILED; -} - ret = per_put_many_bits(po, st->buf, size_in_bits); - if(ret) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); -ASN__ENCODE_FAILED; -} - if(add_trailer) { - static const uint8_t zeros[16]; - size_t trailing_zero_bits = csiz->lower_bound - size_in_bits; - while(trailing_zero_bits > 0) { - if(trailing_zero_bits > 8 * sizeof(zeros)) { - ret = per_put_many_bits(po, zeros, 8 * sizeof(zeros)); - trailing_zero_bits -= 8 * sizeof(zeros); - } else { - ret = per_put_many_bits(po, zeros, trailing_zero_bits); - trailing_zero_bits = 0; - } - if(ret) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); -ASN__ENCODE_FAILED; -} - } - } - ASN__ENCODED_OK(er); - } - - ASN_DEBUG("Encoding %" ASN_PRI_SIZE " bytes", st->size); - - buf = st->buf; - do { - int need_eom = 0; - ssize_t maySave = uper_put_length(po, size_in_bits, &need_eom); - if(maySave < 0) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); -ASN__ENCODE_FAILED; -} - - ASN_DEBUG("Encoding %" ASN_PRI_SSIZE " of %" ASN_PRI_SIZE "", maySave, size_in_bits); - - ret = per_put_many_bits(po, buf, maySave); - if(ret) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); -ASN__ENCODE_FAILED; -} - - buf += maySave >> 3; - size_in_bits -= maySave; - assert(!(maySave & 0x07) || !size_in_bits); - if(need_eom && uper_put_length(po, 0, 0)) -{ - printf("Inside bit string endocde %s:%d\n", __FILE__, __LINE__); - ASN__ENCODE_FAILED; /* End of Message length */ -} - } while(size_in_bits); - - ASN__ENCODED_OK(er); -} - -#endif /* ASN_DISABLE_PER_SUPPORT */ - -asn_random_fill_result_t -BIT_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, - const asn_encoding_constraints_t *constraints, - size_t max_length) { - const asn_OCTET_STRING_specifics_t *specs = - td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_SPC_BIT_STRING_specs; - asn_random_fill_result_t result_ok = {ARFILL_OK, 1}; - asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0}; - asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0}; - static unsigned lengths[] = {0, 1, 2, 3, 4, 8, - 126, 127, 128, 16383, 16384, 16385, - 65534, 65535, 65536, 65537}; - uint8_t *buf; - uint8_t *bend; - uint8_t *b; - size_t rnd_bits, rnd_len; - BIT_STRING_t *st; - - if(max_length == 0) return result_skipped; - - switch(specs->subvariant) { - case ASN_OSUBV_ANY: - return result_failed; - case ASN_OSUBV_BIT: - break; - default: - break; - } - - /* Figure out how far we should go */ - rnd_bits = lengths[asn_random_between( - 0, sizeof(lengths) / sizeof(lengths[0]) - 1)]; - if(!constraints || !constraints->per_constraints) - constraints = &td->encoding_constraints; - if(constraints->per_constraints) { - const asn_per_constraint_t *pc = &constraints->per_constraints->size; - if(pc->flags & APC_CONSTRAINED) { - long suggested_upper_bound = pc->upper_bound < (ssize_t)max_length - ? pc->upper_bound - : (ssize_t)max_length; - if(max_length < (size_t)pc->lower_bound) { - return result_skipped; - } - if(pc->flags & APC_EXTENSIBLE) { - switch(asn_random_between(0, 5)) { - case 0: - if(pc->lower_bound > 0) { - rnd_bits = pc->lower_bound - 1; - break; - } - /* Fall through */ - case 1: - rnd_bits = pc->upper_bound + 1; - break; - case 2: - /* Keep rnd_bits from the table */ - if(rnd_bits < max_length) { - break; - } - /* Fall through */ - default: - rnd_bits = asn_random_between(pc->lower_bound, - suggested_upper_bound); - } - } else { - rnd_bits = - asn_random_between(pc->lower_bound, suggested_upper_bound); - } - } else { - rnd_bits = asn_random_between(0, max_length - 1); - } - } else if(rnd_bits >= max_length) { - rnd_bits = asn_random_between(0, max_length - 1); - } - - rnd_len = (rnd_bits + 7) / 8; - buf = CALLOC(1, rnd_len + 1); - if(!buf) return result_failed; - - bend = &buf[rnd_len]; - - for(b = buf; b < bend; b++) { - *(uint8_t *)b = asn_random_between(0, 255); - } - *b = 0; /* Zero-terminate just in case. */ - - if(*sptr) { - st = *sptr; - FREEMEM(st->buf); - } else { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(!st) { - FREEMEM(buf); - return result_failed; - } - } - - st->buf = buf; - st->size = rnd_len; - st->bits_unused = (8 - (rnd_bits & 0x7)) & 0x7; - if(st->bits_unused) { - assert(st->size > 0); - st->buf[st->size-1] &= 0xff << st->bits_unused; - } - - result_ok.length = st->size; - return result_ok; -} diff --git a/src/du_app/F1AP/asn/Cells-to-be-Activated-List.h b/src/du_app/F1AP/asn/Cells-to-be-Activated-List.h deleted file mode 100755 index 6f5a6c55a..000000000 --- a/src/du_app/F1AP/asn/Cells-to-be-Activated-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _Cells_to_be_Activated_List_H_ -#define _Cells_to_be_Activated_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* Cells-to-be-Activated-List */ -typedef struct Cells_to_be_Activated_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Cells_to_be_Activated_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_Cells_to_be_Activated_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _Cells_to_be_Activated_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetup-Item.h b/src/du_app/F1AP/asn/DRBs-ToBeSetup-Item.h deleted file mode 100755 index bfe922883..000000000 --- a/src/du_app/F1AP/asn/DRBs-ToBeSetup-Item.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _DRBs_ToBeSetup_Item_H_ -#define _DRBs_ToBeSetup_Item_H_ - - -#include - -/* Including external dependencies */ -#include "DRBID.h" -#include "QoSInformation.h" -#include "ULUPTNLInformation-ToBeSetup-List.h" -#include "RLCMode.h" -#include "DuplicationActivation.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ULConfiguration; -struct ProtocolExtensionContainer; - -/* DRBs-ToBeSetup-Item */ -typedef struct DRBs_ToBeSetup_Item { - DRBID_t dRBID; - QoSInformation_t qoSInformation; - ULUPTNLInformation_ToBeSetup_List_t uLUPTNLInformation_ToBeSetup_List; - RLCMode_t rLCMode; - struct ULConfiguration *uLConfiguration; /* OPTIONAL */ - DuplicationActivation_t *duplicationActivation; /* OPTIONAL */ - struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ - /* - * This type is extensible, - * possible extensions are below. - */ - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} DRBs_ToBeSetup_Item_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_DRBs_ToBeSetup_Item; - -#ifdef __cplusplus -} -#endif - -#endif /* _DRBs_ToBeSetup_Item_H_ */ -#include diff --git a/src/du_app/F1AP/asn/DRBs-ToBeSetup-List.h b/src/du_app/F1AP/asn/DRBs-ToBeSetup-List.h deleted file mode 100755 index d27a6111a..000000000 --- a/src/du_app/F1AP/asn/DRBs-ToBeSetup-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _DRBs_ToBeSetup_List_H_ -#define _DRBs_ToBeSetup_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* DRBs-ToBeSetup-List */ -typedef struct DRBs_ToBeSetup_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} DRBs_ToBeSetup_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_DRBs_ToBeSetup_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _DRBs_ToBeSetup_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-List.h b/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-List.h deleted file mode 100755 index a88e6982a..000000000 --- a/src/du_app/F1AP/asn/Flows-Mapped-To-DRB-List.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _Flows_Mapped_To_DRB_List_H_ -#define _Flows_Mapped_To_DRB_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct Flows_Mapped_To_DRB_Item; - -/* Flows-Mapped-To-DRB-List */ -typedef struct Flows_Mapped_To_DRB_List { - A_SEQUENCE_OF(struct Flows_Mapped_To_DRB_Item) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Flows_Mapped_To_DRB_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_Flows_Mapped_To_DRB_List; -extern asn_SET_OF_specifics_t asn_SPC_Flows_Mapped_To_DRB_List_specs_1; -extern asn_TYPE_member_t asn_MBR_Flows_Mapped_To_DRB_List_1[1]; -extern asn_per_constraints_t asn_PER_type_Flows_Mapped_To_DRB_List_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _Flows_Mapped_To_DRB_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/GNB-DU-Served-Cells-List.h b/src/du_app/F1AP/asn/GNB-DU-Served-Cells-List.h deleted file mode 100755 index e9913496e..000000000 --- a/src/du_app/F1AP/asn/GNB-DU-Served-Cells-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _GNB_DU_Served_Cells_List_H_ -#define _GNB_DU_Served_Cells_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* GNB-DU-Served-Cells-List */ -typedef struct GNB_DU_Served_Cells_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} GNB_DU_Served_Cells_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_GNB_DU_Served_Cells_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _GNB_DU_Served_Cells_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/NR-Mode-Info.h b/src/du_app/F1AP/asn/NR-Mode-Info.h deleted file mode 100755 index 8f724e6db..000000000 --- a/src/du_app/F1AP/asn/NR-Mode-Info.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _NR_Mode_Info_H_ -#define _NR_Mode_Info_H_ - - -#include - -/* Including external dependencies */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Dependencies */ -typedef enum NR_Mode_Info_PR { - NR_Mode_Info_PR_NOTHING, /* No components present */ - NR_Mode_Info_PR_fDD, - NR_Mode_Info_PR_tDD, - NR_Mode_Info_PR_choice_extension -} NR_Mode_Info_PR; - -/* Forward declarations */ -struct FDD_Info; -struct TDD_Info; -struct ProtocolIE_SingleContainer; - -/* NR-Mode-Info */ -typedef struct NR_Mode_Info { - NR_Mode_Info_PR present; - union NR_Mode_Info_u { - struct FDD_Info *fDD; - struct TDD_Info *tDD; - struct ProtocolIE_SingleContainer *choice_extension; - } choice; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} NR_Mode_Info_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_NR_Mode_Info; -extern asn_CHOICE_specifics_t asn_SPC_NR_Mode_Info_specs_1; -extern asn_TYPE_member_t asn_MBR_NR_Mode_Info_1[3]; -extern asn_per_constraints_t asn_PER_type_NR_Mode_Info_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _NR_Mode_Info_H_ */ -#include diff --git a/src/du_app/F1AP/asn/NRFreqInfo.h b/src/du_app/F1AP/asn/NRFreqInfo.h deleted file mode 100755 index 08f0ee93f..000000000 --- a/src/du_app/F1AP/asn/NRFreqInfo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _NRFreqInfo_H_ -#define _NRFreqInfo_H_ - - -#include - -/* Including external dependencies */ -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct SUL_Information; -struct ProtocolExtensionContainer; -struct FreqBandNrItem; - -/* NRFreqInfo */ -typedef struct NRFreqInfo { - long nRARFCN; - struct SUL_Information *sul_Information; /* OPTIONAL */ - struct NRFreqInfo__freqBandListNr { - A_SEQUENCE_OF(struct FreqBandNrItem) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } freqBandListNr; - struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ - /* - * This type is extensible, - * possible extensions are below. - */ - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} NRFreqInfo_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_NRFreqInfo; -extern asn_SEQUENCE_specifics_t asn_SPC_NRFreqInfo_specs_1; -extern asn_TYPE_member_t asn_MBR_NRFreqInfo_1[4]; - -#ifdef __cplusplus -} -#endif - -#endif /* _NRFreqInfo_H_ */ -#include diff --git a/src/du_app/F1AP/asn/QoS-Characteristics.h b/src/du_app/F1AP/asn/QoS-Characteristics.h deleted file mode 100755 index 498196960..000000000 --- a/src/du_app/F1AP/asn/QoS-Characteristics.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _QoS_Characteristics_H_ -#define _QoS_Characteristics_H_ - - -#include - -/* Including external dependencies */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Dependencies */ -typedef enum QoS_Characteristics_PR { - QoS_Characteristics_PR_NOTHING, /* No components present */ - QoS_Characteristics_PR_non_Dynamic_5QI, - QoS_Characteristics_PR_dynamic_5QI, - QoS_Characteristics_PR_choice_extension -} QoS_Characteristics_PR; - -/* Forward declarations */ -struct NonDynamic5QIDescriptor; -struct Dynamic5QIDescriptor; -struct ProtocolIE_SingleContainer; - -/* QoS-Characteristics */ -typedef struct QoS_Characteristics { - QoS_Characteristics_PR present; - union QoS_Characteristics_u { - struct NonDynamic5QIDescriptor *non_Dynamic_5QI; - struct Dynamic5QIDescriptor *dynamic_5QI; - struct ProtocolIE_SingleContainer *choice_extension; - } choice; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} QoS_Characteristics_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_QoS_Characteristics; -extern asn_CHOICE_specifics_t asn_SPC_QoS_Characteristics_specs_1; -extern asn_TYPE_member_t asn_MBR_QoS_Characteristics_1[3]; -extern asn_per_constraints_t asn_PER_type_QoS_Characteristics_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _QoS_Characteristics_H_ */ -#include diff --git a/src/du_app/F1AP/asn/QoSInformation.h b/src/du_app/F1AP/asn/QoSInformation.h deleted file mode 100755 index 4e757581c..000000000 --- a/src/du_app/F1AP/asn/QoSInformation.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _QoSInformation_H_ -#define _QoSInformation_H_ - - -#include - -/* Including external dependencies */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Dependencies */ -typedef enum QoSInformation_PR { - QoSInformation_PR_NOTHING, /* No components present */ - QoSInformation_PR_eUTRANQoS, - QoSInformation_PR_choice_extension -} QoSInformation_PR; - -/* Forward declarations */ -struct EUTRANQoS; -struct ProtocolIE_SingleContainer; - -/* QoSInformation */ -typedef struct QoSInformation { - QoSInformation_PR present; - union QoSInformation_u { - struct EUTRANQoS *eUTRANQoS; - struct ProtocolIE_SingleContainer *choice_extension; - } choice; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} QoSInformation_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_QoSInformation; -extern asn_CHOICE_specifics_t asn_SPC_QoSInformation_specs_1; -extern asn_TYPE_member_t asn_MBR_QoSInformation_1[2]; -extern asn_per_constraints_t asn_PER_type_QoSInformation_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _QoSInformation_H_ */ -#include diff --git a/src/du_app/F1AP/asn/RRC-Version.h b/src/du_app/F1AP/asn/RRC-Version.h deleted file mode 100755 index e214345b2..000000000 --- a/src/du_app/F1AP/asn/RRC-Version.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _RRC_Version_H_ -#define _RRC_Version_H_ - - -#include -#include -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolExtensionContainer; - -/* RRC-Version */ -typedef struct RRC_Version { - BIT_STRING_t latest_RRC_Version; - ProtocolExtensionContainer_4624P81_t iE_Extensions; - //struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} RRC_Version_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_RRC_Version; - -#ifdef __cplusplus -} -#endif - -#endif /* _RRC_Version_H_ */ -#include diff --git a/src/du_app/F1AP/asn/SCell-ToBeSetup-List.h b/src/du_app/F1AP/asn/SCell-ToBeSetup-List.h deleted file mode 100755 index c89dccfe3..000000000 --- a/src/du_app/F1AP/asn/SCell-ToBeSetup-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _SCell_ToBeSetup_List_H_ -#define _SCell_ToBeSetup_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* SCell-ToBeSetup-List */ -typedef struct SCell_ToBeSetup_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} SCell_ToBeSetup_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_SCell_ToBeSetup_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _SCell_ToBeSetup_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/SRBs-ToBeSetup-List.h b/src/du_app/F1AP/asn/SRBs-ToBeSetup-List.h deleted file mode 100755 index 4bdfb0eb2..000000000 --- a/src/du_app/F1AP/asn/SRBs-ToBeSetup-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _SRBs_ToBeSetup_List_H_ -#define _SRBs_ToBeSetup_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* SRBs-ToBeSetup-List */ -typedef struct SRBs_ToBeSetup_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} SRBs_ToBeSetup_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_SRBs_ToBeSetup_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _SRBs_ToBeSetup_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Modify-Item.h b/src/du_app/F1AP/asn/Served-Cells-To-Modify-Item.h deleted file mode 100755 index 2bdc40734..000000000 --- a/src/du_app/F1AP/asn/Served-Cells-To-Modify-Item.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _Served_Cells_To_Modify_Item_H_ -#define _Served_Cells_To_Modify_Item_H_ - - -#include - -/* Including external dependencies */ -#include "NRCGI.h" -#include "Served-Cell-Information.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct GNB_DU_System_Information; -struct ProtocolExtensionContainer; - -/* Served-Cells-To-Modify-Item */ -typedef struct Served_Cells_To_Modify_Item { - NRCGI_t oldNRCGI; - Served_Cell_Information_t served_Cell_Information; - struct GNB_DU_System_Information *gNB_DU_System_Information; /* OPTIONAL */ - struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ - /* - * This type is extensible, - * possible extensions are below. - */ - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Served_Cells_To_Modify_Item_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_Served_Cells_To_Modify_Item; - -#ifdef __cplusplus -} -#endif - -#endif /* _Served_Cells_To_Modify_Item_H_ */ -#include diff --git a/src/du_app/F1AP/asn/Served-Cells-To-Modify-List.h b/src/du_app/F1AP/asn/Served-Cells-To-Modify-List.h deleted file mode 100755 index d6b17c23d..000000000 --- a/src/du_app/F1AP/asn/Served-Cells-To-Modify-List.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-PDU-Contents" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _Served_Cells_To_Modify_List_H_ -#define _Served_Cells_To_Modify_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolIE_SingleContainer; - -/* Served-Cells-To-Modify-List */ -typedef struct Served_Cells_To_Modify_List { - A_SEQUENCE_OF(struct ProtocolIE_SingleContainer) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Served_Cells_To_Modify_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_Served_Cells_To_Modify_List; - -#ifdef __cplusplus -} -#endif - -#endif /* _Served_Cells_To_Modify_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/ServedPLMNs-Item.h b/src/du_app/F1AP/asn/ServedPLMNs-Item.h deleted file mode 100755 index 053bacda6..000000000 --- a/src/du_app/F1AP/asn/ServedPLMNs-Item.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _ServedPLMNs_Item_H_ -#define _ServedPLMNs_Item_H_ - - -#include - -/* Including external dependencies */ -#include "PLMN-Identity.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ProtocolExtensionContainer; - -/* ServedPLMNs-Item */ -typedef struct ServedPLMNs_Item { - PLMN_Identity_t pLMN_Identity; - struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ - /* - * This type is extensible, - * possible extensions are below. - */ - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} ServedPLMNs_Item_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_ServedPLMNs_Item; -extern asn_SEQUENCE_specifics_t asn_SPC_ServedPLMNs_Item_specs_1; -extern asn_TYPE_member_t asn_MBR_ServedPLMNs_Item_1[2]; - -#ifdef __cplusplus -} -#endif - -#endif /* _ServedPLMNs_Item_H_ */ -#include diff --git a/src/du_app/F1AP/asn/ServedPLMNs-List.h b/src/du_app/F1AP/asn/ServedPLMNs-List.h deleted file mode 100755 index 943bb806a..000000000 --- a/src/du_app/F1AP/asn/ServedPLMNs-List.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _ServedPLMNs_List_H_ -#define _ServedPLMNs_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ServedPLMNs_Item; - -/* ServedPLMNs-List */ -typedef struct ServedPLMNs_List { - A_SEQUENCE_OF(struct ServedPLMNs_Item) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} ServedPLMNs_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_ServedPLMNs_List; -extern asn_SET_OF_specifics_t asn_SPC_ServedPLMNs_List_specs_1; -extern asn_TYPE_member_t asn_MBR_ServedPLMNs_List_1[1]; -extern asn_per_constraints_t asn_PER_type_ServedPLMNs_List_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _ServedPLMNs_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/SliceSupportList.h b/src/du_app/F1AP/asn/SliceSupportList.h deleted file mode 100755 index ad25c9b50..000000000 --- a/src/du_app/F1AP/asn/SliceSupportList.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _SliceSupportList_H_ -#define _SliceSupportList_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct SliceSupportItem; - -/* SliceSupportList */ -typedef struct SliceSupportList { - A_SEQUENCE_OF(struct SliceSupportItem) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} SliceSupportList_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_SliceSupportList; -extern asn_SET_OF_specifics_t asn_SPC_SliceSupportList_specs_1; -extern asn_TYPE_member_t asn_MBR_SliceSupportList_1[1]; -extern asn_per_constraints_t asn_PER_type_SliceSupportList_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _SliceSupportList_H_ */ -#include diff --git a/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-List.h b/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-List.h deleted file mode 100755 index 434169e07..000000000 --- a/src/du_app/F1AP/asn/ULUPTNLInformation-ToBeSetup-List.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _ULUPTNLInformation_ToBeSetup_List_H_ -#define _ULUPTNLInformation_ToBeSetup_List_H_ - - -#include - -/* Including external dependencies */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations */ -struct ULUPTNLInformation_ToBeSetup_Item; - -/* ULUPTNLInformation-ToBeSetup-List */ -typedef struct ULUPTNLInformation_ToBeSetup_List { - A_SEQUENCE_OF(struct ULUPTNLInformation_ToBeSetup_Item) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} ULUPTNLInformation_ToBeSetup_List_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_ULUPTNLInformation_ToBeSetup_List; -extern asn_SET_OF_specifics_t asn_SPC_ULUPTNLInformation_ToBeSetup_List_specs_1; -extern asn_TYPE_member_t asn_MBR_ULUPTNLInformation_ToBeSetup_List_1[1]; -extern asn_per_constraints_t asn_PER_type_ULUPTNLInformation_ToBeSetup_List_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _ULUPTNLInformation_ToBeSetup_List_H_ */ -#include diff --git a/src/du_app/F1AP/asn/UPTransportLayerInformation.h b/src/du_app/F1AP/asn/UPTransportLayerInformation.h deleted file mode 100755 index 3d8b4865e..000000000 --- a/src/du_app/F1AP/asn/UPTransportLayerInformation.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - * From ASN.1 module "F1AP-IEs" - * found in "F1.asn1" - * `asn1c -D ./out -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example` - */ - -#ifndef _UPTransportLayerInformation_H_ -#define _UPTransportLayerInformation_H_ - - -#include - -/* Including external dependencies */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Dependencies */ -typedef enum UPTransportLayerInformation_PR { - UPTransportLayerInformation_PR_NOTHING, /* No components present */ - UPTransportLayerInformation_PR_gTPTunnel, - UPTransportLayerInformation_PR_choice_extension -} UPTransportLayerInformation_PR; - -/* Forward declarations */ -struct GTPTunnel; -struct ProtocolIE_SingleContainer; - -/* UPTransportLayerInformation */ -typedef struct UPTransportLayerInformation { - UPTransportLayerInformation_PR present; - union UPTransportLayerInformation_u { - struct GTPTunnel *gTPTunnel; - struct ProtocolIE_SingleContainer *choice_extension; - } choice; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} UPTransportLayerInformation_t; - -/* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_UPTransportLayerInformation; -extern asn_CHOICE_specifics_t asn_SPC_UPTransportLayerInformation_specs_1; -extern asn_TYPE_member_t asn_MBR_UPTransportLayerInformation_1[2]; -extern asn_per_constraints_t asn_PER_type_UPTransportLayerInformation_constr_1; - -#ifdef __cplusplus -} -#endif - -#endif /* _UPTransportLayerInformation_H_ */ -#include diff --git a/src/du_app/F1AP/asn/asn_constant.h b/src/du_app/F1AP/asn/asn_constant.h deleted file mode 100755 index 018d1aa48..000000000 --- a/src/du_app/F1AP/asn/asn_constant.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) - */ - -#ifndef _ASN_CONSTANT_H -#define _ASN_CONSTANT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define maxPrivateIEs (65535) -#define maxProtocolExtensions (65535) -#define maxProtocolIEs (65535) -#define maxNRARFCN (3279165) -#define maxnoofErrors (256) -#define maxnoofIndividualF1ConnectionsToReset (65536) -#define maxCellingNBDU (512) -#define maxnoofSCells (32) -#define maxnoofSRBs (8) -#define maxnoofDRBs (64) -#define maxnoofULUPTNLInformation (2) -#define maxnoofDLUPTNLInformation (2) -#define maxnoofBPLMNs (6) -#define maxnoofCandidateSpCells (64) -#define maxnoofPotentialSpCells (64) -#define maxnoofNrCellBands (32) -#define maxnoofSIBTypes (32) -#define maxnoofSITypes (32) -#define maxnoofPagingCells (512) -#define maxnoofTNLAssociations (32) -#define maxnoofQoSFlows (64) -#define maxnoofSliceItems (1024) -#define maxCellineNB (256) -#define maxnoofExtendedBPLMNs (6) -#define maxnoofUEIDs (65536) - - -#ifdef __cplusplus -} -#endif - -#endif /* _ASN_CONSTANT_H */ diff --git a/src/du_app/F1AP/f1ap_msg_hdl.c b/src/du_app/F1AP/f1ap_msg_hdl.c deleted file mode 100644 index d123ef668..000000000 --- a/src/du_app/F1AP/f1ap_msg_hdl.c +++ /dev/null @@ -1,863 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/* This file contains F1AP message handler functions */ - -#include "du_mgr_main.h" -#include "cu_stub_sctp.h" -#include "f1ap_msg_hdl.h" - -char encBuf[ENC_BUF_MAX_LEN]; - -/******************************************************************* - * - * @brief Writes the encoded chunks into a buffer - * - * @details - * - * Function : write_out - * - * Functionality:Fills the encoded buffer - * - * @params[in] void *buffer,initial encoded data - * @params[in] size_t size,size of buffer - * @params[in] void *app_key,final buffer - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -static int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf) -{ - memcpy(encodedBuf + encBufSize, buffer, size); - encBufSize += size; - return 0; -} - -/******************************************************************* - * - * @brief Builds the F1SetupRequest - * - * @details - * - * Function : BuildF1SetupReq - * - * Functionality:Fills the F1SetupRequest - * - * @return ROK - success - * RFAILED - failure - * - ******************************************************************/ -S16 BuildF1SetupReq() -{ - S16 ret; - U8 idx; - U8 elementCnt; - F1AP_PDU_t *f1apMsg = NULL; - F1SetupRequest_t *f1SetupReq; - asn_enc_rval_t encRetVal; /* Encoder return value */ - - printf("\nBuilding F1 Setup Request\n"); - - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&f1apMsg, (Size)sizeof(F1AP_PDU_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - RETVALUE(ret); - } - - f1apMsg->present = F1AP_PDU_PR_initiatingMessage; - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&(f1apMsg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup; - f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; - f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_F1SetupRequest; - - f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest; - - elementCnt = 3; - f1SetupReq->protocolIEs.list.count = elementCnt; - f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t *); - - /* Initialize the F1Setup members */ - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL,(Data **)&(f1SetupReq->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupRequestIEs_t *)); - if(ret != ROK) - { - printf("Memory allocation for F1RequestIEs failed"); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1apMsg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - for(idx=0; idxprotocolIEs.list.array[idx]),\ - (Size)sizeof(F1SetupRequestIEs_t)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1SetupReq->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupRequestIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1apMsg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - } - - /*TransactionID*/ - f1SetupReq->protocolIEs.list.array[0]->id = ProtocolIE_ID_id_TransactionID ; - f1SetupReq->protocolIEs.list.array[0]->criticality = Criticality_reject; - f1SetupReq->protocolIEs.list.array[0]->value.present = F1SetupRequestIEs__value_PR_TransactionID; - f1SetupReq->protocolIEs.list.array[0]->value.choice.TransactionID = TRANS_ID; - - /*DU ID*/ - f1SetupReq->protocolIEs.list.array[1]->id = ProtocolIE_ID_id_gNB_DU_ID; - f1SetupReq->protocolIEs.list.array[1]->criticality = Criticality_reject; - f1SetupReq->protocolIEs.list.array[1]->value.present = \ - F1SetupRequestIEs__value_PR_GNB_DU_ID; - f1SetupReq->protocolIEs.list.array[1]->value.choice.GNB_DU_ID.size = sizeof(U8); - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL,\ - (Data **)&(f1SetupReq->protocolIEs.list.array[1]->value.choice.GNB_DU_ID.buf),\ - (Size)sizeof(uint8_t)); - - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1SetupReq->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupRequestIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1apMsg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - f1SetupReq->protocolIEs.list.array[1]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId; - - /*DU Name*/ - f1SetupReq->protocolIEs.list.array[2]->id = ProtocolIE_ID_id_gNB_DU_Name ; - f1SetupReq->protocolIEs.list.array[2]->criticality = Criticality_ignore; - f1SetupReq->protocolIEs.list.array[2]->value.present = \ - F1SetupRequestIEs__value_PR_GNB_DU_Name; - f1SetupReq->protocolIEs.list.array[2]->value.choice.GNB_DU_Name.size = \ - sizeof(duCfgParam.duName); - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL,\ - (Data **)&(f1SetupReq->protocolIEs.list.array[2]->value.choice.GNB_DU_Name.buf),\ - (Size)sizeof(duCfgParam.duName)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupReq->protocolIEs.list.array[1]->value.choice.GNB_DU_ID.buf),\ - (Size)sizeof(uint8_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupReq->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupRequestIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - strcpy((char*)f1SetupReq->protocolIEs.list.array[2]->value.choice.GNB_DU_Name.buf, - (char*)&duCfgParam.duName); - - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); - - /* Encode the F1SetupRequest type as UPER */ - cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); - encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); - - if(encRetVal.encoded == ENCODE_FAIL) - { - printf( "\nCould not encode F1SetupRequest structure (at %s)\n",\ - encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); - RETVALUE(RFAILED); - } - else - { - printf("\nCreated APER encoded buffer for F1SetupRequest\n"); - for(int i=0; i< encBufSize; i++) - { - printf("%x",encBuf[i]); - } - } - RETVALUE(ROK); -}/* End of BuildF1SetupReq */ - -/******************************************************************* - * - * @brief Builds and sends the F1SetupResponse - * - * @details - * - * Function : ExtractSendF1SetupRsp - * - * Functionality: Constructs the F1SetupResponse message and sends - * it back to the DU through SCTP. - * - * @params[in] void **buf,Buffer to which encoded pattern is written into - * @params[in] int *size,size of buffer - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -S16 BuildF1SetupRsp() -{ - S16 ret; - U8 idx; - U8 elementCnt; - F1AP_PDU_t *f1apMsg = NULL; - F1SetupResponse_t *f1SetupRsp; - GNB_CU_Name_t *cuName; - RRC_Version_t *rrc_Ver; - asn_enc_rval_t encRetVal; - - printf("\nBuilding F1 Setup Response\n"); - - /* Allocate the memory for F1SetupRequest_t */ - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&f1apMsg, (Size)sizeof(F1AP_PDU_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - RETVALUE(ret); - } - f1apMsg->present = F1AP_PDU_PR_successfulOutcome; - - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL,(Data **)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_F1Setup; - f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; - f1apMsg->choice.successfulOutcome->value.present = \ - SuccessfulOutcome__value_PR_F1SetupResponse; - f1SetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse; - - elementCnt = 3; - f1SetupRsp->protocolIEs.list.count = elementCnt; - f1SetupRsp->protocolIEs.list.size = elementCnt*sizeof(F1SetupResponseIEs_t *); - - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL,(Data **)&(f1SetupRsp->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); - if(ret != ROK) - { - printf("Memory allocation for F1ResponseIEs failed"); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - for(idx=0; idxprotocolIEs.list.array[idx]),\ - (Size)sizeof(F1SetupResponseIEs_t)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - } - - /*TransactionID*/ - f1SetupRsp->protocolIEs.list.array[0]->id = ProtocolIE_ID_id_TransactionID ; - f1SetupRsp->protocolIEs.list.array[0]->criticality = Criticality_reject; - f1SetupRsp->protocolIEs.list.array[0]->value.present = \ - F1SetupResponseIEs__value_PR_TransactionID; - f1SetupRsp->protocolIEs.list.array[0]->value.choice.TransactionID = TRANS_ID; - - /*CU Name*/ - f1SetupRsp->protocolIEs.list.array[1]->id = ProtocolIE_ID_id_gNB_CU_Name; - f1SetupRsp->protocolIEs.list.array[1]->criticality = Criticality_ignore; - f1SetupRsp->protocolIEs.list.array[1]->value.present = \ - F1SetupResponseIEs__value_PR_GNB_CU_Name; - cuName = &f1SetupRsp->protocolIEs.list.array[1]->value.choice.GNB_CU_Name; - cuName->size = sizeof(cuCfgParams.cuName); - - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL, (Data **)&(cuName->buf),\ - (Size)sizeof(cuName->size)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - strcpy((char*)cuName->buf, (char*)cuCfgParams.cuName); - - /* RRC Version */ - f1SetupRsp->protocolIEs.list.array[2]->id = ProtocolIE_ID_id_GNB_CU_RRC_Version; - f1SetupRsp->protocolIEs.list.array[2]->criticality = Criticality_reject; - f1SetupRsp->protocolIEs.list.array[2]->value.present = \ - F1SetupResponseIEs__value_PR_RRC_Version; - rrc_Ver = &f1SetupRsp->protocolIEs.list.array[2]->value.choice.RRC_Version; - rrc_Ver->latest_RRC_Version.size = RRC_SIZE; - - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL,\ - (Data **)&(rrc_Ver->latest_RRC_Version.buf), sizeof(U8)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(cuName->buf),(Size)sizeof(cuName->size)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - /* Need to check RRC Version */ - rrc_Ver->latest_RRC_Version.buf[0] = cuCfgParams.rrcVersion.rrcVer; - rrc_Ver->latest_RRC_Version.bits_unused = 5; //TODO: pick from cuCfgParam. If not present, add it - - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); - - /* Encode the F1SetupRequest type as UPER */ - cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); - encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); - - if(encRetVal.encoded == ENCODE_FAIL) - { - printf("Could not encode F1SetupResponse structure (at %s)\n",\ - encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); - ret = RFAILED; - } - else - { - printf("\nCreated APER encoded buffer for F1SetupResponse\n"); - for(int i=0; i< encBufSize; i++) - { - printf("%x",encBuf[i]); - } - } - return ret; -}/* End of BuildF1SetupRsp */ - -/******************************************************************* - * - * @brief Builds and sends the DUConfigUpdate - * - * @details - * - * Function : BuildDUConfigUpdate - * - * Functionality: Constructs the DU Update message and sends - * it to the CU through SCTP. - * - * @params[in] void **buf,Buffer to which encoded pattern is written into - * @params[in] int *size,size of buffer - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 BuildDUConfigUpdate() -{ - S16 ret; - U8 idx; - U8 elementCnt; - asn_enc_rval_t encRetVal; /* Encoder return value */ - F1AP_PDU_t *f1apDuCfg = NULL; - GNBDUConfigurationUpdate_t *duCfgUpdate; - - printf("\nBuilding DU config update\n"); - - /* Allocate the memory for F1DuCfg */ - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - RETVALUE(ret); - } - - f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage; - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&(f1apDuCfg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - f1apDuCfg->choice.initiatingMessage->procedureCode = ProcedureCode_id_gNBDUConfigurationUpdate; - f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject; - f1apDuCfg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_GNBDUConfigurationUpdate; - duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; - - elementCnt = 1; - duCfgUpdate->protocolIEs.list.count = elementCnt; - duCfgUpdate->protocolIEs.list.size = elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *); - - /* Initialize the F1Setup members */ - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&(duCfgUpdate->protocolIEs.list.array),\ - (Size)elementCnt*sizeof(GNBDUConfigurationUpdateIEs_t *)); - if(ret != ROK) - { - printf("Memory allocation for F1RequestIEs failed"); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1apDuCfg->choice.initiatingMessage),\ - (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - for(idx=0;idxprotocolIEs.list.array[idx]),\ - (Size)sizeof(GNBDUConfigurationUpdateIEs_t)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(duCfgUpdate->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)&(f1apDuCfg->choice.initiatingMessage), (Size)sizeof(InitiatingMessage_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apDuCfg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - } - - /*TransactionID*/ - duCfgUpdate->protocolIEs.list.array[0]->id = ProtocolIE_ID_id_TransactionID ; - duCfgUpdate->protocolIEs.list.array[0]->criticality = Criticality_reject; - duCfgUpdate->protocolIEs.list.array[0]->value.present = GNBDUConfigurationUpdateIEs__value_PR_TransactionID; - duCfgUpdate->protocolIEs.list.array[0]->value.choice.TransactionID = TRANS_ID; - - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg); - - /* Encode the DU Config Update type as APER */ - cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); - encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf); - if(encRetVal.encoded == ENCODE_FAIL) - { - printf("Could not encode DUConfigUpdate structure (at %s)\n",encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); - RETVALUE(RFAILED); - } - else - { - printf("\nCreated APER encoded buffer for DUConfigUpdate\n"); - for(int i=0; i< encBufSize; i++) - { - printf("%x",encBuf[i]); - } - } - RETVALUE(ROK); -}/* End of BuildDUConfigUpdate */ - -/******************************************************************* - * - * @brief Builds and sends the DUUpdateAcknowledge - * - * @details - * - * Function : BuildDUUpdateAck - * - * Functionality: Constructs the DU Update Acknowledge message and sends - * it to the DU through SCTP. - * - * @params[in] void **buf,Buffer to which encoded pattern is written into - * @params[in] int *size,size of buffer - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 BuildDUUpdateAck() -{ - S16 ret; - U8 idx; - U8 elementCnt; - F1AP_PDU_t *f1apMsg = NULL; - GNBDUConfigurationUpdateAcknowledge_t *gNBDuCfgAck; - asn_enc_rval_t enRetVal; /* Encoder return value */ - - printf("\nBuilding GNB-DU Config Update Ack\n"); - - /* Allocate the memory for F1SetupRequest_t */ - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&f1apMsg, (Size)sizeof(F1AP_PDU_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - RETVALUE(ret); - } - - f1apMsg->present = F1AP_PDU_PR_successfulOutcome; - - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL,(Data **)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - if(ret != ROK) - { - printf("Memory allocation for F1AP-PDU failed"); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_gNBDUConfigurationUpdate; - f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; - f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge; - gNBDuCfgAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; - - elementCnt = 1; - gNBDuCfgAck->protocolIEs.list.count = elementCnt; - gNBDuCfgAck->protocolIEs.list.size = elementCnt*sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t); - - /* Initialize the F1Setup members */ - ret = SGetSBuf(DU_APP_MEM_REGION,DU_POOL,(Data **)&(gNBDuCfgAck->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); - if(ret != ROK) - { - printf("Memory allocation for DuUpdateAcknowledgeIEs failed"); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - - for(idx=0; idxprotocolIEs.list.array[idx]),\ - (Size)sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t)); - if(ret != ROK) - { - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(gNBDuCfgAck->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); - RETVALUE(ret); - } - } - - /*TransactionID*/ - gNBDuCfgAck->protocolIEs.list.array[0]->id = ProtocolIE_ID_id_TransactionID ; - gNBDuCfgAck->protocolIEs.list.array[0]->criticality = Criticality_reject; - gNBDuCfgAck->protocolIEs.list.array[0]->value.present = GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID; - gNBDuCfgAck->protocolIEs.list.array[0]->value.choice.TransactionID = TRANS_ID; - - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); - - /* Encode the F1SetupRequest type as UPER */ - cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); - encBufSize = 0; - enRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); - if(enRetVal.encoded == ENCODE_FAIL) - { - printf("\nCould not encode DUConfigUpdateAcknowledge structure (at %s)",enRetVal.failed_type ? enRetVal.failed_type->name : "unknown"); - RETVALUE(RFAILED); - } - else - { - printf("\nCreated APER encoded buffer for DuConfigUpdateAcknowledge\n"); - for(int i=0; i< encBufSize; i++) - { - printf("%x",encBuf[i]); - } - } - RETVALUE(ROK); - -}/* End of BuildDUUpdateAck*/ - -/******************************************************************* -* -* @brief Handles received F1AP message and sends back response -* -* @details -* -* Function : F1InmsgHdlr -* -* Functionality: -* - Decodes received F1AP control message -* - Prepares response message, encodes and sends to SCTP -* -* @params[in] -* @return ROK - success -* RFAILED - failure -* -* ****************************************************************/ -void F1InmsgHdlr(Buffer *mBuf) -{ - int i,j; - char *recvBuf; - char *finalBuf; - MsgLen copyCnt; - MsgLen recvBufLen; - F1AP_PDU_t *f1apmsg; - asn_dec_rval_t rval; /* Decoder return value */ - F1AP_PDU_t f1apasnmsg ; - Buffer *respBuf; - - printf("\nReceived F1AP message buffer"); - SPrntMsg(mBuf, 0,0); - - /* Copy mBuf into char array to decode it */ - SFndLenMsg(mBuf, &recvBufLen); - if(SGetSBuf(1, 1, (Data **)&recvBuf, (Size)recvBufLen) != ROK) - { - printf("Memory allocation failed"); - return; - } - if(SCpyMsgFix(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK) - { - printf("\nFailed while copying %d", copyCnt); - return; - } - - printf("\nReceived flat buffer to be decoded : "); - for(i=0; i< recvBufLen; i++) - { - printf("%x",recvBuf[i]); - } - - /* Decoding flat buffer into F1AP messsage */ - f1apmsg = &f1apasnmsg; - memset(f1apmsg, 0, sizeof(F1AP_PDU_t)); - - rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apmsg, recvBuf, recvBufLen, 0, 0); - SPutSBuf(1, 1, (Data *)recvBuf, (Size)recvBufLen); - if(rval.code == RC_FAIL || rval.code == RC_WMORE) - { - printf("\nASN decode failed"); - return; - } - printf("\n"); - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apmsg); - - switch(f1apmsg->present) - { - case F1AP_PDU_PR_initiatingMessage: - { - switch(f1apmsg->choice.initiatingMessage->value.present) - { - case InitiatingMessage__value_PR_F1SetupRequest: - { - printf("\nF1 setup request received"); - - BuildF1SetupRsp(); - - /* Reversing the encoded string */ - if(SGetSBuf(1, 1, (Data **)&finalBuf, (Size)encBufSize) != ROK) - { - printf("Memory allocation failed"); - return; - } - for(i = 0, j = encBufSize-1; ichoice.initiatingMessage->value.present); - return; - } - }/* End of switch(initiatingMessage) */ - break; - } - - case F1AP_PDU_PR_successfulOutcome: - { - switch(f1apmsg->choice.successfulOutcome->value.present) - { - case SuccessfulOutcome__value_PR_F1SetupResponse: - { - F1SetupResponse_t *f1SetRspMsg; - F1SetupRsp f1SetRspDb; - GNB_CU_Name_t *cuName; - RRC_Version_t *rrc_Ver; - - printf("\nF1 Setup Response"); - - /* Store the received info in local database */ - f1SetRspMsg = &f1apmsg->choice.successfulOutcome->value.choice.F1SetupResponse; - cuName = &f1SetRspMsg->protocolIEs.list.array[1]->value.choice.GNB_CU_Name; - rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[2]->value.choice.RRC_Version; - - f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[0]->value.choice.TransactionID; - strcpy(f1SetRspDb.cuName, cuName->buf); - //strcpy(f1SetRspDb.rrcVersion.rrcVer, rrc_Ver->latest_RRC_Version.buf[0]); - - /* TODO :Check the deallocation */ -#if 0 - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); -#endif - - /* Build and send GNB-DU config update */ - BuildDUConfigUpdate(); - - /* Reversing the encoded string */ - if(SGetSBuf(1, 1, (Data **)&finalBuf, (Size)encBufSize) != ROK) - { - printf("Memory allocation failed"); - return; - } - for(i = 0, j = encBufSize-1; ichoice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; - duCfgUpdAckDb.transId = gnbDuCfgUpdAckMsg->protocolIEs.list.array[0]->value.choice.TransactionID; - - /* TODO :Check the deallocation */ -#if 0 - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(gNBDuCfgAck->protocolIEs.list.array),\ - (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ - (Size)sizeof(SuccessfulOutcome_t)); - SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); -#endif - break; - } - - default: - { - printf("\nInvalid type of successful outcome [%d]", f1apmsg->choice.successfulOutcome->value.present); - return; - } - }/* End of switch(successfulOutcome) */ - break; - } - - default: - { - printf("\nInvalie type of f1apMsg->present [%d]",f1apmsg->present); - return; - } - - }/* End of switch(f1apmsg->present) */ - -} /* End of F1InmsgHdlr */ - - -/********************************************************************** - End of file - **********************************************************************/ diff --git a/src/du_app/F1AP/f1ap_msg_hdl.h b/src/du_app/F1AP/f1ap_msg_hdl.h deleted file mode 100644 index c2d16c369..000000000 --- a/src/du_app/F1AP/f1ap_msg_hdl.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/* This file contains all F1AP message handler related functionality */ -#include -#include -#include -#include -#include "ProtocolExtensionField.h" -#include "F1AP-PDU.h" - -#include "envopt.h" /* Environment options */ -#include "envdep.h" /* Environment dependent */ -#include "envind.h" /* Environment independent */ -#include "gen.h" /* General */ -#include "ssi.h" /* System services */ -#include "ss_queue.h" -#include "ss_task.h" -#include "ss_msg.h" - -#include "gen.x" /* General */ -#include "ssi.x" /* System services */ -#include "ss_queue.x" -#include "ss_task.x" -#include "ss_msg.x" - -#define ENC_BUF_MAX_LEN 100 - -extern char encBuf[ENC_BUF_MAX_LEN]; -int encBufSize; - -S16 BuildF1SetupReq(); -void F1InmsgHdlr(Buffer *mBuf); - -#define ENCODE_FAIL -1 -#define TRANS_ID 1 -#define RRC_SIZE 1 - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/du_app/du_app_sctp_intf.c b/src/du_app/du_app_sctp_intf.c deleted file mode 100644 index 165998b3b..000000000 --- a/src/du_app/du_app_sctp_intf.c +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/* This file contains handler for DU APP and SCTP interface functions */ - -#include "du_sctp.h" - -/******************************************************************* - * - * @brief Packs SCTP notification - * - * @details - * - * Function : cmPkSctpNtfy - * - * Functionality: - * Packs SCTP notification - * - * @params[in] Notification - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 cmPkSctpNtfy(CmInetSctpNotification *ntfy) -{ - Buffer *mBuf; - - if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK) - { - printf("\nFailed to allocate memory"); - RETVALUE(RFAILED); - } - - if(ntfy->header.nType == CM_INET_SCTP_ASSOC_CHANGE) - { - SPkU16(ntfy->u.assocChange.state, mBuf); - } - SPkU16(ntfy->header.nType, mBuf); - - sendToDuApp(mBuf, EVTSCTPNTFY); - RETVALUE(ROK); -} - -/******************************************************************* - * - * @brief Unpacks SCTP notification - * - * @details - * - * Function : cmUnpkSctpNtfy - * - * Functionality: - * Unpacks SCTP notification - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf) -{ - CmInetSctpNotification ntfy; - cmMemset((U8*)&ntfy, 0, sizeof(CmInetSctpNotification)); - - SUnpkU16(&(ntfy.header.nType), mBuf); - if(ntfy.header.nType == CM_INET_SCTP_ASSOC_CHANGE) - { - SUnpkU16(&(ntfy.u.assocChange.state), mBuf); - } - - RETVALUE((*func)(mBuf, &ntfy)); -} - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c new file mode 100644 index 000000000..296c2592f --- /dev/null +++ b/src/du_app/du_cell_mgr.c @@ -0,0 +1,279 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains message handling functionality for DU APP */ +#include "du_cell_mgr.h" +#include "du_cfg_hdl.h" + +extern DuCfgParams duCfgParam; + +extern S16 cmPkRgrCfgReq(Pst* pst, RgrCfgTransId transId, \ + RgrCfgReqInfo *cfgReqInfo); + +/******************************************************************* + * + * @brief Processes cells to be activated + * + * @details + * + * Function : procCellsToBeActivated + * + * Functionality: + * - Processes cells to be activated list received in F1SetupRsp + * + * @params[in] void + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) +{ + U16 idx; + S16 ret; + + for(idx=0; idx\ + value.choice.Cells_to_be_Activated_List_Item; + + bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci); + if(cell.nRPCI) + { + pci = *cell.nRPCI; + } + if(ROK != (cmHashListFind(&(duCb.cellLst), (U8*) &nci, sizeof(nci), + 0, (PTR*)cellCb))) + { + return RFAILED; + } + if(!cellCb) + { + DU_LOG("\nDU_APP : HashList Find failed for nci [%d]", nci); + return RFAILED; + } + cellCb->cellStatus = ACTIVATION_IN_PROGRESS; + cellCb->cellInfo.nrPci = pci; + + /* Now remove this cell from configured list and move to active list */ + ret = cmHashListDelete(&(duCb.actvCellLst), (PTR)(cellCb)); + if(ret != ROK) + { + DU_LOG("\nDU_APP : HashListInsert into ActvCellLst failed for [%d]", nci); + } + ret = cmHashListInsert(&(duCb.actvCellLst), (PTR)(cellCb), + (U8 *)&(nci), (U16) sizeof(nci)); + + if(ret != ROK) + { + DU_LOG("\nDU_APP : HashListInsert into ActvCellLst failed for [%d]", nci); + break; + } + else + { + DU_LOG("\nDU_APP : HashListInsert into ActvCellLst successful for [%d]", nci); + } + } + + /* Start sending scheduler config */ + if(ret == ROK) + { + //TODO: uncomment later duSendSchGnbCfg(); + } + + return ROK; +} + +/****************************************************************** +* +* @brief Processes F1 Setup Response sent by CU +* +* @details +* +* Function : procF1SetupRsp +* +* Functionality: Processes F1 Setup Response sent by CU +* +* @params[in] F1AP_PDU_t ASN decoded F1AP message +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg) +{ + S16 ret = ROK; + + F1SetupResponse_t *f1SetRspMsg; + F1SetupRsp f1SetRspDb; + GNB_CU_Name_t *cuName; + RRC_Version_t *rrc_Ver; + U16 idx; + + DU_LOG("\nDU_APP : F1 Setup Response received"); + printf("\nDU_APP : F1 Setup Response received"); + duCb.f1Status = TRUE; //Set F1 status as true + f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse; + + for(idx=0; idxprotocolIEs.list.count; idx++) + { +// F1SetupResponseIEs_t f1RspIe = f1SetRspMsg->protocolIEs.list.array[idx]; + switch(f1SetRspMsg->protocolIEs.list.array[idx]->id) + { + case ProtocolIE_ID_id_Cells_to_be_Activated_List: + { + procCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\ + value.choice.Cells_to_be_Activated_List); + break; + } + //TODO: where to store and how to use below variables?can they be skipped + case ProtocolIE_ID_id_TransactionID: + { + f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\ + value.choice.TransactionID; + break; + } + case ProtocolIE_ID_id_gNB_CU_Name: + { + cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\ + value.choice.GNB_CU_Name; + strcpy(f1SetRspDb.cuName, (const char*)cuName->buf); + break; + } + case ProtocolIE_ID_id_GNB_CU_RRC_Version: + { + rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\ + value.choice.RRC_Version; + strcpy(f1SetRspDb.rrcVersion.rrcVer, + (const char*)rrc_Ver->latest_RRC_Version.buf); + break; + } + default: + DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld", + f1SetRspMsg->protocolIEs.list.array[idx]->id); + } + } + + /* TODO :Check the deallocation */ +#if 0 + SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\ + (Size)elementCnt * sizeof(F1SetupResponseIEs_t *)); + SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ + (Size)sizeof(SuccessfulOutcome_t)); + SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); +#endif + + /* Build and send GNB-DU config update */ + ret = BuildAndSendDUConfigUpdate(); + return ret; +} + +/****************************************************************** +* +* @brief Send gNB cfg to scheduler via MAC +* +* @details +* +* Function : duSendSchGnbCfg +* +* Functionality: Send gNB cfg to scheduler via MAC +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +S16 duSendSchGnbCfg() +{ + + RgrCfgReqInfo *cfgReq = NULLP; + MacSchedGnbCfg *cfg = NULLP; + U32 transId = 1; + + DU_ALLOC(cfgReq, sizeof(RgrCfgReqInfo)); + if( cfgReq == NULLP) + { + DU_LOG("\nDU_APP : Mem allocation failed in duSendSchGnbCfg"); + return RFAILED; + } + + cfgReq->action = SCH_CONFIG; + cfgReq->u.cfgInfo.cfgType = MAC_GNB_CFG; + cfg = &(cfgReq->u.cfgInfo.u.schedGnbCfg); + cfg->numTxAntPorts = duCfgParam.schedCfg.numTxAntPorts; + cfg->ulSchdType = duCfgParam.schedCfg.ulSchdType; + cfg->dlSchdType = duCfgParam.schedCfg.dlSchdType; + cfg->numCells = duCfgParam.schedCfg.numCells; + cfg->maxUlUePerTti = duCfgParam.schedCfg.maxUlUePerTti; + cfg->maxDlUePerTti = duCfgParam.schedCfg.maxDlUePerTti; + + if(ROK != duSendSchGnbCfgToMac(cfgReq, transId)) + { + return RFAILED; + } + + return ROK; +} + +/****************************************************************** +* +* @brief Send gNB cfg to scheduler via MAC +* +* @details +* +* Function : duSendSchGnbCfgToMac +* +* Functionality: Send gNB cfg to scheduler via MAC +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +S16 duSendSchGnbCfgToMac(RgrCfgReqInfo *cfgReq, U32 trans_id) +{ + RgrCfgTransId transId; + Pst pst; + + DU_SET_ZERO(&pst, sizeof(Pst)); + DU_SET_ZERO(&transId, sizeof(RgrCfgTransId)); + + transId.trans[0] = MAC_GNB_CFG; + transId.trans[1] = cfgReq->action; + transId.trans[7] = trans_id & 0x000000ff; trans_id >>= 8; + transId.trans[6] = trans_id & 0x000000ff; trans_id >>= 8; + transId.trans[5] = trans_id & 0x000000ff; trans_id >>= 8; + transId.trans[4] = trans_id & 0x000000ff; trans_id >>= 8; + + pst.selector = DU_SELECTOR_LC; + pst.srcEnt = ENTDUAPP; + pst.dstEnt = ENTRG; + pst.dstInst = (Inst)0; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.region = duCb.init.region; + pst.event = (Event) EVTMACSCHCFGREQ; + + cmPkRgrCfgReq(&pst, transId, cfgReq); + + return ROK; +} + +/********************************************************************** + End of file + **********************************************************************/ diff --git a/src/du_app/du_cell_mgr.h b/src/du_app/du_cell_mgr.h new file mode 100644 index 000000000..b5cd29093 --- /dev/null +++ b/src/du_app/du_cell_mgr.h @@ -0,0 +1,37 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains message handling functionality for DU APP */ +#ifndef __DU_CELL_MGR_H__ +#define __DU_CELL_MGR_H__ + +#include "du_mgr.h" +#include "du_log.h" +#include "du_f1ap_msg_hdl.h" +#include "rgr.h" +#include "rgr.x" + +S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg); +S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToBeActivated); +S16 duSendSchGnbCfg(); +S16 duSendSchGnbCfgToMac(RgrCfgReqInfo *cfgReq, U32 trans_id); + +#endif +/********************************************************************** + End of file + **********************************************************************/ diff --git a/src/du_app/du_cfg_hdl.c b/src/du_app/du_cfg_hdl.c new file mode 100644 index 000000000..7cb71d356 --- /dev/null +++ b/src/du_app/du_cfg_hdl.c @@ -0,0 +1,478 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all utility functions */ +#include "du_cfg_hdl.h" + +extern DuCfgParams duCfgParam; + + +/* Filling Slot configuration as : + * Slot Sym 0 Sym 1 Sym 2 Sym 3 Sym 4 Sym 5 Sym 6 Sym 7 Sym 8 Sym 9 Sym10 Sym11 Sym12 Sym13 + * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL + * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL + * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL + * 3 DL DL DL DL DL DL DL DL DL DL GD GD GD UL + * 4 UL UL UL UL UL UL UL UL UL UL UL UL UL UL +*/ + +/******************************************************************* + * + * @brief Fills the Slot configuration + * + * @details + * + * Function : fillSlotConfig + * + * Functionality:Fill the Slot configuration values + * + * @params[in] void + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void fillSlotConfig() +{ + U8 slot; + U8 symbol; + + for(slot = 0; slot <= 3; slot++) + { + for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) + duCfgParam.clCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT; + } + + duCfgParam.clCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT; + duCfgParam.clCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT; + duCfgParam.clCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT; + duCfgParam.clCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT; + + for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) + duCfgParam.clCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT; + +} + +/******************************************************************* + * + * @brief Reads the CL Configuration. + * + * @details + * + * Function : readClCfg + * + * Functionality: + * - Fills up the cell configuration for CL. + * - Calls fillSlotConfig() + * + * @params[in] void + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + + +/* This function is used to fill up the cell configuration for CL */ +S16 readClCfg() +{ + duCfgParam.clCellCfg.carrierId = CARRIER_IDX; + + /* Cell configuration */ + duCfgParam.clCellCfg.cellId = NR_CELL_ID; + duCfgParam.clCellCfg.phyCellId = NR_PCI; + duCfgParam.clCellCfg.dupType = DUPLEX_MODE; + + /* DL carrier configuration */ + duCfgParam.clCellCfg.dlCarrCfg.pres = TRUE; + duCfgParam.clCellCfg.dlCarrCfg.bw = SUL_ARFCN; + duCfgParam.clCellCfg.dlCarrCfg.freq = NR_ARFCN; + duCfgParam.clCellCfg.dlCarrCfg.k0[0] = 1; + duCfgParam.clCellCfg.dlCarrCfg.k0[1] = 1; + duCfgParam.clCellCfg.dlCarrCfg.k0[2] = 1; + duCfgParam.clCellCfg.dlCarrCfg.k0[3] = 1; + duCfgParam.clCellCfg.dlCarrCfg.k0[4] = 1; + duCfgParam.clCellCfg.dlCarrCfg.gridSize[0] = 1; + duCfgParam.clCellCfg.dlCarrCfg.gridSize[1] = 1; + duCfgParam.clCellCfg.dlCarrCfg.gridSize[2] = 1; + duCfgParam.clCellCfg.dlCarrCfg.gridSize[3] = 1; + duCfgParam.clCellCfg.dlCarrCfg.gridSize[4] = 1; + duCfgParam.clCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT; + + /* UL Carrier configuration */ + duCfgParam.clCellCfg.ulCarrCfg.pres = TRUE; + duCfgParam.clCellCfg.ulCarrCfg.bw = SUL_ARFCN; + duCfgParam.clCellCfg.ulCarrCfg.freq = NR_ARFCN; + duCfgParam.clCellCfg.ulCarrCfg.k0[0] = 1; + duCfgParam.clCellCfg.ulCarrCfg.k0[1] = 1; + duCfgParam.clCellCfg.ulCarrCfg.k0[2] = 1; + duCfgParam.clCellCfg.ulCarrCfg.k0[3] = 1; + duCfgParam.clCellCfg.ulCarrCfg.k0[4] = 1; + duCfgParam.clCellCfg.ulCarrCfg.gridSize[0] = 1; + duCfgParam.clCellCfg.ulCarrCfg.gridSize[1] = 1; + duCfgParam.clCellCfg.ulCarrCfg.gridSize[2] = 1; + duCfgParam.clCellCfg.ulCarrCfg.gridSize[3] = 1; + duCfgParam.clCellCfg.ulCarrCfg.gridSize[4] = 1; + duCfgParam.clCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT; + + duCfgParam.clCellCfg.freqShft = FREQ_SHIFT_7P5KHZ; + + /* SSB configuration */ + duCfgParam.clCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; + duCfgParam.clCellCfg.ssbCfg.bchPayload = BCH_PAYLOAD; + duCfgParam.clCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; + duCfgParam.clCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET; + duCfgParam.clCellCfg.ssbCfg.betaPss = BETA_PSS; + duCfgParam.clCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; + duCfgParam.clCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET; + duCfgParam.clCellCfg.ssbCfg.mibPdu = 104; + duCfgParam.clCellCfg.ssbCfg.nSSBMask[0] = 2162721; + duCfgParam.clCellCfg.ssbCfg.nSSBMask[1] = 0; + duCfgParam.clCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND; + duCfgParam.clCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER; + + /* PRACH configuration */ + duCfgParam.clCellCfg.prachCfg.pres = TRUE; + duCfgParam.clCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN; + duCfgParam.clCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING; + duCfgParam.clCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG; + duCfgParam.clCellCfg.prachCfg.prachFdm = NUM_PRACH_FDM; + duCfgParam.clCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX; + duCfgParam.clCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ; + duCfgParam.clCellCfg.prachCfg.fdm[0].k1 = 1; + duCfgParam.clCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG; + duCfgParam.clCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ; + DU_ALLOC(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq, NUM_UNUSED_ROOT_SEQ * sizeof(U8)); + if(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP) + { + DU_LOG("\nDU_APP : Memory allocation failed"); + RETVALUE(RFAILED); + } + *(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ; + duCfgParam.clCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH; + duCfgParam.clCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND; + + /* TDD configuration */ + duCfgParam.clCellCfg.tddCfg.pres = TRUE; + duCfgParam.clCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY; + + fillSlotConfig(); + + /* RSSI Measurement configuration */ + duCfgParam.clCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT; + + /* This should be calculated based on + (number of mandatory parameters) + (number of otional parameters being filled) */ + duCfgParam.clCellCfg.numTlv = 39; + + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Configures the DU Parameters + * + * @details + * + * Function : readCfg + * + * Functionality: + * - Initializes the DuCfg members. + * - Calls readClCfg() + * + * @params[in] system task ID + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 readCfg() +{ + U8 i,j,k; + U32 ipv4_du, ipv4_cu; + + cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du); + cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu); + + /* F1 DU IP Address and Port*/ + duCfgParam.sctpParams.duIpAddr.ipV4Pres = TRUE; + duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du; + duCfgParam.sctpParams.duPort = DU_PORT; + + /* F1 CU IP Address and Port*/ + duCfgParam.sctpParams.cuIpAddr.ipV4Pres = TRUE; + duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu; + duCfgParam.sctpParams.cuPort = CU_PORT; + + + /* EGTP Parameters */ + duCfgParam.egtpParams.localIp.ipV4Pres = TRUE; + duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du; + duCfgParam.egtpParams.localPort = DU_EGTP_PORT; + duCfgParam.egtpParams.destIp.ipV4Pres = TRUE; + duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu; + duCfgParam.egtpParams.destPort = CU_EGTP_PORT; + duCfgParam.egtpParams.minTunnelId = 0; + duCfgParam.egtpParams.maxTunnelId = 10; + + duCfgParam.maxUe = 32; //TODO: Check + /* DU Info */ + duCfgParam.duId = DU_ID; + strcpy((char*)duCfgParam.duName,DU_NAME); + + for(i=0; ibuf == NULL || bitString->size <= 0) + { + DU_LOG("\nDU_APP : Bit string is empty"); + return RFAILED; + } + + numOctets = (bitString->size + 7 )/8; + for(idx=0; idx< numOctets; idx++) + { + *val |= bitString->buf[idx]; + *val <<= 8; + } + + *val |= bitString->buf[numOctets -1]; + *val >>= ((numOctets * 8) - bitString->size); + + return ROK; +} + + +/********************************************************************** + End of file + **********************************************************************/ + diff --git a/src/du_app/du_cfg_hdl.h b/src/du_app/du_cfg_hdl.h new file mode 100644 index 000000000..517ff7e3e --- /dev/null +++ b/src/du_app/du_cfg_hdl.h @@ -0,0 +1,897 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +#ifndef __DU_CONFIG_H_ +#define __DU_CONFIG_H__ + +#include "du_mgr.h" +#include "lcl.h" +#include "du_log.h" +#include "BIT_STRING.h" + +/* MACROS */ +#define DU_INST 0 +#define DU_ID 1 +#define DU_IP_V4_ADDR "10.0.2.20" +#define CU_IP_V4_ADDR "10.0.2.25" +#define DU_PORT 38472 +#define CU_PORT 38472 +#define DU_EGTP_PORT 39001 +#define CU_EGTP_PORT 39002 +#define NR_PCI 1 +#define NR_CELL_ID 1 +#define DU_NAME "ORAN_OAM_DU" +#define CELL_TYPE SMALL +#define DUPLEX_MODE DUP_MODE_TDD +#define DU_TAC 1 +#define PLMN_MCC0 3 +#define PLMN_MCC1 1 +#define PLMN_MCC2 1 +#define PLMN_MNC0 4 +#define PLMN_MNC1 8 +#define PLMN_MNC2 0 +#define NR_ARFCN 2079427 +#define SUL_ARFCN 100 +#define NR_FREQ_BAND 257 +#define SUL_BAND 2 +#define TIME_CFG 0 +#define CARRIER_IDX 1 +#define NUM_TX_ANT 2 +#define NUM_RX_ANT 2 +#define FREQ_SHIFT_7P5KHZ FALSE +#define SSB_PBCH_PWR 0 +#define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD +#define SUBCARRIER_SPACING 3 +#define PRB_OFFSET 0 +#define BETA_PSS BETA_PSS_0DB +#define SSB_PERIODICITTY SSB_PRDCTY_MS_20 +#define SSB_SUBCARRIER_OFFSET 0 +#define SSB_MULT_CARRIER_BAND FALSE +#define MULT_CELL_CARRIER FALSE + +#define PRACH_SEQ_LEN SHORT_SEQUENCE +#define PRACH_SUBCARRIER_SPACING 3 +#define PRACH_RESTRICTED_SET_CFG UNRESTRICTED +#define NUM_PRACH_FDM 1 +#define ROOT_SEQ_IDX 0 +#define NUM_ROOT_SEQ 1 +#define ZERO_CORRELATION_ZONE_CFG 2 +#define NUM_UNUSED_ROOT_SEQ 1 +#define UNUSED_ROOT_SEQ 1 +#define SSB_PER_RACH 3 +#define PRACH_MULT_CARRIER_BAND FALSE +#define TDD_PERIODICITY TX_PRDCTY_MS_2P5 +#define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI + +#define DU_PROC 0 +#define DU_INST 0 +#define DU_POOL 1 + +#define SCTP_INST 0 +#define EGTP_INST 0 + +/* Events */ +#define EVTCFG 0 + +/* Selector */ +#define DU_SELECTOR_LC 0 +#define DU_SELECTOR_TC 1 +#define DU_SELECTOR_LWLC 2 + +#ifdef EGTP_TEST +/* Macro definitions for EGTP procedures */ +#define EGTP_LCL_TEID 1 /* EGTP local tunnel id */ +#define EGTP_REM_TEID 10 /* EGTP remote tinnel id */ +#endif + + +/* Macro definitions for F1 procedures */ +#define CU_DU_NAME_LEN_MAX 30 /* Max length of CU/DU name string */ +#define MAX_F1_CONNECTIONS 65536 /* Max num of F1 connections */ +#define DU_MAX_CELLS 512 /* Max num of cells served by gNB-DU */ +#define MAX_PLMN 6 /* Max num of broadcast PLMN ids */ +#define MAXNRARFCN 3279165 /* Maximum values of NRAFCN */ +#define MAXNRCELLBANDS 2 /* Maximum number of frequency bands */ +#define MAXNUMOFSLICEITEMS 1024 /* Maximum number of signalled slice support items */ +#define MAXBPLMNNRMINUS1 1 /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */ +#define MAXNUMOFSIBTYPES 32 /* Maximum number of SIB types */ +#define MAX_UEID 512 /* Maximum number of UE Ids */ +#define MAX_TNL_ASSOC 32 /* Max num of TNL Assoc between CU and DU */ +#define MAXCELLINENB 256 /* Max num of cells served by eNB */ +#define MAXNUMOFUEID 65536 /* Max num of UEs served by DU */ +#define MAXNUMOFUACPLMN 12 /* Maximum number of PLMN ids*/ +#define MAXNUMOFUACPERPLMN 64 /* Maximum number of signalled categories per PLMN */ +#define DEFAULT_CELLS 1 /* Max num of broadcast PLMN ids */ + +typedef enum +{ + GNBDU, + GNBCU +}F1Entity; + +typedef enum +{ + UNSPECIFIED, + RL_FAILURE_RLC, + INVALID_CU_UE_F1AP_ID, + INVALID_DU_UE_F1AP_ID, + INTERACTION_WITH_OTHER_PROC, + INVALID_QCI_VALUE, + RADIO_RELATED_REASON, + INSUFFICIENT_RADIO_RESOURCE, + PROCEDURE_CANCELLED, + NORMAL_RELEASE, + UNAVAILABLE_CELL, + RL_FAILURE_OTHERS, + UE_ACCESS_REJECTED, + SLICE_RESOURCE_UNAVAILABLE, + AMF_ABNORMAL_RELEASE, + INVALID_PLMN +}RadioNwCause; + +typedef enum +{ + TRANS_CAUSE_UNSPECIFIED, + TRANSPORT_RESOURCE_UNAVAIL +}TransLayerCause; + +typedef enum +{ + TRANSFER_SYNTAX_ERR, + ABSTRACT_SYNTAX_ERR_REJECT, + ABSTRACT_SYNTAX_ERR_NOTIFY, + INCOMPATIBLE_MESSAGE, + SEMANTIC_ERROR, + ABSTRACT_SYNTAX_ERR_MSG_CONSTRUCT, + PROTOCOL_CAUSE_UNSPECIFIED +}ProtocolCause; + +typedef enum +{ + CONTROL_PROC_OVERLOAD, + INSUFF_USER_PLANE_RESOURCE, + HARDWARE_FAILURE, + O_AND_M_INTERVENTION, + MISC_CAUSE_UNSPECIFIED +}MiscCause; + +typedef enum +{ + ALL +}F1ResetAll; + +typedef enum +{ + IN_SERVICE, + OUT_OF_SERVICE +}SrvState; + +typedef enum +{ + INITIATING_MSG, + SUCCESSFUL_OUTCOME, + UNSUCCESSFUL_OUTCOME +}F1TriggMsgVal; + +typedef enum +{ + CRIT_REJECT, + CRIT_IGNORE, + CRIT_NOTIFY +}F1ProcCritVal; + +typedef enum +{ + NOT_UNDERSTOOD, + MISSING_IE +}F1ErrorType; + +typedef enum +{ + SCS_15, + SCS_30, + SCS_60, + SCS_120 +}F1NrScs; + +typedef enum +{ + NRB_11, + NRB_18, + NRB_24, + NRB_25, + NRB_31, + NRB_32, + NRB_38, + NRB_51, + NRB_52, + NRB_65, + NRB_66, + NRB_78, + NRB_79, + NRB_93, + NRB_106, + NRB_107, + NRB_121, + NRB_132, + NRB_133, + NRB_135, + NRB_160, + NRB_162, + NRB_189, + NRB_216, + NRB_217, + NRB_245, + NRB_264, + NRB_270, + NRB_273 +}F1Nrb; + +typedef enum +{ + VERY_SMALL, + SMALL, + MEDIUM, + LARGE +}F1CellType; + +typedef enum +{ + DL, + UL, + DL_UL +}F1CellDir; + +typedef enum +{ + UE_USAGE, + NON_UE_USAGE, + BOTH +}F1AssocUsage; + +typedef enum +{ + BARRED, + NOT_BARRED +}CellBarred; + +typedef enum +{ + OFFER, + EXECUTION +}F1ReqType; + +typedef enum +{ + IGNORE_YES, + IGNORE_NO +}F1IgnoreReq; + +typedef enum +{ + OVERLOADED, + NOT_OVERLOADED +}F1GnbDuOvrloadInfo; + +typedef enum +{ + REJECT_RRC_CONN_NON_EMERG_MODT, + REJECT_RRC_CONN_SIGNALLING, + PERMIT_EMERG_SESSION_AND_MOBILE_TERM_SERVICE, + PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE +}F1UacStandardAction; + +typedef struct f1RrcVersion +{ + char rrcVer[30]; /* Latest RRC Version */ + U32 extRrcVer; /* Latest RRC version extended */ +}F1RrcVersion; + +typedef struct f1FailCause +{ + union + { + RadioNwCause radioNwCause; /* Radio Network Layer Cause */ + TransLayerCause transLayerCause; /* Transport Layer Cause */ + ProtocolCause protCause; /* Protocol Cause */ + MiscCause miscCause; /* Miscellaneous Cause */ + }cause; +}F1FailCause; + +typedef struct f1ProcCode +{ + Bool pres; + U8 value; +}F1ProcCode; + +typedef struct f1TriggMsg +{ + Bool pres; + F1TriggMsgVal value; +}F1TriggMsg; + +typedef struct f1ProcCrit +{ + Bool pres; + F1ProcCritVal value; +}F1ProcCrit; + +typedef struct f1CritDignosIE +{ + F1ProcCritVal ieCritVal; + U16 ieId; + F1ErrorType type; +}F1CritDignosIE; + +typedef struct f1CritDiagnostic +{ + Bool pres; + F1ProcCode procCode; /* Procedure Code */ + F1TriggMsg triggeringMsg; /* Triggering Message */ + F1ProcCrit procCrit; /* Criticality of Triggering msg/proc */ + U32 transId; + F1CritDignosIE diagnosIE; +}F1CritDiagnostic; + +typedef struct f1FailureIE +{ + U32 transId; /* Uniquely identify transaction */ + F1FailCause cause; /* Failure cause */ + U8 timeToWait; /* Seconds to be waited before retry */ + F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ +}F1FailureIE; + +typedef struct f1LogicalConnUeAssoc +{ + U32 gnbCuUeF1apId; + U32 gnbDuUeF1apId; +}F1LogicalConnUeAssoc; + +typedef struct f1ResetType +{ + union + { + F1ResetAll resetAll; /* Reset All */ + F1LogicalConnUeAssoc ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* In case of Partial Reset : UE associated logical F1 conn list*/ + }type; +}F1ResetType; + +typedef struct f1PLMN +{ + U8 mcc[3]; + U8 mnc[3]; +}PlmnId; + +typedef struct nrEcgi +{ + PlmnId plmn; + U16 cellId; +}NrEcgi; + +typedef struct f1SibType +{ + U8 sibType; + U8 sibMsg; + U8 value; +}F1SibType; + +typedef struct f1TxBw +{ + F1NrScs nrScs; /* NR subcarrier spacing */ + F1Nrb nrb; /* Transmission bandwidth expressed in units of RBs */ +}F1TxBw; + +typedef struct f1SulInfo +{ + U32 sulArfcn; /* SUL ARFCN */ + F1TxBw sulTxBw; /* SUL transmission bandwidth */ +}F1SulInfo; + +typedef struct f1FreqBand +{ + U16 nrFreqBand; + U16 sulBand[MAXNRCELLBANDS]; +}F1FreqBand; + +typedef struct f1NrFreqInfo +{ + U32 nrArfcn; + F1SulInfo sulInfo; + F1FreqBand freqBand[MAXNRCELLBANDS]; +}F1NrFreqInfo; + +typedef struct f1NrFddInfo +{ + F1NrFreqInfo ulNrFreqInfo; /* UL NR Frequency Info */ + F1NrFreqInfo dlNrFreqInfo; /* DL NR Frequency Info */ + F1TxBw ulTxBw; /* UL Transmission bandwidth */ + F1TxBw dlTxBw; /* DL Transmission bandwidth */ +}F1NrFddInfo; + +typedef struct f1NrTddInfo +{ + F1NrFreqInfo nrFreqInfo; /* NR Frequency Info */ + F1TxBw nrTxBw; /* NR Transmission Bandwidth */ +}F1NrTddInfo; + +typedef struct f1NrModeInfo +{ + union + { + F1NrFddInfo fdd; + F1NrTddInfo tdd; + }mode; +}NrModeInfo; + +typedef struct f1EutraFddInfo +{ + U16 ulOffset; /* UL offset to Point A */ + U16 dlOffset; /* DL offset to Point A */ +}F1EutraFDDInfo; + +typedef struct f1EutraTddInfo +{ + U16 tddOffset; /* Offset to Point A */ +}F1EutraTDDInfo; + +typedef struct f1EutraModeInfo +{ + union + { + F1EutraFDDInfo fdd; + F1EutraTDDInfo tdd; + }mode; +}F1EutraModeInfo; + +typedef struct f1Snsaai +{ + U8 sst; + U32 sd; +}F1Snsaai; + +typedef struct epIpAddr +{ + char transportAddr[20]; /* Transport Layer Address */ +}EpIpAddr; + +typedef struct epIpAddrPort +{ + EpIpAddr epIpAddr; + char port[2]; +}EpIpAddrPort; + +typedef struct f1TaiSliceSuppLst +{ + Bool pres; + F1Snsaai snssai[MAXNUMOFSLICEITEMS]; +}F1TaiSliceSuppLst; + +typedef struct f1SrvdPlmn +{ + PlmnId plmn; + F1TaiSliceSuppLst taiSliceSuppLst; +}F1SrvdPlmn; + +typedef struct f1BrdcstPlmnInfo +{ + PlmnId plmn[MAX_PLMN]; /* PLMN id list */ + PlmnId extPlmn[MAX_PLMN]; /* Extended PLMN id list */ + U16 tac; /* 5GS-TAC */ + U32 nrCellId; /* NR Cell id */ + U8 ranac; /* RAN Area code */ +}F1BrdcstPlmnInfo; + +typedef struct f1CellInfo +{ + NrEcgi nrCgi; /* Cell global Identity */ + U32 nrPci; /* Physical Cell Identity */ + PlmnId plmn[MAX_PLMN]; /* Available PLMN list */ + PlmnId extPlmn[MAX_PLMN]; /* Extended available PLMN list */ +}F1CellInfo; + +typedef struct f1DuCellInfo +{ + F1CellInfo cellInfo; /* cell info */ + U16 tac; /* tracking area code */ + U16 epsTac; /* Configured EPS TAC */ + NrModeInfo f1Mode; /* NR mode info : FDD/TDD */ + U8 measTimeCfg; /* Measurement timing configuration */ + F1CellDir cellDir; /* Cell Direction */ + F1CellType cellType; /* Cell Type */ + F1BrdcstPlmnInfo brdcstPlmnInfo[MAXBPLMNNRMINUS1]; /* Broadcast PLMN Identity Info List */ +}F1DuCellInfo; + +typedef struct f1DuSysInfo +{ + U8 *mibMsg; /* MIB message */ + U8 *sib1Msg; /* SIB1 message */ +}F1DuSysInfo; + +typedef struct f1CuSysInfo +{ + F1SibType sibTypeToUpd[MAXNUMOFSIBTYPES]; /* SIB types to be updated */ +}F1CuSysInfo; + +typedef struct f1DuSrvdCellInfo +{ + F1DuCellInfo duCellInfo; /* gNB-DU served cell info */ + F1DuSysInfo duSysInfo; /* gNB-DU System Information */ +}F1DuSrvdCellInfo; + +typedef struct f1DuSrvdCellToDel +{ + NrEcgi oldNrCgi; /* Old NR CGI */ + F1DuSrvdCellInfo srvdCellInfo; /* Info of served cell to be deleted */ +}F1DuSrvdCellToDel; + +typedef struct f1CuActCellInfo +{ + F1CellInfo cuCellInfo; /* gNB-CU available cell info */ + F1CuSysInfo cuSysInfo; /* gNB-CU System Information */ +}F1CuActCellInfo; + +typedef struct f1ActCellFail +{ + NrEcgi nrCgi; + F1FailCause cause; +}F1ActCellFail; + +typedef struct srvStatus +{ + SrvState state; + Bool switchOffOngoing; +}SrvStatus; + +typedef struct f1CellStatus +{ + NrEcgi nrEcgi; + SrvStatus status; /* Service status */ +}F1CellStatus; + +typedef struct f1DedSIDelUE +{ + U32 gnbCuUeF1apId; + NrEcgi nrEcgi; +}F1DedSIDelUE; + +typedef struct tnlAssocInfo +{ + Bool pres; + EpIpAddr epIpAddr; /* Endpoint-IP Address */ + EpIpAddrPort epIpAddrport; /* Endpoint-IP Address and Port */ +}F1TnlAssocAddr; + +typedef struct f1TnlAssocUsage +{ + Bool pres; + F1AssocUsage usage; +}F1TnlAssocUsage; + +typedef struct f1TnlAssoc +{ + F1TnlAssocAddr assocInfo; /* TNL Assoc Transport Layer Info */ + F1TnlAssocUsage assocUsage; /* TNL Assoc usage */ +}F1TnlAssoc; + +typedef struct f1TnlAssocToRmv +{ + F1TnlAssocAddr assocInfoCu; /* TNL Assoc Transport Layer Info of CU */ + F1TnlAssocAddr assocInfoDu; /* TNL Assoc Transport Layer Info of DU */ +}F1TnlAssocToRmv; + +typedef struct f1TnlAssocSetupFail +{ + F1TnlAssocAddr assocInfo; + F1FailCause cause; +}F1TnlAssocSetupFail; + + +typedef struct f1CellBarred +{ + NrEcgi nrcgi; + CellBarred cellBarred; +}F1CellBarred; + +typedef struct f1EutraCell +{ + U32 eutraCellId; /* EUTRA cell id */ + F1EutraModeInfo mode; /* EUTRA mode info : FDD/TDD */ + U8 rsrcInd; /* Protected EUTRA resource Indication */ +}F1EutraCell; + +typedef struct f1ProtectEUTRARsrc +{ + U32 specShareGrpId; /* Spectrum sharing group id */ + F1EutraCell eutraCellList[MAXCELLINENB]; /* EUTRA cells list */ +}F1ProtectEUTRARsrc; + +typedef struct f1UacOperatorDefined +{ + U8 accessCategory; + U8 accessId; +}F1UacOperatorDefined; + +typedef struct f1UacCategoryType +{ + union + { + F1UacStandardAction action; /* UAC standardized action */ + F1UacOperatorDefined operatorDef; /* UAC operator defined */ + }type; +}F1UacCategoryType; + +typedef struct f1UacType +{ + U8 uacReducInd; /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */ + F1UacCategoryType uacCategoryType; /* UAC Category type */ +}F1UacType; + +/* Unified Access Class Assistance Information */ +typedef struct f1UacAssistInfo +{ + PlmnId plmn[MAXNUMOFUACPLMN]; /* UAC PLMN list */ + F1UacType uacType[MAXNUMOFUACPERPLMN]; /* UAC Type list */ +}F1UacAssistInfo; + +/* F1 setup related structures */ + +typedef struct f1SetupReq +{ + U32 transId; /* Uniquely identify transaction */ + U32 duId; /* DU ID */ + char duName[CU_DU_NAME_LEN_MAX]; /* DU name */ + F1DuSrvdCellInfo srvdCellLst[DU_MAX_CELLS]; /* Serving cell list */ + F1RrcVersion rrcVersion; /* RRC version */ +}F1SetupReq; + +typedef struct f1setupRsp +{ + U32 transId; /* Uniquely identify transaction */ + char cuName[CU_DU_NAME_LEN_MAX]; /* CU Name */ + F1CuActCellInfo actCellInfo; /* cells to be activated */ + F1RrcVersion rrcVersion; /* RRC version */ +}F1SetupRsp; + +typedef struct f1SetupFail +{ + F1FailureIE setupFail; +}F1SetupFail; + +/* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 + * and radio resources related to the UE association(s) indicated explicitly or implicitly in + * the RESET message and remove the indicated UE contexts including F1AP ID. */ +typedef struct f1Reset +{ + U32 transId; /* Uniquely identify transaction */ + F1FailCause cause; /* Failure cause */ + F1ResetType resetType; /* type of reset */ +}F1Reset; + +/* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated + * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface, + * the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */ +typedef struct f1ResetAck +{ + U32 transId; /* Uniquely identify transaction */ + F1LogicalConnUeAssoc ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */ + F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ +}F1ResetAck; + +typedef struct f1ErrorInd +{ + U32 transId; /* Uniquely identify transaction */ + F1Entity errorOrigin; /* Specifies if error is originated at DU or CU */ + F1FailCause cause; /* Failure cause */ +/* If failure is due to Ue related message. */ + U32 gnbCuUeF1apId; /* gNB-CU UE F1AP Id */ + U32 gnbDuUeF1apId; /* gNB-DU UE F1AP Id */ + F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ +}F1ErrorInd; + +typedef struct f1GnbDuCfgUpd +{ + U32 transId; /* Uniquely identify transaction */ + F1DuSrvdCellInfo srvdCellLstAdd[DU_MAX_CELLS]; /* Served cell list to be added */ + F1DuSrvdCellToDel srvdCellLstMod[DU_MAX_CELLS]; /* Served cell list to be modified */ + NrEcgi srvdCellLstDel[DU_MAX_CELLS]; /* Served cell list to be deleted */ + F1CellStatus cellStatus[DU_MAX_CELLS]; /* Cell status */ + F1DedSIDelUE ueLst[MAX_UEID]; /* Ue list that requires dedicated SI delivery */ + U32 gnbDuId; + F1TnlAssocToRmv gnbDuTnlAssocRmv[MAX_TNL_ASSOC]; /* TNL Assoc list to remove */ +}F1GnbDuCfgUpd; + +typedef struct f1GnbDuCfgUpdAck +{ + U32 transId; /* Uniquely identify transaction */ + F1CuActCellInfo cellLstAct[DU_MAX_CELLS]; /* List of cells to be activated */ + F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ + NrEcgi cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */ +}F1GnbDuCfgUpdAck; + +typedef struct f1GnbDuCfgUpdFail +{ + F1FailureIE gnbDuCfgUpdFail; +}F1GnbDuCfgUpdFail; + +/* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */ +typedef struct f1GnbCuCfgUpd +{ + U32 transId; /* Uniquely identifies transaction */ + F1CuActCellInfo cellLstAct[DU_MAX_CELLS]; /* List of cells to be activated */ + NrEcgi cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */ + F1TnlAssoc assocLstAdd[MAX_TNL_ASSOC]; /* List of TNL assocs to be added */ + F1TnlAssoc assocLstUpd[MAX_TNL_ASSOC]; /* List of TNL assocs to be updated */ + F1TnlAssocToRmv assocLstRmv[MAX_TNL_ASSOC]; /* List of TNL assocs to be removed */ + F1CellBarred cellToBarList[DU_MAX_CELLS]; /* List of Cells to be barred */ + F1ProtectEUTRARsrc protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */ +}F1GnbCuCfgUpd; + +/* Sent by a gNB-DU to a gNB-CU to acknowledge update of information + * associated to an F1-C interface instance */ +typedef struct f1GnbCuCfgUpdAck +{ + U32 transId; /* Uniquely identify transaction */ + F1ActCellFail actCellFailList[DU_MAX_CELLS]; /* Cells failed to be activated list */ + F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ + F1TnlAssocAddr assocSetupList[MAX_TNL_ASSOC]; /* TNL Assoc Setup list */ + F1TnlAssocSetupFail assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */ + F1DedSIDelUE dedSiDelUelist[MAXNUMOFUEID]; /* Dedicated SI delivery needed UE list */ +}F1GnbCuCfgUpdAck; + +typedef struct f1GnbCuCfgUpdFail +{ + F1FailureIE gnbCuCfgUpdFail; +}F1GnbCuCfgUpdFail; + +/* This procedure enables coordination of radio resource allocation between a gNB-CU and + * a gNB-DU. Coordination request is sent by CU to DU */ +typedef struct f1GnbDuRsrcCoordReq +{ + U32 transId; /* Uniquely identifies transaction */ + F1ReqType reqType; /* Request type */ + U8 cellResCoordReqCont; /* Container for X2AP E-UTRA - NR cell resource coordination request */ + F1IgnoreReq ignoreReq; /* Ignore coordination request */ +}F1GnbDuRsrcCoordReq; + +/* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation + * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */ +typedef struct f1GnbDuRsrcCoordRsp +{ + U32 transId; /* Uniquely identifies transaction */ + U8 cellResCoordRspCont; /* Container for X2AP E-UTRA - NR cell resource coordination response */ +}F1GnbDuRsrcCoordRsp; + +/* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */ +typedef struct f1GnbDuStatusInd +{ + U32 transId; /* Uniquely identifies transaction */ + F1GnbDuOvrloadInfo ovrloadInfo; /* gNB-DU overloaded information */ +}F1GnbDuStatusInd; + +/* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal + * of the interface instance and the related resources */ +typedef struct f1RmvReq +{ + U32 transId; /* Uniquely identifies transaction */ +}F1RmvReq; + +/* This message acknowledges the initiation of removal of the interface + * instance and the related resources */ +typedef struct f1RmvRsp +{ + U32 transId; /* Uniquely identifies transaction */ + F1CritDiagnostic critDiagnos; /* Crititcality diagnostics */ +}F1RmvRsp; + +/* This message indicates that removing the interface instance and the related + * resources cannot be accepted */ +typedef struct f1RmvFail +{ + U32 transId; /* Uniquely identifies transaction */ + F1FailCause cause; /* Failure cause */ + F1CritDiagnostic critDiagnostic; /* Criticality diagnostics */ +}F1RmvFail; + +/* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce + * the rate at which UEs access the network. */ +typedef struct f1NwkAccessRateRed +{ + U32 transId; /* Uniquely identifies transaction */ + F1UacAssistInfo uacAssistInfo; /* UAC Assistance Information */ +}F1NwkAccessRateRed; + +typedef struct f1Ipaddr +{ + Bool ipV4Pres; + U32 ipV4Addr; +}F1IpAddr; + +typedef struct f1SctpParams +{ + F1IpAddr duIpAddr; + U16 duPort; + F1IpAddr cuIpAddr; + U16 cuPort; +}F1SctpParams; + +typedef struct f1EgtpParams +{ + F1IpAddr localIp; /* Ip address of local node */ + U16 localPort; /* Sender Port at local node */ + F1IpAddr destIp; /* Ip address of peer node */ + U16 destPort; /* Sender port at peer node */ + U32 minTunnelId; + U32 maxTunnelId; +}F1EgtpParams; + +typedef struct cellCfgParams +{ + NrEcgi nrEcgi; /* ECGI */ + U16 nrPci; /* PCI */ + U16 fiveGsTac; /* 5gSTac */ + PlmnId plmn[MAX_PLMN]; /* List of serving PLMN IDs */ + U8 ranac; /* RAN Area Code */ + U32 maxUe; /* max UE per slot */ +}CellCfgParams; + +typedef struct schedulerCfg +{ + U8 numTxAntPorts; /*!< Number of Tx antenna ports */ + U8 ulSchdType; /*!< Indicates which UL scheduler to use, range + * is 0..(number of schedulers - 1) */ + U8 dlSchdType; /*!< Indicates which DL scheduler to use, range + * is 0..(number of schedulers - 1) */ + U8 numCells; /*!< Max number of cells */ + U8 maxUlUePerTti; /*!< Max number of UE in UL per TTI */ + U8 maxDlUePerTti; /*!< Max number of UE in DL per TTI */ +}SchedulerCfg; + +typedef struct duCfgParams +{ + F1SctpParams sctpParams; /* SCTP Params */ + F1EgtpParams egtpParams; /* EGTP Params */ + U32 maxUe; + U32 duId; + U8 duName[CU_DU_NAME_LEN_MAX]; + SchedulerCfg schedCfg; + CellCfgParams cellCfg[DU_MAX_CELLS]; /* Cell info config*/ + F1DuSrvdCellInfo srvdCellLst[DU_MAX_CELLS]; /* Serving cell list *///TODO: this must be removed eventually + F1RrcVersion rrcVersion; /* RRC version */ + ClCellCfg clCellCfg; /* CL cell configuration */ + +}DuCfgParams; + +typedef struct duCellCb +{ + U32 cellId; /* Internal cell Id */ + CellCfgParams cellInfo; /* Cell info */ + CellStatus cellStatus; /*Cell status */ +}DuCellCb; + +/*function declarations */ +void fillSlotConfig(); +S16 readClCfg(); +S16 readCfg(); +S16 duReadCfg(); +S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val); + +#endif /* __DU_CONFIG_H__ */ + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/du_app/du_common.h b/src/du_app/du_common.h deleted file mode 100644 index 9c5f2dcff..000000000 --- a/src/du_app/du_common.h +++ /dev/null @@ -1,799 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -#ifndef __DU_COMMON_H__ -#define __DU_COMMON_H__ - -#include "envdep.h" -#include "lcl.h" - -#define DU_PROC 0 -#define DU_INST 0 -#define DU_POOL 1 - -#define SCTP_INST 0 - -/* Events */ -#define EVTCFG 0 - -/* Selector */ -#define DU_SELECTOR_LC 0 -#define DU_SELECTOR_TC 1 -#define DU_SELECTOR_LWLC 2 - - -/* Macro definitions for F1 procedures */ -#define CU_DU_NAME_LEN_MAX 30 /* Max length of CU/DU name string */ -#define MAX_F1_CONNECTIONS 65536 /* Max num of F1 connections */ -#define MAXCELLINGNBDU 2 /* Max num of cells served by gNB-DU */ -#define MAXNUMOFBPLMN 1 /* Max num of broadcast PLMN ids */ -#define MAXNRARFCN 3279165 /* Maximum values of NRAFCN */ -#define MAXNRCELLBANDS 2 /* Maximum number of frequency bands */ -#define MAXNUMOFSLICEITEMS 1024 /* Maximum number of signalled slice support items */ -#define MAXBPLMNNRMINUS1 1 /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */ -#define MAXNUMOFSIBTYPES 32 /* Maximum number of SIB types */ -#define MAX_UEID 512 /* Maximum number of UE Ids */ -#define MAXNUMOFTNLASSOCS 32 /* Max num of TNL Assoc between CU and DU */ -#define MAXCELLINENB 256 /* Max num of cells served by eNB */ -#define MAXNUMOFUEID 65536 /* Max num of UEs served by DU */ -#define MAXNUMOFUACPLMN 12 /* Maximum number of PLMN ids*/ -#define MAXNUMOFUACPERPLMN 64 /* Maximum number of signalled categories per PLMN */ - -#define MAX_IPV6_LEN 16 /* Max lenght of IPV6 Address */ - - - -typedef enum -{ - GNBDU, - GNBCU -}F1Entity; - -typedef enum -{ - UNSPECIFIED, - RL_FAILURE_RLC, - INVALID_CU_UE_F1AP_ID, - INVALID_DU_UE_F1AP_ID, - INTERACTION_WITH_OTHER_PROC, - INVALID_QCI_VALUE, - RADIO_RELATED_REASON, - INSUFFICIENT_RADIO_RESOURCE, - PROCEDURE_CANCELLED, - NORMAL_RELEASE, - UNAVAILABLE_CELL, - RL_FAILURE_OTHERS, - UE_ACCESS_REJECTED, - SLICE_RESOURCE_UNAVAILABLE, - AMF_ABNORMAL_RELEASE, - INVALID_PLMN -}RadioNwCause; - -typedef enum -{ - TRANS_CAUSE_UNSPECIFIED, - TRANSPORT_RESOURCE_UNAVAIL -}TransLayerCause; - -typedef enum -{ - TRANSFER_SYNTAX_ERR, - ABSTRACT_SYNTAX_ERR_REJECT, - ABSTRACT_SYNTAX_ERR_NOTIFY, - INCOMPATIBLE_MESSAGE, - SEMANTIC_ERROR, - ABSTRACT_SYNTAX_ERR_MSG_CONSTRUCT, - PROTOCOL_CAUSE_UNSPECIFIED -}ProtocolCause; - -typedef enum -{ - CONTROL_PROC_OVERLOAD, - INSUFF_USER_PLANE_RESOURCE, - HARDWARE_FAILURE, - O_AND_M_INTERVENTION, - MISC_CAUSE_UNSPECIFIED -}MiscCause; - -typedef enum -{ - ALL -}F1ResetAll; - -typedef enum -{ - IN_SERVICE, - OUT_OF_SERVICE -}SrvState; - -typedef enum -{ - INITIATING_MSG, - SUCCESSFUL_OUTCOME, - UNSUCCESSFUL_OUTCOME -}F1TriggMsgVal; - -typedef enum -{ - CRIT_REJECT, - CRIT_IGNORE, - CRIT_NOTIFY -}F1ProcCritVal; - -typedef enum -{ - NOT_UNDERSTOOD, - MISSING_IE -}F1ErrorType; - -typedef enum -{ - SCS_15, - SCS_30, - SCS_60, - SCS_120 -}F1NrScs; - -typedef enum -{ - NRB_11, - NRB_18, - NRB_24, - NRB_25, - NRB_31, - NRB_32, - NRB_38, - NRB_51, - NRB_52, - NRB_65, - NRB_66, - NRB_78, - NRB_79, - NRB_93, - NRB_106, - NRB_107, - NRB_121, - NRB_132, - NRB_133, - NRB_135, - NRB_160, - NRB_162, - NRB_189, - NRB_216, - NRB_217, - NRB_245, - NRB_264, - NRB_270, - NRB_273 -}F1Nrb; - -typedef enum -{ - VERY_SMALL, - SMALL, - MEDIUM, - LARGE -}F1CellType; - -typedef enum -{ - DL_ONLY, - UL_ONLY, - UL_DL -}F1CellDir; - -typedef enum -{ - UE_USAGE, - NON_UE_USAGE, - BOTH -}F1AssocUsage; - -typedef enum -{ - BARRED, - NOT_BARRED -}CellBarred; - -typedef enum -{ - OFFER, - EXECUTION -}F1ReqType; - -typedef enum -{ - IGNORE_YES, - IGNORE_NO -}F1IgnoreReq; - -typedef enum -{ - OVERLOADED, - NOT_OVERLOADED -}F1GnbDuOvrloadInfo; - -typedef enum -{ - REJECT_RRC_CONN_NON_EMERG_MODT, - REJECT_RRC_CONN_SIGNALLING, - PERMIT_EMERG_SESSION_AND_MOBILE_TERM_SERVICE, - PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE -}F1UacStandardAction; - -typedef struct f1RrcVersion -{ - U8 rrcVer; /* Latest RRC Version */ - U32 extRrcVer; /* Latest RRC version extended */ -}F1RrcVersion; - -typedef struct f1FailCause -{ - union - { - RadioNwCause radioNwCause; /* Radio Network Layer Cause */ - TransLayerCause transLayerCause; /* Transport Layer Cause */ - ProtocolCause protCause; /* Protocol Cause */ - MiscCause miscCause; /* Miscellaneous Cause */ - }cause; -}F1FailCause; - -typedef struct f1ProcCode -{ - Bool pres; - U8 value; -}F1ProcCode; - -typedef struct f1TriggMsg -{ - Bool pres; - F1TriggMsgVal value; -}F1TriggMsg; - -typedef struct f1ProcCrit -{ - Bool pres; - F1ProcCritVal value; -}F1ProcCrit; - -typedef struct f1CritDignosIE -{ - F1ProcCritVal ieCritVal; - U16 ieId; - F1ErrorType type; -}F1CritDignosIE; - -typedef struct f1CritDiagnostic -{ - Bool pres; - F1ProcCode procCode; /* Procedure Code */ - F1TriggMsg triggeringMsg; /* Triggering Message */ - F1ProcCrit procCrit; /* Criticality of Triggering msg/proc */ - U32 transId; - F1CritDignosIE diagnosIE; -}F1CritDiagnostic; - -typedef struct f1FailureIE -{ - U32 transId; /* Uniquely identify transaction */ - F1FailCause cause; /* Failure cause */ - U8 timeToWait; /* Seconds to be waited before retry */ - F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ -}F1FailureIE; - -typedef struct f1LogicalConnUeAssoc -{ - U32 gnbCuUeF1apId; - U32 gnbDuUeF1apId; -}F1LogicalConnUeAssoc; - -typedef struct f1ResetType -{ - union - { - F1ResetAll resetAll; /* Reset All */ - F1LogicalConnUeAssoc ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* In case of Partial Reset : UE associated logical F1 conn list*/ - }type; -}F1ResetType; - -typedef struct f1PLMN -{ - U8 mcc[3]; - U8 mnc[3]; -}F1Plmn; - -typedef struct nrEcgi -{ - F1Plmn plmn; - U32 cellId; -}NrEcgi; - -typedef struct f1SibType -{ - U8 sibType; - U8 sibMsg; - U8 value; -}F1SibType; - -typedef struct f1TxBw -{ - F1NrScs nrScs; /* NR subcarrier spacing */ - F1Nrb nrb; /* Transmission bandwidth expressed in units of RBs */ -}F1TxBw; - -typedef struct f1SulInfo -{ - Bool pres; - U32 sulArfcn; /* SUL ARFCN */ - F1TxBw sulTxBw; /* SUL transmission bandwidth */ -}F1SulInfo; - -typedef struct f1FreqBand -{ - U16 nrFreqBand; - U16 sulBand[MAXNRCELLBANDS]; -}F1FreqBand; - -typedef struct f1NrFreqInfo -{ - U32 nrArfcn; - F1SulInfo sulInfo; - F1FreqBand freqBand[MAXNRCELLBANDS]; -}F1NrFreqInfo; - -typedef struct f1NrFddInfo -{ - F1NrFreqInfo ulNrFreqInfo; /* UL NR Frequency Info */ - F1NrFreqInfo dlNrFreqInfo; /* DL NR Frequency Info */ - F1TxBw ulTxBw; /* UL Transmission bandwidth */ - F1TxBw dlTxBw; /* DL Transmission bandwidth */ -}F1NrFddInfo; - -typedef struct f1NrTddInfo -{ - F1NrFreqInfo nrFreqInfo; /* NR Frequency Info */ - F1TxBw nrTxBw; /* NR Transmission Bandwidth */ -}F1NrTddInfo; - -typedef struct f1NrModeInfo -{ - union - { - F1NrFddInfo fdd; - F1NrTddInfo tdd; - }mode; -}F1NrModeInfo; - -typedef struct f1EutraFddInfo -{ - U16 ulOffset; /* UL offset to Point A */ - U16 dlOffset; /* DL offset to Point A */ -}F1EutraFDDInfo; - -typedef struct f1EutraTddInfo -{ - U16 tddOffset; /* Offset to Point A */ -}F1EutraTDDInfo; - -typedef struct f1EutraModeInfo -{ - union - { - F1EutraFDDInfo fdd; - F1EutraTDDInfo tdd; - }mode; -}F1EutraModeInfo; - -typedef struct f1Tac -{ - Bool pres; - U16 tac; -}F1Tac; - -typedef struct f1Snsaai -{ - U8 sst; - U32 sd; -}F1Snsaai; - -typedef struct epIpAddr -{ - char transportAddr[20]; /* Transport Layer Address */ -}EpIpAddr; - -typedef struct epIpAddrPort -{ - EpIpAddr epIpAddr; - char port[2]; -}EpIpAddrPort; - -typedef struct f1TaiSliceSuppLst -{ - Bool pres; - F1Snsaai snssai[MAXNUMOFSLICEITEMS]; -}F1TaiSliceSuppLst; - -typedef struct f1SrvdPlmn -{ - F1Plmn plmn; - F1TaiSliceSuppLst taiSliceSuppLst; -}F1SrvdPlmn; - -typedef struct f1BrdcstPlmnInfo -{ - F1Plmn plmn[MAXNUMOFBPLMN]; /* PLMN id list */ - F1Plmn extPlmn[MAXNUMOFBPLMN]; /* Extended PLMN id list */ - F1Tac tac; /* 5GS-TAC */ - U32 nrCellId; /* NR Cell id */ - U8 ranac; /* RAN Area code */ - -}F1BrdcstPlmnInfo; - -typedef struct f1CellInfo -{ - NrEcgi nrCgi; /* Cell global Identity */ - U32 nrPci; /* Physical Cell Identity */ - F1Plmn plmn[MAXNUMOFBPLMN]; /* Available PLMN list */ - F1Plmn extPlmn[MAXNUMOFBPLMN]; /* Extended available PLMN list */ -}F1CellInfo; - -typedef struct f1DuCellInfo -{ - F1CellInfo cellInfo; /* cell info */ - F1Tac tac; /* tracking area code */ - F1Tac epsTac; /* Configured EPS TAC */ - F1NrModeInfo f1Mode; /* NR mode info : FDD/TDD */ - U8 measTimeCfg; /* Measurement timing configuration */ - F1CellDir cellDir; /* Cell Direction */ - F1CellType cellType; /* Cell Type */ - F1BrdcstPlmnInfo brdcstPlmnInfo[MAXBPLMNNRMINUS1]; /* Broadcast PLMN Identity Info List */ -}F1DuCellInfo; - -typedef struct f1DuSysInfo -{ - U8 mibMsg; /* MIB message */ - U8 sib1Msg; /* SIB1 message */ -}F1DuSysInfo; - -typedef struct f1CuSysInfo -{ - F1SibType sibTypeToUpd[MAXNUMOFSIBTYPES]; /* SIB types to be updated */ -}F1CuSysInfo; - -typedef struct f1DuSrvdCellInfo -{ - F1DuCellInfo duCellInfo; /* gNB-DU served cell info */ - F1DuSysInfo duSysInfo; /* gNB-DU System Information */ -}F1DuSrvdCellInfo; - -typedef struct f1DuSrvdCellToDel -{ - NrEcgi oldNrCgi; /* Old NR CGI */ - F1DuSrvdCellInfo srvdCellInfo; /* Info of served cell to be deleted */ -}F1DuSrvdCellToDel; - -typedef struct f1CuActCellInfo -{ - F1CellInfo cuCellInfo; /* gNB-CU available cell info */ - F1CuSysInfo cuSysInfo; /* gNB-CU System Information */ -}F1CuActCellInfo; - -typedef struct f1ActCellFail -{ - NrEcgi nrCgi; - F1FailCause cause; -}F1ActCellFail; - -typedef struct srvStatus -{ - SrvState state; - Bool switchOffOngoing; -}SrvStatus; - -typedef struct f1CellStatus -{ - NrEcgi nrEcgi; - SrvStatus status; /* Service status */ -}F1CellStatus; - -typedef struct f1DedSIDelUE -{ - U32 gnbCuUeF1apId; - NrEcgi nrEcgi; -}F1DedSIDelUE; - -typedef struct tnlAssocInfo -{ - Bool pres; - EpIpAddr epIpAddr; /* Endpoint-IP Address */ - EpIpAddrPort epIpAddrport; /* Endpoint-IP Address and Port */ -}F1TnlAssocAddr; - -typedef struct f1TnlAssocUsage -{ - Bool pres; - F1AssocUsage usage; -}F1TnlAssocUsage; - -typedef struct f1TnlAssoc -{ - F1TnlAssocAddr assocInfo; /* TNL Assoc Transport Layer Info */ - F1TnlAssocUsage assocUsage; /* TNL Assoc usage */ -}F1TnlAssoc; - -typedef struct f1TnlAssocToRmv -{ - F1TnlAssocAddr assocInfoCu; /* TNL Assoc Transport Layer Info of CU */ - F1TnlAssocAddr assocInfoDu; /* TNL Assoc Transport Layer Info of DU */ -}F1TnlAssocToRmv; - -typedef struct f1TnlAssocSetupFail -{ - F1TnlAssocAddr assocInfo; - F1FailCause cause; -}F1TnlAssocSetupFail; - - -typedef struct f1CellBarred -{ - NrEcgi nrcgi; - CellBarred cellBarred; -}F1CellBarred; - -typedef struct f1EutraCell -{ - U32 eutraCellId; /* EUTRA cell id */ - F1EutraModeInfo mode; /* EUTRA mode info : FDD/TDD */ - U8 rsrcInd; /* Protected EUTRA resource Indication */ -}F1EutraCell; - -typedef struct f1ProtectEUTRARsrc -{ - U32 specShareGrpId; /* Spectrum sharing group id */ - F1EutraCell eutraCellList[MAXCELLINENB]; /* EUTRA cells list */ -}F1ProtectEUTRARsrc; - -typedef struct f1UacOperatorDefined -{ - U8 accessCategory; - U8 accessId; -}F1UacOperatorDefined; - -typedef struct f1UacCategoryType -{ - union - { - F1UacStandardAction action; /* UAC standardized action */ - F1UacOperatorDefined operatorDef; /* UAC operator defined */ - }type; -}F1UacCategoryType; - -typedef struct f1UacType -{ - U8 uacReducInd; /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */ - F1UacCategoryType uacCategoryType; /* UAC Category type */ -}F1UacType; - -/* Unified Access Class Assistance Information */ -typedef struct f1UacAssistInfo -{ - F1Plmn plmn[MAXNUMOFUACPLMN]; /* UAC PLMN list */ - F1UacType uacType[MAXNUMOFUACPERPLMN]; /* UAC Type list */ -}F1UacAssistInfo; - -/* F1 setup related structures */ - -typedef struct f1SetupReq -{ - U32 transId; /* Uniquely identify transaction */ - U32 duId; /* DU ID */ - char duName[CU_DU_NAME_LEN_MAX]; /* DU name */ - F1DuSrvdCellInfo srvdCellLst[MAXCELLINGNBDU]; /* Serving cell list */ - F1RrcVersion rrcVersion; /* RRC version */ -}F1SetupReq; - -typedef struct f1setupRsp -{ - U32 transId; /* Uniquely identify transaction */ - U32 cuId; /* CU ID */ - char cuName[CU_DU_NAME_LEN_MAX]; /* CU Name */ - F1CuActCellInfo actCellInfo; /* cells to be activated */ - F1RrcVersion rrcVersion; /* RRC version */ -}F1SetupRsp; - -typedef struct f1SetupFail -{ - F1FailureIE setupFail; -}F1SetupFail; - -/* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 - * and radio resources related to the UE association(s) indicated explicitly or implicitly in - * the RESET message and remove the indicated UE contexts including F1AP ID. */ -typedef struct f1Reset -{ - U32 transId; /* Uniquely identify transaction */ - F1FailCause cause; /* Failure cause */ - F1ResetType resetType; /* type of reset */ -}F1Reset; - -/* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated - * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface, - * the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */ -typedef struct f1ResetAck -{ - U32 transId; /* Uniquely identify transaction */ - F1LogicalConnUeAssoc ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */ - F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ -}F1ResetAck; - -typedef struct f1ErrorInd -{ - U32 transId; /* Uniquely identify transaction */ - F1Entity errorOrigin; /* Specifies if error is originated at DU or CU */ - F1FailCause cause; /* Failure cause */ -/* If failure is due to Ue related message. */ - U32 gnbCuUeF1apId; /* gNB-CU UE F1AP Id */ - U32 gnbDuUeF1apId; /* gNB-DU UE F1AP Id */ - F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ -}F1ErrorInd; - -typedef struct f1GnbDuCfgUpd -{ - U32 transId; /* Uniquely identify transaction */ - F1DuSrvdCellInfo srvdCellLstAdd[MAXCELLINGNBDU]; /* Served cell list to be added */ - F1DuSrvdCellToDel srvdCellLstMod[MAXCELLINGNBDU]; /* Served cell list to be modified */ - NrEcgi srvdCellLstDel[MAXCELLINGNBDU]; /* Served cell list to be deleted */ - F1CellStatus cellStatus[MAXCELLINGNBDU]; /* Cell status */ - F1DedSIDelUE ueLst[MAX_UEID]; /* Ue list that requires dedicated SI delivery */ - U32 gnbDuId; - F1TnlAssocToRmv gnbDuTnlAssocRmv[MAXNUMOFTNLASSOCS]; /* TNL Assoc list to remove */ -}F1GnbDuCfgUpd; - -typedef struct f1GnbDuCfgUpdAck -{ - U32 transId; /* Uniquely identify transaction */ - F1CuActCellInfo cellLstAct[MAXCELLINGNBDU]; /* List of cells to be activated */ - F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ - NrEcgi cellLstDeact[MAXCELLINGNBDU]; /* List of cells to be deactivated */ -}F1GnbDuCfgUpdAck; - -typedef struct f1GnbDuCfgUpdFail -{ - F1FailureIE gnbDuCfgUpdFail; -}F1GnbDuCfgUpdFail; - -/* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */ -typedef struct f1GnbCuCfgUpd -{ - U32 transId; /* Uniquely identifies transaction */ - F1CuActCellInfo cellLstAct[MAXCELLINGNBDU]; /* List of cells to be activated */ - NrEcgi cellLstDeact[MAXCELLINGNBDU]; /* List of cells to be deactivated */ - F1TnlAssoc assocLstAdd[MAXNUMOFTNLASSOCS]; /* List of TNL assocs to be added */ - F1TnlAssoc assocLstUpd[MAXNUMOFTNLASSOCS]; /* List of TNL assocs to be updated */ - F1TnlAssocToRmv assocLstRmv[MAXNUMOFTNLASSOCS]; /* List of TNL assocs to be removed */ - F1CellBarred cellToBarList[MAXCELLINGNBDU]; /* List of Cells to be barred */ - F1ProtectEUTRARsrc protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */ -}F1GnbCuCfgUpd; - -/* Sent by a gNB-DU to a gNB-CU to acknowledge update of information - * associated to an F1-C interface instance */ -typedef struct f1GnbCuCfgUpdAck -{ - U32 transId; /* Uniquely identify transaction */ - F1ActCellFail actCellFailList[MAXCELLINGNBDU]; /* Cells failed to be activated list */ - F1CritDiagnostic critDiagnostic; /* Critical diagnostics */ - F1TnlAssocAddr assocSetupList[MAXNUMOFTNLASSOCS]; /* TNL Assoc Setup list */ - F1TnlAssocSetupFail assocSetupFailList[MAXNUMOFTNLASSOCS]; /* TNL Assoc Setup fail list */ - F1DedSIDelUE dedSiDelUelist[MAXNUMOFUEID]; /* Dedicated SI delivery needed UE list */ -}F1GnbCuCfgUpdAck; - -typedef struct f1GnbCuCfgUpdFail -{ - F1FailureIE gnbCuCfgUpdFail; -}F1GnbCuCfgUpdFail; - -/* This procedure enables coordination of radio resource allocation between a gNB-CU and - * a gNB-DU. Coordination request is sent by CU to DU */ -typedef struct f1GnbDuRsrcCoordReq -{ - U32 transId; /* Uniquely identifies transaction */ - F1ReqType reqType; /* Request type */ - U8 cellResCoordReqCont; /* Container for X2AP E-UTRA - NR cell resource coordination request */ - F1IgnoreReq ignoreReq; /* Ignore coordination request */ -}F1GnbDuRsrcCoordReq; - -/* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation - * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */ -typedef struct f1GnbDuRsrcCoordRsp -{ - U32 transId; /* Uniquely identifies transaction */ - U8 cellResCoordRspCont; /* Container for X2AP E-UTRA - NR cell resource coordination response */ -}F1GnbDuRsrcCoordRsp; - -/* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */ -typedef struct f1GnbDuStatusInd -{ - U32 transId; /* Uniquely identifies transaction */ - F1GnbDuOvrloadInfo ovrloadInfo; /* gNB-DU overloaded information */ -}F1GnbDuStatusInd; - -/* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal - * of the interface instance and the related resources */ -typedef struct f1RmvReq -{ - U32 transId; /* Uniquely identifies transaction */ -}F1RmvReq; - -/* This message acknowledges the initiation of removal of the interface - * instance and the related resources */ -typedef struct f1RmvRsp -{ - U32 transId; /* Uniquely identifies transaction */ - F1CritDiagnostic critDiagnos; /* Crititcality diagnostics */ -}F1RmvRsp; - -/* This message indicates that removing the interface instance and the related - * resources cannot be accepted */ -typedef struct f1RmvFail -{ - U32 transId; /* Uniquely identifies transaction */ - F1FailCause cause; /* Failure cause */ - F1CritDiagnostic critDiagnostic; /* Criticality diagnostics */ -}F1RmvFail; - -/* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce - * the rate at which UEs access the network. */ -typedef struct f1NwkAccessRateRed -{ - U32 transId; /* Uniquely identifies transaction */ - F1UacAssistInfo uacAssistInfo; /* UAC Assistance Information */ -}F1NwkAccessRateRed; - -typedef struct f1Ipaddr -{ - Bool ipV4Pres; - U32 ipV4Addr; - Bool ipV6Pres; - U8 ipV6Addr[MAX_IPV6_LEN]; -}F1IpAddr; - -typedef struct f1SctpParams -{ - F1IpAddr duIpAddr; - U16 duPort; - F1IpAddr cuIpAddr; - U16 cuPort; -}F1SctpParams; - -typedef struct duCfgParams -{ - F1SctpParams sctpParams; /* SCTP Params */ - U32 maxUe; - U32 duId; - U8 duName[CU_DU_NAME_LEN_MAX]; - F1DuSrvdCellInfo srvdCellLst[MAXCELLINGNBDU]; /* Serving cell list */ - F1RrcVersion rrcVersion; /* RRC version */ - ClCellCfg clCellCfg; /* CL cell configuration */ - -}DuCfgParams; - -#endif /* __DU_COMMON_H__ */ - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c new file mode 100644 index 000000000..2fca6e2b4 --- /dev/null +++ b/src/du_app/du_egtp.c @@ -0,0 +1,1005 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all EGTP related functionality */ + +#include +#include "du_egtp.h" + +/* Global variable declaration */ +EgtpGlobalCb egtpCb; + +/************************************************************************** + * @brief Task Initiation callback function. + * + * @details + * + * Function : egtpActvInit + * + * Functionality: + * This function is supplied as one of parameters during EGTP's + * task registration. SSI will invoke this function once, after + * it creates and attaches this TAPA Task to a system task. + * + * @param[in] Ent entity, the entity ID of this task. + * @param[in] Inst inst, the instance ID of this task. + * @param[in] Region region, the region ID registered for memory + * usage of this task. + * @param[in] Reason reason. + * @return ROK - success + * RFAILED - failure + ***************************************************************************/ +S16 egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) +{ + DU_LOG("\n\nEGTP : Initializing"); + + cmMemset ((U8 *)&egtpCb, 0, sizeof(EgtpGlobalCb)); + protType = CM_INET_PROTO_UDP; + + RETVALUE(ROK); +} + + +/************************************************************************** + * @brief Task Activation callback function. + * + * @details + * + * Function : egtpActvTsk + * + * Functionality: + * This function handles all EGTP messages received + * This API is registered with SSI during the + * Task Registration of DU APP. + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf, Packed primitive parameters in the + * buffer. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 egtpActvTsk(Pst *pst, Buffer *mBuf) +{ + S16 ret = ROK; + + switch(pst->srcEnt) + { + case ENTDUAPP: + { + switch(pst->event) + { + case EVTCFGREQ: + { + ret = cmUnpkEgtpCfgReq(egtpCfgReq, pst, mBuf); + break; + } + case EVTSRVOPENREQ: + { + ret = cmUnpkEgtpSrvOpenReq(egtpSrvOpenReq, pst, mBuf); + break; + } + case EVTTNLMGMTREQ: + { + ret = cmUnpkEgtpTnlMgmtReq(egtpTnlMgmtReq, pst, mBuf); + break; + } + case EVTTTIIND: + { + ret = cmUnpkEgtpTTIInd(egtpTTIInd, pst, mBuf); + SPutMsg(mBuf); + break; + } + default: + { + DU_LOG("\nEGTP : Invalid event %d", pst->event); + SPutMsg(mBuf); + ret = RFAILED; + } + } + break; + } + case ENTKW: + { + switch(pst->event) + { + case EVTDATIND: + { + //TODO + break; + } + default: + { + DU_LOG("\nEGTP : Invalid event %d", pst->event); + ret = RFAILED; + } + } + break; + } + default: + { + DU_LOG("\nEGTP : Invalid source entity %d", pst->srcEnt); + ret = RFAILED; + } + } + SExitTsk(); + RETVALUE(ret); +} + +/************************************************************************** + * @brief EGTP server configuration + * + * @details + * + * Function : egtpCfgReq + * + * Functionality: + * This function handles EGTP configuration request. + * + * @return ROK - success + * RFAILED - failure + * + * ***********************************************************************/ +S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) +{ + U8 ret; /* Return value */ + Pst rspPst; /* Response Pst structure */ + CmStatus cfgCfm; /* Configuration Confirm */ + + cmMemcpy((U8 *)&egtpCb.egtpCfg, (U8 *)&egtpCfg, (PTR)sizeof(EgtpConfig)); + + egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; + + egtpCb.dstCb.dstIp = CM_INET_NTOH_U32(egtpCb.egtpCfg.destIp.ipV4Addr); + egtpCb.dstCb.dstPort = egtpCb.egtpCfg.destPort; + egtpCb.dstCb.sendTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.dstCb.sendTptSrvr.addr.port = egtpCb.egtpCfg.localPort; + egtpCb.dstCb.numTunn = 0; + + ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_U32MOD, DU_APP_MEM_REGION, DU_POOL); + + if(ret != ROK) + { + DU_LOG("\nEGTP : TeId hash list initialization failed"); + cfgCfm.status = LCM_PRIM_NOK; + cfgCfm.reason = LCM_REASON_HASHING_FAILED; + } + else + { + DU_LOG("\nEGTP : EGTP configuration successful"); + cfgCfm.status = LCM_PRIM_OK; + cfgCfm.reason = LCM_REASON_NOT_APPL; + } + + /* Fill response Pst */ + egtpFillRspPst(pst, &rspPst); + rspPst.event = EVTCFGCFM; + + cmPkEgtpCfgCfm(&rspPst, cfgCfm); + + RETVALUE(ROK); +} + +/************************************************************************** + * @brief Fills post structure to send response + * + * @details + * + * Function : egtpFillRspPst + * + * Functionality: + * Fills post struture to send response + * + * @return ROK - success + * RFAILED - failure + * + * + * ***********************************************************************/ +S16 egtpFillRspPst(Pst *pst, Pst *rspPst) +{ + + cmMemset((U8 *)rspPst, 0, sizeof(Pst)); + rspPst->srcEnt = pst->dstEnt; + rspPst->srcInst = pst->dstInst; + rspPst->srcProcId = pst->dstProcId; + rspPst->dstEnt = pst->srcEnt; + rspPst->dstInst = pst->srcInst; + rspPst->dstProcId = pst->srcProcId; + rspPst->selector = DU_SELECTOR_LC; + rspPst->pool= DU_POOL; + + RETVALUE(ROK); +} + +/************************************************************************** + * @brief EGTP server open request + * + * @details + * + * Function : egtpSrvOpenReq + * + * Functionality: + * This function handles EGTP open server request. + * It opens udp socket to receive/send msgs. + * + * @param[in] Pst *pst, post structure + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ + +S16 egtpSrvOpenReq(Pst *pst) +{ + + U8 ret; /* Return value */ + Pst rspPst; /* Response Pst structure */ + CmStatus cfm; /* Confirmation status */ + U8 sockType; /* Socket type */ + + DU_LOG("\nEGTP : Received EGTP open server request"); + + sockType = CM_INET_DGRAM; + + /* Opening and Binding receiver socket */ + if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.recvTptSrvr)) != ROK) + { + DU_LOG("\nEGTP : Failed while opening receiver transport server"); + RETVALUE(RFAILED); + } + + /* Opening and Binding sender socket */ + if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.dstCb.sendTptSrvr)) != ROK) + { + DU_LOG("\nEGTP : Failed while opening sender transport server"); + RETVALUE(RFAILED); + } + + DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); + + /* Filling and seing response */ + cfm.status = LCM_PRIM_OK; + cfm.reason = LCM_REASON_NOT_APPL; + + egtpFillRspPst(pst, &rspPst); + rspPst.event = EVTSRVOPENCFM; + cmPkEgtpSrvOpenCfm(&rspPst, cfm); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Processing Sever open request + * + * @details + * + * Function : egtpSrvOpenPrc + * + * Functionality: + * + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server) +{ + S8 ret; + + if(ret = (cmInetSocket(sockType, &(server->sockFd), protType)) != ROK) + { + DU_LOG("\nEGTP : Failed to open UDP socket"); + RETVALUE(RFAILED); + } + + if(ret = cmInetBind(&(server->sockFd), &(server->addr)) != ROK) + { + DU_LOG("\nEGTP : Failed to bind socket"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} + +/************************************************************************** + * @brief EGTP tunnel management request + * + * @details + * + * Function : egtpTnlMgmtReq + * + * Functionality: + * This function handles EGTP tunnel managament request + * + * @param[in] Pst *pst, post structure + * Tunnel Eveny structure + * @return ROK - success + * RFAILED - failure + * + + * ***************************************************************************/ +S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) +{ + S8 ret; + Pst rspPst; + + DU_LOG("\nEGTP : Received tunnel management request"); + switch(tnlEvt.action) + { + case EGTP_TNL_MGMT_ADD: + { + ret = egtpTnlAdd(tnlEvt); + break; + } + case EGTP_TNL_MGMT_MOD: + { + ret = egtpTnlMod(tnlEvt); + break; + } + case EGTP_TNL_MGMT_DEL: + { + ret = egtpTnlDel(tnlEvt); + break; + } + default: + { + DU_LOG("\nEGTP : Invalid tunnel management action[%d]", tnlEvt.action); + ret = LCM_REASON_INVALID_ACTION; + } + } + + if(ret == ROK) + { + tnlEvt.cfmStatus.status = LCM_PRIM_OK; + tnlEvt.cfmStatus.reason = LCM_REASON_NOT_APPL; + } + else + { + tnlEvt.cfmStatus.status = LCM_PRIM_NOK; + tnlEvt.cfmStatus.reason = ret; + } + + DU_LOG("\nEGTP : Sending Tunnel management confirmation"); + egtpFillRspPst(pst, &rspPst); + rspPst.event = EVTTNLMGMTCFM; + cmPkEgtpTnlMgmtCfm(&rspPst, tnlEvt); + + RETVALUE(ROK); +} + +/************************************************************************** + * @brief EGTP tunnel addition + * + * @details + * + * Function : egtpTnlAdd + * + * Functionality: + * This function handles EGTP tunnel addition + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) +{ + S16 ret; + EgtpTeIdCb *teidCb; /* Tunnel endpoint control block */ + EgtpMsgHdr preDefHdr; /* pre-define header for this tunnel */ + + DU_LOG("\nEGTP : Tunnel addition : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&teidCb, (Size)sizeof(EgtpTeIdCb)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Memory allocation failed"); + RETVALUE(LCM_REASON_MEM_NOAVAIL); + } + + cmMemset((U8 *)teidCb, 0, sizeof(EgtpTeIdCb)); + teidCb->teId = tnlEvt.lclTeid; + teidCb->remTeId = tnlEvt.remTeid; + + ret = cmHashListInsert(&(egtpCb.dstCb.teIdLst), (PTR)teidCb, (U8 *)&(teidCb->teId), sizeof(U32)); + if(ret != ROK) + { + DU_LOG("\nEGTP : Failed to insert in hash list"); + SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); + RETVALUE(LCM_REASON_HASHING_FAILED); + } + egtpCb.dstCb.numTunn++; + + /* Encoding pre-defined header */ + cmMemset((U8*)&preDefHdr, 0, sizeof(EgtpMsgHdr)); + preDefHdr.msgType = EGTPU_MSG_GPDU; + preDefHdr.teId = teidCb->remTeId; + preDefHdr.extHdr.pdcpNmb.pres = FALSE; + preDefHdr.extHdr.udpPort.pres = FALSE; + preDefHdr.nPdu.pres = FALSE; + + egtpEncodeHdr((U8 *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); + + RETVALUE(ROK); +} /* egtpTnlAdd */ + +/************************************************************************** + * @brief EGTP tunnel modification + * + * @details + * + * Function : egtpTnlMod + * + * Functionality: + * This function handles EGTP tunnel modification + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 egtpTnlMod(EgtpTnlEvt tnlEvt) +{ +#if 0 + S16 ret; + EgtpTeIdCb *teidCb = NULLP; + + printf("\nTunnel modification : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.teId), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + printf("\nTunnel id not found"); + RETVALUE(RFAILED); + } + + teidCb->teId = tnlEvt.lclTeid; + teidCb->remTeId = tnlEvt.remTeid; +#endif + RETVALUE(ROK); +} + +/************************************************************************** + * @brief EGTP tunnel deletion + * + * @details + * + * Function : egtpTnlDel + * + * Functionality: + * This function handles EGTP tunnel deletion + * + * @param[in] Tunnel Event structure + * @return ROK - success + * RFAILED - failure + * + * ***************************************************************************/ +S16 egtpTnlDel(EgtpTnlEvt tnlEvt) +{ + EgtpTeIdCb *teidCb = NULLP; + + DU_LOG("\nEGTP : Tunnel deletion : Local Teid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.lclTeid), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + DU_LOG("\nEGTP : Tunnel id[%d] not configured", tnlEvt.lclTeid); + RETVALUE(LCM_REASON_INVALID_PAR_VAL); + } + + cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb); + SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); + egtpCb.dstCb.numTunn--; + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Handles data indication + * + * @details + * + * Function : EgtpHdlDatInd + * + * Functionality: + * Handles incoming data from peer to be passed + * on from DU to CU + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 egtpHdlDatInd(EgtpMsg egtpMsg) +{ + EgtpTeIdCb *teidCb = NULLP; + MsgLen tPduSize; + U8 hdrLen; + U32 msgLen; + EgtpMsgHdr *msgHdr; + + DU_LOG("\nEGTP : Received Data Indication"); + + cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(egtpMsg.msgHdr.teId), sizeof(U32), 0, (PTR *)&teidCb); + if(teidCb == NULLP) + { + DU_LOG("\nEGTP : Tunnel id[%d] not configured", egtpMsg.msgHdr.teId); + RETVALUE(LCM_REASON_INVALID_PAR_VAL); + } + + msgHdr = &(egtpMsg.msgHdr); + + hdrLen = teidCb->preEncodedHdr.cnt; + + if(msgHdr->extHdr.pdcpNmb.pres) + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= EGTP_MASK_BIT3; + teidCb->preEncodedHdr.hdr[hdrLen] = EGTP_EXT_HDR_PDCP_TYPE; + teidCb->preEncodedHdr.hdr[--hdrLen] = 1; + teidCb->preEncodedHdr.hdr[--hdrLen] = GetHiByte(msgHdr->extHdr.pdcpNmb.val); + teidCb->preEncodedHdr.hdr[--hdrLen] = GetLoByte(msgHdr->extHdr.pdcpNmb.val); + teidCb->preEncodedHdr.hdr[--hdrLen] = 0; + } + else + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT3); + } + + SFndLenMsg(egtpMsg.msg, &tPduSize); + + /*Adjust the header to fill the correct length*/ + msgLen = tPduSize + (EGTP_MAX_HDR_LEN - hdrLen) - 0x08; + + /*********************************************** + * Fill the length field of the message header * + ***********************************************/ + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 3] = (U8)GetHiByte(msgLen); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 4] = (U8)GetLoByte(msgLen); + + /*Update the sequence number*/ + if(egtpMsg.msgHdr.seqNum.pres) + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= (EGTP_MASK_BIT2); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 9] = (U8)GetHiByte(egtpMsg.msgHdr.seqNum.val); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 10] = (U8)GetLoByte(egtpMsg.msgHdr.seqNum.val); + } + else + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT2); + } + + DU_LOG("\nEGTP : Data buffer before encoding header"); + SPrntMsg(egtpMsg.msg, 0, 0); + + SAddPreMsgMult(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg.msg); + + + DU_LOG("\nEGTP : Data buffer after encoding header"); + SPrntMsg(egtpMsg.msg, 0, 0); + + /* Send over UDP */ + egtpSendMsg(egtpMsg.msg); + SPutMsg(egtpMsg.msg); + + RETVALUE(ROK); +}/* EgtpHdlDatInd */ + +/******************************************************************* + * + * @brief Encodes outgoing message + * + * @details + * + * Function : egtpEncodeMsg + * + * Functionality: + * Encodes EGTP message to be sent + * + * @params[in] EGTP message + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) +{ + U8 tmpByte = 0; /* Stores one byte of data for enc */ + U8 cnt = EGTP_MAX_HDR_LEN; /* Stores the position */ + Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + U16 nwWord = 0; + + /* Encoding header */ + tmpByte |= EGTP_MASK_BIT6; /* Setting 6th LSB of 1st byte as version */ + tmpByte |= EGTP_MASK_BIT5; /* Setting 5th LSB of 1st byte as protocol type */ + + if(preDefHdr->extHdr.udpPort.pres || preDefHdr->extHdr.pdcpNmb.pres) + { + tmpByte |= EGTP_MASK_BIT3; /* Setting 3rd LSB of 1st byte if Extension heaeder is present */ + } + + if(preDefHdr->seqNum.pres) + { + tmpByte |= EGTP_MASK_BIT2; + } + + if(preDefHdr->nPdu.pres) + { + tmpByte |= EGTP_MASK_BIT1; + } + + if((tmpByte & EGTP_MASK_BIT1) || (tmpByte & EGTP_MASK_BIT2)||(tmpByte & EGTP_MASK_BIT3)) + { + extPres = TRUE; + } + + preEncodedHdr[--cnt] = tmpByte; + preEncodedHdr[--cnt] = preDefHdr->msgType; + + /* Encode Tunnel endpoint */ + preEncodedHdr[--cnt] = 0; + preEncodedHdr[--cnt] = 0; + nwWord = (U16)(GetHiWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); + nwWord = (U16)(GetLoWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); + + /* Encode sequence number */ + if(preDefHdr->seqNum.pres) + { + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->seqNum.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->seqNum.val); + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + preEncodedHdr[--cnt] = 0; + } + + /* Encode nPdu number */ + if(preDefHdr->nPdu.pres) + { + preEncodedHdr[--cnt] = preDefHdr->nPdu.val; + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + } + + if(preDefHdr->extHdr.udpPort.pres) + { + preEncodedHdr[--cnt] = EGTP_EXT_HDR_UDP_TYPE; + preEncodedHdr[--cnt] = 1; + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->extHdr.udpPort.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->extHdr.udpPort.val); + } + + if(preDefHdr->extHdr.pdcpNmb.pres) + { + preEncodedHdr[--cnt] = EGTP_EXT_HDR_PDCP_TYPE; + preEncodedHdr[--cnt] = 1; + preEncodedHdr[--cnt] = GetHiByte(preDefHdr->extHdr.pdcpNmb.val); + preEncodedHdr[--cnt] = GetLoByte(preDefHdr->extHdr.pdcpNmb.val); + } + + if(tmpByte & EGTP_MASK_BIT3) + { + preEncodedHdr[--cnt] = 0; + } + else if(extPres) + { + preEncodedHdr[--cnt] = 0; + } + + *hdrIdx = cnt; + RETVALUE(ROK); +} /* egtpEncodeHdr */ + +/******************************************************************* + * + * @brief Sends message over UDP + * + * @details + * + * Function : egtpSendMsg + * + * Functionality: + * Sends message over UDP + * + * @params[in] Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 egtpSendMsg(Buffer *mBuf) +{ + S16 ret; + MsgLen txLen; + CmInetMemInfo info; + CmInetAddr dstAddr; + + info.region = DU_APP_MEM_REGION; + info.pool = DU_POOL; + + dstAddr.port = EGTP_DFLT_PORT; + dstAddr.address = egtpCb.dstCb.dstIp; + + ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, mBuf, &txLen, CM_INET_NO_FLAG); + if(ret != ROK && ret != RWOULDBLOCK) + { + DU_LOG("\nEGTP : Failed sending the message"); + RETVALUE(RFAILED); + } + + DU_LOG("\nEGTP : Message Sent"); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Handles TTI Indication from PHY + * + * @details + * + * Function : egtpTTIInd + * + * Functionality: + * Handles TTI Indication from PHY + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 egtpTTIInd() +{ + egtpRecvMsg(); + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Receives EGTP message from UDP socket + * + * @details + * + * Function : egtpRecvMsg + * + * Functionality: + * Receive incoming messages from UDP socket + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 egtpRecvMsg() +{ + U8 ret; /* Return value */ + U8 nMsg; /* Number of messages to read from UDP socked */ + MsgLen bufLen; /* Length of received buffer */ + Buffer *recvBuf; /* Received buffer */ + CmInetAddr fromAddr; /* Egtp data sender address */ + CmInetMemInfo memInfo; /* Buffer allocation info */ + + + DU_LOG("\nEGTP : Received TTI Indication"); + + nMsg = 0; + memInfo.region = DU_APP_MEM_REGION; + memInfo.pool = DU_POOL; + + fromAddr.port = egtpCb.dstCb.dstPort; + fromAddr.address = egtpCb.dstCb.dstIp; + + while(nMsg < EGTP_MAX_MSG_RECV) + { + bufLen = -1; + ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, &recvBuf, &bufLen, CM_INET_NO_FLAG); + if(ret == ROK && recvBuf != NULLP) + { + DU_LOG("\nEGTP : Received Message[%d]\n", nMsg+1); + SPrntMsg(recvBuf, 0 ,0); + egtpHdlRecvData(recvBuf); + } + nMsg++; + } + + RETVALUE(ROK); +} + +S16 egtpHdlRecvData(Buffer *mBuf) +{ + EgtpMsg egtpMsg; + + /* Decode EGTP header */ + egtpDecodeHdr(mBuf, &egtpMsg); + + /* TODO : Send received message to RLC */ + + RETVALUE(ROK); +} + +S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) +{ + U8 tmpByte[5]; /* Holds 5 byte of data after Decoding */ + U8 version = 0; /* Holds the version type, decoded */ + MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */ + MsgLen bufLen = 0; /* Holds the total buffer length */ + U8 extHdrType = 0; /* Holds the Extension hdr type */ + U8 extHdrLen = 0; /* Extension hdr length */ + Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + + SFndLenMsg(mBuf, &bufLen); + + /* Decode first byte and storing in temporary variable */ + SRemPreMsg(&tmpByte[0], mBuf); + + /* Extracting version fro 1st byte */ + version = tmpByte[0] >> 5; + + DU_LOG("\nEGTP : Version %d", version); + + /* Decode message type */ + SRemPreMsg((Data*)&(egtpMsg->msgHdr.msgType), mBuf); + DU_LOG("\nEGTP : msgType %d", egtpMsg->msgHdr.msgType); + + /**************************************************************************** + * Message length param is 2 bytes. So decode next 2 bytes from msg hdr and + * performing OR operation on these two bytes to calculate message length + ***************************************************************************/ + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + msgLen = (tmpByte[1] << 8) | tmpByte[2]; + DU_LOG("\nEGTP : msgLen %d", msgLen); + + + /**************************************************************************** + * Tunnel id param is 4 bytes. So decode next 4 bytes from msg hdr and + * perform OR operation on these 4 bytes to calculate tunnel id + ***************************************************************************/ + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + SRemPreMsg(&tmpByte[3], mBuf); + SRemPreMsg(&tmpByte[4], mBuf); + egtpMsg->msgHdr.teId = (tmpByte[1] << 24) | (tmpByte[2] << 16) | (tmpByte[3] << 8) | tmpByte[4]; + DU_LOG("\nEGTP : teId %d",egtpMsg->msgHdr.teId); + + + /* If any one of S, E or PN flag is set, set extension present as true. */ + if((tmpByte[0] & EGTP_MASK_BIT1) || (tmpByte[0] & EGTP_MASK_BIT2)||(tmpByte[0] & EGTP_MASK_BIT3)) + { + extPres = TRUE; + } + + /* Decode sequence number, if S flag is set in first byte */ + if (tmpByte[0] & EGTP_MASK_BIT2) + { + /************************************************************************ + * Sequence num is 2 bytes. So decode next 2 bytes from msg hdr and + * perform OR operation on them + ************************************************************************/ + egtpMsg->msgHdr.seqNum.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg->msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; + } + /**************************************************************************** + * If extPres is true, but S bit is not set, implies, either of PN or E bit + * was set during Encode so accordingly extract Byte fields for seqNum anyway + ***************************************************************************/ + else if(extPres) + { + /************************************************************************* + * Sequence num is 2 bytes. So decode next 2 bytes from msg hdr and + * perform OR operation on them + ************************************************************************/ + egtpMsg->msgHdr.seqNum.pres = 0; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg->msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; + } + + /* Decode N-PDU number if present flag is set */ + if (tmpByte[0] & EGTP_MASK_BIT1) + { + egtpMsg->msgHdr.nPdu.pres = TRUE; + SRemPreMsg(&(egtpMsg->msgHdr.nPdu.val), mBuf); + } + /**************************************************************************** + * If extPres is true, but PN bit is not set, implies, either of S or E bit + * was set during Encode. Aaccordingly extract Byte fields of N-PDU num anyway + ***************************************************************************/ + else if(extPres) + { + egtpMsg->msgHdr.nPdu.pres = TRUE; + SRemPreMsg(&(egtpMsg->msgHdr.nPdu.val), mBuf); + } + + /* If E flag is set in first byte, decode extension header */ + if(tmpByte[0] & EGTP_MASK_BIT3) + { + SRemPreMsg(&extHdrType, mBuf); + while( 0 != extHdrType) + { + switch (extHdrType) + { + case EGTP_EXT_HDR_UDP_TYPE: + { + SRemPreMsg(&extHdrLen, mBuf); + if(extHdrLen == 0x01) + { + /************************************************************ + * UDP Port is 2 bytes. So decode next 2 bytes from msg hdr + * and perform OR operation on them + *************************************************************/ + egtpMsg->msgHdr.extHdr.udpPort.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg->msgHdr.extHdr.udpPort.val = (tmpByte[1] << 8) | tmpByte[2]; + } + break; + } + + case EGTP_EXT_HDR_PDCP_TYPE: + { + SRemPreMsg(&extHdrLen, mBuf); + if(extHdrLen == 0x01) + { + /************************************************************* + * PDCP num is 2 bytes. So decode next 2 bytes from msg hdr + * and perform OR operation on them + ************************************************************/ + egtpMsg->msgHdr.extHdr.pdcpNmb.pres = TRUE; + SRemPreMsg(&tmpByte[1], mBuf); + SRemPreMsg(&tmpByte[2], mBuf); + egtpMsg->msgHdr.extHdr.pdcpNmb.val = (tmpByte[1] << 8) | tmpByte[2]; + } + break; + } + } /* End of switch */ + + SRemPreMsg(&extHdrType, mBuf); + + } /* End of while */ + } + /**************************************************************************** + * If extPres is true, but E bit is not set, implies, either of PN or S bit + * was set during Encode so accordingly extract Byte fields for extension + * header anyway + ***************************************************************************/ + else if(extPres) + { + SRemPreMsg(&extHdrType, mBuf); + } + + DU_LOG("\nEGTP : Data Buffer after decoding header "); + SPrntMsg(mBuf, 0, 0); + + /* Forward the data to duApp/RLC */ + + RETVALUE(ROK); + +} diff --git a/src/du_app/du_egtp.h b/src/du_app/du_egtp.h new file mode 100644 index 000000000..db20d8fc8 --- /dev/null +++ b/src/du_app/du_egtp.h @@ -0,0 +1,104 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all SCTP related functionality */ + +#ifndef __DU_EGTP_H__ +#define __DU_EGTP_H__ + +#include "du_mgr.h" +#include "du_log.h" +#include "cm_inet.h" +#include "cm_tpt.h" +#include "legtp.h" + +#include "cm_inet.x" +#include "cm_tpt.x" + +#define EGTP_DFLT_PORT 2152 +#define EGTP_MAX_HDR_LEN 40 +#define EGTP_MAX_MSG_RECV 10 + +#define EGTP_EXT_HDR_UDP_TYPE 64 +#define EGTP_EXT_HDR_PDCP_TYPE 192 + +#define EGTP_MASK_BIT1 0x01 +#define EGTP_MASK_BIT2 0x02 +#define EGTP_MASK_BIT3 0x04 +#define EGTP_MASK_BIT4 0x08 +#define EGTP_MASK_BIT5 0x10 +#define EGTP_MASK_BIT6 0x20 +#define EGTP_MASK_BIT7 0x40 +#define EGTP_MASK_BIT8 0x80 + + +U8 protType; + +typedef struct egtpTptSrvr +{ + CmInetAddr addr; + CmInetFd sockFd; /* Socket file descriptor */ +}EgtpTptSrvr; + +typedef struct EgtpTeIdCb +{ + U32 teId; /* Local tunnel id */ + U32 remTeId; /* Remote tunnel id */ + struct + { + U8 hdr[EGTP_MAX_HDR_LEN]; + U8 cnt; + }preEncodedHdr; /* Pre-encoded header for PDUs on this tunnel */ +}EgtpTeIdCb; + +typedef struct egtpDstCb +{ + CmInetIpAddr dstIp; /* destination IP */ + U16 dstPort; /* destination port that sends data */ + EgtpTptSrvr sendTptSrvr; /* Transport server for sending UDP msg to */ + U32 numTunn; /* Number of tunnels */ + CmHashListCp teIdLst; /* Tunnel Id list for this destination */ +}EgtpDstCb; + +typedef struct egtpGlobalCb +{ + EgtpConfig egtpCfg; /* EGTP configuration */ + EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */ + EgtpDstCb dstCb; /* Destination endpoint */ +}EgtpGlobalCb; +extern EgtpGlobalCb egtpCb; /* EGTP global control block */ + +S16 egtpActvInit(Ent entity, Inst inst, Region region, Reason reason); +S16 egtpActvTsk(Pst *pst, Buffer *mBuf); +S16 egtpFillRspPst(Pst *pst, Pst *rspPst); +S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg); +S16 egtpSrvOpenReq(Pst *pst); +S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server); +S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); +S16 egtpTnlAdd(EgtpTnlEvt tnlEvt); +S16 egtpTnlMod(EgtpTnlEvt tnlEvt); +S16 egtpTnlDel(EgtpTnlEvt tnlEvt); +S16 egtpHdlDatInd(EgtpMsg msg); +S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx); +S16 egtpSendMsg(Buffer *mBuf); +S16 egtpTTIInd(); +S16 egtpRecvMsg(); +S16 egtpHdlRecvData(Buffer *mBuf); +S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg); + +#endif diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c new file mode 100644 index 000000000..65e6725b8 --- /dev/null +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -0,0 +1,4561 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains F1AP message handler functions */ + +#include "du_mgr_main.h" +#include "du_cfg_hdl.h" +#include "du_cell_mgr.h" +#include "du_f1ap_msg_hdl.h" + +char encBuf[ENC_BUF_MAX_LEN]; + +extern DuCfgParams duCfgParam; + +/******************************************************************* + * + * @brief Writes the encoded chunks into a buffer + * + * @details + * + * Function : PrepFinalEncBuf + * + * Functionality:Fills the encoded buffer + * + * @params[in] void *buffer,initial encoded data + * @params[in] size_t size,size of buffer + * @params[in] void *encodedBuf,final buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +static int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf) +{ + memcpy(encodedBuf + encBufSize, buffer, size); + encBufSize += size; + return 0; +} /* PrepFinalEncBuf */ + +/******************************************************************* + * + * @brief Builds Uplink Info for NR + * + * @details + * + * Function : BuildULNRInfo + * + * Functionality: Building NR Uplink Info + * + * @params[in] NRFreqInfo_t *ulnrfreq + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildULNRInfo(NRFreqInfo_t *ulnrfreq) +{ + U8 idx; + idx = 0; + ulnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\ + fdd.ulNrFreqInfo.nrArfcn; + ulnrfreq->freqBandListNr.list.count = 1; + ulnrfreq->freqBandListNr.list.size = sizeof(struct FreqBandNrItem *); + DU_ALLOC(ulnrfreq->freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + if(ulnrfreq->freqBandListNr.list.array == NULLP) + { + RETVALUE(RFAILED); + } + DU_ALLOC(ulnrfreq->freqBandListNr.list.array[idx],sizeof(struct FreqBandNrItem)); + if(ulnrfreq->freqBandListNr.list.array[idx] == NULLP) + { + DU_FREE(ulnrfreq->freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + RETVALUE(RFAILED); + } + ulnrfreq->freqBandListNr.list.array[idx]->freqBandIndicatorNr = \ + duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\ + freqBand[0].nrFreqBand; + ulnrfreq->freqBandListNr.list.array[idx]->supportedSULBandList.list.count = SUL_BAND_COUNT; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds Downlink NR Info + * + * @details + * + * Function : BuildDLNRInfo + * + * Functionality: Building Downlink NR Info + * + * @params[in] NRFreqInfo_t *dlnrfreq + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildDLNRInfo(NRFreqInfo_t *dlnrfreq) +{ + U8 idx; + dlnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\ + fdd.dlNrFreqInfo.nrArfcn; + dlnrfreq->freqBandListNr.list.count = 1; + dlnrfreq->freqBandListNr.list.size = sizeof(struct FreqBandNrItem *); + DU_ALLOC(dlnrfreq->freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + if(dlnrfreq->freqBandListNr.list.array == NULLP) + { + RETVALUE(RFAILED); + } + DU_ALLOC(dlnrfreq->freqBandListNr.list.array[idx],sizeof(struct FreqBandNrItem)); + if(dlnrfreq->freqBandListNr.list.array[idx] == NULLP) + { + DU_FREE(dlnrfreq->freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + RETVALUE(RFAILED); + } + dlnrfreq->freqBandListNr.list.array[idx]->freqBandIndicatorNr = \ + duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\ + freqBand[0].nrFreqBand; + dlnrfreq->freqBandListNr.list.array[idx]->supportedSULBandList.list.count = SUL_BAND_COUNT; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds PLMN ID + * + * @details + * + * Function : BuildPlmn + * + * Functionality: Building the PLMN ID + * + * @params[in] PLMNID plmn + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildPlmn(PlmnId plmn, OCTET_STRING_t *plmnid) +{ + U8 mncCnt; + plmnid->size = 3; + DU_ALLOC(plmnid->buf, plmnid->size * sizeof(U8)); + if(plmnid->buf == NULLP) + { + RETVALUE(RFAILED); + } + mncCnt = 2; + plmnid->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0])); + if(mncCnt == 2) + { + plmnid->buf[1] = ((0xf0) | (plmn.mcc[2])); + plmnid->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0])); + } + else + { + plmnid->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2])); + plmnid->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1])); + } + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds NRCell ID + * + * @details + * + * Function : BuildNrCellId + * + * Functionality: Building the NR Cell ID + * + * @params[in] BIT_STRING_t *nrcell + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildNrCellId(BIT_STRING_t *nrcell) +{ + U8 tmp; + nrcell->size = 5; + DU_ALLOC(nrcell->buf, nrcell->size * sizeof(U8)); + if(nrcell->buf == NULLP) + { + RETVALUE(RFAILED); + } + + for (tmp = 0 ; tmp < nrcell->size-1; tmp++) + { + nrcell->buf[tmp] = 0; + } + nrcell->buf[4] = 16;//change this + nrcell->bits_unused = 4; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds Nrcgi + * + * @details + * + * Function : BuildNrcgi + * + * Functionality: Building the PLMN ID and NR Cell id + * + * @params[in] NRCGI_t *nrcgi + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildNrcgi(NRCGI_t *nrcgi) +{ + S16 ret; + GNB_DU_Served_Cells_Item_t *srvCellItem; + ret = BuildPlmn(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + &nrcgi->pLMN_Identity); // Building PLMN function + if(ret != ROK) + { + RETVALUE(RFAILED); + } + /*nrCellIdentity*/ + ret = BuildNrCellId(&nrcgi->nRCellIdentity); + if(ret != ROK) + { + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); + +} +/******************************************************************* + * + * @brief Builds FiveGStac + * + * @details + * + * Function : BuildFiveGSTac + * + * Functionality: Building the FiveGSTac + * + * @params[in] OCTET_STRING_t *fivegsTac + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildFiveGSTac(Served_Cell_Information_t *servcell) +{ + DU_ALLOC(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t)); + if(servcell->fiveGS_TAC == NULLP) + { + RETVALUE(RFAILED); + } + servcell->fiveGS_TAC->size = 3 * sizeof(U8); + DU_ALLOC(servcell->fiveGS_TAC->buf,\ + sizeof(servcell->fiveGS_TAC->size)); + if(servcell->fiveGS_TAC->buf == NULLP) + { + DU_FREE(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t)); + RETVALUE(RFAILED); + } + servcell->fiveGS_TAC->buf[0] = 0; + servcell->fiveGS_TAC->buf[1] = 0; + servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds NR Mode + * + * @details + * + * Function : BuildNrMode + * + * Functionality: Building the NR Mode + * + * @params[in] NR_Mode_Info_t *fdd + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildNrMode(NR_Mode_Info_t *mode) +{ + S16 ret; + GNB_DU_Served_Cells_Item_t *srvCellItem; + /* FDD Mode */ + mode->present = NR_Mode_Info_PR_fDD; + if(mode->present == NR_Mode_Info_PR_fDD) + { + DU_ALLOC(mode->choice.fDD,\ + sizeof(FDD_Info_t)); + if(mode->choice.fDD == NULLP) + { + RETVALUE(RFAILED); + } + ret = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo); + if(ret != ROK) + { + DU_FREE(mode->choice.fDD,\ + sizeof(FDD_Info_t)); + RETVALUE(RFAILED); + } + ret = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo); + if(ret != ROK) + { + DU_FREE(mode->choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(srvCellItem->served_Cell_Information.\ + nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ + freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.\ + nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ + freqBandListNr.list.array[0],sizeof(struct FreqBandNrItem)); + RETVALUE(RFAILED); + } + } + mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \ + duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.ulTxBw.nrScs; + mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \ + duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.ulTxBw.nrb; + + mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \ + duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.dlTxBw.nrScs; + mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \ + duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.dlTxBw.nrb; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds IE Extensions for Served PLMNs + * + * @details + * + * Function : BuildExtensions + * + * Functionality: Building the IE Extensions + * + * @params[in] struct ProtocolExtensionContainer_4624P3 *buildextend + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildExtensions(struct ProtocolExtensionContainer_4624P3 **ieExtend) +{ + U8 idx; + U8 plmnidx; + U8 extensionCnt; + U8 extensionId; + U8 sliceId; + U8 sdId; + DU_ALLOC(*ieExtend,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + if((*ieExtend) == NULLP) + { + RETVALUE(RFAILED); + } + extensionCnt=1; + (*ieExtend)->list.count = extensionCnt; + (*ieExtend)->list.size = \ + extensionCnt * sizeof(struct ServedPLMNs_ItemExtIEs *); + DU_ALLOC((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + if((*ieExtend)->list.array == NULLP) + { + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + if((*ieExtend)->list.array[plmnidx] == NULLP) + { + for(extensionId=0 ; extensionIdlist.array[extensionId],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + } + idx = 0; + (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList; + (*ieExtend)->list.array[idx]->criticality = Criticality_ignore; + (*ieExtend)->list.array[idx]->extensionValue.present = \ + ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.count = 1; + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.size = sizeof(SliceSupportItem_t *); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array == NULLP) + { + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + + } + sliceId = 0; + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId] == NULLP) + { + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sST.size = sizeof(U8); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\ + extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sST.size); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf == NULLP) + { + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sST.buf[0] = 3; + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD == NULLP) + { + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\ + extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sST.size); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->size = 3*sizeof(U8); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf,(*ieExtend)->list.array[idx]->extensionValue.choice.\ + SliceSupportList.list.array[sliceId]->sNSSAI.sD->size); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf == NULLP) + { + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->extensionValue.\ + choice.SliceSupportList.list.array[sliceId]->sNSSAI.sST.size); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE((*ieExtend)->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE((*ieExtend),sizeof(struct ProtocolExtensionContainer_4624P3)); + RETVALUE(RFAILED); + } + sdId = 0; + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf[sdId] = 3; + sdId++; + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf[sdId] = 6; + sdId++; + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf[sdId] = 9; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds Served PLMN + * + * @details + * + * Function : BuildServedPlmn + * + * Functionality: Building the Served PLMN + * + * @params[in] GNB_DU_Served_Cells_Item_t *srvCellItem + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildServedPlmn(ServedPLMNs_List_t *srvplmn) +{ + S16 ret; + U8 plmnidx; + U8 servPlmnid; + U8 servPlmnCnt; + GNB_DU_Served_Cells_Item_t *srvCellItem; + servPlmnCnt = 1; + srvplmn->list.count = servPlmnCnt; + srvplmn->list.size = \ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *); + DU_ALLOC(srvplmn->list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + if(srvplmn->list.array == NULLP) + { + RETVALUE(RFAILED); + } + + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item)); + if(srvplmn->list.array[plmnidx] == NULLP) + { + for(servPlmnid=0; servPlmnidlist.array[servPlmnid],\ + sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(srvplmn->list.array,\ + sizeof(struct ServedPLMNs_Item *)); + RETVALUE(RFAILED); + } + } + ret = BuildPlmn(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + &srvplmn->list.array[0]->pLMN_Identity); + if(ret!= ROK) + { + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvplmn->list.array,\ + sizeof(struct ServedPLMNs_Item *)); + RETVALUE(RFAILED); + } + ret = BuildExtensions(&srvplmn->list.array[0]->iE_Extensions); + if(ret != ROK) + { + DU_FREE(srvplmn->list.\ + array[0]->pLMN_Identity.buf,(Size)\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvplmn->list.array,\ + sizeof(struct ServedPLMNs_Item *)); + RETVALUE(RFAILED); + } +RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds Served Cell List + * + * @details + * + * Function : BuildServedCellList + * + * Functionality: Building Served Cell List + * + * @params[in] PLMNID plmn + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell) +{ + S16 ret; + U8 idx; + U8 plmnidx; + U8 plmnId; + U8 plmnCnt; + U8 servPlmnCnt; + U8 extensionCnt; + U8 sliceId; + U8 servId; + U8 ieId; + GNB_DU_Served_Cells_Item_t *srvCellItem; + + plmnCnt = 1; + duServedCell->list.size = plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *); + duServedCell->list.count = plmnCnt; + DU_ALLOC(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + if(duServedCell->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + if(duServedCell->list.array[plmnidx] == NULLP) + { + for(plmnId=0; plmnIdlist.array[plmnId],sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + } + idx = 0; + duServedCell->list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; + duServedCell->list.array[idx]->criticality = Criticality_reject; + duServedCell->list.array[idx]->value.present = \ + GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; + srvCellItem = \ + &duServedCell->list.array[idx]->value.choice.GNB_DU_Served_Cells_Item; + /*nRCGI*/ + ret = BuildNrcgi(&srvCellItem->served_Cell_Information.nRCGI); + if(ret != ROK) + { + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + + /*nRPCI*/ + srvCellItem->served_Cell_Information.nRPCI = \ + duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci; + + /*fiveGS_TAC*/ + ret = BuildFiveGSTac(&srvCellItem->served_Cell_Information); + if(ret != ROK) + { + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + /*Served PLMNs*/ + ret = BuildServedPlmn(&srvCellItem->served_Cell_Information.servedPLMNs); + if(ret !=ROK) + { + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,\ + sizeof(FiveGS_TAC_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + /*nR Mode Info with FDD*/ + ret = BuildNrMode(&srvCellItem->served_Cell_Information.nR_Mode_Info); + sliceId = 0; + ieId = 0; + servId = 0; + if(ret != ROK) + { + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf, srvCellItem->served_Cell_Information.servedPLMNs.\ + list.array[servId]->iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->size); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\ + servedPLMNs.list.array[servId]->pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxserved_Cell_Information.servedPLMNs.list.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\ + sizeof(struct ServedPLMNs_Item *)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,\ + sizeof(FiveGS_TAC_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + + + /*Measurement timing Config*/ + srvCellItem->served_Cell_Information.measurementTimingConfiguration.\ + size = sizeof(U8); + DU_ALLOC(srvCellItem->served_Cell_Information.\ + measurementTimingConfiguration.buf,sizeof(U8)); + if(srvCellItem->served_Cell_Information.\ + measurementTimingConfiguration.buf == NULLP) + { + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf,srvCellItem->served_Cell_Information.servedPLMNs.\ + list.array[servId]->iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->size); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\ + servedPLMNs.list.array[servId]->pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxserved_Cell_Information.servedPLMNs.list.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\ + sizeof(struct ServedPLMNs_Item *)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,\ + sizeof(FiveGS_TAC_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + RETVALUE(RFAILED); + } + srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf[0] = \ + duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg; + RETVALUE(ROK); +} +/******************************************************************* + * + * @brief Builds RRC Version + * + * @details + * + * Function : BuildRrcVer + * + * Functionality: Building RRC Version + * + * @params[in] int idx,int elementCnt,RRC_Version_t *rrcver + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildRrcVer(RRC_Version_t *rrcVer) +{ + U8 rrcExt; + U8 rrcLatest; + rrcVer->latest_RRC_Version.size = sizeof(U8); + DU_ALLOC(rrcVer->latest_RRC_Version.buf,sizeof(U8)); + if(rrcVer->latest_RRC_Version.buf == NULLP) + { + RETVALUE(RFAILED); + } + rrcVer->latest_RRC_Version.buf[0] = 0; + rrcVer->latest_RRC_Version.bits_unused = 5; + DU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t)); + if(rrcVer->iE_Extensions == NULLP) + { + DU_FREE(rrcVer->latest_RRC_Version.buf,sizeof(U8)); + RETVALUE(RFAILED); + } + rrcVer->iE_Extensions->list.count = 1; + rrcVer->iE_Extensions->list.size = sizeof(struct RRC_Version_ExtIEs *); + DU_ALLOC(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + if(rrcVer->iE_Extensions->list.array == NULLP) + { + DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t)); + DU_FREE(rrcVer->latest_RRC_Version.buf,sizeof(U8)); + RETVALUE(RFAILED); + } + rrcExt = 0; + DU_ALLOC(rrcVer->iE_Extensions->list.array[0],\ + sizeof(struct RRC_Version_ExtIEs)); + if(rrcVer->iE_Extensions->list.array[0] == NULLP) + { + DU_FREE(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t)); + DU_FREE(rrcVer->latest_RRC_Version.buf,sizeof(U8)); + RETVALUE(RFAILED); + } + rrcVer->iE_Extensions->list.array[rrcExt]->id = \ + ProtocolIE_ID_id_latest_RRC_Version_Enhanced; + rrcVer->iE_Extensions->list.array[rrcExt]->criticality = Criticality_reject; + rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.present =\ + RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced; + rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\ + .Latest_RRC_Version_Enhanced.size = 3*sizeof(U8); + DU_ALLOC(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\ + .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\ + array[rrcExt]->extensionValue.choice.Latest_RRC_Version_Enhanced.size); + if(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\ + .Latest_RRC_Version_Enhanced.buf == NULLP) + { + DU_FREE(rrcVer->iE_Extensions->list.array[rrcExt],\ + sizeof(struct RRC_Version_ExtIEs)); + DU_FREE(rrcVer->iE_Extensions->list.array,\ + sizeof(struct RRC_Version_ExtIEs *)); + DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t)); + DU_FREE(rrcVer->latest_RRC_Version.buf,sizeof(U8)); + RETVALUE(RFAILED); + } + rrcLatest = 0; + rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[rrcLatest] = 15; + rrcLatest++; + rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[rrcLatest] = 5; + rrcLatest++; + rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\ + Latest_RRC_Version_Enhanced.buf[rrcLatest] = 0; + RETVALUE(ROK); +} +/******************************************************************* +* +* @brief Sends F1 msg over SCTP +* +* @details +* +* Function : SendF1APMsg +* +* Functionality: Sends F1 msg over SCTP +* +* @params[in] Region region +* Pool pool +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +S16 SendF1APMsg(Region region, Pool pool) +{ + Buffer *mBuf; + + if(SGetMsg(region, pool, &mBuf) == ROK) + { + if(SAddPstMsgMult((Data *)encBuf, encBufSize, mBuf) == ROK) + { + SPrntMsg(mBuf, 0,0); + + if(sctpSend(mBuf) != ROK) + { + DU_LOG("\nF1AP : SCTP Send failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + } + else + { + DU_LOG("\nF1AP : SAddPstMsgMult failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + SPutMsg(mBuf); + } + else + { + DU_LOG("\nF1AP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +} /* SendF1APMsg */ + + +/******************************************************************* + * + * @brief Builds and Send the F1SetupRequest + * + * @details + * + * Function : BuildAndSendF1SetupReq + * + * Functionality:Fills the F1SetupRequest + * + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +S16 BuildAndSendF1SetupReq() +{ + S16 ret; + U8 idx; + U8 ieId; + U8 plmnidx; + U8 servId; + U8 sliceId; + U8 elementCnt; + U8 plmnCnt; + U8 servPlmnCnt; + U8 extensionCnt; + F1AP_PDU_t *f1apMsg = NULL; + F1SetupRequest_t *f1SetupReq; + GNB_DU_Served_Cells_List_t *duServedCell; + GNB_DU_Served_Cells_Item_t *srvCellItem; + RRC_Version_t *rrcVer; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\nF1AP : Building F1 Setup Request\n"); + + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup; + f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_F1SetupRequest; + + f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest; + + elementCnt = (duCfgParam.duName[0] != NULL) ? 5 : 4; + + f1SetupReq->protocolIEs.list.count = elementCnt; + f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t *); + + /* Initialize the F1Setup members */ + DU_ALLOC(f1SetupReq->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + if(f1SetupReq->protocolIEs.list.array == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1RequestIEs failed"); + DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, (Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(F1SetupRequestIEs_t)); + if(f1SetupReq->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0 ; ieIdprotocolIEs.list.array[ieId],\ + sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage, \ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*TransactionID*/ + f1SetupReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID; + f1SetupReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupReq->protocolIEs.list.array[idx]->value.present =\ + F1SetupRequestIEs__value_PR_TransactionID; + f1SetupReq->protocolIEs.list.array[idx]->value.choice.TransactionID = \ + TRANS_ID; + + /*DU ID*/ + idx++; + f1SetupReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_DU_ID; + f1SetupReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupReq->protocolIEs.list.array[idx]->value.present = \ + F1SetupRequestIEs__value_PR_GNB_DU_ID; + f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_ID.size =\ + sizeof(U8); + + DU_ALLOC(f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_ID.buf,\ + sizeof(U8)); + if(f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_ID.buf == \ + NULLP) + { + for(plmnidx=0; plmnidxprotocolIEs.list.array[plmnidx], \ + sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_ID.buf[0] =\ + duCfgParam.duId; + + /*DU Name*/ + if(duCfgParam.duName[0] != NULL) + { + idx++; + f1SetupReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_DU_Name ; + f1SetupReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + f1SetupReq->protocolIEs.list.array[idx]->value.present = \ + F1SetupRequestIEs__value_PR_GNB_DU_Name; + f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_Name.size =\ + sizeof(duCfgParam.duName); + + DU_ALLOC(f1SetupReq->protocolIEs.list.array[idx]->value.choice.\ + GNB_DU_Name.buf, sizeof(duCfgParam.duName)); + if(f1SetupReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_Name.\ + buf == NULLP) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.choice.\ + GNB_DU_ID.buf, sizeof(U8)); + for(plmnidx=0; plmnidxprotocolIEs.list.array[plmnidx], \ + sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage, \ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + strcpy((char*)f1SetupReq->protocolIEs.list.array[idx]->value.\ + choice.GNB_DU_Name.buf, + (char*)&duCfgParam.duName); + } + + /*Served Cell list */ + idx++; + f1SetupReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_Served_Cells_List; + f1SetupReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupReq->protocolIEs.list.array[idx]->value.present = \ + F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; + duServedCell = &f1SetupReq->protocolIEs.list.\ + array[idx]->value.choice.GNB_DU_Served_Cells_List; + ret = BuildServedCellList(duServedCell); + + if(ret != ROK) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.\ + choice.GNB_DU_Name.buf, sizeof(duCfgParam.duName)); + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.\ + choice.GNB_DU_ID.buf, sizeof(U8)); + for(plmnidx=0; plmnidxprotocolIEs.list.array[plmnidx],\ + sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array, \ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } + /*RRC Version*/ + idx++; + f1SetupReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_GNB_DU_RRC_Version ; + f1SetupReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + f1SetupReq->protocolIEs.list.array[idx]->value.present = \ + F1SetupRequestIEs__value_PR_RRC_Version; + rrcVer = &f1SetupReq->protocolIEs.list.array[idx]->value.choice.RRC_Version; + ret = BuildRrcVer(rrcVer); + ieId = 0; + sliceId = 0; + servId = 0; + if(ret != ROK) + { + DU_FREE(srvCellItem->served_Cell_Information.\ + measurementTimingConfiguration.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf,srvCellItem->served_Cell_Information.servedPLMNs.\ + list.array[servId]->iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->size); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\ + servedPLMNs.list.array[servId]->pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\ + sizeof(struct ServedPLMNs_Item *)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,\ + sizeof(FiveGS_TAC_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.\ + choice.GNB_DU_Name.buf, sizeof(duCfgParam.duName)); + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.\ + choice.GNB_DU_ID.buf, sizeof(U8)); + for(plmnidx=0; plmnidxprotocolIEs.list.array[plmnidx],\ + sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array,\ + elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Clean up */ +#if 0 + DU_FREE(srvCellItem->served_Cell_Information.\ + measurementTimingConfiguration.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.array,sizeof(struct FreqBandNrItem *)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->buf,srvCellItem->served_Cell_Information.servedPLMNs.\ + list.array[servId]->iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD->size); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList\ + .list.array[sliceId]->sNSSAI.sST.buf,sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array[sliceId],sizeof(SliceSupportItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ + iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof(SliceSupportItem_t *)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array[plmnidx],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions->list.array,\ + extensionCnt*sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ + array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\ + servedPLMNs.list.array[servId]->pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0;plmnidxserved_Cell_Information.servedPLMNs.list.array[plmnidx],\ + sizeof(struct ServedPLMNs_Item *)); + } + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\ + sizeof(struct ServedPLMNs_Item *)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,\ + sizeof(FiveGS_TAC_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(U8)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(U8)); + for(plmnidx=0; plmnidxlist.array[plmnidx],\ + sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + } + DU_FREE(duServedCell->list.array,\ + plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t *)); + +#endif + if(duCfgParam.duName[0] != NULL) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[idx]->value.choice.\ + GNB_DU_Name.buf, sizeof(duCfgParam.duName)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array[--idx]->value.choice.GNB_DU_ID.\ + buf, sizeof(U8)); + for(idx=0; idxprotocolIEs.list.array[idx], sizeof(F1SetupRequestIEs_t)); + } + DU_FREE(f1SetupReq->protocolIEs.list.array, elementCnt * sizeof(F1SetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nF1AP : Could not encode F1SetupRequest structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\nF1AP : Created APER encoded buffer for F1SetupRequest\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + { + DU_LOG("\nF1AP : Sending F1 Setup request failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendF1SetupReq */ + +/******************************************************************* + * + * @brief Builds the PLMN Id + * + * @details + * + * Function : plmnBuild + * + * Functionality: Builds the PLMN Id + * + * @params[in] PlmnId plmn + * @params[in] OCTET_STRING_t *octe + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void plmnBuild(PlmnId plmn, OCTET_STRING_t *octe) +{ + U8 mncCnt; + mncCnt = 2; + octe->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0])); + if(mncCnt == 2) + { + octe->buf[1] = ((0xf0) | (plmn.mcc[2])); + octe->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0])); + } + else + { + octe->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2])); + octe->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1])); + } +} + +/******************************************************************* + * + * @brief Builds and sends the DUConfigUpdate + * + * @details + * + * Function : BuildAndSendDUConfigUpdate + * + * Functionality: Constructs the DU Update message and sends + * it to the CU through SCTP. + * + * @params[in] void **buf,Buffer to which encoded pattern is written into + * @params[in] int *size,size of buffer + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendDUConfigUpdate() +{ + U8 idx,idy; + U8 elementCnt,modifyCnt,servPlmnCnt,extensionCnt; + asn_enc_rval_t encRetVal; /* Encoder return value */ + F1AP_PDU_t *f1apDuCfg = NULL; + GNBDUConfigurationUpdate_t *duCfgUpdate; + Served_Cells_To_Modify_List_t *cellsToModify; + Served_Cells_To_Modify_Item_t *modifyItem; + DU_LOG("\nF1AP : Building DU config update\n"); + + /* Allocate the memory for F1DuCfg */ + DU_ALLOC(f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); + if(f1apDuCfg == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apDuCfg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + if(f1apDuCfg->choice.initiatingMessage == NULLP) + { + DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed"); + DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apDuCfg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_gNBDUConfigurationUpdate; + f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject; + f1apDuCfg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_GNBDUConfigurationUpdate; + duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\ + choice.GNBDUConfigurationUpdate; + + elementCnt = 3; + duCfgUpdate->protocolIEs.list.count = elementCnt; + duCfgUpdate->protocolIEs.list.size = \ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *); + + /* Initialize the F1Setup members */ + DU_ALLOC(duCfgUpdate->protocolIEs.list.array,\ + elementCnt*sizeof(GNBDUConfigurationUpdateIEs_t *)); + if(duCfgUpdate->protocolIEs.list.array == NULLP) + { + DU_LOG("F1AP : Memory allocation for F1RequestIEs failed"); + DU_FREE(f1apDuCfg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0;idxprotocolIEs.list.array[idx], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + if(duCfgUpdate->protocolIEs.list.array[idx] == NULLP) + { + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + /*TransactionID*/ + idx = 0; + duCfgUpdate->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_TransactionID; + duCfgUpdate->protocolIEs.list.array[idx]->criticality = Criticality_reject; + duCfgUpdate->protocolIEs.list.array[idx]->value.present = \ + GNBDUConfigurationUpdateIEs__value_PR_TransactionID; + duCfgUpdate->protocolIEs.list.array[idx]->value.choice.TransactionID = \ + TRANS_ID; +#if 1 + /*Served Cell to Modify */ + idx++; + duCfgUpdate->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_Served_Cells_To_Modify_List; + duCfgUpdate->protocolIEs.list.array[idx]->criticality = Criticality_reject; + duCfgUpdate->protocolIEs.list.array[idx]->value.present = \ + GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; + cellsToModify = &duCfgUpdate->protocolIEs.list.array[1]->value.choice.\ + Served_Cells_To_Modify_List; + modifyCnt = 1; + cellsToModify->list.count = modifyCnt; + cellsToModify->list.size = \ + modifyCnt*sizeof(struct Served_Cells_To_Modify_ItemIEs *); + DU_ALLOC(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + if(cellsToModify->list.array == NULLP) + { + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + + } + for(idy=0; idylist.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + if(cellsToModify->list.array[idy] == NULLP) + { + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + cellsToModify->list.array[0]->id = \ + ProtocolIE_ID_id_Served_Cells_To_Modify_Item; + cellsToModify->list.array[0]->criticality = Criticality_reject; + cellsToModify->list.array[0]->value.present = \ + Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; + modifyItem=&cellsToModify->list.array[0]->value.choice.\ + Served_Cells_To_Modify_Item; + + /*pLMN_Identity*/ + modifyItem->oldNRCGI.pLMN_Identity.size = 3; + DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + if(modifyItem->oldNRCGI.pLMN_Identity.buf == NULLP) + { + for(idy=0; idylist.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + &modifyItem->oldNRCGI.pLMN_Identity); + /*nRCellIdentity*/ + modifyItem->oldNRCGI.nRCellIdentity.size = 5; + DU_ALLOC(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + if(modifyItem->oldNRCGI.nRCellIdentity.buf == NULLP) + { + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for (int tmp = 0 ; tmp < modifyItem->oldNRCGI.nRCellIdentity.size-1 ; tmp++) + { + modifyItem->oldNRCGI.nRCellIdentity.buf[tmp] = 0; + } + modifyItem->oldNRCGI.nRCellIdentity.buf[4] = 16; + modifyItem->oldNRCGI.nRCellIdentity.bits_unused = 4; + /*pLMN_Identity*/ + /*nRCGI*/ + modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size = 3; + DU_ALLOC(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + if(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf == NULLP) + { + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + &modifyItem->served_Cell_Information.nRCGI.pLMN_Identity); + modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size = 5; + DU_ALLOC(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + if(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for (int tmp = 0 ; tmp < modifyItem->served_Cell_Information.\ + nRCGI.nRCellIdentity.size-1 ; tmp++) + { + modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf[tmp] = 0; + } + modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf[4] = 16; + modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.bits_unused = 4; + + /*nRPCI*/ + modifyItem->served_Cell_Information.nRPCI = \ + duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci; + + /*servedPLMNs*/ + servPlmnCnt = 1; + modifyItem->served_Cell_Information.servedPLMNs.list.count = servPlmnCnt; + modifyItem->served_Cell_Information.servedPLMNs.list.size = \ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idy] == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.size = 3; + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf == NULLP) + { + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.plmn[0],\ + &modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->pLMN_Identity); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + extensionCnt=1; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.count = extensionCnt; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.size = extensionCnt * \ + sizeof(struct ServedPLMNs_ItemExtIEs *); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy] == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->id = ProtocolIE_ID_id_TAISliceSupportList; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->criticality = Criticality_ignore; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.present = \ + ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.count = 1; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.size = sizeof(SliceSupportItem_t *); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array == NULLP) + { + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0] == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.size = sizeof(uint8_t); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue. choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf[0] = 3; + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->size = 3*sizeof(uint8_t); + DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf[0] = 3; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf[1] = 6; + modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf[2] = 9; + + /*nR Mode Info with FDD*/ + modifyItem->served_Cell_Information.nR_Mode_Info.present = \ + NR_Mode_Info_PR_fDD; + DU_ALLOC(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.count = 1; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.size = \ + sizeof(struct FreqBandNrItem *); + DU_ALLOC(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + DU_ALLOC(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0],sizeof(struct FreqBandNrItem)); + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0] == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ + freqBandListNr.list.array[0]->freqBandIndicatorNr = \ + duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\ + freqBand[0].nrFreqBand; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ + freqBandListNr.list.array[0]->supportedSULBandList.list.count=0; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\ + dlNrFreqInfo.nrArfcn; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.count = 1; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.size = sizeof(struct FreqBandNrItem *); + DU_ALLOC(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,\ + sizeof(struct FreqBandNrItem *)); + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0],sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + DU_ALLOC(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,\ + sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0],sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.array[0]->freqBandIndicatorNr = \ + duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\ + freqBand[0].nrFreqBand; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.array[0]->supportedSULBandList.list.count=0; + + /*Transmission Bandwidth*/ + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.ulTxBw.nrScs; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.ulTxBw.nrb; + + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.dlTxBw.nrScs; + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\ + f1Mode.mode.fdd.dlTxBw.nrb; + + /*Measurement timing Config*/ + modifyItem->served_Cell_Information.measurementTimingConfiguration.size = \ + sizeof(uint8_t); + DU_ALLOC(modifyItem->served_Cell_Information.measurementTimingConfiguration.\ + buf,sizeof(uint8_t)); + if(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,\ + sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0],sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + modifyItem->served_Cell_Information.measurementTimingConfiguration.\ + buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg; + + + // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE + /*GNB DU ID */ + duCfgUpdate->protocolIEs.list.array[2]->id = ProtocolIE_ID_id_gNB_DU_ID; + duCfgUpdate->protocolIEs.list.array[2]->criticality = Criticality_reject; + duCfgUpdate->protocolIEs.list.array[2]->value.present = \ + GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID; + duCfgUpdate->protocolIEs.list.array[2]->value.choice.GNB_DU_ID.size = \ + sizeof(uint8_t); + DU_ALLOC(duCfgUpdate->protocolIEs.list.array[2]->value.choice.GNB_DU_ID.buf,\ + sizeof(uint8_t)); + if(duCfgUpdate->protocolIEs.list.array[2]->value.choice.GNB_DU_ID.buf == NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.\ + buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array[0],\ + sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + dL_NRFreqInfo.freqBandListNr.list.array,\ + sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.\ + array[0],sizeof(struct FreqBandNrItem)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ + fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array,sizeof(struct FreqBandNrItem *)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,\ + sizeof(FDD_Info_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD->buf,3*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0]->sNSSAI.sST.buf,sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array[0],sizeof( SliceSupportItem_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->\ + iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ + list.array,sizeof( SliceSupportItem_t *)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array[idy],\ + sizeof(struct ServedPLMNs_ItemExtIEs)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions->list.array,extensionCnt*\ + sizeof(struct ServedPLMNs_ItemExtIEs *)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->iE_Extensions,\ + sizeof(struct ProtocolExtensionContainer_4624P3)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ + array[0]->pLMN_Identity.buf,3*sizeof(uint8_t)); + for(idy=0;idyserved_Cell_Information.servedPLMNs.list.array[idy],\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item)); + } + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ + servPlmnCnt*sizeof(struct ServedPLMNs_Item *)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + 5*sizeof(uint8_t)); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + 3*sizeof(U8)); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ + modifyItem->oldNRCGI.nRCellIdentity.size*sizeof(uint8_t)); + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,3*sizeof(uint8_t)); + DU_FREE(cellsToModify->list.array[idy],\ + sizeof(struct Served_Cells_To_Modify_ItemIEs)); + DU_FREE(cellsToModify->list.array,modifyCnt*\ + sizeof(struct Served_Cells_To_Modify_ItemIEs *)); + for(idy=0;idyprotocolIEs.list.array[idy], \ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,\ + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage,\ + (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + duCfgUpdate->protocolIEs.list.array[2]->value.choice.GNB_DU_ID.buf[0] = \ + duCfgParam.duId; + + + +#endif + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg); + + /* Encode the DU Config Update type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf); + + /* Clean up */ + for(idx=0;idxprotocolIEs.list.array[idx], sizeof(GNBDUConfigurationUpdateIEs_t)); + } + DU_FREE(duCfgUpdate->protocolIEs.list.array, elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t *)); + DU_FREE(f1apDuCfg->choice.initiatingMessage, (Size)sizeof(InitiatingMessage_t)); + DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); + + /* Checking encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("F1AP : Could not encode DUConfigUpdate structure (at %s)\n",encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\nF1AP : Created APER encoded buffer for DUConfigUpdate\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + { + DU_LOG("\nF1AP : Sending GND-DU Config Update failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendDUConfigUpdate */ + +/******************************************************************* + * + * @brief Builds and sends the ULRRCMessageTransfer + * + * @details + * + * Function : BuildAndSendULRRCMessageTransfer + * + * Functionality: Constructs the UL RRC Message Transfer and sends + * it to the CU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendULRRCMessageTransfer() +{ + S16 ret; + U8 elementCnt; + U8 ieId; + U8 idx; + F1AP_PDU_t *f1apMsg = NULL; + ULRRCMessageTransfer_t *ulRRCMsg; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\n F1AP : Building UL RRC Message Transfer Message\n"); + + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_ULRRCMessageTransfer; + f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_ULRRCMessageTransfer; + ulRRCMsg = + &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + elementCnt = 3; + ulRRCMsg->protocolIEs.list.count = elementCnt; + ulRRCMsg->protocolIEs.list.size = \ + elementCnt * sizeof(ULRRCMessageTransferIEs_t *); + + /* Initialize the F1Setup members */ + DU_ALLOC(ulRRCMsg->protocolIEs.list.array, \ + elementCnt * sizeof(ULRRCMessageTransferIEs_t *)); + if(ulRRCMsg->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for UL RRC MessageTransferIEs failed"); + DU_FREE(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(ULRRCMessageTransferIEs_t)); + if(ulRRCMsg->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0; ieIdprotocolIEs.list.array[ieId],\ + sizeof(ULRRCMessageTransferIEs_t)); + } + DU_FREE(ulRRCMsg->protocolIEs.list.array,\ + elementCnt * sizeof(ULRRCMessageTransferIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*GNB CU UE F1AP ID*/ + ulRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ulRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ulRRCMsg->protocolIEs.list.array[idx]->value.present = \ + ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + ulRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; + + /*GNB DU UE F1AP ID*/ + idx++; + ulRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ulRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ulRRCMsg->protocolIEs.list.array[idx]->value.present = \ + ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ulRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; + + /*SRBID*/ + idx++; + ulRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SRBID; + ulRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ulRRCMsg->protocolIEs.list.array[idx]->value.present = \ + ULRRCMessageTransferIEs__value_PR_SRBID; + ulRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = UL_SRBID; + + /*RRCContainer*/ + //YET TO FILL + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending UL RRC Message Transfer Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendULRRCMessageTransfer*/ + +/******************************************************************* + * + * @brief Builds and sends the InitialULRRCMessage + * + * @details + * + * Function : BuildAndSendRRCSetupReq + * + * Functionality: Constructs the Initial UL RRC Message Transfer and sends + * it to the CU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendRRCSetupReq() +{ + S16 ret; + U8 elementCnt; + U8 ieId; + U8 idx; + F1AP_PDU_t *f1apMsg = NULL; + InitialULRRCMessageTransfer_t *initULRRCMsg; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\n F1AP : Building RRC Setup Request\n"); + + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_InitialULRRCMessageTransfer; + f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_InitialULRRCMessageTransfer; + initULRRCMsg = + &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; + elementCnt = 3; + initULRRCMsg->protocolIEs.list.count = elementCnt; + initULRRCMsg->protocolIEs.list.size = \ + elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *); + + /* Initialize the F1Setup members */ + DU_ALLOC(initULRRCMsg->protocolIEs.list.array, \ + elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *)); + if(initULRRCMsg->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed"); + DU_FREE(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(InitialULRRCMessageTransferIEs_t)); + if(initULRRCMsg->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0; ieIdprotocolIEs.list.array[ieId],\ + sizeof(InitialULRRCMessageTransferIEs_t)); + } + DU_FREE(initULRRCMsg->protocolIEs.list.array,\ + elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*GNB DU UE F1AP ID*/ + initULRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + initULRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + initULRRCMsg->protocolIEs.list.array[idx]->value.present = \ + InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + initULRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; + + /*NRCGI*/ + idx++; + initULRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_NRCGI; + initULRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + initULRRCMsg->protocolIEs.list.array[idx]->value.present = \ + InitialULRRCMessageTransferIEs__value_PR_NRCGI; + ret = \ + BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI); + if(ret != ROK) + { + DU_FREE(initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + nRCellIdentity.buf,initULRRCMsg->protocolIEs.list.array[idx]->\ + value.choice.NRCGI.nRCellIdentity.size); + DU_FREE(initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + pLMN_Identity.buf,initULRRCMsg->protocolIEs.list.array[idx]->\ + value.choice.NRCGI.pLMN_Identity.size); + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(InitialULRRCMessageTransferIEs_t)); + } + DU_FREE(initULRRCMsg->protocolIEs.list.array,\ + elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + + } + + /*Cell RNTI*/ + idx++; + initULRRCMsg->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_C_RNTI; + initULRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject; + initULRRCMsg->protocolIEs.list.array[idx]->value.present = \ + InitialULRRCMessageTransferIEs__value_PR_C_RNTI; + initULRRCMsg->protocolIEs.list.array[idx]->value.choice.C_RNTI = CRNTI; + + /*RRCContainer*/ + // Need to fill this. + + /*DUtoCURRCContainer*/ + //Need to fill this too. + + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode Initial UL RRC Message Transfer structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for Initial UL RRC Message transfer\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending Initial UL RRC Message Transfer Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendRRCSetupReq*/ + +/******************************************************************* + * + * @brief Builds Special cell list for UE Setup Request + * + * @details + * + * Function : BuildSplCellList + * + * Functionality: Constructs the Special Cell list for UESetReq + * + * @params[in] SCell_ToBeSetup_List_t *spCellLst + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst) +{ + U8 cellCnt; + U8 idx; + U8 cellidx; + S16 ret; + cellCnt = 1; + spCellLst->list.count = cellCnt; + spCellLst->list.size = cellCnt * sizeof(struct SCell_ToBeSetup_ItemIEs *); + DU_ALLOC(spCellLst->list.array,spCellLst->list.size); + if(spCellLst->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(idx=0; idxlist.array[idx],sizeof(struct SCell_ToBeSetup_ItemIEs)); + if(spCellLst->list.array[idx] == NULLP) + { + for(cellidx=0; cellidxlist.array[cellidx],sizeof(struct SCell_ToBeSetup_ItemIEs)); + } + DU_FREE(spCellLst->list.array,spCellLst->list.size); + RETVALUE(RFAILED); + } + } + idx = 0; + spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item; + spCellLst->list.array[idx]->criticality = Criticality_ignore; + spCellLst->list.array[idx]->value.present = \ + SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + /* Special Cell ID -NRCGI */ + ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); + if(ret != ROK) + { + for(cellidx=0; cellidxlist.array[cellidx],sizeof(struct + SCell_ToBeSetup_ItemIEs)); + } + DU_FREE(spCellLst->list.array,spCellLst->list.size); + RETVALUE(RFAILED); + } + /*Special Cell Index*/ + spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1; + + RETVALUE(ROK); +}/* End of BuildSplCellList*/ + +/******************************************************************* + * + * @brief Builds SRBS to be setup + * + * @details + * + * Function : BuildSRBSetup + * + * Functionality: Constructs the SRB's for UESetReq + * + * @params[in] SRBs_ToBeSetup_List_t *srbSet + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet) +{ + U8 idx; + U8 srbidx; + U8 srbCnt; + srbCnt = 1; + srbSet->list.count = srbCnt; + srbSet->list.size = srbCnt*sizeof(struct SRBs_ToBeSetup_ItemIEs *); + DU_ALLOC(srbSet->list.array,srbSet->list.size); + if(srbSet->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(idx=0; idxlist.array[idx],sizeof(struct SRBs_ToBeSetup_ItemIEs)); + if(srbSet->list.array[idx] == NULLP) + { + for(srbidx=0; srbidxlist.array[srbidx],sizeof(struct SRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(srbSet->list.array,srbSet->list.size); + } + } + idx = 0; + srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item; + srbSet->list.array[idx]->criticality = Criticality_ignore; + srbSet->list.array[idx]->value.present = \ + SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; + srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2; + RETVALUE(ROK); +}/* End of BuildSRBSetup*/ + +/******************************************************************* + * + * @brief Builds QOS Info for DRB Setum Item + * + * @details + * + * Function : BuildQOSInfo + * + * Functionality: Constructs the QOS Info for DRB Setup Item + * + * @params[in] QoSInformation_t *qosinfo + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos) +{ + /* NonDynamic5QIDescriptor */ + drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI; + DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI == NULLP) + { + RETVALUE(RFAILED); + } + /*FiveQI*/ + drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0; + /*AveragingWindow*/ + DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \ + NULLP) + { + DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\ + sizeof(NonDynamic5QIDescriptor_t)); + RETVALUE(RFAILED); + } + *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0; + /*MaxDataBurstVolume*/ + DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \ + NULLP) + { + DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\ + sizeof(NonDynamic5QIDescriptor_t)); + RETVALUE(RFAILED); + } + *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0; + + /*nRGRAN Allocation Retention Priority*/ + drbQos->nGRANallocationRetentionPriority.priorityLevel = \ + PriorityLevel_highest; + drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = \ + Pre_emptionCapability_may_trigger_pre_emption; + drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = \ + Pre_emptionVulnerability_not_pre_emptable; + + /* TO DO: GBR_QoSFlowInformation */ + RETVALUE(ROK); +}/*End of BuildQOSInfo*/ + +/******************************************************************* + * + * @brief Builds SNSSAI + * + * @details + * + * Function : BuildSNSSAI + * + * Functionality: Constructs the SNSSAI For DRB list + * + * @params[in] SNSSAI_t *snssai + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildSNSSAI(SNSSAI_t *snssai) +{ + /*SNSSAI*/ + /*ssT*/ + snssai->sST.size = sizeof(U8); + DU_ALLOC(snssai->sST.buf,snssai->sST.size); + if(snssai->sST.buf == NULLP) + { + RETVALUE(RFAILED); + } + snssai->sST.buf[0] = 3; + /*sD*/ + DU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t)); + if(snssai->sD == NULLP) + { + DU_FREE(snssai->sST.buf,snssai->sST.size); + RETVALUE(RFAILED); + } + snssai->sD->size = 3*sizeof(U8); + DU_ALLOC(snssai->sD->buf,snssai->sD->size); + if(snssai->sD->buf == NULLP) + { + DU_FREE(snssai->sD,sizeof(OCTET_STRING_t)); + DU_FREE(snssai->sST.buf,snssai->sST.size); + RETVALUE(RFAILED); + } + snssai->sD->buf[0] = 3; + snssai->sD->buf[1] = 6; + snssai->sD->buf[2] = 9; + + RETVALUE(ROK); +}/*End of BuildSNSSAI*/ + +/******************************************************************* + * + * @brief Builds the flow map. + * + * @details + * + * Function : BuildFlowsMap + * + * Functionality: Constructs the flowmap For DRB list + * + * @params[in] Flows_Mapped_To_DRB_List_t *flowMap + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap) +{ + S16 ret; + U8 idx; + U8 flowidx; + U8 flowCnt; + flowCnt = 1; + flowMap->list.count = flowCnt; + flowMap->list.size = flowCnt * sizeof(struct Flows_Mapped_To_DRB_Item *); + DU_ALLOC(flowMap->list.array,flowMap->list.size); + if(flowMap->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(idx=0; idxlist.array[idx],sizeof(struct Flows_Mapped_To_DRB_Item)); + if(flowMap->list.array[idx] == NULLP) + { + for(flowidx=0; flowidxlist.array[flowidx],sizeof(struct \ + Flows_Mapped_To_DRB_Item)); + } + + DU_FREE(flowMap->list.array,flowMap->list.size); + } + } + idx = 0; + flowMap->list.array[idx]->qoSFlowIdentifier = 0; + ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters); + if(ret != ROK) + { + DU_FREE(flowMap->list.array[idx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + DU_FREE(flowMap->list.array[idx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + DU_FREE(flowMap->list.array[idx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI,\ + sizeof(NonDynamic5QIDescriptor_t)); + for(idx=0; idxlist.array[idx],sizeof(struct Flows_Mapped_To_DRB_Item)); + } + DU_FREE(flowMap->list.array,flowMap->list.size); + RETVALUE(RFAILED); + } + RETVALUE(ROK); +}/*End of BuildFlowsMap*/ + +/******************************************************************* + * + * @brief Builds the Uplink Tunnel Info + * + * @details + * + * Function : BuildULTnlInfo + * + * Functionality: Constructs the UL TnlInfo For DRB list + * + * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) +{ + S16 ret; + U8 idx; + U8 ulidx; + U8 ulCnt; + ulCnt = 1; + ulInfo->list.count = ulCnt; + ulInfo->list.size = ulCnt * sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item *); + DU_ALLOC(ulInfo->list.array,ulInfo->list.size); + if(ulInfo->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(idx=0; idxlist.array[idx],sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item)); + if(ulInfo->list.array[idx] == NULLP) + { + for(ulidx=0; ulidxlist.array[ulidx],sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item)); + } + DU_FREE(ulInfo->list.array,ulInfo->list.size); + RETVALUE(RFAILED); + } + } + idx = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.present = \ + UPTransportLayerInformation_PR_gTPTunnel; + /*GTP TUNNEL*/ + DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(struct GTPTunnel)); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP) + { + for(idx=0; idxlist.array[idx],sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item)); + } + DU_FREE(ulInfo->list.array,ulInfo->list.size); + RETVALUE(RFAILED); + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.size = 4*sizeof(U8); + DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf,ulInfo->list.array[idx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf == NULLP) + { + DU_FREE(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(struct GTPTunnel)); + for(idx=0; idxlist.array[idx],sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item)); + } + DU_FREE(ulInfo->list.array,ulInfo->list.size); + RETVALUE(RFAILED); + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[0] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[1] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[2] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[3] = 5; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.bits_unused = 0; + /*GTP TEID*/ + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\ + = 4 * sizeof(U8); + DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf,ulInfo->list.array[idx]->uLUPTNLInformation.choice.\ + gTPTunnel->gTP_TEID.size); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ + == NULLP) + { + DU_FREE(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf,ulInfo->list.array[idx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + DU_FREE(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(struct GTPTunnel)); + for(idx=0; idxlist.array[idx],sizeof(struct \ + ULUPTNLInformation_ToBeSetup_Item)); + } + DU_FREE(ulInfo->list.array,ulInfo->list.size); + RETVALUE(RFAILED); + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[0] = 11; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[1] = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[2] = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[3] = 1; + + RETVALUE(ROK); +}/*End of BuildULTnlInfo*/ + +/******************************************************************* + * + * @brief Builds DRBS to be setup + * + * @details + * + * Function : BuildDRBSetup + * + * Functionality: Constructs the DRB's for UESetReq + * + * @params[in] DRBs_ToBeSetup_List_t *drbSet + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet) +{ + S16 ret; + U8 idx; + U8 drbidx; + U8 drbCnt; + U8 flowidx; + U8 flowCnt; + U8 ulidx; + U8 ulCnt; + DRBs_ToBeSetup_Item_t *drbSetItem; + drbCnt = 1; + drbSet->list.count = drbCnt; + drbSet->list.size = drbCnt*sizeof(struct DRBs_ToBeSetup_ItemIEs *); + DU_ALLOC(drbSet->list.array,drbSet->list.size); + if(drbSet->list.array == NULLP) + { + RETVALUE(RFAILED); + } + for(idx=0; idxlist.array[idx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + if(drbSet->list.array[idx] == NULLP) + { + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + } + idx = 0; + drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item; + drbSet->list.array[idx]->criticality = Criticality_ignore; + drbSet->list.array[idx]->value.present = \ + DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; + drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item; + /*dRBID*/ + drbSetItem->dRBID = 1; + /*qoSInformation*/ + drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension; + DU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + if(drbSetItem->qoSInformation.choice.choice_extension == NULLP) + { + for(idx=0; idxlist.array[idx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + drbSetItem->qoSInformation.choice.choice_extension->id = \ + ProtocolIE_ID_id_DRB_Information; + drbSetItem->qoSInformation.choice.choice_extension->criticality = \ + Criticality_ignore; + drbSetItem->qoSInformation.choice.choice_extension->value.present = \ + QoSInformation_ExtIEs__value_PR_DRB_Information; + ret = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS); + if(ret != ROK) + { + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + /*SNSSAI*/ + ret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI); + if(ret != ROK) + { + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + /*Flows mapped to DRB List*/ + ret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List); + if(ret != ROK) + { + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD->buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sD->size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sST.buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sST.size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + /*ULUPTNLInformation To Be Setup List*/ + ret = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + if(ret != ROK) + { + flowidx=0; + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array,drbSetItem->qoSInformation.choice.choice_extension->\ + value.choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); + flowCnt = 1; + for(flowidx=0; flowidxqoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx],sizeof(struct Flows_Mapped_To_DRB_Item)); + } + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD->buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sD->size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sST.buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sST.size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + /*RLCMode*/ + drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional; + + /*UL Configuration*/ + ulCnt = 1; + DU_ALLOC(drbSetItem->uLConfiguration,sizeof(struct ULConfiguration)); + if(drbSetItem->uLConfiguration == NULLP) + { + ulidx=0; + DU_FREE(drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\ + drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size); + DU_FREE(drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\ + drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + DU_FREE(drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel,sizeof(struct GTPTunnel)); + DU_FREE(drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.array,\ + drbSetItem->uLUPTNLInformation_ToBeSetup_List.list.size); + for(ulidx=0; ulidxuLUPTNLInformation_ToBeSetup_List.list.array[ulidx],\ + sizeof(struct ULUPTNLInformation_ToBeSetup_Item)); + } + flowidx=0; + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx]->qoSFlowLevelQoSParameters.qoS_Characteristics.\ + choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array,drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); + flowCnt = 1; + for(flowidx=0; flowidxqoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.\ + array[flowidx],sizeof(struct Flows_Mapped_To_DRB_Item)); + } + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD,sizeof(OCTET_STRING_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sD->buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sD->size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.sNSSAI.sST.buf,drbSetItem->qoSInformation.\ + choice.choice_extension->value.choice.DRB_Information.\ + sNSSAI.sST.size); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.dRB_QoS.qoS_Characteristics.choice.\ + non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(struct\ + QoSInformation_ExtIEs)); + for(drbidx=0; drbidxlist.array[drbidx],sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(drbSet->list.array,drbSet->list.size); + RETVALUE(RFAILED); + } + drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data; + + RETVALUE(ROK); +}/* End of BuildDRBSetup*/ + +/******************************************************************* + * + * @brief Builds and sends the UE Setup Request + * + * @details + * + * Function : BuildAndSendUESetReq + * + * Functionality: Constructs the UE Setup Request and sends + * it to the CU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildAndSendUESetReq() +{ + S16 ret; + U8 elementCnt; + U8 cellCnt; + U8 ieId; + U8 idx; + U8 spId; + U8 srbCnt; + U8 srbId; + U8 drbCnt; + U8 drbId; + U8 flowidx; + U8 flowCnt; + U8 ulidx; + U8 ulCnt; + F1AP_PDU_t *f1apMsg = NULL; + UEContextSetupRequest_t *ueSetReq; + SCell_ToBeSetup_List_t *spCellLst; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\n F1AP : Building UE Context Setup Request\n"); + + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + RETVALUE(RFAILED); + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + f1apMsg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_UEContextSetup; + f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_UEContextSetupRequest; + ueSetReq = + &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; + elementCnt = 9; + ueSetReq->protocolIEs.list.count = elementCnt; + ueSetReq->protocolIEs.list.size = \ + elementCnt * sizeof(UEContextSetupRequestIEs_t *); + + /* Initialize the UESetup members */ + DU_ALLOC(ueSetReq->protocolIEs.list.array, \ + elementCnt * sizeof(UEContextSetupRequestIEs_t *)); + if(ueSetReq->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed"); + DU_FREE(f1apMsg->choice.initiatingMessage, + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupRequestIEs_t)); + if(ueSetReq->protocolIEs.list.array[idx] == NULLP) + { + for(ieId=0; ieIdprotocolIEs.list.array[ieId],\ + sizeof(UEContextSetupRequestIEs_t)); + } + DU_FREE(ueSetReq->protocolIEs.list.array,\ + elementCnt * sizeof(UEContextSetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + } + + idx = 0; + + /*GNB CU UE F1AP ID*/ + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; + + /*GNB DU UE F1AP ID*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; + + /*Special Cell ID*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SpCell_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_NRCGI; + ret = \ + BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI); + if(ret != ROK) + { + //idx =2 + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + nRCellIdentity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.nRCellIdentity.size)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + pLMN_Identity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.pLMN_Identity.size)); + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(InitialULRRCMessageTransferIEs_t)); + } + DU_FREE(ueSetReq->protocolIEs.list.array,\ + elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + + } + + /*Served Cell Index*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_ServCellIndex; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_ServCellIndex; + ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \ + CELL_INDEX; + + /*CellULConfigured*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SpCellULConfigured; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_CellULConfigured; + ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \ + CellULConfigured_none; + + + /*CUtoDURRCContainer*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_CUtoDURRCInformation; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + + /*Special Cells to be SetupList*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SCell_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; + cellCnt = 1; + ret = BuildSplCellList(&ueSetReq->protocolIEs.\ + list.array[idx]->value.choice.SCell_ToBeSetup_List); + if(ret != ROK) + { //idx=6 + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.buf,\ + ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.size); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.buf,\ + ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.size); + for(spId=0; spIdprotocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[spId],sizeof(struct + SCell_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SCell_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[idx]->value.choice.SCell_ToBeSetup_List.list.size); + //idx =2 + idx=idx-4; + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + nRCellIdentity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.nRCellIdentity.size)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + pLMN_Identity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.pLMN_Identity.size)); + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupRequestIEs_t)); + } + DU_FREE(ueSetReq->protocolIEs.list.array,\ + elementCnt * sizeof(UEContextSetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + /*SRBs To Be Setup List*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SRBs_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; + srbCnt = 1; + ret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.SRBs_ToBeSetup_List); + if(ret != ROK) + {//idx =7 + for(srbId=0; srbIdprotocolIEs.list.array[idx]->value.choice.\ + SRBs_ToBeSetup_List.list.array[srbId],\ + sizeof(struct SRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + SRBs_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[idx]->value.choice.SRBs_ToBeSetup_List.list.size); + //idx=6 + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.buf,\ + ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.size); + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.buf,\ + ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.size); + for(spId=0; spIdprotocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[spId],sizeof(struct + SCell_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[--idx]->value.choice.SCell_ToBeSetup_List.list.size); + //idx=2 + idx=idx-4; + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + nRCellIdentity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.nRCellIdentity.size)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + pLMN_Identity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.pLMN_Identity.size)); + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupRequestIEs_t)); + } + DU_FREE(ueSetReq->protocolIEs.list.array,\ + elementCnt * sizeof(UEContextSetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + /*DRBs to Be Setup List*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_DRBs_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; + drbCnt = 1; + flowCnt = 1; + ulCnt = 1; + ret = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.DRBs_ToBeSetup_List); + if(ret != ROK) + { //idx=8 + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.uLConfiguration,\ + sizeof(struct ULConfiguration)); + ulidx=0; + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.uLUPTNLInformation_ToBeSetup_List.list.\ + array[ulidx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(struct GTPTunnel)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.uLUPTNLInformation_ToBeSetup_List.list.\ + array,ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.uLUPTNLInformation_ToBeSetup_List.list.size); + for(ulidx=0; ulidxprotocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.uLUPTNLInformation_ToBeSetup_List.list.\ + array[ulidx],sizeof(struct ULUPTNLInformation_ToBeSetup_Item)); + } + flowidx = 0; + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array[idx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array[idx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array,ueSetReq->protocolIEs.list.\ + array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.size); + for(flowidx=0;flowidxprotocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(struct + Flows_Mapped_To_DRB_Item)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI.\ + sD->buf,ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI.\ + sD->size); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI.\ + sD,sizeof(OCTET_STRING_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI.\ + sST.buf,ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI.\ + sST.size); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI,\ + sizeof(NonDynamic5QIDescriptor_t)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[0]->value.choice.\ + DRBs_ToBeSetup_Item.qoSInformation.choice.\ + choice_extension,sizeof(struct QoSInformation_ExtIEs)); + for(drbId=0; drbIdprotocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array[drbId],\ + sizeof(struct DRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.\ + DRBs_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[idx]->value.choice.DRBs_ToBeSetup_List.list.size); + //idx=7 + for(srbId=0; srbIdprotocolIEs.list.array[--idx]->value.choice.\ + SRBs_ToBeSetup_List.list.array[srbId],\ + sizeof(struct SRBs_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SRBs_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[--idx]->value.choice.SRBs_ToBeSetup_List.list.size); + //idx=6 + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.buf,\ + ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.nRCellIdentity.size); + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.buf,\ + ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[0]->value.choice.\ + SCell_ToBeSetup_Item.sCell_ID.pLMN_Identity.size); + for(spId=0; spIdprotocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array[spId],sizeof(struct + SCell_ToBeSetup_ItemIEs)); + } + DU_FREE(ueSetReq->protocolIEs.list.array[--idx]->value.choice.\ + SCell_ToBeSetup_List.list.array,ueSetReq->protocolIEs.list.\ + array[--idx]->value.choice.SCell_ToBeSetup_List.list.size); + //idx =2 + idx = idx-4; + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + nRCellIdentity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.nRCellIdentity.size)); + DU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI.\ + pLMN_Identity.buf,sizeof(ueSetReq->protocolIEs.list.array[idx]->value.\ + choice.NRCGI.pLMN_Identity.size)); + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupRequestIEs_t)); + } + DU_FREE(ueSetReq->protocolIEs.list.array,\ + elementCnt * sizeof(UEContextSetupRequestIEs_t *)); + DU_FREE(f1apMsg->choice.initiatingMessage,\ + sizeof(InitiatingMessage_t)); + DU_FREE(f1apMsg,sizeof(F1AP_PDU_t)); + RETVALUE(RFAILED); + } + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\ + encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + RETVALUE(RFAILED); + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending UE Context Setup Request Failed"); + RETVALUE(RFAILED); + } + + RETVALUE(ROK); +}/* End of BuildAndSendUESetReq*/ + +/******************************************************************* +* +* @brief Handles received F1AP message and sends back response +* +* @details +* +* Function : F1APMsgHdlr +* +* Functionality: +* - Decodes received F1AP control message +* - Prepares response message, encodes and sends to SCTP +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void F1APMsgHdlr(Buffer *mBuf) +{ + int i; + char *recvBuf; + MsgLen copyCnt; + MsgLen recvBufLen; + F1AP_PDU_t *f1apMsg; + asn_dec_rval_t rval; /* Decoder return value */ + F1AP_PDU_t f1apasnmsg ; + + DU_LOG("\nF1AP : Received F1AP message buffer"); + SPrntMsg(mBuf, 0,0); + + /* Copy mBuf into char array to decode it */ + SFndLenMsg(mBuf, &recvBufLen); + if(SGetSBuf(DFLT_REGION, DFLT_POOL, (Data **)&recvBuf, (Size)recvBufLen) != ROK) + { + DU_LOG("\nF1AP : Memory allocation failed"); + return; + } + if(SCpyMsgFix(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK) + { + DU_LOG("\nF1AP : Failed while copying %d", copyCnt); + return; + } + + printf("\nF1AP : Received flat buffer to be decoded : "); + for(i=0; i< recvBufLen; i++) + { + printf("%x",recvBuf[i]); + } + + /* Decoding flat buffer into F1AP messsage */ + f1apMsg = &f1apasnmsg; + memset(f1apMsg, 0, sizeof(F1AP_PDU_t)); + + rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0); + SPutSBuf(DFLT_REGION, DFLT_POOL, (Data *)recvBuf, (Size)recvBufLen); + if(rval.code == RC_FAIL || rval.code == RC_WMORE) + { + DU_LOG("\nF1AP : ASN decode failed"); + return; + } + printf("\n"); + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + switch(f1apMsg->present) + { + case F1AP_PDU_PR_successfulOutcome: + { + switch(f1apMsg->choice.successfulOutcome->value.present) + { + case SuccessfulOutcome__value_PR_F1SetupResponse: + { +#ifndef ODU_TEST_STUB + procF1SetupRsp(f1apMsg); +#endif + break; + } + + case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: + { + procGNBDUCfgUpdAck(f1apMsg); + break; + } + + default: + { + DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present); + return; + } + }/* End of switch(successfulOutcome) */ + break; + } + + default: + { + DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); + return; + } + + }/* End of switch(f1apMsg->present) */ + +} /* End of F1APMsgHdlr */ + +/******************************************************************* + * + * @brief Processes GNB DU config update ack + * + * @details + * + * Function : procGNBDUCfgUpdAck + * + * Functionality: Processes GNB DU config update ack + * + * @params[in] F1AP_PDU_t ASN decoded F1AP message + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg) +{ + F1GnbDuCfgUpdAck duCfgUpdAckDb; + GNBDUConfigurationUpdateAcknowledge_t *gnbDuCfgUpdAckMsg; + + + DU_LOG("\nF1AP : GNB-DU config update acknowledgment received"); + + /* Store the received info in local database */ + gnbDuCfgUpdAckMsg = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; + duCfgUpdAckDb.transId = gnbDuCfgUpdAckMsg->protocolIEs.list.array[0]->value.choice.TransactionID; + + /* TODO :Check the deallocation */ +#if 0 + SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(gNBDuCfgAck->protocolIEs.list.array),\ + (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *)); + SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\ + (Size)sizeof(SuccessfulOutcome_t)); + SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); +#endif + + RETVALUE(ROK); +} + +/********************************************************************** + End of file + **********************************************************************/ diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h new file mode 100644 index 000000000..96cbeb1af --- /dev/null +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -0,0 +1,69 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # +# # +# 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. # +################################################################################ +*******************************************************************************/ + +/* This file contains all F1AP message handler related functionality */ +#include +#include +#include +#include +#include "ProtocolExtensionField.h" +#include "F1AP-PDU.h" +#include "Cells-to-be-Activated-List.h" + +#include "envopt.h" /* Environment options */ +#include "envdep.h" /* Environment dependent */ +#include "envind.h" /* Environment independent */ +#include "gen.h" /* General */ +#include "ssi.h" /* System services */ +#include "ss_queue.h" +#include "ss_task.h" +#include "ss_msg.h" + +#include "gen.x" /* General */ +#include "ssi.x" /* System services */ +#include "ss_queue.x" +#include "ss_task.x" +#include "ss_msg.x" + +#include "du_log.h" + +#define ENCODE_FAIL -1 +#define TRANS_ID 1 +#define RRC_SIZE 1 +#define ENC_BUF_MAX_LEN 100 +#define SUL_BAND_COUNT 0 +#define UL_SRBID 1 +#define DL_SRBID 0 +#define DU_ID 1 +#define CU_ID 1 +#define CRNTI 17017 +#define CELL_INDEX 0 + + + + +extern char encBuf[ENC_BUF_MAX_LEN]; +int encBufSize; + +void F1APMsgHdlr(Buffer *mBuf); +S16 BuildAndSendF1SetupReq(); +S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg); + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 8e5c68ca7..008079714 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -36,8 +36,9 @@ #include "cm_inet.h" #include "lkw.h" #include "lrg.h" +#include "legtp.h" -#include "du_common.h" +/*#include "du_cfg_hdl.h"*/ #include "gen.x" /* General */ #include "ssi.x" /* System services */ @@ -55,7 +56,7 @@ #define DU_PROC 0 /* Memory related configs */ -#define DU_APP_MEM_REGION 1 +#define DU_APP_MEM_REGION 0 #define RLC_UL_MEM_REGION 1 #define RLC_DL_MEM_REGION 4 #define RG_MEM_REGION 4 @@ -66,9 +67,14 @@ /* Events */ #define EVTCFG 0 -#define EVTSCTPSTRT 1 -#define EVTSCTPDATA 2 -#define EVTSCTPNTFY 3 +#define EVTSCTPSTRT 1 +#define EVTSCTPDATA 2 +#define EVTSCTPNTFY 3 +#define EVTSRVOPENREQ 4 +#define EVTSRVOPENCFM 5 +#define EVTTNLMGMTREQ 6 +#define EVTTNLMGMTCFM 7 +#define EVTTTIIND 8 /* Selector */ #define DU_SELECTOR_LC 0 @@ -76,17 +82,26 @@ #define DU_SELECTOR_LWLC 2 /* SAP IDs */ -#define DU_RG_SUID 0 -#define DU_RG_SPID 0 +#define DU_MAC_SUID 0 +#define DU_MAC_SPID 0 /* Instance */ #define RLC_UL_INST 0 #define RLC_DL_INST 1 +/* SAP state */ +#define DU_SAP_UNBOUND 1 +#define DU_SAP_BINDING 2 +#define DU_SAP_BOUND 3 + #define DU_ZERO_VAL 0 /* Macros */ #define DEFAULT_CELLS 1 +#define NR_RANAC 150 + +#define ADD 0 +#define DEL 1 #define RLC_GEN_CFG 1 #define RLC_MAC_SAP_CFG 2 @@ -105,18 +120,66 @@ #define DU_SET_ZERO(_buf, _size) \ cmMemset((U8 *)(_buf), 0, _size); +/* allocate and zero out a static buffer */ +#define DU_ALLOC(_datPtr, _size) \ +{ \ + S16 _ret; \ + _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \ + (Data **)&_datPtr, _size); \ + if(_ret == ROK) \ + cmMemset((U8*)_datPtr, 0, _size); \ + else \ + _datPtr = NULLP; \ +} + +/* free a static buffer */ +#define DU_FREE(_datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \ + (Data *)_datPtr, _size); + +typedef enum +{ + OOS, + ACTIVATION_IN_PROGRESS, + ACTIVATED, + DELETION_IN_PROGRESS +}CellStatus; + +#if 0 +typedef struct duCellCb +{ + U32 cellId; /* Internal cell Id */ + CellCfgParams cellInfo; /* Cell info */ + CellStatus cellStatus; /*Cell status */ +}DuCellCb; +#endif + +typedef struct duLSapCb +{ + Pst pst; + SuId suId; + SpId spId; + State sapState; + Mem mem; + CmTimer timer; + U8 bndRetryCnt; + U8 maxBndRetry; + TmrCfg bndTmr; +}DuLSapCb; /* DU APP DB */ typedef struct duCb { - Mem mem; - TskInit init; - Bool sctpStatus; - Bool f1Status; - Bool duStatus; - + Mem mem; /* Memory configs */ + TskInit init; /* DU Init */ + //DuLSapCb **macSap; /* MAC SAP */ + Bool f1Status; /* Status of F1 connection */ + CmHashListCp cellLst; /* List of cells at DU APP of type DuCellCb */ + CmHashListCp actvCellLst; /* List of cells activated/to be activated of type DuCellCb */ }DuCb; + typedef struct duLSapCfg { SuId suId; @@ -137,7 +200,7 @@ typedef struct duLSapCfg /* global variables */ DuCb duCb; -DuCfgParams duCfgParam; +//DuCfgParams duCfgParam; /* DU Cell Functions */ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason); @@ -156,8 +219,20 @@ S16 duBuildMacGenCfg(); S16 duBuildMacUsapCfg(SpId sapId); S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm); S16 duBindUnbindRlcToMacSap(U8 inst, U8 action); +S16 duProcCfgComplete(); +S16 duSendSchCfg(); S16 duSctpStartReq(); S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy); + +S16 duBuildEgtpCfgReq(); +S16 duHdlEgtpCfgComplete(CmStatus cfm); +S16 duSendEgtpSrvOpenReq(); +S16 duHdlEgtpSrvOpenComplete(CmStatus cfm); +S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid); +S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm); +S16 duSendEgtpDatInd(); +S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm); + #endif /********************************************************************** diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 44a83ccfc..ce4895b39 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -16,10 +16,12 @@ ################################################################################ *******************************************************************************/ -/* This file contains message handling functionality for DU cell management */ +/* This file contains message handling functionality for DU APP */ #include "du_sctp.h" -#include "f1ap_msg_hdl.h" +#include "du_f1ap_msg_hdl.h" +#include "lsctp.h" +#include "legtp.h" extern S16 cmUnpkLkwCfgCfm(LkwCfgCfm func,Pst *pst, Buffer *mBuf); extern S16 cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf); @@ -60,9 +62,29 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason) duCb.mem.region = DFLT_REGION; duCb.mem.pool = DU_POOL; - duCb.sctpStatus = FALSE; duCb.f1Status = FALSE; - duCb.duStatus = FALSE; + + if(ROK != cmHashListInit(&(duCb.cellLst), + (U16) DU_MAX_CELLS, + (U16) 0, + (Bool) FALSE, + (U16) CM_HASH_KEYTYPE_CONID, + 0, + 0)) + { + DU_LOG("\nDU_APP : cellLst Initialization Failed"); + } + + if(ROK != cmHashListInit(&(duCb.actvCellLst), + (U16) DU_MAX_CELLS, + (U16) 0, + (Bool) FALSE, + (U16) CM_HASH_KEYTYPE_CONID, + 0, + 0)) + { + DU_LOG("\nDU_APP : ActvCellLst Initialization Failed"); + } SSetProcId(DU_PROC); @@ -102,13 +124,14 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) { case EVTCFG: { - duSendRlcUlCfg(); + DU_LOG("\n****** Received initial configs at DU APP ******\n"); + duProcCfgComplete(); SPutMsg(mBuf); break; } default: { - printf("\nInvalid event received at duActvTsk from ENTDUAPP"); + DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP"); SPutMsg(mBuf); ret = RFAILED; } @@ -136,7 +159,7 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) } default: { - printf("\nInvalid event %d received at duActvTsk from ENTKW", \ + DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTKW", \ pst->event); SPutMsg(mBuf); ret = RFAILED; @@ -163,9 +186,15 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) { break; } + case EVTMACSCHGENCFGCFM: + { + ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf); + break; + } + default: { - printf("\nInvalid event received at duActvTsk from ENTRG"); + DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG"); SPutMsg(mBuf); ret = RFAILED; } @@ -179,27 +208,55 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) { case EVTSCTPDATA: { - F1InmsgHdlr(mBuf); + F1APMsgHdlr(mBuf); break; } case EVTSCTPNTFY: - { - ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf); - break; - } + { + ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf); + break; + } default: - { - printf("\nInvalid event received at duActvTsk from ENTRG"); - ret = RFAILED; - } + { + DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTSCTP"); + ret = RFAILED; + } } SPutMsg(mBuf); break; } + case ENTEGTP: + { + switch(pst->event) + { + case EVTCFGCFM: + { + cmUnpkEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf); + break; + } + case EVTSRVOPENCFM: + { + cmUnpkEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf); + break; + } + case EVTTNLMGMTCFM: + { + cmUnpkEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf); + break; + } + default: + { + DU_LOG("\nDU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event); + ret = RFAILED; + } + } + SPutMsg(mBuf); + break; + } default: { - printf("\n DU APP can not process message from Entity %d", pst->srcEnt); + DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt); SPutMsg(mBuf); ret = RFAILED; } diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index ceca4ebde..a9a55ab9f 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -20,6 +20,8 @@ #include "du_mgr_main.h" #include "du_sctp.h" +#include "du_egtp.h" + extern S16 kwUlActvTsk (Pst *, Buffer *); extern S16 kwUlActvInit (Ent, Inst, Region, Reason); @@ -28,6 +30,9 @@ extern S16 kwDlActvInit (Ent, Inst, Region, Reason); extern S16 rgActvTsk (Pst *, Buffer *); extern S16 rgActvInit (Ent, Inst, Region, Reason); +/* Global variable */ +DuCfgParams duCfgParam; + /******************************************************************* * * @brief Initializes DU APP @@ -47,8 +52,8 @@ extern S16 rgActvInit (Ent, Inst, Region, Reason); * ****************************************************************/ S16 duAppInit(SSTskId sysTskId) { - /* Register DU APP TAPA Task for DU */ - if(SRegTTsk((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, + /* Register DU APP TAPA Task for DU */ + if(SRegTTsk((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, duActvInit, (ActvTsk)duActvTsk) != ROK) { return RFAILED; @@ -59,10 +64,48 @@ S16 duAppInit(SSTskId sysTskId) return RFAILED; } - printf("\nDU APP created and registered \ - to %d sys task\n", sysTskId); + DU_LOG("\nDU_APP : DU APP created and registered \ + to %d sys task", sysTskId); return ROK; } + +/******************************************************************* + * + * @brief Initializes EGTP + * + * @details + * + * Function : egtpInit + * + * Functionality: + * - Registers and attaches TAPA tasks belonging to + * DU_APP sys task + * + * @params[in] system task ID + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 egtpInit(SSTskId sysTskId) +{ + /* Register DU APP TAPA Task for DU */ + if(SRegTTsk((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0, + egtpActvInit, (ActvTsk)egtpActvTsk) != ROK) + { + return RFAILED; + } + /* Attach DU APP TAPA Task for DU */ + if (SAttachTTsk((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK) + { + return RFAILED; + } + + DU_LOG("\nDU_APP : EGTP created and registered \ + to %d sys task", sysTskId); + return ROK; +} + + /******************************************************************* * * @brief Initializes SCTP task @@ -93,7 +136,7 @@ S16 sctpInit(SSTskId sysTskId) return RFAILED; } - printf("\nSCTP TAPA task created and registered to %d sys task\n", + DU_LOG("\nDU_APP : SCTP TAPA task created and registered to %d sys task", sysTskId); return ROK; } @@ -139,8 +182,8 @@ S16 rlcDlInit(SSTskId sysTskId) return RFAILED; } - printf("\nRLC DL and MAC TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nDU_APP : RLC DL and MAC TAPA task created and registered to \ + %d sys task", sysTskId); return ROK; } @@ -173,8 +216,8 @@ S16 rlcUlInit(SSTskId sysTskId) { return RFAILED; } - printf("\nRLC UL TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nDU_APP : RLC UL TAPA task created and registered to \ + %d sys task", sysTskId); return ROK; } @@ -220,25 +263,31 @@ S16 commonInit() /* Create TAPA tasks */ if(duAppInit(du_app_stsk) != ROK) { - printf("\nDU APP TAPA Task initialization failed"); + DU_LOG("\nDU_APP : DU APP TAPA Task initialization failed"); + return RFAILED; + } + + if(egtpInit(du_app_stsk) != ROK) + { + DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed"); return RFAILED; } if(sctpInit(sctp_stsk) != ROK) { - printf("\nSCTP TAPA Task initialization failed"); + DU_LOG("\nDU_APP : SCTP TAPA Task initialization failed"); return RFAILED; } if(rlcDlInit(rlc_mac_cl_stsk) != ROK) { - printf("\nRLC DL Tapa Task initialization failed"); + DU_LOG("\nDU_APP : RLC DL Tapa Task initialization failed"); return RFAILED; } if(rlcUlInit(rlc_ul_stsk) != ROK) { - printf("\nRLC UL Tapa Task initialization failed"); + DU_LOG("\nDU_APP : RLC UL Tapa Task initialization failed"); return RFAILED; } return ROK; @@ -272,6 +321,10 @@ S16 duInit() return ret; } +void init_log() +{ + openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); +} /******************************************************************* * * @brief Entry point for the DU APP @@ -291,24 +344,18 @@ S16 duInit() * ****************************************************************/ S16 tst(void) { + init_log(); - //Initialize TAPA layers - if(duInit() != ROK) - { + //Initialize TAPA layers + if(duInit() != ROK) + { return RFAILED; } + //Read all the configs from du_utils.c into duCfgParams duReadCfg(); -#if 0 - //Establish SCTP connection - while(ret == -1) - { - printf("\nEstablishing SCTP link with CU... \n"); - //ret = establishSctp(); //To be implemeted in du_sctp.c - } -#endif return ROK; }/* end of main()*/ diff --git a/src/du_app/du_mgr_main.h b/src/du_app/du_mgr_main.h index 6ed9a214a..d3c5c27e7 100644 --- a/src/du_app/du_mgr_main.h +++ b/src/du_app/du_mgr_main.h @@ -20,12 +20,9 @@ #define __DU_MGR_MAIN_H__ #include "du_mgr.h" +#include "du_log.h" /* Function declarations */ -S16 duReadCfg(); -S16 readCfg(); -S16 readClCfg(); -void fillSlotConfig(); S16 duAppInit(SSTskId sysTskId); S16 sctpInit(SSTskId sysTskId); S16 rlcDlInit(SSTskId sysTskId); diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 2bc0f6f45..7a35a6859 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -19,7 +19,10 @@ /* This file contains message handling functionality for DU cell management */ #include "du_sctp.h" -#include "f1ap_msg_hdl.h" +#include "du_f1ap_msg_hdl.h" +#include "lsctp.h" +#include "legtp.h" +#include "lphy_stub.h" U8 rlcDlCfg = 0; U8 numRlcDlSaps = 0; @@ -28,6 +31,8 @@ U8 numRlcMacSaps = 0; U8 macCfg = 0; U8 macCfgInst = 0; +extern DuCfgParams duCfgParam;; + extern S16 cmPkLkwCfgReq(Pst *pst, KwMngmt *cfg); extern S16 cmPkLkwCntrlReq(Pst *pst, KwMngmt *cfg); extern S16 cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg); @@ -107,7 +112,7 @@ S16 duBuildRlcCfg(Inst inst) pst.srcProcId = DU_PROC; pst.region = duCb.init.region; - printf("\nRLC Gen Cfg Req sent for inst %d", inst); + DU_LOG("\nDU_APP : RLC Gen Cfg Req sent for inst %d", inst); /* Send the request to RLC */ cmPkLkwCfgReq(&pst, &kwMngmt); @@ -173,7 +178,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst) lSap->sapId = lsapInst; /* SapId will be stored as suId in MAC */ lSap->selector = (inst == RLC_UL_INST) ? DU_SELECTOR_LWLC : DU_SELECTOR_TC; kwMngmt.hdr.elmId.elmnt = STRGUSAP; - printf("\nRLC MAC Lower Sap Cfg Req sent for inst %d", inst); + DU_LOG("\nDU_APP : RLC MAC Lower Sap Cfg Req sent for inst %d", inst); } else @@ -185,7 +190,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst) lSap->sapId = 0; lSap->selector = DU_SELECTOR_LC; kwMngmt.hdr.elmId.elmnt = STUDXSAP; - printf("\nRLC DL/UL Lower Sap Cfg Req sent for inst %d", inst); + DU_LOG("\nDU_APP : RLC DL/UL Lower Sap Cfg Req sent for inst %d", inst); } cmPkLkwCfgReq(&pst, &kwMngmt); @@ -252,11 +257,72 @@ S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst) pst.srcProcId = DU_PROC; pst.region = duCb.init.region; - printf("\nRLC Kwu Upper Sap Cfg Req sent for inst %d", inst); + DU_LOG("\nDU_APP : RLC Kwu Upper Sap Cfg Req sent for inst %d", inst); cmPkLkwCfgReq(&pst, &kwMngmt); return ROK; } + +/************************************************************************** + * @brief Function to populate internal DS of DU APP + * + * @details + * + * Function : duProcCfgComplete + * + * Functionality: + * Populates internal data structures of DU APP after + * receiving configurations. + * + * @param[in] void + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 duProcCfgComplete() +{ + S16 ret = ROK; + static U16 cellId = 0; + U16 idx; + for(idx=0; idx< DEFAULT_CELLS; idx++) //TODO: the length of this loop must be determined + { + DuCellCb *cell; + DU_ALLOC(cell, sizeof(DuCellCb)) + if(cell == NULLP) + { + DU_LOG("\nDU_APP : Memory Allocation failed in duProcCfgComplete"); + ret = RFAILED; + } + else + { + U16 nci; + + cell->cellId = cellId++; + memcpy((void*)&cell->cellInfo, (void*)&duCfgParam.cellCfg[idx],\ + sizeof(CellCfgParams)); + cell->cellStatus = OOS; + nci = cell->cellInfo.nrEcgi.cellId; + ret = cmHashListInsert(&(duCb.cellLst), (PTR)(cell), + (U8 *)&(nci), (U16) sizeof(nci)); + + if(ret != ROK) + { + DU_LOG("\nDU_APP : HashListInsert into cellLst failed for [%d]", nci); + break; + } + else + { + DU_LOG("\nDU_APP : HashListInsert into cellLst successful for [%d]", nci); + } + } + } + if(ret != RFAILED) + { + //Start layer configs + ret = duSendRlcUlCfg(); + } + return ret; +} /************************************************************************** * @brief Function to invoke DU Layer Configs * @@ -372,7 +438,7 @@ S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cntrl) { if (pst->srcInst == RLC_DL_INST) { - printf("\nBIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL"); + DU_LOG("\nDU_APP : BIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL"); macCfgInst++; if(macCfgInst < DEFAULT_CELLS) { @@ -386,7 +452,7 @@ S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cntrl) } else { - printf("\nBIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL"); + DU_LOG("\nDU_APP : BIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL"); macCfgInst++; if(macCfgInst < DEFAULT_CELLS) { @@ -394,9 +460,8 @@ S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cntrl) } else { - duSctpStartReq(); + duSendSchCfg(); } - break; } } @@ -425,7 +490,7 @@ S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm) { S16 ret; - printf("\nRLC UL Cfg Status %d", cfm->cfm.status); + DU_LOG("\nDU_APP : RLC UL Cfg Status %d", cfm->cfm.status); if (cfm->cfm.status == LCM_PRIM_OK) { switch(cfm->hdr.elmId.elmnt) @@ -454,7 +519,7 @@ S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm) default: break; } - printf("\n RLC UL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); + DU_LOG("\nDU_APP : RLC UL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); if(rlcUlCfg == DU_RLC_UL_CONFIGURED) { rlcUlCfg = 0; @@ -466,7 +531,7 @@ S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm) } else { - printf("\nConfig confirm NOK from RLC UL"); + DU_LOG("\nDU_APP : Config confirm NOK from RLC UL"); ret = RFAILED; } return ret; @@ -490,7 +555,7 @@ S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm) ***************************************************************************/ S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm) { - printf("\nRLC DL Cfg Status %d", cfm->cfm.status); + DU_LOG("\nDU_APP : RLC DL Cfg Status %d", cfm->cfm.status); if (cfm->cfm.status == LCM_PRIM_OK) { switch(cfm->hdr.elmId.elmnt) @@ -520,7 +585,7 @@ S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm) break; } - printf("\n RLC DL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); + DU_LOG("\nDU_APP : RLC DL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); if(rlcDlCfg == DU_RLC_DL_CONFIGURED) { rlcDlCfg = 0; @@ -531,7 +596,7 @@ S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm) } else { - printf("\nConfig confirm NOK from RLC DL"); + DU_LOG("\nDU_APP : Config confirm NOK from RLC DL"); } return ROK; } @@ -629,7 +694,7 @@ S16 duBuildMacGenCfg() pst.srcProcId = DU_PROC; pst.region = duCb.init.region; - printf("\nMAC Gen Cfg Req sent"); + DU_LOG("\nDU_APP : MAC Gen Cfg Req sent"); /* Send the request to MAC */ cmPkLrgCfgReq(&pst, &rgMngmt); @@ -691,7 +756,7 @@ S16 duBuildMacUsapCfg(SpId sapId) pst.srcProcId = DU_PROC; pst.region = duCb.init.region; - printf("\nMAC Rgu USap Cfg Req sent"); + DU_LOG("\nDU_APP : MAC Rgu USap Cfg Req sent"); /* Send the request to MAC */ cmPkLrgCfgReq(&pst, &rgMngmt); @@ -737,11 +802,11 @@ S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm) default: break; } - printf("\n MAC Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); + DU_LOG("\nDU_APP : MAC Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt); if(macCfg == MAC_CONFIGURED && numRlcMacSaps == MAX_MAC_SAP) { macCfg = 0; - printf("\n Completed sending Configs"); + DU_LOG("\nDU_APP : Completed sending Configs"); macCfgInst = 0; duBindUnbindRlcToMacSap(RLC_DL_INST, ABND); } @@ -749,7 +814,7 @@ S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm) } else { - printf("\nConfig confirm NOK from MAC"); + DU_LOG("\nDU_APP : Config confirm NOK from MAC"); ret = RFAILED; } return ret; @@ -784,11 +849,11 @@ S16 duBindUnbindRlcToMacSap(U8 inst, U8 action) if (action == ABND) { - printf("\nCntrl Req to RLC inst %d to bind MAC sap", inst); + DU_LOG("\nDU_APP : Cntrl Req to RLC inst %d to bind MAC sap", inst); } else { - printf("\nCntrl Req to RLC inst %d to unbind MAC sap", inst); + DU_LOG("\nDU_APP : Cntrl Req to RLC inst %d to unbind MAC sap", inst); } cntrl = &(kwMngmt.t.cntrl); @@ -831,13 +896,13 @@ S16 duBindUnbindRlcToMacSap(U8 inst, U8 action) * Function to start SCTP * * @params[in] - * @return void + * @return ROK - success + * RFAILED - failure * * ****************************************************************/ S16 duSctpStartReq() { Pst pst; - Buffer *mBuf; cmMemset((U8 *)&(pst), 0, sizeof(Pst)); pst.srcEnt = (Ent)ENTDUAPP; @@ -849,12 +914,8 @@ S16 duSctpStartReq() pst.event = EVTSCTPSTRT; pst.selector = DU_SELECTOR_LC; pst.pool= DU_POOL; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) - { - printf("\nMemory allocation failed in duReadCfg"); - return RFAILED; - } - SPstTsk(&pst, mBuf); + + cmPkSctpAssocReq(&pst, duCfgParam.sctpParams); RETVALUE(ROK); } @@ -880,9 +941,6 @@ S16 duSctpStartReq() S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy) { - char *finalBuf; - int i,j; - switch(ntfy->header.nType) { case CM_INET_SCTP_ASSOC_CHANGE: @@ -890,42 +948,20 @@ S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy) { case CM_INET_SCTP_COMM_UP: { - printf("\nSCTP communication UP"); - duCb.sctpStatus = TRUE; + DU_LOG("\nDU_APP : SCTP communication UP"); //Setup F1-C if(!duCb.f1Status) { /* Build and send F1 Setup response */ - Buffer *f1SetupReq; - MsgLen copyCnt; - - BuildF1SetupReq(); - /* Reversing the encoded string */ - if(SGetSBuf(1, 1, (Data **)&finalBuf, (Size)encBufSize) != ROK) + if(BuildAndSendF1SetupReq() != ROK) { - printf("Memory allocation failed"); RETVALUE(RFAILED); } - for(i = 0, j = encBufSize-1; isrcEnt = (Ent)ENTDUAPP; + pst->srcInst = (Inst)DU_INST; + pst->srcProcId = DU_PROC; + pst->dstEnt = (Ent)ENTEGTP; + pst->dstInst = (Inst)EGTP_INST; + pst->dstProcId = pst->srcProcId; + pst->event = event; + pst->selector = DU_SELECTOR_LC; + pst->pool= DU_POOL; + + RETVALUE(ROK); +} + + +/******************************************************************* + * + * @brief Function to configure EGTP + * + * @details + * + * Function : duBuildEgtpCfgReq + * + * Functionality: + * Function to configure EGTP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 duBuildEgtpCfgReq() +{ + Pst pst; + EgtpConfig egtpCfg; + + DU_LOG("\nDU_APP : Sending EGTP config request"); + + cmMemset((U8 *)&egtpCfg, 0, sizeof(EgtpConfig)); + cmMemcpy((U8 *)&egtpCfg, (U8 *)&duCfgParam.egtpParams, (PTR)sizeof(EgtpConfig)); + + duFillEgtpPst(&pst, EVTCFGREQ); + cmPkEgtpCfgReq(&pst, egtpCfg); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Function to configure EGTP + * + * @details + * + * Function : duBuildEgtpCfgReq + * + * Functionality: + * Function to configure EGTP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 duHdlEgtpCfgComplete(CmStatus cfm) +{ + S16 ret = ROK; + + if(cfm.status == LCM_PRIM_OK) + { + DU_LOG("\nDU_APP : EGTP configuraton complete"); +#ifdef EGTP_TEST + duSendEgtpSrvOpenReq(); +#endif + } + else + { + DU_LOG("\nDU_APP : EGTP configuraton failed"); + ret = RFAILED; + } + + RETVALUE(ret); +} + +/******************************************************************* + * + * @brief Sends server open request to EGTP + * + * @details + * + * Function : duSendEgtpSrvOpenReq + * + * Functionality: + * Sends server open request to EGTP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 duSendEgtpSrvOpenReq() +{ + Pst pst; + + DU_LOG("\nDU_APP : Sending EGTP server open request"); + + duFillEgtpPst(&pst, EVTSRVOPENREQ); + cmPkEgtpSrvOpenReq(&pst); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Handles server open confirmation + * + * @details + * + * Function : duHdlEgtpSrvOpenComplete + * + * Functionality: + * Handles server open confirmation + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + +S16 duHdlEgtpSrvOpenComplete(CmStatus cfm) +{ + S16 ret = ROK; + + if(cfm.status == LCM_PRIM_OK) + { + DU_LOG("\nDU_APP : EGTP server opened successfully"); +#ifdef EGTP_TEST + duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, EGTP_LCL_TEID, EGTP_REM_TEID); +#endif + } + else + { + DU_LOG("\nDU_APP : EGTP server opening failed"); + ret = RFAILED; + } + + RETVALUE(ret); +} + +/******************************************************************* + * + * @brief Sends tunnel management request + * + * @details + * + * Function : duSendEgtpTnlMgmtReq + * + * Functionality: + * Builds and sends tunnel management request to EGTP + * + * @params[in] Action + * Local tunnel endpoint id + * Remote tunnel endpoint id + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid) +{ + Pst pst; + EgtpTnlEvt tnlEvt; + + tnlEvt.action = action; + tnlEvt.lclTeid = lclTeid; + tnlEvt.remTeid = remTeid; + + DU_LOG("\nDU_APP : Sending EGTP tunnel management request"); + + duFillEgtpPst(&pst, EVTTNLMGMTREQ); + cmPkEgtpTnlMgmtReq(&pst, tnlEvt); + + RETVALUE(ROK); +} + +/******************************************************************* + * + * @brief Handles Tunnel management confirm + * + * @details + * + * Function : duHdlEgtpTnlMgmtCfm + * + * Functionality: + * Handles tunnel management confirm received from Egtp + * + * @params[in] Tunnel Event + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm) +{ + S16 ret = ROK; + + if(tnlEvtCfm.cfmStatus.status == LCM_PRIM_OK) + { + DU_LOG("\nDU_APP : Tunnel management confirm OK"); + +#ifdef EGTP_TEST + duSendEgtpDatInd(); + + /* For testing purpose. TTI thread should actually be in L1 */ + duStartTtiThread(); +#endif + } + else + { + DU_LOG("\nDU_APP : Tunnel management failed"); + ret = RFAILED; + } + + RETVALUE(ret); +} + +#ifdef EGTP_TEST +/******************************************************************* + * + * @brief Simulate RLC to EGTP data indication + * + * @details + * + * Function : duSendEgtpDatInd + * + * Functionality: + * Simulate RLC to EGTP data indication + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 duSendEgtpDatInd() +{ + char data[30] = "This is EGTP data from DU"; + int datSize = 30; + + Buffer *mBuf; + EgtpMsg egtpMsg; + + if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK) + { + if(SAddPstMsgMult((Data *)data, datSize, mBuf) == ROK) + { + SPrntMsg(mBuf, 0,0); + } + else + { + DU_LOG("\nDU_APP : SAddPstMsgMult failed"); + SPutMsg(mBuf); + RETVALUE(RFAILED); + } + } + else + { + DU_LOG("\nDU_APP : Failed to allocate memory"); + RETVALUE(RFAILED); + } + + /* filling IPv4 header */ + CmIpv4Hdr ipv4Hdr; + MsgLen mLen; + + mLen = 0; + SFndLenMsg(mBuf, &mLen); + + cmMemset((U8 *)&ipv4Hdr, 0, sizeof(CmIpv4Hdr)); + ipv4Hdr.length = CM_IPV4_HDRLEN + mLen; + ipv4Hdr.hdrVer = 0x45; + ipv4Hdr.proto = 1; + ipv4Hdr.srcAddr = CM_INET_NTOH_U32(duCfgParam.egtpParams.localIp.ipV4Addr); + ipv4Hdr.destAddr = CM_INET_NTOH_U32(duCfgParam.egtpParams.destIp.ipV4Addr); + + /* Packing IPv4 header into buffer */ + S16 ret, cnt, idx; + Data revPkArray[CM_IPV4_HDRLEN]; + Data pkArray[CM_IPV4_HDRLEN]; + + /* initialize locals */ + cnt = 0; + cmMemset(revPkArray, 0, CM_IPV4_HDRLEN); + cmMemset(pkArray, 0, CM_IPV4_HDRLEN); + + /* Pack Header Version */ + pkArray[cnt++] = ipv4Hdr.hdrVer; + + /* Pack TOS */ + pkArray[cnt++] = ipv4Hdr.tos; + + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.length); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.length); + + /* Pack Id */ + pkArray[cnt++] = (Data) GetHiByte(ipv4Hdr.id); + pkArray[cnt++] = (Data) GetLoByte(ipv4Hdr.id); + + /* Pack Offset */ + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.off); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.off); + + /* Pack TTL */ + pkArray[cnt++] = ipv4Hdr.ttl; + + /* Pack Protocol */ + pkArray[cnt++] = ipv4Hdr.proto; + + /* Pack Checksum */ + pkArray[cnt++] = (Data)GetHiByte(ipv4Hdr.chkSum); + pkArray[cnt++] = (Data)GetLoByte(ipv4Hdr.chkSum); + + /* Pack Source Address */ + pkArray[cnt++] = (Data)GetHiByte(GetHiWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetHiWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetHiByte(GetLoWord(ipv4Hdr.srcAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetLoWord(ipv4Hdr.srcAddr)); + + /* Pack Destination Address */ + pkArray[cnt++] = (Data)GetHiByte(GetHiWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetHiWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetHiByte(GetLoWord(ipv4Hdr.destAddr)); + pkArray[cnt++] = (Data)GetLoByte(GetLoWord(ipv4Hdr.destAddr)); + + for (idx = 0; idx < CM_IPV4_HDRLEN; idx++) + revPkArray[idx] = pkArray[CM_IPV4_HDRLEN - idx -1]; + + /* this function automatically reverses revPkArray */ + ret = SAddPreMsgMult(revPkArray, (MsgLen)cnt, mBuf); + + + egtpMsg.msgHdr.msgType = EGTPU_MSG_GPDU; + egtpMsg.msgHdr.nPdu.pres = FALSE; + egtpMsg.msgHdr.seqNum.pres = FALSE; + egtpMsg.msgHdr.extHdr.udpPort.pres = FALSE; + egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE; + egtpMsg.msgHdr.teId = 1; + egtpMsg.msg = mBuf; + + SPrntMsg(mBuf, 0, 0); + + egtpHdlDatInd(egtpMsg); + + RETVALUE(ROK); +} +#endif /* EGTP_TEST */ + + +/************************************************************************** + * @brief Function to send configs to SCH + * + * @details + * + * Function : duSendSchCfg + * + * Functionality: + * Sends general config to Scheduler via MAC layer + * + * @param[in] void + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 duSendSchCfg() +{ + RgMngmt rgMngmt; + RgSchInstCfg *cfg = NULLP; + Pst pst; + + DU_SET_ZERO(&pst, sizeof(Pst)); + DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt)); + + cfg = &(rgMngmt.t.cfg.s.schInstCfg); + + /* Filling of Instance Id */ + cfg->instId = DEFAULT_CELLS + 1; + /* Filling of Gen config */ + cfg->genCfg.mem.region = RG_MEM_REGION; + cfg->genCfg.mem.pool = RG_POOL; + cfg->genCfg.tmrRes = 10; + +#ifdef LTE_ADV + cfg->genCfg.forceCntrlSrbBoOnPCel = FALSE; + cfg->genCfg.isSCellActDeactAlgoEnable = TRUE; +#endif/*LTE_ADV*/ + cfg->genCfg.startCellId = 1; + cfg->genCfg.lmPst.dstProcId = DU_PROC; + cfg->genCfg.lmPst.srcProcId = DU_PROC; + cfg->genCfg.lmPst.dstEnt = ENTDUAPP; + cfg->genCfg.lmPst.dstInst = DU_INST; + cfg->genCfg.lmPst.srcEnt = ENTRG; + cfg->genCfg.lmPst.srcInst = DEFAULT_CELLS + 1; + cfg->genCfg.lmPst.prior = PRIOR0; + cfg->genCfg.lmPst.route = RTESPEC; + cfg->genCfg.lmPst.region = RG_MEM_REGION; + cfg->genCfg.lmPst.pool = RG_POOL; + cfg->genCfg.lmPst.selector = DU_SELECTOR_LC; + + /* Fill Header */ + rgMngmt.hdr.msgType = TCFG; + rgMngmt.hdr.entId.ent = ENTRG; + rgMngmt.hdr.entId.inst = DU_INST; + rgMngmt.hdr.elmId.elmnt = STSCHINST; + rgMngmt.hdr.response.mem.region = RG_MEM_REGION; + rgMngmt.hdr.response.mem.pool = RG_POOL; + + /* Fill Pst */ + pst.selector = DU_SELECTOR_LC; + pst.srcEnt = ENTDUAPP; + pst.dstEnt = ENTRG; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.srcInst = DU_INST; + pst.dstInst = 0; + pst.region = duCb.init.region; + pst.event = (Event) EVTMACSCHGENCFGREQ; + + DU_LOG("\nDU_APP : MAC Sch Cfg sent"); + + /* Send the request to MAC */ + cmPkLrgSchCfgReq(&pst, &rgMngmt); + + return ROK; +} + +/************************************************************************** + * @brief Function to handle SCH Config Confirm from MAC + * + * @details + * + * Function : duHdlSchCfgComplete + * + * Functionality: + * Handles Scheduler Gen Config Confirm from MAC + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] RgMngmt *cfm, Unpacked primitive info received from MAC + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm) +{ + if (cfm->cfm.status == LCM_PRIM_OK) + { + switch (cfm->hdr.elmId.elmnt) + { + case STSCHINST: + { + DU_LOG("\nDU_APP : Received SCH CFG CFM at DU APP"); + break; + } + default: + break; + } + } + duSctpStartReq(); + + duBuildEgtpCfgReq(); + return ROK; +} + +/******************************************************************* + * + * @brief Handles TTI indication + * + * @details + * + * Function : duSendEgtpTTIInd + * + * Functionality: + * Handles TTI indication received from PHY + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 duSendEgtpTTIInd() +{ + Pst pst; + + duFillEgtpPst(&pst, EVTTTIIND); + cmPkEgtpTTIInd(&pst); + + RETVALUE(ROK); + +} /********************************************************************** - End of file -**********************************************************************/ + End of file + **********************************************************************/ diff --git a/src/du_app/du_sctp.c b/src/du_app/du_sctp.c index 8f56b77f0..0fbee10b5 100644 --- a/src/du_app/du_sctp.c +++ b/src/du_app/du_sctp.c @@ -20,20 +20,10 @@ #include #include "du_sctp.h" -#include "du_common.h" +#include "lsctp.h" /* Global variable declaration */ -CmInetFd sockFd; /* Socket file descriptor */ -U8 socket_type; /* Socket type */ -Bool nonblocking; /* Blocking/Non-blocking socket */ -Bool connUp; /* Is connection up */ -int assocId; /* Assoc Id of connected assoc */ - -CmInetNetAddrLst localAddrLst; -CmInetNetAddrLst remoteAddrLst; - -F1SctpParams *sctpCfg; /* SCTP configurations at DU */ -S16 sctpOutMsgSend(Buffer *mBuf); +F1SctpParams sctpCfg; /* SCTP configurations at DU */ /************************************************************************** * @brief Task Initiation callback function. @@ -57,11 +47,11 @@ S16 sctpOutMsgSend(Buffer *mBuf); ***************************************************************************/ S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason) { + DU_LOG("\n\nSCTP : Initializing"); SSetProcId(DU_PROC); connUp = FALSE; assocId = 0; nonblocking = FALSE; - sctpCfg = &(duCfgParam.sctpParams); return ROK; } @@ -95,6 +85,7 @@ S16 sctpActvTsk(Pst *pst, Buffer *mBuf) { case EVTSCTPSTRT: { + cmUnpkSctpAssocReq(mBuf); SPutMsg(mBuf); sctpAssocReq(); break; @@ -132,24 +123,24 @@ S16 openSctpEndp() socket_type = CM_INET_STREAM; do{ - ret = cmInetSocket(socket_type, &sockFd, IPPROTO_SCTP,(sctpCfg->duIpAddr.ipV4Pres ? CM_INET_IPV4_DOMAIN : CM_INET_IPV6_DOMAIN)); + ret = cmInetSocket(socket_type, &sockFd, IPPROTO_SCTP); if (ret != ROK) { numRetry++; if(numRetry >= MAX_RETRY) { - printf("\nAll attempts to open socket failed."); + DU_LOG("\nSCTP : All attempts to open socket failed."); /* Send indication to du_app */ RETVALUE(RFAILED); } else { - printf("\nRetrying socket opening"); + DU_LOG("\nSCTP : Retrying socket opening"); } } else { - printf("\nSocket[%d] opened successfully",sockFd.fd); + DU_LOG("\nSCTP : Socket[%d] open",sockFd.fd); break; } }while(numRetry < MAX_RETRY); @@ -182,15 +173,10 @@ S16 bindSctpEndp() /* Binding the socket with local address */ localAddrLst.count = 1; - if(sctpCfg->duIpAddr.ipV4Pres) + if(sctpCfg.duIpAddr.ipV4Pres) { localAddrLst.addrs[0].type = CM_INET_IPV4ADDR_TYPE; - localAddrLst.addrs[0].u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg->duIpAddr.ipV4Addr); - } - else if(sctpCfg->duIpAddr.ipV6Pres) - { - localAddrLst.addrs[0].type = CM_INET_IPV6ADDR_TYPE; - // CM_INET_COPY_IPV6ADDR(&(localAddrLst.addrs[0].u.ipv6NetAddr),&(sctpCfg->duIpAddr.ipV6Addr); + localAddrLst.addrs[0].u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg.duIpAddr.ipV4Addr); } else { @@ -199,25 +185,25 @@ S16 bindSctpEndp() } do{ - ret = cmInetSctpBindx(&sockFd, &localAddrLst, sctpCfg->duPort); + ret = cmInetSctpBindx(&sockFd, &localAddrLst, sctpCfg.duPort); if (ret != ROK) { numRetry++; if(numRetry >= MAX_RETRY) { - printf("\nAll attempts to bind socket failed."); + DU_LOG("\nSCTP : All attempts to bind socket failed."); cmInetClose(&sockFd); /* Send indication to du_app */ RETVALUE(RFAILED); } else { - printf("\nRetrying socket binding"); + DU_LOG("\nSCTP : Retrying socket binding"); } } else { - printf("\nSocket bind successful"); + DU_LOG("\nSCTP : Socket bind successful"); break; } }while(numRetry < MAX_RETRY); @@ -285,15 +271,10 @@ S16 sctpConnect() CmInetNetAddr primDstAddr; /* primary destination address */ /* Filling primary destination address */ - if(sctpCfg->cuIpAddr.ipV4Pres) + if(sctpCfg.cuIpAddr.ipV4Pres) { primDstAddr.type = CM_INET_IPV4ADDR_TYPE; - primDstAddr.u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg->cuIpAddr.ipV4Addr); - } - else if(sctpCfg->cuIpAddr.ipV6Pres) - { - primDstAddr.type = CM_INET_IPV6ADDR_TYPE; - //CM_INET_COPY_IPV6ADDR(&(primDstAddr.u.ipv6NetAddr),&(sctpCfg->cuIpAddr.ipV6Addr); + primDstAddr.u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg.cuIpAddr.ipV4Addr); } else { @@ -303,15 +284,10 @@ S16 sctpConnect() /* Filling destination address list */ remoteAddrLst.count = 1; - if(sctpCfg->cuIpAddr.ipV4Pres) + if(sctpCfg.cuIpAddr.ipV4Pres) { remoteAddrLst.addrs[0].type = CM_INET_IPV4ADDR_TYPE; - remoteAddrLst.addrs[0].u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg->cuIpAddr.ipV4Addr); - } - else if(sctpCfg->cuIpAddr.ipV6Pres) - { - remoteAddrLst.addrs[0].type = CM_INET_IPV6ADDR_TYPE; - //CM_INET_COPY_IPV6ADDR(&(remoteAddrLst.addrs[0].u.ipv6NetAddr),&(sctpCfg->cuIpAddr.ipV6Addr); + remoteAddrLst.addrs[0].u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg.cuIpAddr.ipV4Addr); } else { @@ -321,31 +297,31 @@ S16 sctpConnect() /* Sending connect request to remote */ do{ - ret = cmInetSctpConnectx(&sockFd, &primDstAddr, &remoteAddrLst, sctpCfg->cuPort); + ret = cmInetSctpConnectx(&sockFd, &primDstAddr, &remoteAddrLst, sctpCfg.cuPort); if (ret == RFAILED || ret == ROKDNA || ret == RCLOSED) { numRetry++; if(numRetry >= MAX_RETRY) { - printf("\nAll attempts to connect failed."); + DU_LOG("\nSCTP : All attempts to connect failed."); cmInetClose(&sockFd); /* Send indication to du_app */ RETVALUE(RFAILED); } else { - printf("\nRetrying connection"); + DU_LOG("\nSCTP : Retrying connection"); } } else if(ret == RINPROGRESS) { - printf("\nConnection in progess"); + DU_LOG("\nSCTP : Connection in progess"); break; } else { connUp = TRUE; - printf("\nSCTP connect successful"); + DU_LOG("\nSCTP : Connect successful"); break; } }while(numRetry < MAX_RETRY); @@ -374,7 +350,7 @@ S16 sctpConnect() void sendToDuApp(Buffer *mBuf, Event event) { Pst pst; - printf("\nForwarding received message to duApp"); + DU_LOG("\nSCTP : Forwarding received message to duApp"); SPrntMsg(mBuf, 0, 0); @@ -392,8 +368,7 @@ void sendToDuApp(Buffer *mBuf, Event event) if (SPstTsk(&pst, mBuf) != ROK) { - printf("\nSPstTsk failed in duReadCfg"); - // return RFAILED; + DU_LOG("\nSCTP : SPstTsk failed in duReadCfg"); } } @@ -415,66 +390,82 @@ void sendToDuApp(Buffer *mBuf, Event event) * ****************************************************************/ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) { + Pst pst; switch(ntfy->header.nType) { case CM_INET_SCTP_ASSOC_CHANGE : + DU_LOG("\nSCTP : Assoc change notification received"); switch(ntfy->u.assocChange.state) { case CM_INET_SCTP_COMM_UP: - printf("\nSCTP notify assocchange(comm up) received"); + DU_LOG("Event : COMMUNICATION UP"); connUp = TRUE; break; case CM_INET_SCTP_COMM_LOST: - printf("\nSCTP notify assocchange(comm lost) received"); + DU_LOG("Event : COMMUNICATION LOST"); connUp = FALSE; break; case CM_INET_SCTP_RESTART: - printf("\nSCTP notify assocchange(sctp restart) received"); + DU_LOG("Event : SCTP RESTART"); connUp = FALSE; break; case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */ - printf("\nSCTP notify assocchange(shutdown complete) received\n"); + DU_LOG("Event : SHUTDOWN COMPLETE"); connUp = FALSE; break; case CM_INET_SCTP_CANT_STR_ASSOC: - printf("\nSCTP notify assocchange(cant str assoc) received\n"); + DU_LOG("Event : CANT START ASSOC"); connUp = FALSE; break; default: - printf("\nInvalid event"); + DU_LOG("\nInvalid event"); break; } break; case CM_INET_SCTP_PEER_ADDR_CHANGE : - printf("\nSCTP notify peer addr change received"); + DU_LOG("\nSCTP : Peer Address Change notificarion received"); /* Need to add handler */ break; case CM_INET_SCTP_REMOTE_ERROR : - printf("\nSCTP notify remote error received"); + DU_LOG("\nSCTP : Remote Error notification received"); break; case CM_INET_SCTP_SEND_FAILED : - printf("\nSCTP notify send failed received\n"); + DU_LOG("\nSCTP : Send Failed notification received\n"); break; case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */ - printf("\nSCTP notify shutdown event received\n"); + DU_LOG("\nSCTP : Shutdown Event notification received\n"); connUp = FALSE; break; case CM_INET_SCTP_ADAPTATION_INDICATION : - printf("\nSCTP notify adaptation indication received\n"); + DU_LOG("\nSCTP : Adaptation Indication received\n"); break; case CM_INET_SCTP_PARTIAL_DELIVERY_EVENT: - printf("\nSCTP notify partial delivery received\n"); + DU_LOG("\nSCTP : Partial Delivery Event received\n"); break; default: - printf("\nInvalid sctp notification type\n"); + DU_LOG("\nSCTP : Invalid sctp notification type\n"); break; } /* Pack notification and send to APP */ - if(cmPkSctpNtfy(ntfy) != ROK) + DU_LOG("\nSCTP : Forwarding received message to duApp"); + + cmMemset((U8 *)&(pst), 0, sizeof(Pst)); + pst.srcEnt = (Ent)ENTSCTP; + pst.srcInst = (Inst)SCTP_INST; + pst.srcProcId = DU_PROC; + pst.dstEnt = (Ent)ENTDUAPP; + pst.dstInst = (Inst)DU_INST; + pst.dstProcId = pst.srcProcId; + pst.event = EVTSCTPNTFY; + pst.selector = DU_SELECTOR_LC; + pst.pool= DU_POOL; + pst.region = DFLT_REGION; + + if(cmPkSctpNtfy(&pst, ntfy) != ROK) { - printf("\nFailed to pack SCTP notification"); + DU_LOG("\nSCTP : Failed to pack SCTP notification"); RETVALUE(RFAILED); } RETVALUE(ROK); @@ -537,7 +528,7 @@ S16 sctpSockPoll() ret = cmInetSctpRecvMsg(&sockFd, &addr, &port, &memInfo, &mBuf, &bufLen, &info, &flag, &ntfy); if (connUp && ret != ROK) { - printf("\nFailed to receive sctp msg\n"); + DU_LOG("\nFailed to receive sctp msg\n"); } else { @@ -547,7 +538,7 @@ S16 sctpSockPoll() ret = sctpNtfyHdlr(&ntfy); if(ret != ROK) { - printf("\nFailed to process sctp notify msg\n"); + DU_LOG("\nSCTP : Failed to process sctp notify msg\n"); } } else if(connUp) /* If data received */ @@ -571,7 +562,7 @@ S16 sctpSockPoll() * * @details * - * Function : sctpOutMsgSend + * Function : sctpSend * * Functionality: * Send message on SCTP socket @@ -581,7 +572,7 @@ S16 sctpSockPoll() * RFAILED - failure * * ****************************************************************/ -S16 sctpOutMsgSend(Buffer *mBuf) +S16 sctpSend(Buffer *mBuf) { U8 ret; MsgLen len; /* number of actually sent octets */ @@ -593,16 +584,10 @@ S16 sctpOutMsgSend(Buffer *mBuf) memInfo.pool = DU_POOL; - if(sctpCfg->cuIpAddr.ipV4Pres) + if(sctpCfg.cuIpAddr.ipV4Pres) { peerAddr.type = CM_INET_IPV4ADDR_TYPE; - peerAddr.u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg->cuIpAddr.ipV4Addr); - dstAddr = &peerAddr; - } - else if(sctpCfg->cuIpAddr.ipV6Pres) - { - peerAddr.type = CM_INET_IPV6ADDR_TYPE; - //CM_INET_COPY_IPV6ADDR(&(primDstAddr.u.ipv6NetAddr),&(sctpCfg->cuIpAddr.ipV6Addr); + peerAddr.u.ipv4NetAddr = CM_INET_NTOH_U32(sctpCfg.cuIpAddr.ipV4Addr); dstAddr = &peerAddr; } else @@ -610,15 +595,15 @@ S16 sctpOutMsgSend(Buffer *mBuf) dstAddr = NULLP; } - ret = cmInetSctpSendMsg(&sockFd, dstAddr, sctpCfg->cuPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); + ret = cmInetSctpSendMsg(&sockFd, dstAddr, sctpCfg.cuPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); if(ret != ROK && ret != RWOULDBLOCK) { - printf("\nFailed sending the message"); + DU_LOG("\nSCTP : Failed sending the message"); RETVALUE(RFAILED); } RETVALUE(ROK); -} /* End of sctpOutMsgSend */ +} /* End of sctpSend */ /******************************************************************* * @@ -641,23 +626,23 @@ void sctpAssocReq() { if(openSctpEndp() != ROK) { - printf("\nFailed while opening socket"); + DU_LOG("\nSCTP : Failed while opening socket"); } else if(bindSctpEndp() != ROK) { - printf("\nFailed while binding socket"); + DU_LOG("\nSCTP : Failed while binding socket"); } else if(sctpSetSockOpts() != ROK) { - printf("\nFailed while setting socket options"); + DU_LOG("\nSCTP : Failed while setting socket options"); } else if(sctpConnect() != ROK) { - printf("\nFailed while connecting to peer"); + DU_LOG("\nSCTP : Failed while connecting to peer"); } else if(sctpSockPoll() != ROK) { - printf("\nFailed while polling"); + DU_LOG("\nSCTP : Failed while polling"); } } /* End of sctpAssocReq */ diff --git a/src/du_app/du_sctp.h b/src/du_app/du_sctp.h index f9efaf50f..45da7b592 100644 --- a/src/du_app/du_sctp.h +++ b/src/du_app/du_sctp.h @@ -21,23 +21,34 @@ #ifndef __DU_SCTP_H__ #define __DU_SCTP_H__ +#include "du_cfg_hdl.h" #include "du_mgr.h" +#include "du_log.h" #include "cm_inet.h" #include "cm_tpt.h" #include "cm_inet.x" #include "cm_tpt.x" +/* Global variable declaration */ +CmInetFd sockFd; /* Socket file descriptor */ +U8 socket_type; /* Socket type */ +Bool nonblocking; /* Blocking/Non-blocking socket */ +Bool connUp; /* Is connection up */ +int assocId; /* Assoc Id of connected assoc */ + +CmInetNetAddrLst localAddrLst; +CmInetNetAddrLst remoteAddrLst; + +extern F1SctpParams sctpCfg; /* SCTP configurations at DU */ + S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason); S16 sctpActvTsk(Pst *pst, Buffer *mBuf); void sctpAssocReq(); void sendToDuApp(Buffer *mBuf, Event event); -S16 sctpOutMsgSend(Buffer *mBuf); +S16 sctpSend(Buffer *mBuf); typedef S16 (*SctpNtfy) ARGS((Buffer *mBuf, CmInetSctpNotification *ntfy)); -S16 cmPkSctpNtfy(CmInetSctpNotification *ntfy); -S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf); - #define MAX_RETRY 5 #endif diff --git a/src/du_app/du_utils.c b/src/du_app/du_utils.c deleted file mode 100644 index 3d8b86349..000000000 --- a/src/du_app/du_utils.c +++ /dev/null @@ -1,458 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # -# # -# 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. # -################################################################################ -*******************************************************************************/ - -/* This file contains all utility functions */ -#if 0 -#include -#include -#include -#include -#include -#endif -#include "du_mgr.h" - -#define DU_INST 0 -#define DU_ID 1 -#define DU_IP_V4_ADDR "10.0.2.20" -#define CU_IP_V4_ADDR "10.0.2.25" -#define DU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0001" -#define DU_PORT 38472 -#define CU_PORT 38472 -#define NR_PCI 1 -#define NR_CELL_ID 1 -#define DU_NAME "ORAN_OAM_DU" -#define CELL_DIR UL_DL -#define CELL_TYPE SMALL -#define DUPLEX_MODE DUP_MODE_TDD -#define DU_TAC 1 -#define PLMN_MCC0 3 -#define PLMN_MCC1 1 -#define PLMN_MCC2 1 -#define PLMN_MNC0 4 -#define PLMN_MNC1 8 -#define PLMN_MNC2 0 -#define NR_ARFCN 2079427 -#define SUL_ARFCN 100 -#define NR_FREQ_BAND 257 -#define SUL_BAND 2 -#define TIME_CFG 10 -#define NR_RANAC 150 -#define CARRIER_IDX 1 -#define NUM_TX_ANT 2 -#define NUM_RX_ANT 2 -#define FREQ_SHIFT_7P5KHZ FALSE -#define SSB_PBCH_PWR 0 -#define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD -#define SUBCARRIER_SPACING 3 -#define PRB_OFFSET 0 -#define BETA_PSS BETA_PSS_0DB -#define SSB_PERIODICITTY SSB_PRDCTY_MS_20 -#define SSB_SUBCARRIER_OFFSET 0 -#define SSB_MULT_CARRIER_BAND FALSE -#define MULT_CELL_CARRIER FALSE - -#define PRACH_SEQ_LEN SHORT_SEQUENCE -#define PRACH_SUBCARRIER_SPACING 3 -#define PRACH_RESTRICTED_SET_CFG UNRESTRICTED -#define NUM_PRACH_FDM 1 -#define ROOT_SEQ_IDX 0 -#define NUM_ROOT_SEQ 1 -#define ZERO_CORRELATION_ZONE_CFG 2 -#define NUM_UNUSED_ROOT_SEQ 1 -#define UNUSED_ROOT_SEQ 1 -#define SSB_PER_RACH 3 -#define PRACH_MULT_CARRIER_BAND FALSE -#define TDD_PERIODICITY TX_PRDCTY_MS_2P5 -#define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI - -/* Filling Slot configuration as : - * Slot Sym 0 Sym 1 Sym 2 Sym 3 Sym 4 Sym 5 Sym 6 Sym 7 Sym 8 Sym 9 Sym10 Sym11 Sym12 Sym13 - * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL - * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL - * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL - * 3 DL DL DL DL DL DL DL DL DL DL GD GD GD UL - * 4 UL UL UL UL UL UL UL UL UL UL UL UL UL UL -*/ - -/******************************************************************* - * - * @brief Fills the Slot configuration - * - * @details - * - * Function : fillSlotConfig - * - * Functionality:Fill the Slot configuration values - * - * @params[in] void - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -void fillSlotConfig() -{ - U8 slot; - U8 symbol; - - for(slot = 0; slot <= 3; slot++) - { - for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) - duCfgParam.clCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT; - } - - duCfgParam.clCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT; - - for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) - duCfgParam.clCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT; - -} - -/******************************************************************* - * - * @brief Reads the CL Configuration. - * - * @details - * - * Function : readClCfg - * - * Functionality: - * - Fills up the cell configuration for CL. - * - Calls fillSlotConfig() - * - * @params[in] void - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - - -/* This function is used to fill up the cell configuration for CL */ -S16 readClCfg() -{ - duCfgParam.clCellCfg.carrierId = CARRIER_IDX; - - /* Cell configuration */ - duCfgParam.clCellCfg.cellId = NR_CELL_ID; - duCfgParam.clCellCfg.phyCellId = NR_PCI; - duCfgParam.clCellCfg.dupType = DUPLEX_MODE; - - /* DL carrier configuration */ - duCfgParam.clCellCfg.dlCarrCfg.pres = TRUE; - duCfgParam.clCellCfg.dlCarrCfg.bw = SUL_ARFCN; - duCfgParam.clCellCfg.dlCarrCfg.freq = NR_ARFCN; - duCfgParam.clCellCfg.dlCarrCfg.k0[0] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[1] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[2] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[3] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[4] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[0] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[1] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[2] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[3] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[4] = 1; - duCfgParam.clCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT; - - /* UL Carrier configuration */ - duCfgParam.clCellCfg.ulCarrCfg.pres = TRUE; - duCfgParam.clCellCfg.ulCarrCfg.bw = SUL_ARFCN; - duCfgParam.clCellCfg.ulCarrCfg.freq = NR_ARFCN; - duCfgParam.clCellCfg.ulCarrCfg.k0[0] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[1] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[2] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[3] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[4] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[0] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[1] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[2] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[3] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[4] = 1; - duCfgParam.clCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT; - - duCfgParam.clCellCfg.freqShft = FREQ_SHIFT_7P5KHZ; - - /* SSB configuration */ - duCfgParam.clCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; - duCfgParam.clCellCfg.ssbCfg.bchPayload = BCH_PAYLOAD; - duCfgParam.clCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; - duCfgParam.clCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET; - duCfgParam.clCellCfg.ssbCfg.betaPss = BETA_PSS; - duCfgParam.clCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; - duCfgParam.clCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET; - duCfgParam.clCellCfg.ssbCfg.mibPdu = 104; - duCfgParam.clCellCfg.ssbCfg.nSSBMask[0] = 2162721; - duCfgParam.clCellCfg.ssbCfg.nSSBMask[1] = 0; - duCfgParam.clCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND; - duCfgParam.clCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER; - - /* PRACH configuration */ - duCfgParam.clCellCfg.prachCfg.pres = TRUE; - duCfgParam.clCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN; - duCfgParam.clCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING; - duCfgParam.clCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG; - duCfgParam.clCellCfg.prachCfg.prachFdm = NUM_PRACH_FDM; - duCfgParam.clCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX; - duCfgParam.clCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ; - duCfgParam.clCellCfg.prachCfg.fdm[0].k1 = 1; - duCfgParam.clCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG; - duCfgParam.clCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ; - if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq), NUM_UNUSED_ROOT_SEQ * sizeof(U8))) - { - printf("\nMemory allocation failed"); - RETVALUE(RFAILED); - } - *(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ; - duCfgParam.clCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH; - duCfgParam.clCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND; - - /* TDD configuration */ - duCfgParam.clCellCfg.tddCfg.pres = TRUE; - duCfgParam.clCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY; - - fillSlotConfig(); - - /* RSSI Measurement configuration */ - duCfgParam.clCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT; - - /* This should be calculated based on - (number of mandatory parameters) + (number of otional parameters being filled) */ - duCfgParam.clCellCfg.numTlv = 39; - - RETVALUE(ROK); -} -/******************************************************************* - * - * @brief Configures the DU Parameters - * - * @details - * - * Function : readCfg - * - * Functionality: - * - Initializes the DuCfg members. - * - Calls readClCfg() - * - * @params[in] system task ID - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 readCfg() -{ - U8 i,j,k; - U32 ipv4_du, ipv4_cu; - - cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du); - cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu); - //U32 ipv6_int = inet_addr(DU_IP_V6_ADDR); - - /* F1 DU IP Address and Port*/ - duCfgParam.sctpParams.duIpAddr.ipV4Pres = TRUE; - duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du; - duCfgParam.sctpParams.duIpAddr.ipV6Pres = FALSE; - //strcpy(duCfgParam.sctpParams.duIpAddr.ipV6Addr, (char*)DU_IP_V6_ADDR); - duCfgParam.sctpParams.duPort = DU_PORT; - - /* F1 CU IP Address and Port*/ - duCfgParam.sctpParams.cuIpAddr.ipV4Pres = TRUE; - duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu; - duCfgParam.sctpParams.cuIpAddr.ipV6Pres = FALSE; - //strcpy(duCfgParam.sctpParams.cuIpAddr.ipV6Addr, DU_IP_V6_ADDR); - duCfgParam.sctpParams.cuPort = CU_PORT; - - duCfgParam.maxUe = 32; //TODO: Check - /* DU Info */ - duCfgParam.duId = DU_ID; - strcpy((char*)duCfgParam.duName,DU_NAME); - - for(i=0;i> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)]) -#endif { /* Klock work fix ccpu00148484 */ if(!(createdThreads < SS_MAX_THREAD_CREATE_RETRY)) @@ -8713,15 +8696,12 @@ Region region /* Region associated with thread */ /* If we found free mapping table entry, place the region and send pthread_cancel * for all the thread Ids which are created before this */ -#if 0 -#else osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)] = region; #ifdef XEON_SPECIFIC_CHANGES printf("ThreadId %ld, Thread Idx %d, Region %d\n", threadId, ((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP), region); #endif -#endif for(indx = 0; indx < createdThreads; indx++) { #ifdef XEON_SPECIFIC_CHANGES diff --git a/src/mt/mt_ss_wl.x b/src/mt/mt_ss_wl.x index 96198b503..a9c883d44 100755 --- a/src/mt/mt_ss_wl.x +++ b/src/mt/mt_ss_wl.x @@ -33,124 +33,6 @@ #ifndef __MTSSWLX__ #define __MTSSWLX__ -#if 0 -/* mt001.301: Addition */ -#ifdef SS_LOGGER_SUPPORT -/* #define __USE_POSIX */ -#include -#include -#endif /* SS_LOGGER_SUPPORT */ - -/* TAPA task entry doesn't need anything extra for MTSS */ -typedef S8 SsdTTskEntry; - - -/* System task entry */ -typedef struct ssdSTskEntry -{ - pthread_t tId; - Ent ent; - Inst inst; - SLockId lock; - -#ifdef SS_MULTICORE_SUPPORT - U32 lwpId; -#endif /* SS_MULTICORE_SUPPORT */ -} SsdSTskEntry; - - -#ifdef SS_DRVR_SUPPORT -/* Driver task entry */ -typedef struct ssdDrvrTskEntry -{ - Bool flag; - -} SsdDrvrTskEntry; -#endif - - -/* timer entry--MTSS uses common timers */ -typedef struct ssdTmrEntry -{ - CmTimer timers[TMR_DEF_MAX]; - -} SsdTmrEntry; - - -/* dynamic pool doesn't need anything extra for MTSS */ -typedef S8 SsdDPoolEntry; - - -/* static pool -- information for the memory management scheme */ -typedef S8 SsdSPoolEntry; - - -/* generic pool doesn't need anything extra for MTSS */ -typedef S8 SsdPoolEntry; - - -/* region doesn't need anything extra for MTSS */ -typedef S8 SsdRegionEntry; - - -/* system services control point--tick count, timer implementation, - * console implementation, IS task implementation - */ -typedef struct ssdOs -{ - unsigned randSeed; /* random number generator seed */ - - Ticks sysTicks; /* elapsed system ticks */ - - pthread_t tmrHdlrTID; /* timer handler thread */ - CmTqCp tmrTqCp; /* common timer control point */ - CmTqType tmrTq[SS_MAX_TMRS]; /* common timer queue */ - - sem_t ssStarted; /* posted when SS completes init */ -#ifdef CONAVL - FILE *conInFp; /* console input file pointer */ - FILE *conOutFp; /* console output file pointer */ - pthread_t conHdlrTID; /* console handler thread ID */ -#endif - -#ifndef NOFILESYS - FILE *fileOutFp; /* output file pointer */ -#endif - -#ifdef SS_DRVR_SUPPORT - pthread_t isTskHdlrTID; /* IS task handler thread ID */ - int isFildes[2]; /* pipe for SSetIntPend to isTskHdlr */ -#endif - Bool sigEvnt; /*mt010.301 Flag to check interupt signal(SIGINT)*/ - -} SsdOs; - -/* mt018.201 - added for memory configuration */ -typedef struct mtBktCfg -{ - Size blkSize; /* bucket quantum size */ - U32 numBlks; /* the total blocks in the bucket */ -} MtBktCfg; - -typedef struct mtRegCfg -{ - Region regionId; - U16 numBkts; - Size heapsize; - MtBktCfg bkt[SS_MAX_POOLS_PER_REG]; -} MtRegCfg; - -typedef struct mtMemCfg -{ - U8 numRegions; - MtRegCfg region[SS_MAX_REGS]; -} MtMemCfg; - -#endif - - - - typedef struct mtDynBktCfg { U16 blkSetRelThreshold; /* threshold value for releasing memory blocks */ @@ -193,25 +75,6 @@ typedef struct mtGlobMemCfg MtGlobBktCfg bkt[SS_MAX_POOLS_PER_REG]; }MtGlobMemCfg; - -#if 0 - -/* mt003.301 Readwrite lock additions */ -#ifdef SS_LOCK_SUPPORT -typedef struct sLockInfo -{ - union - { -#ifdef SS_RDWR_LOCK_SUPPORT - pthread_rwlock_t rdWrLockId; -#endif /* SS_RDWR_LOCK_SUPPORT */ -#ifdef SS_REC_LOCK_SUPPORT - pthread_mutex_t recurLock; -#endif /* SS_REC_LOCK_SUPPORT */ - }l; -}SLockInfo; -#endif /* SS_LOCK_SUPPORT */ -#endif /* __MTSSX__ */ #endif /********************************************************************** diff --git a/src/mt/ss_msg.c b/src/mt/ss_msg.c index 15cc55d86..55f756542 100644 --- a/src/mt/ss_msg.c +++ b/src/mt/ss_msg.c @@ -653,10 +653,7 @@ Buffer *mBuf; if(pthread_self() == gMacTId) //if(pthread_equal(pthread_self(),gMacTId)) { -#if 0 -#else if(ROK == mtAddBufToRing(SS_RNG_BUF_MAC_FREE_RING,(Void *)mBuf,0)) -#endif { RETVALUE(ROK); } @@ -665,10 +662,7 @@ Buffer *mBuf; #ifdef RLC_FREE_RING_BUF else if(pthread_self() == gRlcTId) { -#if 0 -#else if(ROK == mtAddBufToRing(SS_RNG_BUF_RLC_FREE_RING,(Void *)mBuf,0)) -#endif { RETVALUE(ROK); } @@ -836,10 +830,7 @@ U8 memType; /* memory type used if shareable or not */ if(pthread_self() == gMacTId) //if(pthread_equal(pthread_self(),gMacTId)) { -#if 0 -#else if(ROK == mtAddBufToRing(SS_RNG_BUF_MAC_FREE_RING,(Void *)ptr,1)) -#endif { RETVALUE(ROK); } @@ -848,10 +839,7 @@ U8 memType; /* memory type used if shareable or not */ #ifdef RLC_FREE_RING_BUF else if(pthread_self() == gRlcTId) { -#if 0 -#else if(ROK == mtAddBufToRing(SS_RNG_BUF_RLC_FREE_RING,(Void *)ptr,1)) -#endif { RETVALUE(ROK); } @@ -5985,10 +5973,6 @@ Buffer *mBuf; /* message buffer */ MsgLen numBytes; MsgLen avail; -#if 0 - char* file = __FILE__; - U32 line = __LINE__; -#endif TRC1(SGetPstMsgMult) #if ( ERRCLASS & ERRCLS_INT_PAR ) @@ -8001,11 +7985,6 @@ Buffer *mBuf; } } -#if 0 - char * file = __FILE__; - U32 line = __LINE__; -#endif - /* allocate a DBlk minimum of size Cnt to pack the data */ newblk = NULLP; if (ssGetDBufOfSize(minfo->region, cnt, &newblk) != ROK) diff --git a/src/mt/ss_rbuf.c b/src/mt/ss_rbuf.c index e0ef97c1c..d030e1b19 100755 --- a/src/mt/ss_rbuf.c +++ b/src/mt/ss_rbuf.c @@ -225,10 +225,6 @@ Desc: Checks if Ring is full */ inline static S16 IsFull(SsRngBuf* rBuf) { -#if 0 - /* write+1 == read implies ring is full */ - return ((((rBuf->write + 1)> rBuf->size)?0:(rBuf->write+1))==rBuf->read); -#endif #if 1 if((rBuf->write+1) == rBuf->read) { @@ -583,33 +579,6 @@ S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,U8 freeType) -#if 0 -int main(int argc, char **argv) -{ - SCreateSRngBuf(1,sizeof(SsRngBuf), 10); - rngElem* buf; - /* Fill buffer with test elements 3 times */ - buf = (SsRngBuf*)malloc(sizeof(rngBuf)); - buf->ptr = 1; - SEnqSRngBuf(1, buf); - buf = (SsRngBuf*)malloc(sizeof(rngBuf)); - buf->ptr = 2; - SEnqSRngBuf(1, buf); - buf = (SsRngBuf*)malloc(sizeof(rngBuf)); - buf->ptr = 3; - SEnqSRngBuf(1, buf); - - SDeqSRngBuf(1,buf); - printf("buf 1 = %d",buf->ptr); - SDeqSRngBuf(1,buf); - printf("buf 2 = %d",buf->ptr); - SDeqSRngBuf(1,buf); - printf("buf 3 = %d",buf->ptr); - - return 0; -} -#endif - /********************************************************************** End of file **********************************************************************/ diff --git a/src/phy_stub/.l1_bdy1.c.swo b/src/phy_stub/.l1_bdy1.c.swo deleted file mode 100644 index 8fee77f52..000000000 Binary files a/src/phy_stub/.l1_bdy1.c.swo and /dev/null differ diff --git a/src/phy_stub/.l1_bdy1.c.swp b/src/phy_stub/.l1_bdy1.c.swp deleted file mode 100644 index 092d2521f..000000000 Binary files a/src/phy_stub/.l1_bdy1.c.swp and /dev/null differ diff --git a/src/phy_stub/l1_bdy1.c b/src/phy_stub/l1_bdy1.c index afabefe73..435903c68 100644 --- a/src/phy_stub/l1_bdy1.c +++ b/src/phy_stub/l1_bdy1.c @@ -16,7 +16,7 @@ ################################################################################ *******************************************************************************/ -/*This file contains stub for PHY to handle messages to/from MAC CL */ +/*This file contains stub for PHY to handle messages to/from MAC CL */ #include "envdep.h" #include "gen.h" @@ -26,8 +26,126 @@ #include "ssi.x" #include "rg_cl_phy.h" +#include "lwr_mac.h" +#include "fapi.h" + EXTERN void phyToMac ARGS((U16 msgType, U32 msgLen,void *msg)); +EXTERN void fillTlvs ARGS((fapi_uint16_tlv_t *tlv, U16 tag, U16 length, U16 value, U16 *msgLen)); +EXTERN void fillMsgHeader ARGS((fapi_msg_t *hdr, U16 msgType, U16 msgLen)); +EXTERN S16 sendToLowerMac ARGS((U16 msgType, U32 msgLen,void *msg)); + +/******************************************************************* + * + * @brief Builds and sends param response to MAC CL + * + * @details + * + * Function : lwrMacBldAndSndParamRsp + * + * Functionality: + * - Builds and sends param response to MAC + * + * @params[in] Config request message pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 lwrMacBldAndSndParamRsp(void *msg) +{ + S16 index = 0; + U16 msgLen = 0; + fapi_param_resp_t *fapiParamRsp; + fapiParamRsp = (fapi_param_resp_t *)msg; +#if 0 + if(SGetSBuf(0, 0, (Data **)&fapiParamRsp, sizeof(fapi_param_resp_t)) != ROK) + { + printf("\nMemory allocation failed for PHY Config Response"); + RETVALUE(RFAILED); + } +#endif + /* Cell Params */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_RELEASE_CAPABILITY_TAG, sizeof(U16), 1, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PHY_STATE_TAG, sizeof(U16), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SKIP_BLANK_DL_CONFIG_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SKIP_BLANK_UL_CONFIG_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG, sizeof(U8), 0, &msgLen); + + /* Carrier Params */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_CYCLIC_PREFIX_TAG, sizeof(U8), 1, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG, sizeof(U8), 1, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_BANDWIDTH_DL_TAG, sizeof(U16), 1, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_BANDWIDTH_UL_TAG, sizeof(U16), 0, &msgLen); + + /* PDCCH Param*/ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_CCE_MAPPING_TYPE_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PRECODER_GRANULARITY_CORESET_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDCCH_MU_MIMO_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDCCH_PRECODER_CYCLING_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_PDCCHS_PER_SLOT_TAG, sizeof(U8), 0, &msgLen); + + /* PUCCH Param */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUCCH_FORMATS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_PUCCHS_PER_SLOT_TAG, sizeof(U8), 0, &msgLen); + + /* PDSCH Param */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_MAPPING_TYPE_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_ALLOCATION_TYPES_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_CBG_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_DMRS_MAX_LENGTH_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_MU_MIMO_USERS_DL_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PREMPTIONSUPPORT_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PDSCH_NON_SLOT_SUPPORT_TAG, sizeof(U8), 0, &msgLen); + + /* PUSCH Param */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_UCI_ONLY_PUSCH_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_FREQUENCY_HOPPING_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_DMRS_MAX_LEN_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_CBG_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_MAPPING_TYPE_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_ALLOCATION_TYPES_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_MAX_PTRS_PORTS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_MU_MIMO_USERS_UL_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_DFTS_OFDM_SUPPORT_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PUSCH_AGGREGATION_FACTOR_TAG, sizeof(U8), 0, &msgLen); + + /* PRACH Params */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PRACH_LONG_FORMATS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PRACH_SHORT_FORMATS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_PRACH_RESTRICTED_SETS_TAG, sizeof(U8), 0, &msgLen); + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, sizeof(U8), 0, &msgLen); + + /* MEASUREMENT TAG */ + fillTlvs(&fapiParamRsp->tlvs[index++], FAPI_RSSI_MEASUREMENT_SUPPORT_TAG, sizeof(U8), 0, &msgLen); + + fapiParamRsp->number_of_tlvs = index; + msgLen = msgLen + sizeof(fapi_param_resp_t); + + fillMsgHeader(&fapiParamRsp->header, FAPI_PARAM_RESPONSE, msgLen); + fapiParamRsp->error_code = MSG_OK; + if(sendToLowerMac(fapiParamRsp->header.message_type_id, sizeof(fapi_param_resp_t), (void *)fapiParamRsp) != ROK) + { + RETVALUE(RFAILED); + } + printf("\n Filled the Param Response successfully"); + RETVALUE(ROK); +} /******************************************************************* * @@ -61,7 +179,7 @@ S16 l1BldAndSndCfgRsp(void *msg) printf("\nMemory allocation failed for PHY Config Response"); RETVALUE(RFAILED); } - + FAPIConfigRsp->hdr.nMsg = 1; FAPIConfigRsp->hdr.msgType = MSG_TYPE_CONFIG_RSP; FAPIConfigRsp->hdr.msgLen = sizeof(L1L2ConfigRsp); @@ -83,7 +201,7 @@ S16 l1BldAndSndCfgRsp(void *msg) /******************************************************************* * - * @brief Handles config request received from MAC + * @brief Handles config request received from MAC * * @details * @@ -111,6 +229,35 @@ void l1HndlConfigReq(U16 msgLen, void *msg) } } +/******************************************************************* + * + * @brief Handles param request received from MAC + * + * @details + * + * Function : lwrMacHdlParamReq + * + * Functionality: + * -Handles param request received from MAC + * + * @params[in] Message length + * Param request message pointer + * + * @return void + * + * ****************************************************************/ + +PUBLIC void lwrMacHdlParamReq(U16 msgLen, void *msg) +{ + printf("\n Received Param Request in PHY"); + + /* Handling PARAM RESPONSE */ + if(lwrMacBldAndSndParamRsp(msg)!= ROK) + { + printf("\n Failed Sending Param Response"); + } +} + /******************************************************************* * * @brief Receives message from MAC @@ -140,9 +287,39 @@ void macToPhy(U16 msgType, U32 msgLen, void *msg) default: printf("\nInvalid message type[%x] received at PHY", msgType); } - } +/******************************************************************* + * + * @brief Receives message from MAC + * + * @details + * + * Function : processRequest + * + * Functionality: + * - Receives message from MAC and calls handler + * + * @params[in] Message type + * Message length + * Message pointer + * + * @return void + * + * ****************************************************************/ + +void processRequest(U16 msgType, U32 msgLen, void *msg) +{ + switch(msgType) + { + case FAPI_PARAM_REQUEST: + lwrMacHdlParamReq(msgLen, msg); + break; + default: + printf("\n Invalid message type[%x] received at PHY", msgType); + break; + } +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/phy_stub/l1_bdy2.c b/src/phy_stub/l1_bdy2.c new file mode 100644 index 000000000..a636f172f --- /dev/null +++ b/src/phy_stub/l1_bdy2.c @@ -0,0 +1,30 @@ +/* This file handles TTI genertion */ + +#include +#include +#include "lphy_stub.h" + +void *GenerateTicks(void *arg) +{ + while(1) + { + sleep(10); + printf("\nTTI indication"); + /* Send TTI indication to CL */ + duSendEgtpTTIInd(); + } +} + +void duStartTtiThread() +{ + pthread_t ttiThread; + int ret; + + ret = pthread_create(&ttiThread, NULL, GenerateTicks, NULL); + if(ret) + { + printf("\nUnable to create thread"); + } +} + + diff --git a/src/rlog/rl_rlog.c b/src/rlog/rl_rlog.c index cb44af511..27208e0d3 100644 --- a/src/rlog/rl_rlog.c +++ b/src/rlog/rl_rlog.c @@ -1311,17 +1311,6 @@ void saveLogData(const void* buf, U16 len, U32 g_rlogWritePosIndex) } -#if 0 -void storeTimeDelimeter(FILE* fp) -{ - LOGDATA logData; - logData.logId = L_TIME_DELIMITER; - logData.argType = 0; - logData.logLevel = 0; - logData.numOfArgs = 0; - logData.len = 0; -} -#endif void sendToPostProcessor(const void* buf, U16 len) { if( send(g_nCliSocket, buf, len, 0 ) == -1 ) {